aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/masm/WeakRandom.h14
-rw-r--r--src/3rdparty/masm/assembler/ARMAssembler.h4
-rw-r--r--src/3rdparty/masm/assembler/MacroAssemblerARMv7.h2
-rw-r--r--src/3rdparty/masm/assembler/MacroAssemblerMIPS.h48
-rw-r--r--src/3rdparty/masm/config.h14
-rw-r--r--src/3rdparty/masm/stubs/ExecutableAllocator.h17
-rw-r--r--src/3rdparty/masm/stubs/JSGlobalData.h14
-rw-r--r--src/3rdparty/masm/stubs/Options.cpp14
-rw-r--r--src/3rdparty/masm/stubs/Options.h14
-rw-r--r--src/3rdparty/masm/stubs/WTFStubs.cpp20
-rw-r--r--src/3rdparty/masm/stubs/WTFStubs.h16
-rw-r--r--src/3rdparty/masm/stubs/compat/stdint.h14
-rw-r--r--src/3rdparty/masm/stubs/wtf/FastAllocBase.h14
-rw-r--r--src/3rdparty/masm/stubs/wtf/FastMalloc.h14
-rw-r--r--src/3rdparty/masm/stubs/wtf/Noncopyable.h14
-rw-r--r--src/3rdparty/masm/stubs/wtf/OwnPtr.h14
-rw-r--r--src/3rdparty/masm/stubs/wtf/PassOwnPtr.h14
-rw-r--r--src/3rdparty/masm/stubs/wtf/PassRefPtr.h14
-rw-r--r--src/3rdparty/masm/stubs/wtf/RefCounted.h14
-rw-r--r--src/3rdparty/masm/stubs/wtf/RefPtr.h14
-rw-r--r--src/3rdparty/masm/stubs/wtf/TypeTraits.h14
-rw-r--r--src/3rdparty/masm/stubs/wtf/UnusedParam.h14
-rw-r--r--src/3rdparty/masm/stubs/wtf/Vector.h14
-rw-r--r--src/3rdparty/masm/stubs/wtf/text/CString.h14
-rw-r--r--src/3rdparty/masm/stubs/wtf/text/WTFString.h14
-rw-r--r--src/3rdparty/masm/stubs/wtf/unicode/Unicode.h14
-rw-r--r--src/3rdparty/masm/wtf/DataLog.h2
-rw-r--r--src/3rdparty/masm/wtf/OSAllocator.h2
-rw-r--r--src/3rdparty/masm/wtf/OSAllocatorPosix.cpp5
-rw-r--r--src/3rdparty/masm/wtf/OSAllocatorWin.cpp14
-rw-r--r--src/3rdparty/masm/wtf/OSAllocatorWinRT.cpp14
-rw-r--r--src/3rdparty/masm/wtf/PageAllocation.h16
-rw-r--r--src/3rdparty/masm/wtf/PageAllocationAligned.cpp9
-rw-r--r--src/3rdparty/masm/wtf/PageBlock.h7
-rw-r--r--src/3rdparty/masm/wtf/PageReservation.h14
-rw-r--r--src/3rdparty/masm/yarr/YarrJIT.cpp8
-rw-r--r--src/imports/folderlistmodel/fileinfothread.cpp16
-rw-r--r--src/imports/folderlistmodel/fileinfothread_p.h14
-rw-r--r--src/imports/folderlistmodel/fileproperty_p.h14
-rw-r--r--src/imports/folderlistmodel/plugin.cpp14
-rw-r--r--src/imports/folderlistmodel/qquickfolderlistmodel.cpp14
-rw-r--r--src/imports/folderlistmodel/qquickfolderlistmodel.h14
-rw-r--r--src/imports/localstorage/plugin.cpp233
-rw-r--r--src/imports/models/models.pro2
-rw-r--r--src/imports/models/plugin.cpp16
-rw-r--r--src/imports/models/plugins.qmltypes540
-rw-r--r--src/imports/particles/plugin.cpp14
-rw-r--r--src/imports/qtquick2/plugin.cpp14
-rw-r--r--src/imports/settings/plugin.cpp14
-rw-r--r--src/imports/settings/qqmlsettings.cpp31
-rw-r--r--src/imports/settings/qqmlsettings_p.h14
-rw-r--r--src/imports/statemachine/childrenprivate.h12
-rw-r--r--src/imports/statemachine/finalstate.cpp12
-rw-r--r--src/imports/statemachine/finalstate.h12
-rw-r--r--src/imports/statemachine/plugin.cpp12
-rw-r--r--src/imports/statemachine/signaltransition.cpp20
-rw-r--r--src/imports/statemachine/signaltransition.h12
-rw-r--r--src/imports/statemachine/state.cpp12
-rw-r--r--src/imports/statemachine/state.h12
-rw-r--r--src/imports/statemachine/statemachine.cpp12
-rw-r--r--src/imports/statemachine/statemachine.h12
-rw-r--r--src/imports/statemachine/timeouttransition.cpp12
-rw-r--r--src/imports/statemachine/timeouttransition.h12
-rw-r--r--src/imports/testlib/SignalSpy.qml14
-rw-r--r--src/imports/testlib/TestCase.qml113
-rw-r--r--src/imports/testlib/main.cpp16
-rw-r--r--src/imports/testlib/testlogger.js36
-rw-r--r--src/imports/window/plugin.cpp14
-rw-r--r--src/imports/xmllistmodel/plugin.cpp14
-rw-r--r--src/imports/xmllistmodel/qqmlxmllistmodel.cpp16
-rw-r--r--src/imports/xmllistmodel/qqmlxmllistmodel_p.h14
-rw-r--r--src/particles/qquickage.cpp14
-rw-r--r--src/particles/qquickage_p.h14
-rw-r--r--src/particles/qquickangledirection.cpp24
-rw-r--r--src/particles/qquickangledirection_p.h14
-rw-r--r--src/particles/qquickcumulativedirection.cpp14
-rw-r--r--src/particles/qquickcumulativedirection_p.h14
-rw-r--r--src/particles/qquickcustomaffector.cpp16
-rw-r--r--src/particles/qquickcustomaffector_p.h14
-rw-r--r--src/particles/qquickcustomparticle.cpp21
-rw-r--r--src/particles/qquickcustomparticle_p.h14
-rw-r--r--src/particles/qquickdirection.cpp14
-rw-r--r--src/particles/qquickdirection_p.h14
-rw-r--r--src/particles/qquickellipseextruder.cpp24
-rw-r--r--src/particles/qquickellipseextruder_p.h14
-rw-r--r--src/particles/qquickfriction.cpp26
-rw-r--r--src/particles/qquickfriction_p.h14
-rw-r--r--src/particles/qquickgravity.cpp14
-rw-r--r--src/particles/qquickgravity_p.h14
-rw-r--r--src/particles/qquickgroupgoal.cpp14
-rw-r--r--src/particles/qquickgroupgoal_p.h14
-rw-r--r--src/particles/qquickimageparticle.cpp26
-rw-r--r--src/particles/qquickimageparticle_p.h14
-rw-r--r--src/particles/qquickitemparticle.cpp77
-rw-r--r--src/particles/qquickitemparticle_p.h16
-rw-r--r--src/particles/qquicklineextruder.cpp14
-rw-r--r--src/particles/qquicklineextruder_p.h14
-rw-r--r--src/particles/qquickmaskextruder.cpp14
-rw-r--r--src/particles/qquickmaskextruder_p.h14
-rw-r--r--src/particles/qquickparticleaffector.cpp14
-rw-r--r--src/particles/qquickparticleaffector_p.h14
-rw-r--r--src/particles/qquickparticleemitter.cpp19
-rw-r--r--src/particles/qquickparticleemitter_p.h14
-rw-r--r--src/particles/qquickparticleextruder.cpp14
-rw-r--r--src/particles/qquickparticleextruder_p.h14
-rw-r--r--src/particles/qquickparticlegroup.cpp14
-rw-r--r--src/particles/qquickparticlegroup_p.h14
-rw-r--r--src/particles/qquickparticlepainter.cpp14
-rw-r--r--src/particles/qquickparticlepainter_p.h14
-rw-r--r--src/particles/qquickparticlesmodule.cpp14
-rw-r--r--src/particles/qquickparticlesmodule_p.h14
-rw-r--r--src/particles/qquickparticlesystem.cpp41
-rw-r--r--src/particles/qquickparticlesystem_p.h25
-rw-r--r--src/particles/qquickpointattractor.cpp14
-rw-r--r--src/particles/qquickpointattractor_p.h14
-rw-r--r--src/particles/qquickpointdirection.cpp14
-rw-r--r--src/particles/qquickpointdirection_p.h14
-rw-r--r--src/particles/qquickrectangleextruder.cpp14
-rw-r--r--src/particles/qquickrectangleextruder_p.h14
-rw-r--r--src/particles/qquickspritegoal.cpp14
-rw-r--r--src/particles/qquickspritegoal_p.h14
-rw-r--r--src/particles/qquicktargetdirection.cpp14
-rw-r--r--src/particles/qquicktargetdirection_p.h14
-rw-r--r--src/particles/qquicktrailemitter.cpp16
-rw-r--r--src/particles/qquicktrailemitter_p.h14
-rw-r--r--src/particles/qquickturbulence.cpp14
-rw-r--r--src/particles/qquickturbulence_p.h14
-rw-r--r--src/particles/qquickv4particledata.cpp90
-rw-r--r--src/particles/qquickv4particledata_p.h14
-rw-r--r--src/particles/qquickwander.cpp14
-rw-r--r--src/particles/qquickwander_p.h14
-rw-r--r--src/particles/qtquickparticlesglobal_p.h14
-rw-r--r--src/plugins/qmltooling/qmldbg_qtquick2/highlight.cpp14
-rw-r--r--src/plugins/qmltooling/qmldbg_qtquick2/highlight.h14
-rw-r--r--src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.cpp20
-rw-r--r--src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.h14
-rw-r--r--src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.cpp14
-rw-r--r--src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.h14
-rw-r--r--src/plugins/qmltooling/qmldbg_qtquick2/qtquick2plugin.cpp14
-rw-r--r--src/plugins/qmltooling/qmldbg_qtquick2/qtquick2plugin.h14
-rw-r--r--src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp31
-rw-r--r--src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.h18
-rw-r--r--src/plugins/qmltooling/shared/abstracttool.cpp14
-rw-r--r--src/plugins/qmltooling/shared/abstracttool.h14
-rw-r--r--src/plugins/qmltooling/shared/abstractviewinspector.cpp14
-rw-r--r--src/plugins/qmltooling/shared/abstractviewinspector.h14
-rw-r--r--src/plugins/qmltooling/shared/qmlinspectorconstants.h14
-rw-r--r--src/plugins/qmltooling/shared/qpacketprotocol.cpp14
-rw-r--r--src/plugins/qmltooling/shared/qpacketprotocol.h14
-rw-r--r--src/qml/animations/qabstractanimationjob.cpp17
-rw-r--r--src/qml/animations/qabstractanimationjob_p.h18
-rw-r--r--src/qml/animations/qanimationgroupjob.cpp14
-rw-r--r--src/qml/animations/qanimationgroupjob_p.h14
-rw-r--r--src/qml/animations/qanimationjobutil_p.h14
-rw-r--r--src/qml/animations/qcontinuinganimationgroupjob.cpp14
-rw-r--r--src/qml/animations/qcontinuinganimationgroupjob_p.h12
-rw-r--r--src/qml/animations/qparallelanimationgroupjob.cpp16
-rw-r--r--src/qml/animations/qparallelanimationgroupjob_p.h14
-rw-r--r--src/qml/animations/qpauseanimationjob.cpp16
-rw-r--r--src/qml/animations/qpauseanimationjob_p.h14
-rw-r--r--src/qml/animations/qsequentialanimationgroupjob.cpp16
-rw-r--r--src/qml/animations/qsequentialanimationgroupjob_p.h14
-rw-r--r--src/qml/compiler/qqmlirbuilder.cpp335
-rw-r--r--src/qml/compiler/qqmlirbuilder_p.h30
-rw-r--r--src/qml/compiler/qqmltypecompiler.cpp112
-rw-r--r--src/qml/compiler/qqmltypecompiler_p.h31
-rw-r--r--src/qml/compiler/qv4codegen.cpp34
-rw-r--r--src/qml/compiler/qv4codegen_p.h24
-rw-r--r--src/qml/compiler/qv4compileddata.cpp42
-rw-r--r--src/qml/compiler/qv4compileddata_p.h44
-rw-r--r--src/qml/compiler/qv4compiler.cpp16
-rw-r--r--src/qml/compiler/qv4compiler_p.h14
-rw-r--r--src/qml/compiler/qv4instr_moth.cpp14
-rw-r--r--src/qml/compiler/qv4instr_moth_p.h14
-rw-r--r--src/qml/compiler/qv4isel_moth.cpp24
-rw-r--r--src/qml/compiler/qv4isel_moth_p.h14
-rw-r--r--src/qml/compiler/qv4isel_p.cpp30
-rw-r--r--src/qml/compiler/qv4isel_p.h14
-rw-r--r--src/qml/compiler/qv4isel_util_p.h14
-rw-r--r--src/qml/compiler/qv4jsir.cpp66
-rw-r--r--src/qml/compiler/qv4jsir_p.h60
-rw-r--r--src/qml/compiler/qv4ssa.cpp709
-rw-r--r--src/qml/compiler/qv4ssa_p.h16
-rw-r--r--src/qml/debugger/qdebugmessageservice.cpp14
-rw-r--r--src/qml/debugger/qdebugmessageservice_p.h14
-rw-r--r--src/qml/debugger/qqmlabstractprofileradapter.cpp66
-rw-r--r--src/qml/debugger/qqmlabstractprofileradapter_p.h14
-rw-r--r--src/qml/debugger/qqmlconfigurabledebugservice.cpp14
-rw-r--r--src/qml/debugger/qqmlconfigurabledebugservice_p.h14
-rw-r--r--src/qml/debugger/qqmlconfigurabledebugservice_p_p.h14
-rw-r--r--src/qml/debugger/qqmldebug.h22
-rw-r--r--src/qml/debugger/qqmldebugserver.cpp174
-rw-r--r--src/qml/debugger/qqmldebugserver_p.h19
-rw-r--r--src/qml/debugger/qqmldebugserverconnection_p.h17
-rw-r--r--src/qml/debugger/qqmldebugservice.cpp16
-rw-r--r--src/qml/debugger/qqmldebugservice_p.h14
-rw-r--r--src/qml/debugger/qqmldebugservice_p_p.h14
-rw-r--r--src/qml/debugger/qqmldebugstatesdelegate_p.h14
-rw-r--r--src/qml/debugger/qqmlenginecontrolservice.cpp14
-rw-r--r--src/qml/debugger/qqmlenginecontrolservice_p.h14
-rw-r--r--src/qml/debugger/qqmlenginedebugservice.cpp34
-rw-r--r--src/qml/debugger/qqmlenginedebugservice_p.h14
-rw-r--r--src/qml/debugger/qqmlinspectorinterface_p.h14
-rw-r--r--src/qml/debugger/qqmlinspectorservice.cpp14
-rw-r--r--src/qml/debugger/qqmlinspectorservice_p.h14
-rw-r--r--src/qml/debugger/qqmlprofiler.cpp14
-rw-r--r--src/qml/debugger/qqmlprofiler_p.h22
-rw-r--r--src/qml/debugger/qqmlprofilerdefinitions_p.h40
-rw-r--r--src/qml/debugger/qqmlprofilerservice.cpp14
-rw-r--r--src/qml/debugger/qqmlprofilerservice_p.h16
-rw-r--r--src/qml/debugger/qv4debugservice.cpp64
-rw-r--r--src/qml/debugger/qv4debugservice_p.h14
-rw-r--r--src/qml/debugger/qv4profileradapter.cpp14
-rw-r--r--src/qml/debugger/qv4profileradapter_p.h14
-rw-r--r--src/qml/doc/snippets/code/src_script_qjsengine.cpp13
-rw-r--r--src/qml/doc/snippets/code/src_script_qjsvalue.cpp8
-rw-r--r--src/qml/doc/snippets/code/src_script_qjsvalueiterator.cpp8
-rw-r--r--src/qml/doc/snippets/delegatemodel/visualdatagroup.qml19
-rw-r--r--src/qml/doc/snippets/delegatemodel/visualdatamodel.qml11
-rw-r--r--src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/main.cpp8
-rw-r--r--src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/view.qml11
-rw-r--r--src/qml/doc/snippets/package/Delegate.qml8
-rw-r--r--src/qml/doc/snippets/package/view.qml8
-rw-r--r--src/qml/doc/snippets/qml/Button.qml8
-rw-r--r--src/qml/doc/snippets/qml/DynamicText.qml8
-rw-r--r--src/qml/doc/snippets/qml/SelfDestroyingRect.qml8
-rw-r--r--src/qml/doc/snippets/qml/Sprite.qml8
-rw-r--r--src/qml/doc/snippets/qml/application.qml8
-rw-r--r--src/qml/doc/snippets/qml/comments.qml8
-rw-r--r--src/qml/doc/snippets/qml/component.qml8
-rw-r--r--src/qml/doc/snippets/qml/component/MyItem.qml8
-rw-r--r--src/qml/doc/snippets/qml/component/main.qml8
-rw-r--r--src/qml/doc/snippets/qml/createComponent-simple.qml8
-rw-r--r--src/qml/doc/snippets/qml/createComponent.qml8
-rw-r--r--src/qml/doc/snippets/qml/createQmlObject.qml11
-rw-r--r--src/qml/doc/snippets/qml/dynamicObjects-destroy.qml8
-rw-r--r--src/qml/doc/snippets/qml/events.qml8
-rw-r--r--src/qml/doc/snippets/qml/imports/chart.qml8
-rw-r--r--src/qml/doc/snippets/qml/imports/installed-module.qml8
-rw-r--r--src/qml/doc/snippets/qml/imports/merged-named-imports.qml8
-rw-r--r--src/qml/doc/snippets/qml/imports/named-imports.qml8
-rw-r--r--src/qml/doc/snippets/qml/imports/network-imports.qml8
-rw-r--r--src/qml/doc/snippets/qml/imports/qtquick-1.0.qml8
-rw-r--r--src/qml/doc/snippets/qml/imports/timeexample.qml8
-rw-r--r--src/qml/doc/snippets/qml/integrating-javascript/connectjs.qml8
-rw-r--r--src/qml/doc/snippets/qml/integrating-javascript/includejs/app.qml8
-rw-r--r--src/qml/doc/snippets/qml/integrating-javascript/includejs/factorial.js8
-rw-r--r--src/qml/doc/snippets/qml/integrating-javascript/includejs/script.js11
-rw-r--r--src/qml/doc/snippets/qml/integrating-javascript/scarceresources/avatarExample.cpp8
-rw-r--r--src/qml/doc/snippets/qml/integrating-javascript/scarceresources/avatarExample.h8
-rw-r--r--src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleFive.qml8
-rw-r--r--src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleFour.js8
-rw-r--r--src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleFour.qml8
-rw-r--r--src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleOne.qml8
-rw-r--r--src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleThree.js8
-rw-r--r--src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleThree.qml8
-rw-r--r--src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleTwo.qml8
-rw-r--r--src/qml/doc/snippets/qml/integrating-javascript/script.js8
-rw-r--r--src/qml/doc/snippets/qml/listmodel/listelements.qml8
-rw-r--r--src/qml/doc/snippets/qml/listmodel/listmodel-modify.qml8
-rw-r--r--src/qml/doc/snippets/qml/listmodel/listmodel-nested.qml8
-rw-r--r--src/qml/doc/snippets/qml/listmodel/listmodel-simple.qml8
-rw-r--r--src/qml/doc/snippets/qml/listmodel/listmodel.qml8
-rw-r--r--src/qml/doc/snippets/qml/properties.qml8
-rw-r--r--src/qml/doc/snippets/qml/qml-documents/inline-component.qml8
-rw-r--r--src/qml/doc/snippets/qml/qml-documents/inline-text-component.qml8
-rw-r--r--src/qml/doc/snippets/qml/qml-documents/non-trivial.qml8
-rw-r--r--src/qml/doc/snippets/qml/qml-documents/qmldocuments.qml8
-rw-r--r--src/qml/doc/snippets/qml/qsTr.qml8
-rw-r--r--src/qml/doc/snippets/qml/qsTrId.1.qml8
-rw-r--r--src/qml/doc/snippets/qml/qsTrId.qml8
-rw-r--r--src/qml/doc/snippets/qml/qsTranslate.qml8
-rw-r--r--src/qml/doc/snippets/qml/qtBinding.1.qml8
-rw-r--r--src/qml/doc/snippets/qml/qtBinding.2.qml8
-rw-r--r--src/qml/doc/snippets/qml/qtBinding.3.qml8
-rw-r--r--src/qml/doc/snippets/qml/qtBinding.4.qml8
-rw-r--r--src/qml/doc/snippets/qml/qtTrIdNoOp.qml8
-rw-r--r--src/qml/doc/snippets/qml/qtTrNoOp.qml8
-rw-r--r--src/qml/doc/snippets/qml/qtTranslateNoOp.qml8
-rw-r--r--src/qml/doc/snippets/qml/qtbinding/context-advanced/MyItem.qml8
-rw-r--r--src/qml/doc/snippets/qml/qtbinding/context-advanced/applicationdata.h8
-rw-r--r--src/qml/doc/snippets/qml/qtbinding/context-advanced/connections.qml8
-rw-r--r--src/qml/doc/snippets/qml/qtbinding/context-advanced/main.cpp8
-rw-r--r--src/qml/doc/snippets/qml/qtbinding/context/MyItem.qml8
-rw-r--r--src/qml/doc/snippets/qml/qtbinding/context/main.cpp8
-rw-r--r--src/qml/doc/snippets/qml/qtbinding/functions-qml/MyItem.qml8
-rw-r--r--src/qml/doc/snippets/qml/qtbinding/functions-qml/main.cpp8
-rw-r--r--src/qml/doc/snippets/qml/qtbinding/loading/MyItem.qml8
-rw-r--r--src/qml/doc/snippets/qml/qtbinding/loading/main.cpp8
-rw-r--r--src/qml/doc/snippets/qml/qtbinding/properties-qml/MyItem.qml8
-rw-r--r--src/qml/doc/snippets/qml/qtbinding/properties-qml/main.cpp8
-rw-r--r--src/qml/doc/snippets/qml/qtbinding/resources/example.qdoc8
-rw-r--r--src/qml/doc/snippets/qml/qtbinding/signals-qml/MyItem.qml8
-rw-r--r--src/qml/doc/snippets/qml/qtbinding/signals-qml/main.cpp8
-rw-r--r--src/qml/doc/snippets/qml/qtbinding/signals-qml/myclass.h8
-rw-r--r--src/qml/doc/snippets/qml/qtbinding/variantlistmap/MyItem.qml8
-rw-r--r--src/qml/doc/snippets/qml/qtbinding/variantlistmap/main.cpp8
-rw-r--r--src/qml/doc/snippets/qml/qtobject.qml8
-rw-r--r--src/qml/doc/snippets/qml/reusablecomponents/Button.qml8
-rw-r--r--src/qml/doc/snippets/qml/reusablecomponents/application.qml8
-rw-r--r--src/qml/doc/snippets/qml/reusablecomponents/component.qml8
-rw-r--r--src/qml/doc/snippets/qml/reusablecomponents/focusbutton.qml8
-rw-r--r--src/qml/doc/snippets/qml/statemachine/Button.qml8
-rw-r--r--src/qml/doc/snippets/qml/statemachine/basicstate.qml6
-rw-r--r--src/qml/doc/snippets/qml/statemachine/finalstate.qml6
-rw-r--r--src/qml/doc/snippets/qml/statemachine/guardcondition.qml6
-rw-r--r--src/qml/doc/snippets/qml/statemachine/historystate.qml6
-rw-r--r--src/qml/doc/snippets/qml/statemachine/signaltransition.qml6
-rw-r--r--src/qml/doc/snippets/qml/statemachine/signaltransitionsignal.qml6
-rw-r--r--src/qml/doc/snippets/qml/statemachine/simplestatemachine.qml6
-rw-r--r--src/qml/doc/snippets/qml/statemachine/statemachine-button-history.qml6
-rw-r--r--src/qml/doc/snippets/qml/statemachine/statemachine-button-nested-ignore-quit.qml6
-rw-r--r--src/qml/doc/snippets/qml/statemachine/statemachine-button-nested.qml6
-rw-r--r--src/qml/doc/snippets/qml/statemachine/statemachine-button.qml6
-rw-r--r--src/qml/doc/snippets/qml/statemachine/timeouttransition.qml6
-rw-r--r--src/qml/doc/snippets/qml/workerscript/workerscript.qml8
-rw-r--r--src/qml/doc/snippets/qtjavascript/evaluation/main.cpp8
-rw-r--r--src/qml/doc/snippets/qtjavascript/registeringobjects/main.cpp8
-rw-r--r--src/qml/doc/snippets/qtjavascript/registeringvalues/main.cpp8
-rw-r--r--src/qml/doc/src/cppclasses/topic.qdoc12
-rw-r--r--src/qml/doc/src/cppintegration/contextproperties.qdoc15
-rw-r--r--src/qml/doc/src/cppintegration/data.qdoc44
-rw-r--r--src/qml/doc/src/cppintegration/definetypes.qdoc12
-rw-r--r--src/qml/doc/src/cppintegration/exposecppattributes.qdoc15
-rw-r--r--src/qml/doc/src/cppintegration/extending-tutorial.qdoc12
-rw-r--r--src/qml/doc/src/cppintegration/interactqmlfromcpp.qdoc22
-rw-r--r--src/qml/doc/src/cppintegration/topic.qdoc12
-rw-r--r--src/qml/doc/src/examples.qdoc12
-rw-r--r--src/qml/doc/src/external-resources.qdoc12
-rw-r--r--src/qml/doc/src/javascript/date.qdoc31
-rw-r--r--src/qml/doc/src/javascript/dynamicobjectcreation.qdoc25
-rw-r--r--src/qml/doc/src/javascript/expressions.qdoc12
-rw-r--r--src/qml/doc/src/javascript/functionlist.qdoc12
-rw-r--r--src/qml/doc/src/javascript/hostenvironment.qdoc12
-rw-r--r--src/qml/doc/src/javascript/imports.qdoc12
-rw-r--r--src/qml/doc/src/javascript/number.qdoc12
-rw-r--r--src/qml/doc/src/javascript/qmlglobalobject.qdoc13
-rw-r--r--src/qml/doc/src/javascript/qtjavascript.qdoc12
-rw-r--r--src/qml/doc/src/javascript/resources.qdoc12
-rw-r--r--src/qml/doc/src/javascript/string.qdoc12
-rw-r--r--src/qml/doc/src/javascript/topic.qdoc12
-rw-r--r--src/qml/doc/src/qmlfunctions.qdoc14
-rw-r--r--src/qml/doc/src/qmllanguageref/documents/definetypes.qdoc12
-rw-r--r--src/qml/doc/src/qmllanguageref/documents/networktransparency.qdoc12
-rw-r--r--src/qml/doc/src/qmllanguageref/documents/scope.qdoc12
-rw-r--r--src/qml/doc/src/qmllanguageref/documents/structure.qdoc12
-rw-r--r--src/qml/doc/src/qmllanguageref/documents/topic.qdoc12
-rw-r--r--src/qml/doc/src/qmllanguageref/modules/cppplugins.qdoc12
-rw-r--r--src/qml/doc/src/qmllanguageref/modules/identifiedmodules.qdoc12
-rw-r--r--src/qml/doc/src/qmllanguageref/modules/legacymodules.qdoc12
-rw-r--r--src/qml/doc/src/qmllanguageref/modules/qmldir.qdoc62
-rw-r--r--src/qml/doc/src/qmllanguageref/modules/topic.qdoc12
-rw-r--r--src/qml/doc/src/qmllanguageref/qmlreference.qdoc12
-rw-r--r--src/qml/doc/src/qmllanguageref/syntax/basics.qdoc12
-rw-r--r--src/qml/doc/src/qmllanguageref/syntax/directoryimports.qdoc12
-rw-r--r--src/qml/doc/src/qmllanguageref/syntax/imports.qdoc12
-rw-r--r--src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc16
-rw-r--r--src/qml/doc/src/qmllanguageref/syntax/propertybinding.qdoc12
-rw-r--r--src/qml/doc/src/qmllanguageref/syntax/signals.qdoc12
-rw-r--r--src/qml/doc/src/qmllanguageref/typesystem/basictypes.qdoc12
-rw-r--r--src/qml/doc/src/qmllanguageref/typesystem/objecttypes.qdoc12
-rw-r--r--src/qml/doc/src/qmllanguageref/typesystem/topic.qdoc12
-rw-r--r--src/qml/doc/src/qmltypereference.qdoc17
-rw-r--r--src/qml/doc/src/qtqml-cpp.qdoc12
-rw-r--r--src/qml/doc/src/qtqml.qdoc12
-rw-r--r--src/qml/doc/src/statemachine.qdoc12
-rw-r--r--src/qml/doc/src/whatsnew.qdoc130
-rw-r--r--src/qml/jit/qv4assembler.cpp36
-rw-r--r--src/qml/jit/qv4assembler_p.h51
-rw-r--r--src/qml/jit/qv4binop.cpp16
-rw-r--r--src/qml/jit/qv4binop_p.h14
-rw-r--r--src/qml/jit/qv4isel_masm.cpp205
-rw-r--r--src/qml/jit/qv4isel_masm_p.h14
-rw-r--r--src/qml/jit/qv4regalloc.cpp177
-rw-r--r--src/qml/jit/qv4regalloc_p.h14
-rw-r--r--src/qml/jit/qv4registerinfo_p.h14
-rw-r--r--src/qml/jit/qv4targetplatform_p.h24
-rw-r--r--src/qml/jit/qv4unop.cpp14
-rw-r--r--src/qml/jit/qv4unop_p.h14
-rw-r--r--src/qml/jsapi/qjsengine.cpp257
-rw-r--r--src/qml/jsapi/qjsengine.h16
-rw-r--r--src/qml/jsapi/qjsengine_p.h148
-rw-r--r--src/qml/jsapi/qjsvalue.cpp573
-rw-r--r--src/qml/jsapi/qjsvalue.h30
-rw-r--r--src/qml/jsapi/qjsvalue_p.h133
-rw-r--r--src/qml/jsapi/qjsvalueiterator.cpp61
-rw-r--r--src/qml/jsapi/qjsvalueiterator.h14
-rw-r--r--src/qml/jsapi/qjsvalueiterator_p.h16
-rw-r--r--src/qml/jsruntime/jsruntime.pri10
-rw-r--r--src/qml/jsruntime/qv4alloca_p.h14
-rw-r--r--src/qml/jsruntime/qv4argumentsobject.cpp129
-rw-r--r--src/qml/jsruntime/qv4argumentsobject_p.h105
-rw-r--r--src/qml/jsruntime/qv4arraybuffer.cpp189
-rw-r--r--src/qml/jsruntime/qv4arraybuffer_p.h98
-rw-r--r--src/qml/jsruntime/qv4arraydata.cpp529
-rw-r--r--src/qml/jsruntime/qv4arraydata_p.h264
-rw-r--r--src/qml/jsruntime/qv4arrayobject.cpp236
-rw-r--r--src/qml/jsruntime/qv4arrayobject_p.h28
-rw-r--r--src/qml/jsruntime/qv4booleanobject.cpp46
-rw-r--r--src/qml/jsruntime/qv4booleanobject_p.h28
-rw-r--r--src/qml/jsruntime/qv4context.cpp471
-rw-r--r--src/qml/jsruntime/qv4context_p.h288
-rw-r--r--src/qml/jsruntime/qv4dataview.cpp315
-rw-r--r--src/qml/jsruntime/qv4dataview_p.h99
-rw-r--r--src/qml/jsruntime/qv4dateobject.cpp224
-rw-r--r--src/qml/jsruntime/qv4dateobject_p.h62
-rw-r--r--src/qml/jsruntime/qv4debugging.cpp112
-rw-r--r--src/qml/jsruntime/qv4debugging_p.h20
-rw-r--r--src/qml/jsruntime/qv4engine.cpp1367
-rw-r--r--src/qml/jsruntime/qv4engine_p.h293
-rw-r--r--src/qml/jsruntime/qv4errorobject.cpp192
-rw-r--r--src/qml/jsruntime/qv4errorobject_p.h187
-rw-r--r--src/qml/jsruntime/qv4executableallocator.cpp14
-rw-r--r--src/qml/jsruntime/qv4executableallocator_p.h14
-rw-r--r--src/qml/jsruntime/qv4function.cpp29
-rw-r--r--src/qml/jsruntime/qv4function_p.h54
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp456
-rw-r--r--src/qml/jsruntime/qv4functionobject_p.h244
-rw-r--r--src/qml/jsruntime/qv4global_p.h84
-rw-r--r--src/qml/jsruntime/qv4globalobject.cpp93
-rw-r--r--src/qml/jsruntime/qv4globalobject_p.h28
-rw-r--r--src/qml/jsruntime/qv4identifier.cpp16
-rw-r--r--src/qml/jsruntime/qv4identifier_p.h20
-rw-r--r--src/qml/jsruntime/qv4identifiertable.cpp78
-rw-r--r--src/qml/jsruntime/qv4identifiertable_p.h41
-rw-r--r--src/qml/jsruntime/qv4include.cpp84
-rw-r--r--src/qml/jsruntime/qv4include_p.h20
-rw-r--r--src/qml/jsruntime/qv4internalclass.cpp234
-rw-r--r--src/qml/jsruntime/qv4internalclass_p.h50
-rw-r--r--src/qml/jsruntime/qv4jsonobject.cpp172
-rw-r--r--src/qml/jsruntime/qv4jsonobject_p.h34
-rw-r--r--src/qml/jsruntime/qv4lookup.cpp553
-rw-r--r--src/qml/jsruntime/qv4lookup_p.h122
-rw-r--r--src/qml/jsruntime/qv4managed.cpp57
-rw-r--r--src/qml/jsruntime/qv4managed_p.h211
-rw-r--r--src/qml/jsruntime/qv4math_p.h14
-rw-r--r--src/qml/jsruntime/qv4mathobject.cpp170
-rw-r--r--src/qml/jsruntime/qv4mathobject_p.h28
-rw-r--r--src/qml/jsruntime/qv4memberdata.cpp50
-rw-r--r--src/qml/jsruntime/qv4memberdata_p.h57
-rw-r--r--src/qml/jsruntime/qv4mm.cpp392
-rw-r--r--src/qml/jsruntime/qv4mm_p.h96
-rw-r--r--src/qml/jsruntime/qv4numberobject.cpp116
-rw-r--r--src/qml/jsruntime/qv4numberobject_p.h27
-rw-r--r--src/qml/jsruntime/qv4object.cpp427
-rw-r--r--src/qml/jsruntime/qv4object_p.h395
-rw-r--r--src/qml/jsruntime/qv4objectiterator.cpp107
-rw-r--r--src/qml/jsruntime/qv4objectiterator_p.h67
-rw-r--r--src/qml/jsruntime/qv4objectproto.cpp381
-rw-r--r--src/qml/jsruntime/qv4objectproto_p.h33
-rw-r--r--src/qml/jsruntime/qv4persistent.cpp390
-rw-r--r--src/qml/jsruntime/qv4persistent_p.h158
-rw-r--r--src/qml/jsruntime/qv4profiling.cpp14
-rw-r--r--src/qml/jsruntime/qv4profiling_p.h24
-rw-r--r--src/qml/jsruntime/qv4property_p.h60
-rw-r--r--src/qml/jsruntime/qv4qmlextensions.cpp14
-rw-r--r--src/qml/jsruntime/qv4qmlextensions_p.h19
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp646
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper_p.h124
-rw-r--r--src/qml/jsruntime/qv4regexp.cpp44
-rw-r--r--src/qml/jsruntime/qv4regexp_p.h59
-rw-r--r--src/qml/jsruntime/qv4regexpobject.cpp157
-rw-r--r--src/qml/jsruntime/qv4regexpobject_p.h86
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp807
-rw-r--r--src/qml/jsruntime/qv4runtime_p.h415
-rw-r--r--src/qml/jsruntime/qv4scopedvalue_p.h337
-rw-r--r--src/qml/jsruntime/qv4script.cpp207
-rw-r--r--src/qml/jsruntime/qv4script_p.h88
-rw-r--r--src/qml/jsruntime/qv4sequenceobject.cpp244
-rw-r--r--src/qml/jsruntime/qv4sequenceobject_p.h19
-rw-r--r--src/qml/jsruntime/qv4serialize.cpp140
-rw-r--r--src/qml/jsruntime/qv4serialize_p.h22
-rw-r--r--src/qml/jsruntime/qv4sparsearray.cpp14
-rw-r--r--src/qml/jsruntime/qv4sparsearray_p.h14
-rw-r--r--src/qml/jsruntime/qv4string.cpp285
-rw-r--r--src/qml/jsruntime/qv4string_p.h189
-rw-r--r--src/qml/jsruntime/qv4stringobject.cpp200
-rw-r--r--src/qml/jsruntime/qv4stringobject_p.h55
-rw-r--r--src/qml/jsruntime/qv4typedarray.cpp575
-rw-r--r--src/qml/jsruntime/qv4typedarray_p.h155
-rw-r--r--src/qml/jsruntime/qv4util_p.h14
-rw-r--r--src/qml/jsruntime/qv4value.cpp56
-rw-r--r--src/qml/jsruntime/qv4value_inl_p.h55
-rw-r--r--src/qml/jsruntime/qv4value_p.h252
-rw-r--r--src/qml/jsruntime/qv4variantobject.cpp65
-rw-r--r--src/qml/jsruntime/qv4variantobject_p.h49
-rw-r--r--src/qml/jsruntime/qv4vme_moth.cpp499
-rw-r--r--src/qml/jsruntime/qv4vme_moth_p.h18
-rw-r--r--src/qml/parser/qqmljs.g52
-rw-r--r--src/qml/parser/qqmljsast.cpp14
-rw-r--r--src/qml/parser/qqmljsast_p.h14
-rw-r--r--src/qml/parser/qqmljsastfwd_p.h14
-rw-r--r--src/qml/parser/qqmljsastvisitor.cpp14
-rw-r--r--src/qml/parser/qqmljsastvisitor_p.h14
-rw-r--r--src/qml/parser/qqmljsengine_p.cpp22
-rw-r--r--src/qml/parser/qqmljsengine_p.h19
-rw-r--r--src/qml/parser/qqmljsglobal_p.h14
-rw-r--r--src/qml/parser/qqmljsgrammar.cpp14
-rw-r--r--src/qml/parser/qqmljsgrammar_p.h14
-rw-r--r--src/qml/parser/qqmljskeywords_p.h14
-rw-r--r--src/qml/parser/qqmljslexer.cpp176
-rw-r--r--src/qml/parser/qqmljslexer_p.h25
-rw-r--r--src/qml/parser/qqmljsmemorypool_p.h14
-rw-r--r--src/qml/parser/qqmljsparser.cpp45
-rw-r--r--src/qml/parser/qqmljsparser_p.h14
-rw-r--r--src/qml/qml/ftw/ftw.pri3
-rw-r--r--src/qml/qml/ftw/qbitfield_p.h25
-rw-r--r--src/qml/qml/ftw/qdeletewatcher_p.h14
-rw-r--r--src/qml/qml/ftw/qfieldlist_p.h14
-rw-r--r--src/qml/qml/ftw/qfinitestack_p.h14
-rw-r--r--src/qml/qml/ftw/qflagpointer_p.h14
-rw-r--r--src/qml/qml/ftw/qhashedstring.cpp14
-rw-r--r--src/qml/qml/ftw/qhashedstring_p.h22
-rw-r--r--src/qml/qml/ftw/qhashfield_p.h14
-rw-r--r--src/qml/qml/ftw/qintrusivelist.cpp14
-rw-r--r--src/qml/qml/ftw/qintrusivelist_p.h14
-rw-r--r--src/qml/qml/ftw/qlazilyallocated_p.h14
-rw-r--r--src/qml/qml/ftw/qpodvector_p.h14
-rw-r--r--src/qml/qml/ftw/qpointervaluepair_p.h14
-rw-r--r--src/qml/qml/ftw/qqmlnullablevalue_p.h (renamed from src/qml/qml/qqmlnullablevalue_p_p.h)14
-rw-r--r--src/qml/qml/ftw/qqmlpool.cpp14
-rw-r--r--src/qml/qml/ftw/qqmlpool_p.h16
-rw-r--r--src/qml/qml/ftw/qqmlrefcount_p.h16
-rw-r--r--src/qml/qml/ftw/qqmlthread.cpp14
-rw-r--r--src/qml/qml/ftw/qqmlthread_p.h14
-rw-r--r--src/qml/qml/ftw/qqmltrace.cpp147
-rw-r--r--src/qml/qml/ftw/qqmltrace_p.h286
-rw-r--r--src/qml/qml/ftw/qrecursionwatcher_p.h14
-rw-r--r--src/qml/qml/ftw/qrecyclepool_p.h14
-rw-r--r--src/qml/qml/qml.pri19
-rw-r--r--src/qml/qml/qqml.h14
-rw-r--r--src/qml/qml/qqmlabstractbinding.cpp32
-rw-r--r--src/qml/qml/qqmlabstractbinding_p.h14
-rw-r--r--src/qml/qml/qqmlabstractexpression.cpp14
-rw-r--r--src/qml/qml/qqmlabstractexpression_p.h14
-rw-r--r--src/qml/qml/qqmlabstracturlinterceptor.cpp12
-rw-r--r--src/qml/qml/qqmlabstracturlinterceptor.h12
-rw-r--r--src/qml/qml/qqmlaccessors.cpp14
-rw-r--r--src/qml/qml/qqmlaccessors_p.h14
-rw-r--r--src/qml/qml/qqmlapplicationengine.cpp12
-rw-r--r--src/qml/qml/qqmlapplicationengine.h12
-rw-r--r--src/qml/qml/qqmlapplicationengine_p.h12
-rw-r--r--src/qml/qml/qqmlbinding.cpp71
-rw-r--r--src/qml/qml/qqmlbinding_p.h16
-rw-r--r--src/qml/qml/qqmlboundsignal.cpp48
-rw-r--r--src/qml/qml/qqmlboundsignal_p.h20
-rw-r--r--src/qml/qml/qqmlboundsignalexpressionpointer_p.h14
-rw-r--r--src/qml/qml/qqmlbundle.cpp310
-rw-r--r--src/qml/qml/qqmlbundle_p.h119
-rw-r--r--src/qml/qml/qqmlcleanup.cpp14
-rw-r--r--src/qml/qml/qqmlcleanup_p.h14
-rw-r--r--src/qml/qml/qqmlcompileddata.cpp14
-rw-r--r--src/qml/qml/qqmlcompiler_p.h16
-rw-r--r--src/qml/qml/qqmlcomponent.cpp184
-rw-r--r--src/qml/qml/qqmlcomponent.h14
-rw-r--r--src/qml/qml/qqmlcomponent_p.h16
-rw-r--r--src/qml/qml/qqmlcomponentattached_p.h14
-rw-r--r--src/qml/qml/qqmlcontext.cpp95
-rw-r--r--src/qml/qml/qqmlcontext.h14
-rw-r--r--src/qml/qml/qqmlcontext_p.h36
-rw-r--r--src/qml/qml/qqmlcontextwrapper.cpp161
-rw-r--r--src/qml/qml/qqmlcontextwrapper_p.h76
-rw-r--r--src/qml/qml/qqmlcustomparser.cpp14
-rw-r--r--src/qml/qml/qqmlcustomparser_p.h16
-rw-r--r--src/qml/qml/qqmldata_p.h57
-rw-r--r--src/qml/qml/qqmldirparser.cpp124
-rw-r--r--src/qml/qml/qqmldirparser_p.h20
-rw-r--r--src/qml/qml/qqmlengine.cpp168
-rw-r--r--src/qml/qml/qqmlengine.h15
-rw-r--r--src/qml/qml/qqmlengine_p.h127
-rw-r--r--src/qml/qml/qqmlerror.cpp18
-rw-r--r--src/qml/qml/qqmlerror.h14
-rw-r--r--src/qml/qml/qqmlexpression.cpp31
-rw-r--r--src/qml/qml/qqmlexpression.h14
-rw-r--r--src/qml/qml/qqmlexpression_p.h14
-rw-r--r--src/qml/qml/qqmlextensioninterface.h14
-rw-r--r--src/qml/qml/qqmlextensionplugin.cpp14
-rw-r--r--src/qml/qml/qqmlextensionplugin.h14
-rw-r--r--src/qml/qml/qqmlextensionplugin_p.h14
-rw-r--r--src/qml/qml/qqmlfile.cpp290
-rw-r--r--src/qml/qml/qqmlfile.h29
-rw-r--r--src/qml/qml/qqmlfileselector.cpp24
-rw-r--r--src/qml/qml/qqmlfileselector.h12
-rw-r--r--src/qml/qml/qqmlfileselector_p.h12
-rw-r--r--src/qml/qml/qqmlglobal.cpp39
-rw-r--r--src/qml/qml/qqmlglobal_p.h26
-rw-r--r--src/qml/qml/qqmlguard_p.h14
-rw-r--r--src/qml/qml/qqmlimport.cpp98
-rw-r--r--src/qml/qml/qqmlimport_p.h20
-rw-r--r--src/qml/qml/qqmlincubator.cpp14
-rw-r--r--src/qml/qml/qqmlincubator.h14
-rw-r--r--src/qml/qml/qqmlincubator_p.h14
-rw-r--r--src/qml/qml/qqmlinfo.cpp18
-rw-r--r--src/qml/qml/qqmlinfo.h14
-rw-r--r--src/qml/qml/qqmljavascriptexpression.cpp66
-rw-r--r--src/qml/qml/qqmljavascriptexpression_p.h26
-rw-r--r--src/qml/qml/qqmllist.cpp14
-rw-r--r--src/qml/qml/qqmllist.h14
-rw-r--r--src/qml/qml/qqmllist_p.h14
-rw-r--r--src/qml/qml/qqmllistwrapper.cpp60
-rw-r--r--src/qml/qml/qqmllistwrapper_p.h48
-rw-r--r--src/qml/qml/qqmllocale.cpp284
-rw-r--r--src/qml/qml/qqmllocale_p.h60
-rw-r--r--src/qml/qml/qqmlmemoryprofiler.cpp14
-rw-r--r--src/qml/qml/qqmlmemoryprofiler_p.h14
-rw-r--r--src/qml/qml/qqmlmetatype.cpp114
-rw-r--r--src/qml/qml/qqmlmetatype_p.h20
-rw-r--r--src/qml/qml/qqmlnetworkaccessmanagerfactory.cpp14
-rw-r--r--src/qml/qml/qqmlnetworkaccessmanagerfactory.h14
-rw-r--r--src/qml/qml/qqmlnotifier.cpp14
-rw-r--r--src/qml/qml/qqmlnotifier_p.h17
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp200
-rw-r--r--src/qml/qml/qqmlobjectcreator_p.h28
-rw-r--r--src/qml/qml/qqmlopenmetaobject.cpp17
-rw-r--r--src/qml/qml/qqmlopenmetaobject_p.h14
-rw-r--r--src/qml/qml/qqmlparserstatus.cpp14
-rw-r--r--src/qml/qml/qqmlparserstatus.h14
-rw-r--r--src/qml/qml/qqmlplatform.cpp14
-rw-r--r--src/qml/qml/qqmlplatform_p.h14
-rw-r--r--src/qml/qml/qqmlprivate.h14
-rw-r--r--src/qml/qml/qqmlproperty.cpp142
-rw-r--r--src/qml/qml/qqmlproperty.h14
-rw-r--r--src/qml/qml/qqmlproperty_p.h16
-rw-r--r--src/qml/qml/qqmlpropertycache.cpp428
-rw-r--r--src/qml/qml/qqmlpropertycache_p.h93
-rw-r--r--src/qml/qml/qqmlpropertyvalueinterceptor.cpp14
-rw-r--r--src/qml/qml/qqmlpropertyvalueinterceptor_p.h14
-rw-r--r--src/qml/qml/qqmlpropertyvaluesource.cpp14
-rw-r--r--src/qml/qml/qqmlpropertyvaluesource.h14
-rw-r--r--src/qml/qml/qqmlproxymetaobject.cpp14
-rw-r--r--src/qml/qml/qqmlproxymetaobject_p.h14
-rw-r--r--src/qml/qml/qqmlscriptstring.cpp14
-rw-r--r--src/qml/qml/qqmlscriptstring.h14
-rw-r--r--src/qml/qml/qqmlscriptstring_p.h14
-rw-r--r--src/qml/qml/qqmlstringconverters.cpp14
-rw-r--r--src/qml/qml/qqmlstringconverters_p.h14
-rw-r--r--src/qml/qml/qqmltypeloader.cpp417
-rw-r--r--src/qml/qml/qqmltypeloader_p.h144
-rw-r--r--src/qml/qml/qqmltypenamecache.cpp14
-rw-r--r--src/qml/qml/qqmltypenamecache_p.h14
-rw-r--r--src/qml/qml/qqmltypenotavailable.cpp14
-rw-r--r--src/qml/qml/qqmltypenotavailable_p.h14
-rw-r--r--src/qml/qml/qqmltypewrapper.cpp91
-rw-r--r--src/qml/qml/qqmltypewrapper_p.h63
-rw-r--r--src/qml/qml/qqmlvaluetype.cpp206
-rw-r--r--src/qml/qml/qqmlvaluetype_p.h203
-rw-r--r--src/qml/qml/qqmlvaluetypeproxybinding.cpp17
-rw-r--r--src/qml/qml/qqmlvaluetypeproxybinding_p.h14
-rw-r--r--src/qml/qml/qqmlvaluetypewrapper.cpp520
-rw-r--r--src/qml/qml/qqmlvaluetypewrapper_p.h53
-rw-r--r--src/qml/qml/qqmlvme.cpp14
-rw-r--r--src/qml/qml/qqmlvme_p.h15
-rw-r--r--src/qml/qml/qqmlvmemetaobject.cpp56
-rw-r--r--src/qml/qml/qqmlvmemetaobject_p.h34
-rw-r--r--src/qml/qml/qqmlwatcher.cpp14
-rw-r--r--src/qml/qml/qqmlwatcher_p.h14
-rw-r--r--src/qml/qml/qqmlxmlhttprequest.cpp866
-rw-r--r--src/qml/qml/qqmlxmlhttprequest_p.h19
-rw-r--r--src/qml/qml/v8/qqmlbuiltinfunctions.cpp663
-rw-r--r--src/qml/qml/v8/qqmlbuiltinfunctions_p.h67
-rw-r--r--src/qml/qml/v8/qv4domerrors.cpp18
-rw-r--r--src/qml/qml/v8/qv4domerrors_p.h20
-rw-r--r--src/qml/qml/v8/qv4sqlerrors.cpp18
-rw-r--r--src/qml/qml/v8/qv4sqlerrors_p.h14
-rw-r--r--src/qml/qml/v8/qv8debug_p.h34
-rw-r--r--src/qml/qml/v8/qv8engine.cpp733
-rw-r--r--src/qml/qml/v8/qv8engine_p.h75
-rw-r--r--src/qml/qml/v8/v8.pri1
-rw-r--r--src/qml/qtqmlglobal.h14
-rw-r--r--src/qml/qtqmlglobal_p.h14
-rw-r--r--src/qml/types/qqmlbind.cpp16
-rw-r--r--src/qml/types/qqmlbind_p.h14
-rw-r--r--src/qml/types/qqmlconnections.cpp14
-rw-r--r--src/qml/types/qqmlconnections_p.h14
-rw-r--r--src/qml/types/qqmldelegatemodel.cpp266
-rw-r--r--src/qml/types/qqmldelegatemodel_p.h16
-rw-r--r--src/qml/types/qqmldelegatemodel_p_p.h58
-rw-r--r--src/qml/types/qqmlinstantiator.cpp50
-rw-r--r--src/qml/types/qqmlinstantiator_p.h12
-rw-r--r--src/qml/types/qqmlinstantiator_p_p.h14
-rw-r--r--src/qml/types/qqmlitemmodels.qdoc110
-rw-r--r--src/qml/types/qqmlitemselectionmodel.qdoc143
-rw-r--r--src/qml/types/qqmllistmodel.cpp167
-rw-r--r--src/qml/types/qqmllistmodel_p.h22
-rw-r--r--src/qml/types/qqmllistmodel_p_p.h34
-rw-r--r--src/qml/types/qqmllistmodelworkeragent.cpp16
-rw-r--r--src/qml/types/qqmllistmodelworkeragent_p.h16
-rw-r--r--src/qml/types/qqmlmodelindexvaluetype.cpp60
-rw-r--r--src/qml/types/qqmlmodelindexvaluetype_p.h158
-rw-r--r--src/qml/types/qqmlmodelsmodule.cpp15
-rw-r--r--src/qml/types/qqmlmodelsmodule_p.h12
-rw-r--r--src/qml/types/qqmlobjectmodel.cpp14
-rw-r--r--src/qml/types/qqmlobjectmodel_p.h14
-rw-r--r--src/qml/types/qqmltimer.cpp14
-rw-r--r--src/qml/types/qqmltimer_p.h14
-rw-r--r--src/qml/types/qquickpackage.cpp18
-rw-r--r--src/qml/types/qquickpackage_p.h14
-rw-r--r--src/qml/types/qquickworkerscript.cpp58
-rw-r--r--src/qml/types/qquickworkerscript_p.h14
-rw-r--r--src/qml/types/types.pri2
-rw-r--r--src/qml/util/qqmladaptormodel.cpp91
-rw-r--r--src/qml/util/qqmladaptormodel_p.h14
-rw-r--r--src/qml/util/qqmlchangeset.cpp14
-rw-r--r--src/qml/util/qqmlchangeset_p.h14
-rw-r--r--src/qml/util/qqmllistaccessor.cpp18
-rw-r--r--src/qml/util/qqmllistaccessor_p.h14
-rw-r--r--src/qml/util/qqmllistcompositor.cpp14
-rw-r--r--src/qml/util/qqmllistcompositor_p.h14
-rw-r--r--src/qml/util/qqmlpropertymap.cpp14
-rw-r--r--src/qml/util/qqmlpropertymap.h14
-rw-r--r--src/qmldevtools/qmldevtools.pro12
-rw-r--r--src/qmldevtools/qtqmldevtoolsglobal_p.h69
-rw-r--r--src/qmltest/qmltest.pro4
-rw-r--r--src/qmltest/qtestoptions_p.h14
-rw-r--r--src/qmltest/quicktest.cpp21
-rw-r--r--src/qmltest/quicktest.h14
-rw-r--r--src/qmltest/quicktestevent.cpp41
-rw-r--r--src/qmltest/quicktestevent_p.h16
-rw-r--r--src/qmltest/quicktestglobal.h14
-rw-r--r--src/qmltest/quicktestresult.cpp23
-rw-r--r--src/qmltest/quicktestresult_p.h14
-rw-r--r--src/quick/accessible/accessible.pri2
-rw-r--r--src/quick/accessible/qaccessiblequickitem.cpp135
-rw-r--r--src/quick/accessible/qaccessiblequickitem_p.h18
-rw-r--r--src/quick/accessible/qaccessiblequickview.cpp15
-rw-r--r--src/quick/accessible/qaccessiblequickview_p.h14
-rw-r--r--src/quick/accessible/qqmlaccessible.cpp195
-rw-r--r--src/quick/accessible/qqmlaccessible_p.h82
-rw-r--r--src/quick/accessible/qquickaccessiblefactory.cpp14
-rw-r--r--src/quick/accessible/qquickaccessiblefactory_p.h14
-rw-r--r--src/quick/designer/designersupport.cpp18
-rw-r--r--src/quick/designer/designersupport.h14
-rw-r--r--src/quick/designer/designerwindowmanager.cpp14
-rw-r--r--src/quick/designer/designerwindowmanager_p.h14
-rw-r--r--src/quick/doc/snippets/qml/anchoranimation.qml8
-rw-r--r--src/quick/doc/snippets/qml/anchorchanges.qml8
-rw-r--r--src/quick/doc/snippets/qml/animatedimage.qml8
-rw-r--r--src/quick/doc/snippets/qml/animation.qml8
-rw-r--r--src/quick/doc/snippets/qml/animators.qml8
-rw-r--r--src/quick/doc/snippets/qml/behavior.qml8
-rw-r--r--src/quick/doc/snippets/qml/borderimage/borderimage-scaled.qml8
-rw-r--r--src/quick/doc/snippets/qml/borderimage/borderimage-tiled.qml8
-rw-r--r--src/quick/doc/snippets/qml/borderimage/normal-image.qml8
-rw-r--r--src/quick/doc/snippets/qml/coloranimation.qml8
-rw-r--r--src/quick/doc/snippets/qml/colors.qml8
-rw-r--r--src/quick/doc/snippets/qml/column/column-transitions.qml8
-rw-r--r--src/quick/doc/snippets/qml/column/column.qml8
-rw-r--r--src/quick/doc/snippets/qml/column/vertical-positioner.qml8
-rw-r--r--src/quick/doc/snippets/qml/drag.qml8
-rw-r--r--src/quick/doc/snippets/qml/flickable.qml8
-rw-r--r--src/quick/doc/snippets/qml/flickableScrollbar.qml8
-rw-r--r--src/quick/doc/snippets/qml/flipable/flipable.qml8
-rw-r--r--src/quick/doc/snippets/qml/flow.qml8
-rw-r--r--src/quick/doc/snippets/qml/focus/MyClickableWidget.qml8
-rw-r--r--src/quick/doc/snippets/qml/focus/MyWidget.qml8
-rw-r--r--src/quick/doc/snippets/qml/focus/advancedFocus.qml8
-rw-r--r--src/quick/doc/snippets/qml/focus/basicwidget.qml8
-rw-r--r--src/quick/doc/snippets/qml/focus/clickablewidget.qml8
-rw-r--r--src/quick/doc/snippets/qml/focus/myfocusscopewidget.qml8
-rw-r--r--src/quick/doc/snippets/qml/focus/rectangle.qml8
-rw-r--r--src/quick/doc/snippets/qml/focus/widget.qml8
-rw-r--r--src/quick/doc/snippets/qml/gradient.qml8
-rw-r--r--src/quick/doc/snippets/qml/grid-spacing.qml8
-rw-r--r--src/quick/doc/snippets/qml/grid/grid.qml8
-rw-r--r--src/quick/doc/snippets/qml/gridview/ContactModel.qml8
-rw-r--r--src/quick/doc/snippets/qml/gridview/gridview.qml8
-rw-r--r--src/quick/doc/snippets/qml/image.qml8
-rw-r--r--src/quick/doc/snippets/qml/itemGrab.qml6
-rw-r--r--src/quick/doc/snippets/qml/keynavigation.qml8
-rw-r--r--src/quick/doc/snippets/qml/keys/keys-handler.qml8
-rw-r--r--src/quick/doc/snippets/qml/keys/keys-pressed.qml8
-rw-r--r--src/quick/doc/snippets/qml/layerblending.qml6
-rw-r--r--src/quick/doc/snippets/qml/layerwitheffect.qml6
-rw-r--r--src/quick/doc/snippets/qml/layoutmirroring.qml8
-rw-r--r--src/quick/doc/snippets/qml/listview-decorations.qml8
-rw-r--r--src/quick/doc/snippets/qml/listview-sections.qml8
-rw-r--r--src/quick/doc/snippets/qml/listview.qml8
-rw-r--r--src/quick/doc/snippets/qml/listview/ContactModel.qml8
-rw-r--r--src/quick/doc/snippets/qml/listview/listview.qml8
-rw-r--r--src/quick/doc/snippets/qml/loader/KeyReader.qml17
-rw-r--r--src/quick/doc/snippets/qml/loader/MyComponent.qml14
-rw-r--r--src/quick/doc/snippets/qml/loader/MyItem.qml14
-rw-r--r--src/quick/doc/snippets/qml/loader/connections.qml14
-rw-r--r--src/quick/doc/snippets/qml/loader/creationContext1.qml14
-rw-r--r--src/quick/doc/snippets/qml/loader/creationContext2.qml14
-rw-r--r--src/quick/doc/snippets/qml/loader/creationContext3.qml14
-rw-r--r--src/quick/doc/snippets/qml/loader/creationContext4.qml14
-rw-r--r--src/quick/doc/snippets/qml/loader/focus.qml14
-rw-r--r--src/quick/doc/snippets/qml/loader/simple.qml14
-rw-r--r--src/quick/doc/snippets/qml/loader/sizeitem.qml43
-rw-r--r--src/quick/doc/snippets/qml/loader/sizeloader.qml43
-rw-r--r--src/quick/doc/snippets/qml/models/views-models-delegates.qml8
-rw-r--r--src/quick/doc/snippets/qml/models/visual-model-and-view.qml8
-rw-r--r--src/quick/doc/snippets/qml/mousearea/mousearea-snippet.qml8
-rw-r--r--src/quick/doc/snippets/qml/mousearea/mousearea.qml8
-rw-r--r--src/quick/doc/snippets/qml/mousearea/mouseareadragfilter.qml8
-rw-r--r--src/quick/doc/snippets/qml/multipointtoucharea/multipointtoucharea.qml8
-rw-r--r--src/quick/doc/snippets/qml/numberanimation.qml8
-rw-r--r--src/quick/doc/snippets/qml/opacitymask.qml6
-rw-r--r--src/quick/doc/snippets/qml/parallelanimation.qml8
-rw-r--r--src/quick/doc/snippets/qml/parentanimation.qml8
-rw-r--r--src/quick/doc/snippets/qml/parentchange.qml8
-rw-r--r--src/quick/doc/snippets/qml/path/arcdirection.qml8
-rw-r--r--src/quick/doc/snippets/qml/path/arcradius.qml8
-rw-r--r--src/quick/doc/snippets/qml/path/basicarc.qml8
-rw-r--r--src/quick/doc/snippets/qml/path/basiccurve.qml8
-rw-r--r--src/quick/doc/snippets/qml/path/largearc.qml8
-rw-r--r--src/quick/doc/snippets/qml/pathinterpolator.qml8
-rw-r--r--src/quick/doc/snippets/qml/pathview/ContactModel.qml8
-rw-r--r--src/quick/doc/snippets/qml/pathview/pathattributes.qml8
-rw-r--r--src/quick/doc/snippets/qml/pathview/pathview.qml8
-rw-r--r--src/quick/doc/snippets/qml/propertyaction-sequential.qml8
-rw-r--r--src/quick/doc/snippets/qml/propertyaction.qml8
-rw-r--r--src/quick/doc/snippets/qml/propertyanimation.qml14
-rw-r--r--src/quick/doc/snippets/qml/propertychanges.qml8
-rw-r--r--src/quick/doc/snippets/qml/qml-data-models/dynamic-listmodel.qml8
-rw-r--r--src/quick/doc/snippets/qml/qml-data-models/listelements.qml8
-rw-r--r--src/quick/doc/snippets/qml/qml-data-models/listmodel-listview.qml8
-rw-r--r--src/quick/doc/snippets/qml/qml-extending-types/components/Button.qml8
-rw-r--r--src/quick/doc/snippets/qml/qml-extending-types/components/application.qml8
-rw-r--r--src/quick/doc/snippets/qml/qml-extending-types/methods/app.qml8
-rw-r--r--src/quick/doc/snippets/qml/qml-extending-types/properties/ImageViewer.qml8
-rw-r--r--src/quick/doc/snippets/qml/qml-extending-types/properties/alias-override.qml8
-rw-r--r--src/quick/doc/snippets/qml/qml-extending-types/properties/alias.qml8
-rw-r--r--src/quick/doc/snippets/qml/qml-extending-types/properties/alias/ImageViewer.qml8
-rw-r--r--src/quick/doc/snippets/qml/qml-extending-types/properties/alias/application.qml8
-rw-r--r--src/quick/doc/snippets/qml/qml-extending-types/properties/application.qml8
-rw-r--r--src/quick/doc/snippets/qml/qml-extending-types/properties/property-signals.qml8
-rw-r--r--src/quick/doc/snippets/qml/qml-extending-types/signals/Button.qml8
-rw-r--r--src/quick/doc/snippets/qml/qml-extending-types/signals/basic.qml8
-rw-r--r--src/quick/doc/snippets/qml/qml-extending-types/signals/connectdynamic.qml8
-rw-r--r--src/quick/doc/snippets/qml/qml-extending-types/signals/connectslots.qml8
-rw-r--r--src/quick/doc/snippets/qml/qml-extending-types/signals/no-parameters.qml8
-rw-r--r--src/quick/doc/snippets/qml/qml-extending-types/signals/parameters.qml8
-rw-r--r--src/quick/doc/snippets/qml/rectangle/rectangle-colors.qml8
-rw-r--r--src/quick/doc/snippets/qml/rectangle/rectangle-gradient.qml8
-rw-r--r--src/quick/doc/snippets/qml/rectangle/rectangle.qml8
-rw-r--r--src/quick/doc/snippets/qml/repeaters/repeater-grid-index.qml8
-rw-r--r--src/quick/doc/snippets/qml/repeaters/repeater.qml8
-rw-r--r--src/quick/doc/snippets/qml/righttoleft.qml8
-rw-r--r--src/quick/doc/snippets/qml/righttoleft/Child.qml8
-rw-r--r--src/quick/doc/snippets/qml/rotation.qml8
-rw-r--r--src/quick/doc/snippets/qml/rotationanimation.qml8
-rw-r--r--src/quick/doc/snippets/qml/row.qml8
-rw-r--r--src/quick/doc/snippets/qml/row/row.qml8
-rw-r--r--src/quick/doc/snippets/qml/sequentialanimation.qml8
-rw-r--r--src/quick/doc/snippets/qml/smoothedanimation.qml8
-rw-r--r--src/quick/doc/snippets/qml/springanimation.qml8
-rw-r--r--src/quick/doc/snippets/qml/state-when.qml8
-rw-r--r--src/quick/doc/snippets/qml/state.qml8
-rw-r--r--src/quick/doc/snippets/qml/states.qml8
-rw-r--r--src/quick/doc/snippets/qml/states/statechangescript.qml8
-rw-r--r--src/quick/doc/snippets/qml/systempalette.qml8
-rw-r--r--src/quick/doc/snippets/qml/text/onLinkActivated.qml8
-rw-r--r--src/quick/doc/snippets/qml/texteditor.qml8
-rw-r--r--src/quick/doc/snippets/qml/texthandling.qml8
-rw-r--r--src/quick/doc/snippets/qml/transition-from-to-modified.qml8
-rw-r--r--src/quick/doc/snippets/qml/transition-from-to.qml8
-rw-r--r--src/quick/doc/snippets/qml/transition-reversible.qml8
-rw-r--r--src/quick/doc/snippets/qml/transition.qml8
-rw-r--r--src/quick/doc/snippets/qml/transitions-list.qml8
-rw-r--r--src/quick/doc/snippets/qml/viewtransitions/viewtransitions-basic.qml8
-rw-r--r--src/quick/doc/snippets/qml/viewtransitions/viewtransitions-delayedbyindex.qml8
-rw-r--r--src/quick/doc/snippets/qml/viewtransitions/viewtransitions-intermediatemove.qml8
-rw-r--r--src/quick/doc/snippets/qml/viewtransitions/viewtransitions-interruptedgood.qml8
-rw-r--r--src/quick/doc/snippets/qml/viewtransitions/viewtransitions-pathanim.qml8
-rw-r--r--src/quick/doc/snippets/qml/viewtransitions/viewtransitions-scriptactionbad.qml8
-rw-r--r--src/quick/doc/snippets/qml/viewtransitions/viewtransitions-scriptactiongood.qml8
-rw-r--r--src/quick/doc/snippets/qml/visualparent.qml8
-rw-r--r--src/quick/doc/snippets/qml/visualparent2.qml8
-rw-r--r--src/quick/doc/snippets/qml/xmlrole.qml8
-rw-r--r--src/quick/doc/src/advtutorial.qdoc12
-rw-r--r--src/quick/doc/src/concepts/convenience/topic.qdoc12
-rw-r--r--src/quick/doc/src/concepts/effects/particles.qdoc12
-rw-r--r--src/quick/doc/src/concepts/effects/sprites.qdoc12
-rw-r--r--src/quick/doc/src/concepts/effects/topic.qdoc12
-rw-r--r--src/quick/doc/src/concepts/effects/transformations.qdoc12
-rw-r--r--src/quick/doc/src/concepts/input/focus.qdoc12
-rw-r--r--src/quick/doc/src/concepts/input/mouse.qdoc12
-rw-r--r--src/quick/doc/src/concepts/input/textinput.qdoc12
-rw-r--r--src/quick/doc/src/concepts/input/topic.qdoc12
-rw-r--r--src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc16
-rw-r--r--src/quick/doc/src/concepts/modelviewsdata/modelview.qdoc12
-rw-r--r--src/quick/doc/src/concepts/modelviewsdata/topic.qdoc12
-rw-r--r--src/quick/doc/src/concepts/positioning/anchors.qdoc12
-rw-r--r--src/quick/doc/src/concepts/positioning/layouts.qdoc12
-rw-r--r--src/quick/doc/src/concepts/positioning/righttoleft.qdoc12
-rw-r--r--src/quick/doc/src/concepts/positioning/topic.qdoc12
-rw-r--r--src/quick/doc/src/concepts/statesanimations/animations.qdoc12
-rw-r--r--src/quick/doc/src/concepts/statesanimations/behaviors.qdoc12
-rw-r--r--src/quick/doc/src/concepts/statesanimations/states.qdoc12
-rw-r--r--src/quick/doc/src/concepts/statesanimations/topic.qdoc12
-rw-r--r--src/quick/doc/src/concepts/visualcanvas/coordinates.qdoc12
-rw-r--r--src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc59
-rw-r--r--src/quick/doc/src/concepts/visualcanvas/topic.qdoc12
-rw-r--r--src/quick/doc/src/concepts/visualcanvas/visualparent.qdoc20
-rw-r--r--src/quick/doc/src/concepts/visualtypes/topic.qdoc12
-rw-r--r--src/quick/doc/src/cppextensionpoints.qdoc12
-rw-r--r--src/quick/doc/src/dynamicview-tutorial.qdoc12
-rw-r--r--src/quick/doc/src/examples.qdoc12
-rw-r--r--src/quick/doc/src/qmltypereference.qdoc86
-rw-r--r--src/quick/doc/src/qtquick-cpp.qdoc12
-rw-r--r--src/quick/doc/src/qtquick.qdoc18
-rw-r--r--src/quick/doc/src/tutorial.qdoc12
-rw-r--r--src/quick/doc/src/whatsnew.qdoc452
-rwxr-xr-xsrc/quick/items/checksync.pl14
-rw-r--r--src/quick/items/context2d/qquickcanvascontext.cpp14
-rw-r--r--src/quick/items/context2d/qquickcanvascontext_p.h16
-rw-r--r--src/quick/items/context2d/qquickcanvasitem.cpp20
-rw-r--r--src/quick/items/context2d/qquickcanvasitem_p.h26
-rw-r--r--src/quick/items/context2d/qquickcontext2d.cpp917
-rw-r--r--src/quick/items/context2d/qquickcontext2d_p.h18
-rw-r--r--src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp22
-rw-r--r--src/quick/items/context2d/qquickcontext2dcommandbuffer_p.h14
-rw-r--r--src/quick/items/context2d/qquickcontext2dtexture.cpp14
-rw-r--r--src/quick/items/context2d/qquickcontext2dtexture_p.h30
-rw-r--r--src/quick/items/context2d/qquickcontext2dtile.cpp14
-rw-r--r--src/quick/items/context2d/qquickcontext2dtile_p.h14
-rw-r--r--src/quick/items/qquickaccessibleattached.cpp93
-rw-r--r--src/quick/items/qquickaccessibleattached_p.h26
-rw-r--r--src/quick/items/qquickanchors.cpp14
-rw-r--r--src/quick/items/qquickanchors_p.h14
-rw-r--r--src/quick/items/qquickanchors_p_p.h18
-rw-r--r--src/quick/items/qquickanimatedimage.cpp47
-rw-r--r--src/quick/items/qquickanimatedimage_p.h21
-rw-r--r--src/quick/items/qquickanimatedimage_p_p.h14
-rw-r--r--src/quick/items/qquickanimatedsprite.cpp67
-rw-r--r--src/quick/items/qquickanimatedsprite_p.h18
-rw-r--r--src/quick/items/qquickborderimage.cpp85
-rw-r--r--src/quick/items/qquickborderimage_p.h24
-rw-r--r--src/quick/items/qquickborderimage_p_p.h14
-rw-r--r--src/quick/items/qquickclipnode.cpp14
-rw-r--r--src/quick/items/qquickclipnode_p.h14
-rw-r--r--src/quick/items/qquickdrag.cpp26
-rw-r--r--src/quick/items/qquickdrag_p.h14
-rw-r--r--src/quick/items/qquickdroparea.cpp34
-rw-r--r--src/quick/items/qquickdroparea_p.h23
-rw-r--r--src/quick/items/qquickevents.cpp16
-rw-r--r--src/quick/items/qquickevents_p_p.h14
-rw-r--r--src/quick/items/qquickflickable.cpp355
-rw-r--r--src/quick/items/qquickflickable_p.h45
-rw-r--r--src/quick/items/qquickflickable_p_p.h30
-rw-r--r--src/quick/items/qquickflickablebehavior_p.h12
-rw-r--r--src/quick/items/qquickflipable.cpp18
-rw-r--r--src/quick/items/qquickflipable_p.h16
-rw-r--r--src/quick/items/qquickfocusscope.cpp14
-rw-r--r--src/quick/items/qquickfocusscope_p.h14
-rw-r--r--src/quick/items/qquickframebufferobject.cpp25
-rw-r--r--src/quick/items/qquickframebufferobject.h16
-rw-r--r--src/quick/items/qquickgridview.cpp105
-rw-r--r--src/quick/items/qquickgridview_p.h26
-rw-r--r--src/quick/items/qquickimage.cpp26
-rw-r--r--src/quick/items/qquickimage_p.h30
-rw-r--r--src/quick/items/qquickimage_p_p.h14
-rw-r--r--src/quick/items/qquickimagebase.cpp56
-rw-r--r--src/quick/items/qquickimagebase_p.h23
-rw-r--r--src/quick/items/qquickimagebase_p_p.h20
-rw-r--r--src/quick/items/qquickimplicitsizeitem.cpp14
-rw-r--r--src/quick/items/qquickimplicitsizeitem_p.h14
-rw-r--r--src/quick/items/qquickimplicitsizeitem_p_p.h18
-rw-r--r--src/quick/items/qquickitem.cpp250
-rw-r--r--src/quick/items/qquickitem.h20
-rw-r--r--src/quick/items/qquickitem_p.h87
-rw-r--r--src/quick/items/qquickitemanimation.cpp30
-rw-r--r--src/quick/items/qquickitemanimation_p.h26
-rw-r--r--src/quick/items/qquickitemanimation_p_p.h14
-rw-r--r--src/quick/items/qquickitemchangelistener_p.h14
-rw-r--r--src/quick/items/qquickitemgrabresult.cpp12
-rw-r--r--src/quick/items/qquickitemgrabresult.h12
-rw-r--r--src/quick/items/qquickitemsmodule.cpp54
-rw-r--r--src/quick/items/qquickitemsmodule_p.h14
-rw-r--r--src/quick/items/qquickitemview.cpp22
-rw-r--r--src/quick/items/qquickitemview_p.h36
-rw-r--r--src/quick/items/qquickitemview_p_p.h20
-rw-r--r--src/quick/items/qquickitemviewtransition.cpp20
-rw-r--r--src/quick/items/qquickitemviewtransition_p.h14
-rw-r--r--src/quick/items/qquicklistview.cpp140
-rw-r--r--src/quick/items/qquicklistview_p.h26
-rw-r--r--src/quick/items/qquickloader.cpp35
-rw-r--r--src/quick/items/qquickloader_p.h18
-rw-r--r--src/quick/items/qquickloader_p_p.h28
-rw-r--r--src/quick/items/qquickmousearea.cpp51
-rw-r--r--src/quick/items/qquickmousearea_p.h19
-rw-r--r--src/quick/items/qquickmousearea_p_p.h15
-rw-r--r--src/quick/items/qquickmultipointtoucharea.cpp17
-rw-r--r--src/quick/items/qquickmultipointtoucharea_p.h36
-rw-r--r--src/quick/items/qquickopenglinfo.cpp14
-rw-r--r--src/quick/items/qquickopenglinfo_p.h14
-rw-r--r--src/quick/items/qquickpainteditem.cpp14
-rw-r--r--src/quick/items/qquickpainteditem.h16
-rw-r--r--src/quick/items/qquickpainteditem_p.h14
-rw-r--r--src/quick/items/qquickpathview.cpp51
-rw-r--r--src/quick/items/qquickpathview_p.h28
-rw-r--r--src/quick/items/qquickpathview_p_p.h16
-rw-r--r--src/quick/items/qquickpincharea.cpp279
-rw-r--r--src/quick/items/qquickpincharea_p.h35
-rw-r--r--src/quick/items/qquickpincharea_p_p.h14
-rw-r--r--src/quick/items/qquickpositioners.cpp15
-rw-r--r--src/quick/items/qquickpositioners_p.h36
-rw-r--r--src/quick/items/qquickpositioners_p_p.h24
-rw-r--r--src/quick/items/qquickrectangle.cpp14
-rw-r--r--src/quick/items/qquickrectangle_p.h16
-rw-r--r--src/quick/items/qquickrectangle_p_p.h14
-rw-r--r--src/quick/items/qquickrendercontrol.cpp35
-rw-r--r--src/quick/items/qquickrendercontrol.h16
-rw-r--r--src/quick/items/qquickrendercontrol_p.h14
-rw-r--r--src/quick/items/qquickrepeater.cpp110
-rw-r--r--src/quick/items/qquickrepeater_p.h18
-rw-r--r--src/quick/items/qquickrepeater_p_p.h18
-rw-r--r--src/quick/items/qquickscalegrid.cpp14
-rw-r--r--src/quick/items/qquickscalegrid_p_p.h14
-rw-r--r--src/quick/items/qquickscreen.cpp18
-rw-r--r--src/quick/items/qquickscreen_p.h14
-rw-r--r--src/quick/items/qquickshadereffect.cpp61
-rw-r--r--src/quick/items/qquickshadereffect_p.h24
-rw-r--r--src/quick/items/qquickshadereffectmesh.cpp16
-rw-r--r--src/quick/items/qquickshadereffectmesh_p.h18
-rw-r--r--src/quick/items/qquickshadereffectnode.cpp102
-rw-r--r--src/quick/items/qquickshadereffectnode_p.h28
-rw-r--r--src/quick/items/qquickshadereffectsource.cpp14
-rw-r--r--src/quick/items/qquickshadereffectsource_p.h26
-rw-r--r--src/quick/items/qquicksprite.cpp14
-rw-r--r--src/quick/items/qquicksprite_p.h16
-rw-r--r--src/quick/items/qquickspriteengine.cpp36
-rw-r--r--src/quick/items/qquickspriteengine_p.h18
-rw-r--r--src/quick/items/qquickspritesequence.cpp28
-rw-r--r--src/quick/items/qquickspritesequence_p.h16
-rw-r--r--src/quick/items/qquickstateoperations.cpp18
-rw-r--r--src/quick/items/qquickstateoperations_p.h60
-rw-r--r--src/quick/items/qquicktext.cpp198
-rw-r--r--src/quick/items/qquicktext_p.h44
-rw-r--r--src/quick/items/qquicktext_p_p.h26
-rw-r--r--src/quick/items/qquicktextcontrol.cpp30
-rw-r--r--src/quick/items/qquicktextcontrol_p.h18
-rw-r--r--src/quick/items/qquicktextcontrol_p_p.h14
-rw-r--r--src/quick/items/qquicktextdocument.cpp14
-rw-r--r--src/quick/items/qquicktextdocument.h14
-rw-r--r--src/quick/items/qquicktextedit.cpp74
-rw-r--r--src/quick/items/qquicktextedit_p.h68
-rw-r--r--src/quick/items/qquicktextedit_p_p.h18
-rw-r--r--src/quick/items/qquicktextinput.cpp105
-rw-r--r--src/quick/items/qquicktextinput_p.h70
-rw-r--r--src/quick/items/qquicktextinput_p_p.h26
-rw-r--r--src/quick/items/qquicktextnode.cpp15
-rw-r--r--src/quick/items/qquicktextnode_p.h14
-rw-r--r--src/quick/items/qquicktextnodeengine.cpp142
-rw-r--r--src/quick/items/qquicktextnodeengine_p.h34
-rw-r--r--src/quick/items/qquicktextutil.cpp14
-rw-r--r--src/quick/items/qquicktextutil_p.h14
-rw-r--r--src/quick/items/qquicktranslate.cpp16
-rw-r--r--src/quick/items/qquicktranslate_p.h22
-rw-r--r--src/quick/items/qquickview.cpp26
-rw-r--r--src/quick/items/qquickview.h30
-rw-r--r--src/quick/items/qquickview_p.h54
-rw-r--r--src/quick/items/qquickwindow.cpp507
-rw-r--r--src/quick/items/qquickwindow.h47
-rw-r--r--src/quick/items/qquickwindow_p.h32
-rw-r--r--src/quick/items/qquickwindowattached.cpp32
-rw-r--r--src/quick/items/qquickwindowattached_p.h20
-rw-r--r--src/quick/items/qquickwindowmodule.cpp225
-rw-r--r--src/quick/items/qquickwindowmodule_p.h50
-rw-r--r--src/quick/qtquick2.cpp14
-rw-r--r--src/quick/qtquick2_p.h14
-rw-r--r--src/quick/qtquickglobal.h14
-rw-r--r--src/quick/qtquickglobal_p.h14
-rw-r--r--src/quick/scenegraph/coreapi/qsgabstractrenderer.cpp14
-rw-r--r--src/quick/scenegraph/coreapi/qsgabstractrenderer.h14
-rw-r--r--src/quick/scenegraph/coreapi/qsgabstractrenderer_p.h14
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp230
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h170
-rw-r--r--src/quick/scenegraph/coreapi/qsggeometry.cpp14
-rw-r--r--src/quick/scenegraph/coreapi/qsggeometry.h14
-rw-r--r--src/quick/scenegraph/coreapi/qsggeometry_p.h14
-rw-r--r--src/quick/scenegraph/coreapi/qsgmaterial.cpp15
-rw-r--r--src/quick/scenegraph/coreapi/qsgmaterial.h14
-rw-r--r--src/quick/scenegraph/coreapi/qsgmaterialshader_p.h12
-rw-r--r--src/quick/scenegraph/coreapi/qsgnode.cpp49
-rw-r--r--src/quick/scenegraph/coreapi/qsgnode.h15
-rw-r--r--src/quick/scenegraph/coreapi/qsgnode_p.h12
-rw-r--r--src/quick/scenegraph/coreapi/qsgnodeupdater.cpp14
-rw-r--r--src/quick/scenegraph/coreapi/qsgnodeupdater_p.h14
-rw-r--r--src/quick/scenegraph/coreapi/qsgrenderer.cpp33
-rw-r--r--src/quick/scenegraph/coreapi/qsgrenderer_p.h14
-rw-r--r--src/quick/scenegraph/coreapi/qsgrendernode.cpp14
-rw-r--r--src/quick/scenegraph/coreapi/qsgrendernode_p.h14
-rw-r--r--src/quick/scenegraph/coreapi/qsgshaderrewriter.cpp14
-rw-r--r--src/quick/scenegraph/qsgadaptationlayer.cpp41
-rw-r--r--src/quick/scenegraph/qsgadaptationlayer_p.h15
-rw-r--r--src/quick/scenegraph/qsgcontext.cpp39
-rw-r--r--src/quick/scenegraph/qsgcontext_p.h16
-rw-r--r--src/quick/scenegraph/qsgcontextplugin.cpp14
-rw-r--r--src/quick/scenegraph/qsgcontextplugin_p.h14
-rw-r--r--src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp33
-rw-r--r--src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h25
-rw-r--r--src/quick/scenegraph/qsgdefaultglyphnode.cpp14
-rw-r--r--src/quick/scenegraph/qsgdefaultglyphnode_p.cpp73
-rw-r--r--src/quick/scenegraph/qsgdefaultglyphnode_p.h14
-rw-r--r--src/quick/scenegraph/qsgdefaultglyphnode_p_p.h14
-rw-r--r--src/quick/scenegraph/qsgdefaultimagenode.cpp14
-rw-r--r--src/quick/scenegraph/qsgdefaultimagenode_p.h14
-rw-r--r--src/quick/scenegraph/qsgdefaultlayer.cpp38
-rw-r--r--src/quick/scenegraph/qsgdefaultlayer_p.h72
-rw-r--r--src/quick/scenegraph/qsgdefaultrectanglenode.cpp22
-rw-r--r--src/quick/scenegraph/qsgdefaultrectanglenode_p.h14
-rw-r--r--src/quick/scenegraph/qsgdistancefieldglyphnode.cpp14
-rw-r--r--src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp14
-rw-r--r--src/quick/scenegraph/qsgdistancefieldglyphnode_p.h14
-rw-r--r--src/quick/scenegraph/qsgdistancefieldglyphnode_p_p.h14
-rw-r--r--src/quick/scenegraph/qsgrenderloop.cpp52
-rw-r--r--src/quick/scenegraph/qsgrenderloop_p.h15
-rw-r--r--src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp24
-rw-r--r--src/quick/scenegraph/qsgshareddistancefieldglyphcache_p.h14
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp147
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop_p.h19
-rw-r--r--src/quick/scenegraph/qsgwindowsrenderloop.cpp83
-rw-r--r--src/quick/scenegraph/qsgwindowsrenderloop_p.h14
-rw-r--r--src/quick/scenegraph/scenegraph.qrc2
-rw-r--r--src/quick/scenegraph/shaders/32bitcolortext.frag9
-rw-r--r--src/quick/scenegraph/shaders/32bitcolortext_core.frag13
-rw-r--r--src/quick/scenegraph/shaders/smoothtexture.vert5
-rw-r--r--src/quick/scenegraph/shaders/smoothtexture_core.vert7
-rw-r--r--src/quick/scenegraph/shaders/visualization.frag4
-rw-r--r--src/quick/scenegraph/shaders/visualization.vert6
-rw-r--r--src/quick/scenegraph/util/qsgareaallocator.cpp14
-rw-r--r--src/quick/scenegraph/util/qsgareaallocator_p.h14
-rw-r--r--src/quick/scenegraph/util/qsgatlastexture.cpp111
-rw-r--r--src/quick/scenegraph/util/qsgatlastexture_p.h26
-rw-r--r--src/quick/scenegraph/util/qsgdefaultpainternode.cpp14
-rw-r--r--src/quick/scenegraph/util/qsgdefaultpainternode_p.h14
-rw-r--r--src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp16
-rw-r--r--src/quick/scenegraph/util/qsgdepthstencilbuffer_p.h14
-rw-r--r--src/quick/scenegraph/util/qsgdistancefieldutil.cpp14
-rw-r--r--src/quick/scenegraph/util/qsgdistancefieldutil_p.h14
-rw-r--r--src/quick/scenegraph/util/qsgengine.cpp14
-rw-r--r--src/quick/scenegraph/util/qsgengine.h14
-rw-r--r--src/quick/scenegraph/util/qsgengine_p.h16
-rw-r--r--src/quick/scenegraph/util/qsgflatcolormaterial.cpp14
-rw-r--r--src/quick/scenegraph/util/qsgflatcolormaterial.h14
-rw-r--r--src/quick/scenegraph/util/qsgshadersourcebuilder.cpp12
-rw-r--r--src/quick/scenegraph/util/qsgshadersourcebuilder_p.h12
-rw-r--r--src/quick/scenegraph/util/qsgsimplematerial.cpp14
-rw-r--r--src/quick/scenegraph/util/qsgsimplematerial.h14
-rw-r--r--src/quick/scenegraph/util/qsgsimplerectnode.cpp15
-rw-r--r--src/quick/scenegraph/util/qsgsimplerectnode.h14
-rw-r--r--src/quick/scenegraph/util/qsgsimpletexturenode.cpp77
-rw-r--r--src/quick/scenegraph/util/qsgsimpletexturenode.h18
-rw-r--r--src/quick/scenegraph/util/qsgtexture.cpp35
-rw-r--r--src/quick/scenegraph/util/qsgtexture.h14
-rw-r--r--src/quick/scenegraph/util/qsgtexture_p.h14
-rw-r--r--src/quick/scenegraph/util/qsgtexturematerial.cpp14
-rw-r--r--src/quick/scenegraph/util/qsgtexturematerial.h14
-rw-r--r--src/quick/scenegraph/util/qsgtexturematerial_p.h14
-rw-r--r--src/quick/scenegraph/util/qsgtextureprovider.cpp15
-rw-r--r--src/quick/scenegraph/util/qsgtextureprovider.h14
-rw-r--r--src/quick/scenegraph/util/qsgvertexcolormaterial.cpp23
-rw-r--r--src/quick/scenegraph/util/qsgvertexcolormaterial.h14
-rw-r--r--src/quick/util/qquickanimation.cpp23
-rw-r--r--src/quick/util/qquickanimation_p.h14
-rw-r--r--src/quick/util/qquickanimation_p_p.h16
-rw-r--r--src/quick/util/qquickanimationcontroller.cpp14
-rw-r--r--src/quick/util/qquickanimationcontroller_p.h14
-rw-r--r--src/quick/util/qquickanimator.cpp20
-rw-r--r--src/quick/util/qquickanimator_p.h14
-rw-r--r--src/quick/util/qquickanimator_p_p.h14
-rw-r--r--src/quick/util/qquickanimatorcontroller.cpp14
-rw-r--r--src/quick/util/qquickanimatorcontroller_p.h14
-rw-r--r--src/quick/util/qquickanimatorjob.cpp59
-rw-r--r--src/quick/util/qquickanimatorjob_p.h20
-rw-r--r--src/quick/util/qquickapplication.cpp14
-rw-r--r--src/quick/util/qquickapplication_p.h14
-rw-r--r--src/quick/util/qquickbehavior.cpp14
-rw-r--r--src/quick/util/qquickbehavior_p.h14
-rw-r--r--src/quick/util/qquickfontloader.cpp14
-rw-r--r--src/quick/util/qquickfontloader_p.h14
-rw-r--r--src/quick/util/qquickfontmetrics.cpp14
-rw-r--r--src/quick/util/qquickfontmetrics_p.h14
-rw-r--r--src/quick/util/qquickglobal.cpp99
-rw-r--r--src/quick/util/qquickimageprovider.cpp14
-rw-r--r--src/quick/util/qquickimageprovider.h20
-rw-r--r--src/quick/util/qquickpath.cpp14
-rw-r--r--src/quick/util/qquickpath_p.h16
-rw-r--r--src/quick/util/qquickpath_p_p.h14
-rw-r--r--src/quick/util/qquickpathinterpolator.cpp14
-rw-r--r--src/quick/util/qquickpathinterpolator_p.h14
-rw-r--r--src/quick/util/qquickpixmapcache.cpp169
-rw-r--r--src/quick/util/qquickpixmapcache_p.h27
-rw-r--r--src/quick/util/qquickprofiler.cpp16
-rw-r--r--src/quick/util/qquickprofiler_p.h140
-rw-r--r--src/quick/util/qquickpropertychanges.cpp18
-rw-r--r--src/quick/util/qquickpropertychanges_p.h14
-rw-r--r--src/quick/util/qquickshortcut.cpp283
-rw-r--r--src/quick/util/qquickshortcut_p.h109
-rw-r--r--src/quick/util/qquicksmoothedanimation.cpp28
-rw-r--r--src/quick/util/qquicksmoothedanimation_p.h14
-rw-r--r--src/quick/util/qquicksmoothedanimation_p_p.h14
-rw-r--r--src/quick/util/qquickspringanimation.cpp37
-rw-r--r--src/quick/util/qquickspringanimation_p.h14
-rw-r--r--src/quick/util/qquickstate.cpp19
-rw-r--r--src/quick/util/qquickstate_p.h14
-rw-r--r--src/quick/util/qquickstate_p_p.h14
-rw-r--r--src/quick/util/qquickstatechangescript.cpp14
-rw-r--r--src/quick/util/qquickstatechangescript_p.h14
-rw-r--r--src/quick/util/qquickstategroup.cpp14
-rw-r--r--src/quick/util/qquickstategroup_p.h14
-rw-r--r--src/quick/util/qquickstyledtext.cpp20
-rw-r--r--src/quick/util/qquickstyledtext_p.h14
-rw-r--r--src/quick/util/qquicksvgparser.cpp22
-rw-r--r--src/quick/util/qquicksvgparser_p.h14
-rw-r--r--src/quick/util/qquicksystempalette.cpp14
-rw-r--r--src/quick/util/qquicksystempalette_p.h14
-rw-r--r--src/quick/util/qquicktextmetrics.cpp14
-rw-r--r--src/quick/util/qquicktextmetrics_p.h14
-rw-r--r--src/quick/util/qquicktimeline.cpp24
-rw-r--r--src/quick/util/qquicktimeline_p_p.h14
-rw-r--r--src/quick/util/qquicktransition.cpp14
-rw-r--r--src/quick/util/qquicktransition_p.h14
-rw-r--r--src/quick/util/qquicktransitionmanager.cpp14
-rw-r--r--src/quick/util/qquicktransitionmanager_p_p.h14
-rw-r--r--src/quick/util/qquickutilmodule.cpp17
-rw-r--r--src/quick/util/qquickutilmodule_p.h14
-rw-r--r--src/quick/util/qquickvaluetypes.cpp125
-rw-r--r--src/quick/util/qquickvaluetypes_p.h102
-rw-r--r--src/quick/util/util.pri6
-rw-r--r--src/quickwidgets/qquickwidget.cpp159
-rw-r--r--src/quickwidgets/qquickwidget.h24
-rw-r--r--src/quickwidgets/qquickwidget_p.h15
-rw-r--r--src/quickwidgets/qtquickwidgetsglobal.h14
1227 files changed, 28608 insertions, 24475 deletions
diff --git a/src/3rdparty/masm/WeakRandom.h b/src/3rdparty/masm/WeakRandom.h
index 1c79a92fe6..bf5d20e360 100644
--- a/src/3rdparty/masm/WeakRandom.h
+++ b/src/3rdparty/masm/WeakRandom.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/3rdparty/masm/assembler/ARMAssembler.h b/src/3rdparty/masm/assembler/ARMAssembler.h
index 3888226b21..16cc25d4db 100644
--- a/src/3rdparty/masm/assembler/ARMAssembler.h
+++ b/src/3rdparty/masm/assembler/ARMAssembler.h
@@ -41,10 +41,10 @@ namespace JSC {
r0 = 0,
r1,
r2,
- r3, S0 = r3, /* Same as thumb assembler. */
+ r3,
r4,
r5,
- r6,
+ r6, S0 = r6,
r7,
r8,
r9,
diff --git a/src/3rdparty/masm/assembler/MacroAssemblerARMv7.h b/src/3rdparty/masm/assembler/MacroAssemblerARMv7.h
index 15e427bbff..85cd6c27b9 100644
--- a/src/3rdparty/masm/assembler/MacroAssemblerARMv7.h
+++ b/src/3rdparty/masm/assembler/MacroAssemblerARMv7.h
@@ -40,7 +40,7 @@ protected: // the YarrJIT needs know about addressTempRegister in order to push
// - dTR is likely used more than aTR, and we'll get better instruction
// encoding if it's in the low 8 registers.
static const RegisterID dataTempRegister = ARMRegisters::ip;
- static const RegisterID addressTempRegister = ARMRegisters::r10;
+ static const RegisterID addressTempRegister = ARMRegisters::r6;
static const ARMRegisters::FPDoubleRegisterID fpTempRegister = ARMRegisters::d7;
inline ARMRegisters::FPSingleRegisterID fpTempRegisterAsSingle() { return ARMRegisters::asSingle(fpTempRegister); }
diff --git a/src/3rdparty/masm/assembler/MacroAssemblerMIPS.h b/src/3rdparty/masm/assembler/MacroAssemblerMIPS.h
index c2e61ae404..03f8e2d71a 100644
--- a/src/3rdparty/masm/assembler/MacroAssemblerMIPS.h
+++ b/src/3rdparty/masm/assembler/MacroAssemblerMIPS.h
@@ -767,7 +767,53 @@ public:
void load16Unaligned(BaseIndex address, RegisterID dest)
{
- load16(address, dest);
+ if (address.offset >= -32768 && address.offset <= 32766 && !m_fixedWidth) {
+ /*
+ sll addrtemp, address.index, address.scale
+ addu addrtemp, addrtemp, address.base
+ lbu immTemp, address.offset+x(addrtemp) (x=0 for LE, x=1 for BE)
+ lbu dest, address.offset+x(addrtemp) (x=1 for LE, x=0 for BE)
+ sll dest, dest, 8
+ or dest, dest, immTemp
+ */
+ m_assembler.sll(addrTempRegister, address.index, address.scale);
+ m_assembler.addu(addrTempRegister, addrTempRegister, address.base);
+#if CPU(BIG_ENDIAN)
+ m_assembler.lbu(immTempRegister, addrTempRegister, address.offset + 1);
+ m_assembler.lbu(dest, addrTempRegister, address.offset);
+#else
+ m_assembler.lbu(immTempRegister, addrTempRegister, address.offset);
+ m_assembler.lbu(dest, addrTempRegister, address.offset + 1);
+#endif
+ m_assembler.sll(dest, dest, 8);
+ m_assembler.orInsn(dest, dest, immTempRegister);
+ } else {
+ /*
+ sll addrTemp, address.index, address.scale
+ addu addrTemp, addrTemp, address.base
+ lui immTemp, address.offset >> 16
+ ori immTemp, immTemp, address.offset & 0xffff
+ addu addrTemp, addrTemp, immTemp
+ lbu immTemp, x(addrtemp) (x=0 for LE, x=1 for BE)
+ lbu dest, x(addrtemp) (x=1 for LE, x=0 for BE)
+ sll dest, dest, 8
+ or dest, dest, immTemp
+ */
+ m_assembler.sll(addrTempRegister, address.index, address.scale);
+ m_assembler.addu(addrTempRegister, addrTempRegister, address.base);
+ m_assembler.lui(immTempRegister, address.offset >> 16);
+ m_assembler.ori(immTempRegister, immTempRegister, address.offset);
+ m_assembler.addu(addrTempRegister, addrTempRegister, immTempRegister);
+#if CPU(BIG_ENDIAN)
+ m_assembler.lbu(immTempRegister, addrTempRegister, 1);
+ m_assembler.lbu(dest, addrTempRegister, 0);
+#else
+ m_assembler.lbu(immTempRegister, addrTempRegister, 0);
+ m_assembler.lbu(dest, addrTempRegister, 1);
+#endif
+ m_assembler.sll(dest, dest, 8);
+ m_assembler.orInsn(dest, dest, immTempRegister);
+ }
}
void load32WithUnalignedHalfWords(BaseIndex address, RegisterID dest)
diff --git a/src/3rdparty/masm/config.h b/src/3rdparty/masm/config.h
index 05b32f5ac6..224b7d09e2 100644
--- a/src/3rdparty/masm/config.h
+++ b/src/3rdparty/masm/config.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/3rdparty/masm/stubs/ExecutableAllocator.h b/src/3rdparty/masm/stubs/ExecutableAllocator.h
index d83681b37b..5f7d5678ab 100644
--- a/src/3rdparty/masm/stubs/ExecutableAllocator.h
+++ b/src/3rdparty/masm/stubs/ExecutableAllocator.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -114,6 +114,9 @@ struct ExecutableAllocator {
#if !OS(WINRT)
DWORD oldProtect;
VirtualProtect(reinterpret_cast<void*>(roundAddr), size + (iaddr - roundAddr), PAGE_EXECUTE_READWRITE, &oldProtect);
+#else
+ (void)size; // suppress unused parameter warning
+ (void)roundAddr; // suppress unused parameter warning
#endif
#else
int mode = PROT_READ | PROT_EXEC;
diff --git a/src/3rdparty/masm/stubs/JSGlobalData.h b/src/3rdparty/masm/stubs/JSGlobalData.h
index d9bfe73971..cac2aa6b6a 100644
--- a/src/3rdparty/masm/stubs/JSGlobalData.h
+++ b/src/3rdparty/masm/stubs/JSGlobalData.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/3rdparty/masm/stubs/Options.cpp b/src/3rdparty/masm/stubs/Options.cpp
index 704d1c8bba..3b13e32218 100644
--- a/src/3rdparty/masm/stubs/Options.cpp
+++ b/src/3rdparty/masm/stubs/Options.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/3rdparty/masm/stubs/Options.h b/src/3rdparty/masm/stubs/Options.h
index 1942be7270..b0590f1a77 100644
--- a/src/3rdparty/masm/stubs/Options.h
+++ b/src/3rdparty/masm/stubs/Options.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/3rdparty/masm/stubs/WTFStubs.cpp b/src/3rdparty/masm/stubs/WTFStubs.cpp
index 7e6ba9b81d..828712b29a 100644
--- a/src/3rdparty/masm/stubs/WTFStubs.cpp
+++ b/src/3rdparty/masm/stubs/WTFStubs.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -60,9 +60,9 @@ uint32_t cryptographicallyRandomNumber()
return 0;
}
-static PrintStream* s_dataFile;
+static FilePrintStream* s_dataFile;
-void setDataFile(PrintStream *ps)
+void setDataFile(FilePrintStream *ps)
{
delete s_dataFile;
s_dataFile = ps;
@@ -74,7 +74,7 @@ void setDataFile(FILE* f)
s_dataFile = new FilePrintStream(f, FilePrintStream::Borrow);
}
-PrintStream& dataFile()
+FilePrintStream& dataFile()
{
if (!s_dataFile)
s_dataFile = new FilePrintStream(stderr, FilePrintStream::Borrow);
diff --git a/src/3rdparty/masm/stubs/WTFStubs.h b/src/3rdparty/masm/stubs/WTFStubs.h
index 397aed5f16..3b6acc7224 100644
--- a/src/3rdparty/masm/stubs/WTFStubs.h
+++ b/src/3rdparty/masm/stubs/WTFStubs.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -36,7 +36,7 @@
namespace WTF {
void setDataFile(FILE* f);
-void setDataFile(class PrintStream *);
+void setDataFile(class FilePrintStream *);
}
diff --git a/src/3rdparty/masm/stubs/compat/stdint.h b/src/3rdparty/masm/stubs/compat/stdint.h
index 46d083e911..94a80b7839 100644
--- a/src/3rdparty/masm/stubs/compat/stdint.h
+++ b/src/3rdparty/masm/stubs/compat/stdint.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/3rdparty/masm/stubs/wtf/FastAllocBase.h b/src/3rdparty/masm/stubs/wtf/FastAllocBase.h
index 5b314518e9..49fc89ce26 100644
--- a/src/3rdparty/masm/stubs/wtf/FastAllocBase.h
+++ b/src/3rdparty/masm/stubs/wtf/FastAllocBase.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/3rdparty/masm/stubs/wtf/FastMalloc.h b/src/3rdparty/masm/stubs/wtf/FastMalloc.h
index d2a449ea89..c4b0d4ebcc 100644
--- a/src/3rdparty/masm/stubs/wtf/FastMalloc.h
+++ b/src/3rdparty/masm/stubs/wtf/FastMalloc.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/3rdparty/masm/stubs/wtf/Noncopyable.h b/src/3rdparty/masm/stubs/wtf/Noncopyable.h
index ac2db1136b..658375c3f5 100644
--- a/src/3rdparty/masm/stubs/wtf/Noncopyable.h
+++ b/src/3rdparty/masm/stubs/wtf/Noncopyable.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/3rdparty/masm/stubs/wtf/OwnPtr.h b/src/3rdparty/masm/stubs/wtf/OwnPtr.h
index ca09385f02..7c99077d18 100644
--- a/src/3rdparty/masm/stubs/wtf/OwnPtr.h
+++ b/src/3rdparty/masm/stubs/wtf/OwnPtr.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/3rdparty/masm/stubs/wtf/PassOwnPtr.h b/src/3rdparty/masm/stubs/wtf/PassOwnPtr.h
index fc1efafeaf..aabd05060c 100644
--- a/src/3rdparty/masm/stubs/wtf/PassOwnPtr.h
+++ b/src/3rdparty/masm/stubs/wtf/PassOwnPtr.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/3rdparty/masm/stubs/wtf/PassRefPtr.h b/src/3rdparty/masm/stubs/wtf/PassRefPtr.h
index 6197c56922..5353b1680c 100644
--- a/src/3rdparty/masm/stubs/wtf/PassRefPtr.h
+++ b/src/3rdparty/masm/stubs/wtf/PassRefPtr.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/3rdparty/masm/stubs/wtf/RefCounted.h b/src/3rdparty/masm/stubs/wtf/RefCounted.h
index 08c5c2a22b..2624c4218a 100644
--- a/src/3rdparty/masm/stubs/wtf/RefCounted.h
+++ b/src/3rdparty/masm/stubs/wtf/RefCounted.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/3rdparty/masm/stubs/wtf/RefPtr.h b/src/3rdparty/masm/stubs/wtf/RefPtr.h
index 63ae9ceda4..7e63511bca 100644
--- a/src/3rdparty/masm/stubs/wtf/RefPtr.h
+++ b/src/3rdparty/masm/stubs/wtf/RefPtr.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/3rdparty/masm/stubs/wtf/TypeTraits.h b/src/3rdparty/masm/stubs/wtf/TypeTraits.h
index f1d7ea7cff..406fdcb3e3 100644
--- a/src/3rdparty/masm/stubs/wtf/TypeTraits.h
+++ b/src/3rdparty/masm/stubs/wtf/TypeTraits.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/3rdparty/masm/stubs/wtf/UnusedParam.h b/src/3rdparty/masm/stubs/wtf/UnusedParam.h
index 47ed6ed4d0..da4b8e0cc7 100644
--- a/src/3rdparty/masm/stubs/wtf/UnusedParam.h
+++ b/src/3rdparty/masm/stubs/wtf/UnusedParam.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/3rdparty/masm/stubs/wtf/Vector.h b/src/3rdparty/masm/stubs/wtf/Vector.h
index 2aea829ef0..22922ff27c 100644
--- a/src/3rdparty/masm/stubs/wtf/Vector.h
+++ b/src/3rdparty/masm/stubs/wtf/Vector.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/3rdparty/masm/stubs/wtf/text/CString.h b/src/3rdparty/masm/stubs/wtf/text/CString.h
index 20b14d7795..cfbfd27c6d 100644
--- a/src/3rdparty/masm/stubs/wtf/text/CString.h
+++ b/src/3rdparty/masm/stubs/wtf/text/CString.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/3rdparty/masm/stubs/wtf/text/WTFString.h b/src/3rdparty/masm/stubs/wtf/text/WTFString.h
index 6c33a261f7..17bd466951 100644
--- a/src/3rdparty/masm/stubs/wtf/text/WTFString.h
+++ b/src/3rdparty/masm/stubs/wtf/text/WTFString.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/3rdparty/masm/stubs/wtf/unicode/Unicode.h b/src/3rdparty/masm/stubs/wtf/unicode/Unicode.h
index 46c3278706..ce25561f52 100644
--- a/src/3rdparty/masm/stubs/wtf/unicode/Unicode.h
+++ b/src/3rdparty/masm/stubs/wtf/unicode/Unicode.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/3rdparty/masm/wtf/DataLog.h b/src/3rdparty/masm/wtf/DataLog.h
index 2b3df09970..0bd8efe727 100644
--- a/src/3rdparty/masm/wtf/DataLog.h
+++ b/src/3rdparty/masm/wtf/DataLog.h
@@ -34,7 +34,7 @@
namespace WTF {
-WTF_EXPORT_PRIVATE PrintStream &dataFile();
+WTF_EXPORT_PRIVATE FilePrintStream& dataFile();
WTF_EXPORT_PRIVATE void dataLogFV(const char* format, va_list) WTF_ATTRIBUTE_PRINTF(1, 0);
WTF_EXPORT_PRIVATE void dataLogF(const char* format, ...) WTF_ATTRIBUTE_PRINTF(1, 2);
diff --git a/src/3rdparty/masm/wtf/OSAllocator.h b/src/3rdparty/masm/wtf/OSAllocator.h
index a12a467497..494f8bc3c7 100644
--- a/src/3rdparty/masm/wtf/OSAllocator.h
+++ b/src/3rdparty/masm/wtf/OSAllocator.h
@@ -45,7 +45,7 @@ public:
// These methods are symmetric; reserveUncommitted allocates VM in an uncommitted state,
// releaseDecommitted should be called on a region of VM allocated by a single reservation,
// the memory must all currently be in a decommitted state.
- static void* reserveUncommitted(size_t, Usage = UnknownUsage, bool writable = true, bool executable = false, bool includesGuardPages = false);
+ static void* reserveUncommitted(size_t, Usage = UnknownUsage, bool writable = true, bool executable = false);
WTF_EXPORT_PRIVATE static void releaseDecommitted(void*, size_t);
// These methods are symmetric; they commit or decommit a region of VM (uncommitted VM should
diff --git a/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp b/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp
index d8c8e0378f..f52c22f7fa 100644
--- a/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp
+++ b/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp
@@ -38,7 +38,7 @@
namespace WTF {
-void* OSAllocator::reserveUncommitted(size_t bytes, Usage usage, bool writable, bool executable, bool includesGuardPages)
+void* OSAllocator::reserveUncommitted(size_t bytes, Usage usage, bool writable, bool executable)
{
#if OS(QNX)
// Reserve memory with PROT_NONE and MAP_LAZY so it isn't committed now.
@@ -49,14 +49,13 @@ void* OSAllocator::reserveUncommitted(size_t bytes, Usage usage, bool writable,
UNUSED_PARAM(usage);
UNUSED_PARAM(writable);
UNUSED_PARAM(executable);
- UNUSED_PARAM(includesGuardPages);
void* result = mmap(0, bytes, PROT_NONE, MAP_NORESERVE | MAP_PRIVATE | MAP_ANON, -1, 0);
if (result == MAP_FAILED)
CRASH();
madvise(result, bytes, MADV_DONTNEED);
#else
- void* result = reserveAndCommit(bytes, usage, writable, executable, includesGuardPages);
+ void* result = reserveAndCommit(bytes, usage, writable, executable);
#if HAVE(MADV_FREE_REUSE)
// To support the "reserve then commit" model, we have to initially decommit.
while (madvise(result, bytes, MADV_FREE_REUSABLE) == -1 && errno == EAGAIN) { }
diff --git a/src/3rdparty/masm/wtf/OSAllocatorWin.cpp b/src/3rdparty/masm/wtf/OSAllocatorWin.cpp
index f95a4841c6..259fc67324 100644
--- a/src/3rdparty/masm/wtf/OSAllocatorWin.cpp
+++ b/src/3rdparty/masm/wtf/OSAllocatorWin.cpp
@@ -25,6 +25,7 @@
#include "config.h"
#include "OSAllocator.h"
+#include "PageBlock.h"
#if OS(WINDOWS)
@@ -40,7 +41,7 @@ static inline DWORD protection(bool writable, bool executable)
(writable ? PAGE_READWRITE : PAGE_READONLY);
}
-void* OSAllocator::reserveUncommitted(size_t bytes, Usage, bool writable, bool executable, bool)
+void* OSAllocator::reserveUncommitted(size_t bytes, Usage, bool writable, bool executable)
{
void* result = VirtualAlloc(0, bytes, MEM_RESERVE, protection(writable, executable));
if (!result)
@@ -48,11 +49,20 @@ void* OSAllocator::reserveUncommitted(size_t bytes, Usage, bool writable, bool e
return result;
}
-void* OSAllocator::reserveAndCommit(size_t bytes, Usage, bool writable, bool executable, bool)
+void* OSAllocator::reserveAndCommit(size_t bytes, Usage, bool writable, bool executable,
+ bool includesGuardPages)
{
void* result = VirtualAlloc(0, bytes, MEM_RESERVE | MEM_COMMIT, protection(writable, executable));
if (!result)
CRASH();
+ if (includesGuardPages) {
+ size_t guardSize = pageSize();
+ DWORD oldProtect;
+ if (!VirtualProtect(result, guardSize, protection(false, false), &oldProtect) ||
+ !VirtualProtect(static_cast<char*>(result) + bytes - guardSize, guardSize,
+ protection(false, false), &oldProtect))
+ CRASH();
+ }
return result;
}
diff --git a/src/3rdparty/masm/wtf/OSAllocatorWinRT.cpp b/src/3rdparty/masm/wtf/OSAllocatorWinRT.cpp
index 7ed9f539e5..d684367ec6 100644
--- a/src/3rdparty/masm/wtf/OSAllocatorWinRT.cpp
+++ b/src/3rdparty/masm/wtf/OSAllocatorWinRT.cpp
@@ -33,9 +33,17 @@
namespace WTF {
-void* OSAllocator::reserveUncommitted(size_t bytes, Usage, bool, bool, bool)
+inline size_t getPageSize()
{
- void* result = _aligned_malloc(bytes, 16);
+ SYSTEM_INFO info;
+ GetNativeSystemInfo(&info);
+ return info.dwPageSize;
+}
+
+void* OSAllocator::reserveUncommitted(size_t bytes, Usage, bool, bool)
+{
+ static const size_t pageSize = getPageSize();
+ void* result = _aligned_malloc(bytes, pageSize);
if (!result)
CRASH();
memset(result, 0, bytes);
@@ -47,7 +55,7 @@ void* OSAllocator::reserveAndCommit(size_t bytes, Usage usage, bool writable, bo
return reserveUncommitted(bytes, usage, writable, executable);
}
-void OSAllocator::commit(void* address, size_t bytes, bool writable, bool executable)
+void OSAllocator::commit(void*, size_t, bool, bool)
{
CRASH(); // Unimplemented
}
diff --git a/src/3rdparty/masm/wtf/PageAllocation.h b/src/3rdparty/masm/wtf/PageAllocation.h
index 18d31880c0..db4e230e03 100644
--- a/src/3rdparty/masm/wtf/PageAllocation.h
+++ b/src/3rdparty/masm/wtf/PageAllocation.h
@@ -86,11 +86,17 @@ public:
// control warning when a client tries to use operator bool exposed above via "using PageBlock::operator bool".
operator bool() const { return PageBlock::operator bool(); }
#endif
+ bool operator<(const PageAllocation &b) { return base() < b.base(); }
- static PageAllocation allocate(size_t size, OSAllocator::Usage usage = OSAllocator::UnknownUsage, bool writable = true, bool executable = false)
+ static PageAllocation allocate(size_t size,
+ OSAllocator::Usage usage = OSAllocator::UnknownUsage,
+ bool writable = true, bool executable = false,
+ bool includesGuardPages = false)
{
ASSERT(isPageAligned(size));
- return PageAllocation(OSAllocator::reserveAndCommit(size, usage, writable, executable), size);
+ return PageAllocation(OSAllocator::reserveAndCommit(size, usage, writable, executable,
+ includesGuardPages), size,
+ includesGuardPages);
}
void deallocate()
@@ -103,12 +109,12 @@ public:
ASSERT(tmp);
ASSERT(!*this);
- OSAllocator::decommitAndRelease(tmp.base(), tmp.size());
+ OSAllocator::decommitAndRelease(tmp.realBase(), tmp.realSize());
}
private:
- PageAllocation(void* base, size_t size)
- : PageBlock(base, size, false)
+ PageAllocation(void* base, size_t size, bool includesGuardPages = false)
+ : PageBlock(base, size, includesGuardPages)
{
}
};
diff --git a/src/3rdparty/masm/wtf/PageAllocationAligned.cpp b/src/3rdparty/masm/wtf/PageAllocationAligned.cpp
index bdb976b1b7..90c2fd61db 100644
--- a/src/3rdparty/masm/wtf/PageAllocationAligned.cpp
+++ b/src/3rdparty/masm/wtf/PageAllocationAligned.cpp
@@ -52,7 +52,7 @@ PageAllocationAligned PageAllocationAligned::allocate(size_t size, size_t alignm
// Resererve with suffcient additional VM to correctly align.
size_t reservationSize = size + alignmentDelta;
- void* reservationBase = OSAllocator::reserveUncommitted(reservationSize, usage, writable, false);
+ void* reservationBase = OSAllocator::reserveUncommitted(reservationSize, usage, writable);
// Select an aligned region within the reservation and commit.
void* alignedBase = reinterpret_cast<uintptr_t>(reservationBase) & alignmentMask
@@ -75,10 +75,11 @@ void PageAllocationAligned::deallocate()
ASSERT(!*this);
#if OS(DARWIN)
- vm_deallocate(current_task(), reinterpret_cast<vm_address_t>(tmp.base()), tmp.size());
+ vm_deallocate(current_task(), reinterpret_cast<vm_address_t>(tmp.realBase()), tmp.realSize());
#else
- ASSERT(tmp.m_reservation.contains(tmp.base(), tmp.size()));
- OSAllocator::decommitAndRelease(tmp.m_reservation.base(), tmp.m_reservation.size(), tmp.base(), tmp.size());
+ ASSERT(tmp.m_reservation.contains(tmp.realBase(), tmp.realSize()));
+ OSAllocator::decommitAndRelease(tmp.m_reservation.realBase(), tmp.m_reservation.realSize(),
+ tmp.realBase(), tmp.realSize());
#endif
}
diff --git a/src/3rdparty/masm/wtf/PageBlock.h b/src/3rdparty/masm/wtf/PageBlock.h
index 56e5570178..4d408e1c91 100644
--- a/src/3rdparty/masm/wtf/PageBlock.h
+++ b/src/3rdparty/masm/wtf/PageBlock.h
@@ -40,8 +40,13 @@ public:
PageBlock(const PageBlock&);
PageBlock(void*, size_t, bool hasGuardPages);
+ void* realBase() const { return m_realBase; }
void* base() const { return m_base; }
- size_t size() const { return m_size; }
+ size_t size() const
+ {
+ return m_size - 2 * (static_cast<char *>(m_base) - static_cast<char *>(m_realBase));
+ }
+ size_t realSize() const { return m_size; }
operator bool() const { return !!m_realBase; }
diff --git a/src/3rdparty/masm/wtf/PageReservation.h b/src/3rdparty/masm/wtf/PageReservation.h
index 77783ebcc4..74a136168c 100644
--- a/src/3rdparty/masm/wtf/PageReservation.h
+++ b/src/3rdparty/masm/wtf/PageReservation.h
@@ -104,13 +104,7 @@ public:
static PageReservation reserve(size_t size, OSAllocator::Usage usage = OSAllocator::UnknownUsage, bool writable = true, bool executable = false)
{
ASSERT(isPageAligned(size));
- return PageReservation(OSAllocator::reserveUncommitted(size, usage, writable, executable), size, writable, executable, false);
- }
-
- static PageReservation reserveWithGuardPages(size_t size, OSAllocator::Usage usage = OSAllocator::UnknownUsage, bool writable = true, bool executable = false)
- {
- ASSERT(isPageAligned(size));
- return PageReservation(OSAllocator::reserveUncommitted(size + pageSize() * 2, usage, writable, executable, true), size, writable, executable, true);
+ return PageReservation(OSAllocator::reserveUncommitted(size, usage, writable, executable), size, writable, executable);
}
void deallocate()
@@ -125,12 +119,12 @@ public:
ASSERT(tmp);
ASSERT(!*this);
- OSAllocator::releaseDecommitted(tmp.base(), tmp.size());
+ OSAllocator::releaseDecommitted(tmp.realBase(), tmp.realSize());
}
private:
- PageReservation(void* base, size_t size, bool writable, bool executable, bool hasGuardPages)
- : PageBlock(base, size, hasGuardPages)
+ PageReservation(void* base, size_t size, bool writable, bool executable)
+ : PageBlock(base, size, false)
, m_committed(0)
, m_writable(writable)
, m_executable(executable)
diff --git a/src/3rdparty/masm/yarr/YarrJIT.cpp b/src/3rdparty/masm/yarr/YarrJIT.cpp
index 94a72a57c7..ce18b3ab4f 100644
--- a/src/3rdparty/masm/yarr/YarrJIT.cpp
+++ b/src/3rdparty/masm/yarr/YarrJIT.cpp
@@ -46,10 +46,10 @@ class YarrGenerator : private MacroAssembler {
static const RegisterID input = ARMRegisters::r0;
static const RegisterID index = ARMRegisters::r1;
static const RegisterID length = ARMRegisters::r2;
- static const RegisterID output = ARMRegisters::r4;
+ static const RegisterID output = ARMRegisters::r3;
- static const RegisterID regT0 = ARMRegisters::r5;
- static const RegisterID regT1 = ARMRegisters::r6;
+ static const RegisterID regT0 = ARMRegisters::r4;
+ static const RegisterID regT1 = ARMRegisters::r5;
static const RegisterID returnRegister = ARMRegisters::r0;
static const RegisterID returnRegister2 = ARMRegisters::r1;
@@ -2561,7 +2561,6 @@ class YarrGenerator : private MacroAssembler {
#if CPU(ARM_TRADITIONAL)
push(ARMRegisters::r8); // scratch register
#endif
- push(addressTempRegister);
if (compileMode == IncludeSubpatterns)
move(ARMRegisters::r3, output);
#elif CPU(SH4)
@@ -2589,7 +2588,6 @@ class YarrGenerator : private MacroAssembler {
pop(X86Registers::ebx);
pop(X86Registers::ebp);
#elif CPU(ARM)
- pop(addressTempRegister);
#if CPU(ARM_TRADITIONAL)
pop(ARMRegisters::r8); // scratch register
#endif
diff --git a/src/imports/folderlistmodel/fileinfothread.cpp b/src/imports/folderlistmodel/fileinfothread.cpp
index 982e1e2a1a..e1db7834ec 100644
--- a/src/imports/folderlistmodel/fileinfothread.cpp
+++ b/src/imports/folderlistmodel/fileinfothread.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -86,6 +86,8 @@ void FileInfoThread::removePath(const QString &path)
#ifndef QT_NO_FILESYSTEMWATCHER
if (!path.startsWith(QLatin1Char(':')))
watcher->removePath(path);
+#else
+ Q_UNUSED(path);
#endif
currentPath.clear();
}
diff --git a/src/imports/folderlistmodel/fileinfothread_p.h b/src/imports/folderlistmodel/fileinfothread_p.h
index acf256f519..ee325fa50b 100644
--- a/src/imports/folderlistmodel/fileinfothread_p.h
+++ b/src/imports/folderlistmodel/fileinfothread_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/imports/folderlistmodel/fileproperty_p.h b/src/imports/folderlistmodel/fileproperty_p.h
index 6c93aa1576..d514ad55bc 100644
--- a/src/imports/folderlistmodel/fileproperty_p.h
+++ b/src/imports/folderlistmodel/fileproperty_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/imports/folderlistmodel/plugin.cpp b/src/imports/folderlistmodel/plugin.cpp
index 80c1cdcda8..a2536bdc7d 100644
--- a/src/imports/folderlistmodel/plugin.cpp
+++ b/src/imports/folderlistmodel/plugin.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
index 3f7b0fc072..80b32e64ef 100644
--- a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
+++ b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.h b/src/imports/folderlistmodel/qquickfolderlistmodel.h
index 3f3d410b4f..63ed528556 100644
--- a/src/imports/folderlistmodel/qquickfolderlistmodel.h
+++ b/src/imports/folderlistmodel/qquickfolderlistmodel.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp
index 8b90f5a685..b0ba3f9228 100644
--- a/src/imports/localstorage/plugin.cpp
+++ b/src/imports/localstorage/plugin.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -52,28 +52,29 @@
#include <private/qv4functionobject_p.h>
#include <private/qv4objectproto_p.h>
#include <private/qv4scopedvalue_p.h>
+#include <private/qv4objectiterator_p.h>
-using namespace QV4;
+QT_BEGIN_NAMESPACE
#define V4THROW_SQL(error, desc) { \
- QV4::Scoped<String> v(scope, scope.engine->newString(desc)); \
- QV4::Scoped<Object> ex(scope, scope.engine->newErrorObject(v)); \
+ QV4::ScopedString v(scope, scope.engine->newString(desc)); \
+ QV4::ScopedObject ex(scope, scope.engine->newErrorObject(v)); \
ex->put(QV4::ScopedString(scope, scope.engine->newIdentifier(QStringLiteral("code"))).getPointer(), QV4::ScopedValue(scope, Primitive::fromInt32(error))); \
- ctx->throwError(ex); \
+ ctx->engine()->throwError(ex); \
return Encode::undefined(); \
}
#define V4THROW_SQL2(error, desc) { \
- QV4::Scoped<String> v(scope, scope.engine->newString(desc)); \
- QV4::Scoped<Object> ex(scope, scope.engine->newErrorObject(v)); \
+ QV4::ScopedString v(scope, scope.engine->newString(desc)); \
+ QV4::ScopedObject ex(scope, scope.engine->newErrorObject(v)); \
ex->put(QV4::ScopedString(scope, scope.engine->newIdentifier(QStringLiteral("code"))).getPointer(), QV4::ScopedValue(scope, Primitive::fromInt32(error))); \
- args->setReturnValue(ctx->throwError(ex)); \
+ args->setReturnValue(ctx->engine()->throwError(ex)); \
return; \
}
#define V4THROW_REFERENCE(string) { \
- QV4::Scoped<String> v(scope, scope.engine->newString(string)); \
- ctx->throwReferenceError(v); \
+ QV4::ScopedString v(scope, scope.engine->newString(string)); \
+ ctx->engine()->throwReferenceError(v); \
return Encode::undefined(); \
}
@@ -81,27 +82,22 @@ using namespace QV4;
class QQmlSqlDatabaseData : public QV8Engine::Deletable
{
public:
- QQmlSqlDatabaseData(QV8Engine *engine);
+ QQmlSqlDatabaseData(QV4::ExecutionEngine *engine);
~QQmlSqlDatabaseData();
- PersistentValue databaseProto;
- PersistentValue queryProto;
- PersistentValue rowsProto;
+ QV4::PersistentValue databaseProto;
+ QV4::PersistentValue queryProto;
+ QV4::PersistentValue rowsProto;
};
-V8_DEFINE_EXTENSION(QQmlSqlDatabaseData, databaseData)
+V4_DEFINE_EXTENSION(QQmlSqlDatabaseData, databaseData)
-class QQmlSqlDatabaseWrapper : public Object
-{
-public:
- enum Type { Database, Query, Rows };
- struct Data : Object::Data {
- Data(ExecutionEngine *e)
- : Object::Data(e)
- {
- setVTable(staticVTable());
- type = Database;
- }
+namespace QV4 {
+
+namespace Heap {
+ struct QQmlSqlDatabaseWrapper : public Object {
+ enum Type { Database, Query, Rows };
+ QQmlSqlDatabaseWrapper(ExecutionEngine *e);
Type type;
QSqlDatabase database;
@@ -114,30 +110,42 @@ public:
QSqlQuery sqlQuery; // type == Rows
bool forwardOnly; // type == Rows
};
- V4_OBJECT(Object)
+}
+
+class QQmlSqlDatabaseWrapper : public Object
+{
+public:
+ V4_OBJECT2(QQmlSqlDatabaseWrapper, Object)
+ V4_NEEDS_DESTROY
- static QQmlSqlDatabaseWrapper *create(QV8Engine *engine)
+ static Heap::QQmlSqlDatabaseWrapper *create(QV4::ExecutionEngine *engine)
{
- QV4::ExecutionEngine *e = QV8Engine::getV4(engine);
- return e->memoryManager->alloc<QQmlSqlDatabaseWrapper>(e);
+ return engine->memoryManager->alloc<QQmlSqlDatabaseWrapper>(engine);
}
~QQmlSqlDatabaseWrapper() {
}
static ReturnedValue getIndexed(Managed *m, uint index, bool *hasProperty);
- static void destroy(Managed *that) {
- static_cast<QQmlSqlDatabaseWrapper *>(that)->~QQmlSqlDatabaseWrapper();
- }
};
-DEFINE_OBJECT_VTABLE(QQmlSqlDatabaseWrapper);
+}
+
+using namespace QV4;
+
+DEFINE_OBJECT_VTABLE(QV4::QQmlSqlDatabaseWrapper);
+
+QV4::Heap::QQmlSqlDatabaseWrapper::QQmlSqlDatabaseWrapper(ExecutionEngine *e)
+ : QV4::Heap::Object(e)
+{
+ type = Database;
+}
static ReturnedValue qmlsqldatabase_version(CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->d()->callData->thisObject.as<QQmlSqlDatabaseWrapper>());
- if (!r || r->d()->type != QQmlSqlDatabaseWrapper::Database)
+ QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->thisObject().as<QQmlSqlDatabaseWrapper>());
+ if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Database)
V4THROW_REFERENCE("Not a SQLDatabase object");
return Encode(scope.engine->newString(r->d()->version));
@@ -146,8 +154,8 @@ static ReturnedValue qmlsqldatabase_version(CallContext *ctx)
static ReturnedValue qmlsqldatabase_rows_length(CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->d()->callData->thisObject.as<QQmlSqlDatabaseWrapper>());
- if (!r || r->d()->type != QQmlSqlDatabaseWrapper::Rows)
+ QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->thisObject().as<QQmlSqlDatabaseWrapper>());
+ if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Rows)
V4THROW_REFERENCE("Not a SQLDatabase::Rows object");
int s = r->d()->sqlQuery.size();
@@ -165,8 +173,8 @@ static ReturnedValue qmlsqldatabase_rows_length(CallContext *ctx)
static ReturnedValue qmlsqldatabase_rows_forwardOnly(CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->d()->callData->thisObject.as<QQmlSqlDatabaseWrapper>());
- if (!r || r->d()->type != QQmlSqlDatabaseWrapper::Rows)
+ QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->thisObject().as<QQmlSqlDatabaseWrapper>());
+ if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Rows)
V4THROW_REFERENCE("Not a SQLDatabase::Rows object");
return Encode(r->d()->sqlQuery.isForwardOnly());
}
@@ -174,13 +182,13 @@ static ReturnedValue qmlsqldatabase_rows_forwardOnly(CallContext *ctx)
static ReturnedValue qmlsqldatabase_rows_setForwardOnly(CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->d()->callData->thisObject.as<QQmlSqlDatabaseWrapper>());
- if (!r || r->d()->type != QQmlSqlDatabaseWrapper::Rows)
+ QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->thisObject().as<QQmlSqlDatabaseWrapper>());
+ if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Rows)
V4THROW_REFERENCE("Not a SQLDatabase::Rows object");
- if (ctx->d()->callData->argc < 1)
- return ctx->throwTypeError();
+ if (ctx->argc() < 1)
+ return ctx->engine()->throwTypeError();
- r->d()->sqlQuery.setForwardOnly(ctx->d()->callData->args[0].toBoolean());
+ r->d()->sqlQuery.setForwardOnly(ctx->args()[0].toBoolean());
return Encode::undefined();
}
@@ -188,20 +196,20 @@ QQmlSqlDatabaseData::~QQmlSqlDatabaseData()
{
}
-static QString qmlsqldatabase_databasesPath(QV8Engine *engine)
+static QString qmlsqldatabase_databasesPath(QV4::ExecutionEngine *engine)
{
- return engine->engine()->offlineStoragePath() +
+ return engine->qmlEngine()->offlineStoragePath() +
QDir::separator() + QLatin1String("Databases");
}
-static void qmlsqldatabase_initDatabasesPath(QV8Engine *engine)
+static void qmlsqldatabase_initDatabasesPath(QV4::ExecutionEngine *engine)
{
QString databasesPath = qmlsqldatabase_databasesPath(engine);
if (!QDir().mkpath(databasesPath))
qWarning() << "LocalStorage: can't create path - " << databasesPath;
}
-static QString qmlsqldatabase_databaseFile(const QString& connectionName, QV8Engine *engine)
+static QString qmlsqldatabase_databaseFile(const QString& connectionName, QV4::ExecutionEngine *engine)
{
return qmlsqldatabase_databasesPath(engine) + QDir::separator() + connectionName;
}
@@ -209,16 +217,15 @@ static QString qmlsqldatabase_databaseFile(const QString& connectionName, QV8Eng
static ReturnedValue qmlsqldatabase_rows_index(QQmlSqlDatabaseWrapper *r, ExecutionEngine *v4, quint32 index, bool *hasProperty = 0)
{
Scope scope(v4);
- QV8Engine *v8 = v4->v8Engine;
if (r->d()->sqlQuery.at() == (int)index || r->d()->sqlQuery.seek(index)) {
QSqlRecord record = r->d()->sqlQuery.record();
// XXX optimize
- Scoped<Object> row(scope, v4->newObject());
+ ScopedObject row(scope, v4->newObject());
for (int ii = 0; ii < record.count(); ++ii) {
QVariant v = record.value(ii);
ScopedString s(scope, v4->newIdentifier(record.fieldName(ii)));
- ScopedValue val(scope, v.isNull() ? Encode::null() : v8->fromVariant(v));
+ ScopedValue val(scope, v.isNull() ? Encode::null() : v4->fromVariant(v));
row->put(s.getPointer(), val);
}
if (hasProperty)
@@ -233,40 +240,38 @@ static ReturnedValue qmlsqldatabase_rows_index(QQmlSqlDatabaseWrapper *r, Execut
ReturnedValue QQmlSqlDatabaseWrapper::getIndexed(Managed *m, uint index, bool *hasProperty)
{
- QV4::Scope scope(m->engine());
+ QV4::Scope scope(static_cast<QQmlSqlDatabaseWrapper *>(m)->engine());
Q_ASSERT(m->as<QQmlSqlDatabaseWrapper>());
QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, static_cast<QQmlSqlDatabaseWrapper *>(m));
- if (!r || r->d()->type != QQmlSqlDatabaseWrapper::Rows)
+ if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Rows)
return Object::getIndexed(m, index, hasProperty);
- return qmlsqldatabase_rows_index(r, m->engine(), index, hasProperty);
+ return qmlsqldatabase_rows_index(r, scope.engine, index, hasProperty);
}
static ReturnedValue qmlsqldatabase_rows_item(CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->d()->callData->thisObject.as<QQmlSqlDatabaseWrapper>());
- if (!r || r->d()->type != QQmlSqlDatabaseWrapper::Rows)
+ QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->thisObject().as<QQmlSqlDatabaseWrapper>());
+ if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Rows)
V4THROW_REFERENCE("Not a SQLDatabase::Rows object");
- return qmlsqldatabase_rows_index(r, scope.engine, ctx->d()->callData->argc ? ctx->d()->callData->args[0].toUInt32() : 0);
+ return qmlsqldatabase_rows_index(r, scope.engine, ctx->argc() ? ctx->args()[0].toUInt32() : 0);
}
static ReturnedValue qmlsqldatabase_executeSql(CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->d()->callData->thisObject.as<QQmlSqlDatabaseWrapper>());
- if (!r || r->d()->type != QQmlSqlDatabaseWrapper::Query)
+ QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->thisObject().as<QQmlSqlDatabaseWrapper>());
+ if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Query)
V4THROW_REFERENCE("Not a SQLDatabase::Query object");
- QV8Engine *engine = scope.engine->v8Engine;
-
if (!r->d()->inTransaction)
V4THROW_SQL(SQLEXCEPTION_DATABASE_ERR,QQmlEngine::tr("executeSql called outside transaction()"));
QSqlDatabase db = r->d()->database;
- QString sql = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toQString() : QString();
+ QString sql = ctx->argc() ? ctx->args()[0].toQString() : QString();
if (r->d()->readonly && !sql.startsWith(QLatin1String("SELECT"),Qt::CaseInsensitive)) {
V4THROW_SQL(SQLEXCEPTION_SYNTAX_ERR, QQmlEngine::tr("Read-only Transaction"));
@@ -278,14 +283,14 @@ static ReturnedValue qmlsqldatabase_executeSql(CallContext *ctx)
ScopedValue result(scope, Primitive::undefinedValue());
if (query.prepare(sql)) {
- if (ctx->d()->callData->argc > 1) {
- ScopedValue values(scope, ctx->d()->callData->args[1]);
+ if (ctx->argc() > 1) {
+ ScopedValue values(scope, ctx->args()[1]);
if (values->asArrayObject()) {
ScopedArrayObject array(scope, values);
quint32 size = array->getLength();
QV4::ScopedValue v(scope);
for (quint32 ii = 0; ii < size; ++ii)
- query.bindValue(ii, engine->toVariant((v = array->getIndexed(ii)), -1));
+ query.bindValue(ii, scope.engine->toVariant((v = array->getIndexed(ii)), -1));
} else if (values->asObject()) {
ScopedObject object(scope, values);
ObjectIterator it(scope, object, ObjectIterator::WithProtoChain|ObjectIterator::EnumerableOnly);
@@ -295,7 +300,7 @@ static ReturnedValue qmlsqldatabase_executeSql(CallContext *ctx)
key = it.nextPropertyName(val);
if (key->isNull())
break;
- QVariant v = engine->toVariant(val, -1);
+ QVariant v = scope.engine->toVariant(val, -1);
if (key->isString()) {
query.bindValue(key->stringValue()->toQString(), v);
} else {
@@ -304,24 +309,24 @@ static ReturnedValue qmlsqldatabase_executeSql(CallContext *ctx)
}
}
} else {
- query.bindValue(0, engine->toVariant(values, -1));
+ query.bindValue(0, scope.engine->toVariant(values, -1));
}
}
if (query.exec()) {
- QV4::Scoped<QQmlSqlDatabaseWrapper> rows(scope, QQmlSqlDatabaseWrapper::create(engine));
- QV4::ScopedObject p(scope, databaseData(engine)->rowsProto.value());
+ QV4::Scoped<QQmlSqlDatabaseWrapper> rows(scope, QQmlSqlDatabaseWrapper::create(scope.engine));
+ QV4::ScopedObject p(scope, databaseData(scope.engine)->rowsProto.value());
rows->setPrototype(p.getPointer());
- rows->d()->type = QQmlSqlDatabaseWrapper::Rows;
+ rows->d()->type = Heap::QQmlSqlDatabaseWrapper::Rows;
rows->d()->database = db;
rows->d()->sqlQuery = query;
- Scoped<Object> resultObject(scope, scope.engine->newObject());
+ ScopedObject resultObject(scope, scope.engine->newObject());
result = resultObject.asReturnedValue();
// XXX optimize
ScopedString s(scope);
ScopedValue v(scope);
resultObject->put((s = scope.engine->newIdentifier("rowsAffected")).getPointer(), (v = Primitive::fromInt32(query.numRowsAffected())));
- resultObject->put((s = scope.engine->newIdentifier("insertId")).getPointer(), (v = engine->toString(query.lastInsertId().toString())));
+ resultObject->put((s = scope.engine->newIdentifier("insertId")).getPointer(), (v = scope.engine->newString(query.lastInsertId().toString())));
resultObject->put((s = scope.engine->newIdentifier("rows")).getPointer(), rows);
} else {
err = true;
@@ -332,7 +337,7 @@ static ReturnedValue qmlsqldatabase_executeSql(CallContext *ctx)
if (err)
V4THROW_SQL(SQLEXCEPTION_DATABASE_ERR,query.lastError().text());
- return result.asReturnedValue();
+ return result->asReturnedValue();
}
struct TransactionRollback {
@@ -366,29 +371,27 @@ struct TransactionRollback {
static ReturnedValue qmlsqldatabase_changeVersion(CallContext *ctx)
{
- if (ctx->d()->callData->argc < 2)
+ if (ctx->argc() < 2)
return Encode::undefined();
Scope scope(ctx);
- Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->d()->callData->thisObject);
- if (!r || r->d()->type != QQmlSqlDatabaseWrapper::Database)
+ Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->thisObject());
+ if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Database)
V4THROW_REFERENCE("Not a SQLDatabase object");
- QV8Engine *engine = scope.engine->v8Engine;
-
QSqlDatabase db = r->d()->database;
- QString from_version = ctx->d()->callData->args[0].toQString();
- QString to_version = ctx->d()->callData->args[1].toQString();
- Scoped<FunctionObject> callback(scope, ctx->argument(2));
+ QString from_version = ctx->args()[0].toQString();
+ QString to_version = ctx->args()[1].toQString();
+ ScopedFunctionObject callback(scope, ctx->argument(2));
if (from_version != r->d()->version)
V4THROW_SQL(SQLEXCEPTION_VERSION_ERR, QQmlEngine::tr("Version mismatch: expected %1, found %2").arg(from_version).arg(r->d()->version));
- Scoped<QQmlSqlDatabaseWrapper> w(scope, QQmlSqlDatabaseWrapper::create(engine));
- ScopedObject p(scope, databaseData(engine)->queryProto.value());
+ Scoped<QQmlSqlDatabaseWrapper> w(scope, QQmlSqlDatabaseWrapper::create(scope.engine));
+ ScopedObject p(scope, databaseData(scope.engine)->queryProto.value());
w->setPrototype(p.getPointer());
- w->d()->type = QQmlSqlDatabaseWrapper::Query;
+ w->d()->type = Heap::QQmlSqlDatabaseWrapper::Query;
w->d()->database = db;
w->d()->version = r->d()->version;
@@ -398,7 +401,7 @@ static ReturnedValue qmlsqldatabase_changeVersion(CallContext *ctx)
db.transaction();
ScopedCallData callData(scope, 1);
- callData->thisObject = engine->global();
+ callData->thisObject = scope.engine->globalObject();
callData->args[0] = w;
TransactionRollback rollbackOnException(&db, &w->d()->inTransaction);
@@ -415,7 +418,7 @@ static ReturnedValue qmlsqldatabase_changeVersion(CallContext *ctx)
if (ok) {
w->d()->version = to_version;
#ifndef QT_NO_SETTINGS
- QSettings ini(qmlsqldatabase_databaseFile(db.connectionName(),engine) + QLatin1String(".ini"), QSettings::IniFormat);
+ QSettings ini(qmlsqldatabase_databaseFile(db.connectionName(), scope.engine) + QLatin1String(".ini"), QSettings::IniFormat);
ini.setValue(QLatin1String("Version"), to_version);
#endif
}
@@ -426,22 +429,20 @@ static ReturnedValue qmlsqldatabase_changeVersion(CallContext *ctx)
static ReturnedValue qmlsqldatabase_transaction_shared(CallContext *ctx, bool readOnly)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->d()->callData->thisObject.as<QQmlSqlDatabaseWrapper>());
- if (!r || r->d()->type != QQmlSqlDatabaseWrapper::Database)
+ QV4::Scoped<QQmlSqlDatabaseWrapper> r(scope, ctx->thisObject().as<QQmlSqlDatabaseWrapper>());
+ if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Database)
V4THROW_REFERENCE("Not a SQLDatabase object");
- QV8Engine *engine = scope.engine->v8Engine;
-
- FunctionObject *callback = ctx->d()->callData->argc ? ctx->d()->callData->args[0].asFunctionObject() : 0;
+ FunctionObject *callback = ctx->argc() ? ctx->args()[0].asFunctionObject() : 0;
if (!callback)
V4THROW_SQL(SQLEXCEPTION_UNKNOWN_ERR, QQmlEngine::tr("transaction: missing callback"));
QSqlDatabase db = r->d()->database;
- Scoped<QQmlSqlDatabaseWrapper> w(scope, QQmlSqlDatabaseWrapper::create(engine));
- QV4::ScopedObject p(scope, databaseData(engine)->queryProto.value());
+ Scoped<QQmlSqlDatabaseWrapper> w(scope, QQmlSqlDatabaseWrapper::create(scope.engine));
+ QV4::ScopedObject p(scope, databaseData(scope.engine)->queryProto.value());
w->setPrototype(p.getPointer());
- w->d()->type = QQmlSqlDatabaseWrapper::Query;
+ w->d()->type = Heap::QQmlSqlDatabaseWrapper::Query;
w->d()->database = db;
w->d()->version = r->d()->version;
w->d()->readonly = readOnly;
@@ -449,7 +450,7 @@ static ReturnedValue qmlsqldatabase_transaction_shared(CallContext *ctx, bool re
db.transaction();
if (callback) {
ScopedCallData callData(scope, 1);
- callData->thisObject = engine->global();
+ callData->thisObject = scope.engine->globalObject();
callData->args[0] = w;
TransactionRollback rollbackOnException(&db, &w->d()->inTransaction);
callback->call(callData);
@@ -472,12 +473,11 @@ static ReturnedValue qmlsqldatabase_read_transaction(CallContext *ctx)
return qmlsqldatabase_transaction_shared(ctx, true);
}
-QQmlSqlDatabaseData::QQmlSqlDatabaseData(QV8Engine *engine)
+QQmlSqlDatabaseData::QQmlSqlDatabaseData(ExecutionEngine *v4)
{
- ExecutionEngine *v4 = QV8Engine::getV4(engine);
Scope scope(v4);
{
- Scoped<Object> proto(scope, v4->newObject());
+ ScopedObject proto(scope, v4->newObject());
proto->defineDefaultProperty(QStringLiteral("transaction"), qmlsqldatabase_transaction);
proto->defineDefaultProperty(QStringLiteral("readTransaction"), qmlsqldatabase_read_transaction);
proto->defineAccessorProperty(QStringLiteral("version"), qmlsqldatabase_version, 0);
@@ -486,12 +486,12 @@ QQmlSqlDatabaseData::QQmlSqlDatabaseData(QV8Engine *engine)
}
{
- Scoped<Object> proto(scope, v4->newObject());
+ ScopedObject proto(scope, v4->newObject());
proto->defineDefaultProperty(QStringLiteral("executeSql"), qmlsqldatabase_executeSql);
queryProto = proto;
}
{
- Scoped<Object> proto(scope, v4->newObject());
+ ScopedObject proto(scope, v4->newObject());
proto->defineDefaultProperty(QStringLiteral("item"), qmlsqldatabase_rows_item);
proto->defineAccessorProperty(QStringLiteral("length"), qmlsqldatabase_rows_length, 0);
proto->defineAccessorProperty(QStringLiteral("forwardOnly"),
@@ -659,13 +659,12 @@ public:
void QQuickLocalStorage::openDatabaseSync(QQmlV4Function *args)
{
#ifndef QT_NO_SETTINGS
- QV8Engine *engine = args->engine();
- QV4::ExecutionContext *ctx = args->v4engine()->currentContext();
- QV4::Scope scope(ctx);
- if (engine->engine()->offlineStoragePath().isEmpty())
+ QV4::Scope scope(args->v4engine());
+ QV4::ScopedContext ctx(scope, args->v4engine()->currentContext());
+ if (scope.engine->qmlEngine()->offlineStoragePath().isEmpty())
V4THROW_SQL2(SQLEXCEPTION_DATABASE_ERR, QQmlEngine::tr("SQL: can't create database, offline storage is disabled."));
- qmlsqldatabase_initDatabasesPath(engine);
+ qmlsqldatabase_initDatabasesPath(scope.engine);
QSqlDatabase database;
@@ -680,7 +679,7 @@ void QQuickLocalStorage::openDatabaseSync(QQmlV4Function *args)
md5.addData(dbname.toUtf8());
QString dbid(QLatin1String(md5.result().toHex()));
- QString basename = qmlsqldatabase_databaseFile(dbid, engine);
+ QString basename = qmlsqldatabase_databaseFile(dbid, scope.engine);
bool created = false;
QString version = dbversion;
@@ -716,8 +715,8 @@ void QQuickLocalStorage::openDatabaseSync(QQmlV4Function *args)
database.open();
}
- QV4::Scoped<QQmlSqlDatabaseWrapper> db(scope, QQmlSqlDatabaseWrapper::create(engine));
- QV4::ScopedObject p(scope, databaseData(engine)->databaseProto.value());
+ QV4::Scoped<QQmlSqlDatabaseWrapper> db(scope, QQmlSqlDatabaseWrapper::create(scope.engine));
+ QV4::ScopedObject p(scope, databaseData(scope.engine)->databaseProto.value());
db->setPrototype(p.getPointer());
db->d()->database = database;
db->d()->version = version;
@@ -725,7 +724,7 @@ void QQuickLocalStorage::openDatabaseSync(QQmlV4Function *args)
if (created && dbcreationCallback) {
Scope scope(ctx);
ScopedCallData callData(scope, 1);
- callData->thisObject = engine->global();
+ callData->thisObject = scope.engine->globalObject();
callData->args[0] = db;
dbcreationCallback->call(callData);
}
@@ -760,4 +759,6 @@ public:
}
};
+QT_END_NAMESPACE
+
#include "plugin.moc"
diff --git a/src/imports/models/models.pro b/src/imports/models/models.pro
index 98b0bd617a..6a2952cd82 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.1
+IMPORT_VERSION = 2.2
SOURCES += \
plugin.cpp
diff --git a/src/imports/models/plugin.cpp b/src/imports/models/plugin.cpp
index 82c64764d8..c2b0d2ae94 100644
--- a/src/imports/models/plugin.cpp
+++ b/src/imports/models/plugin.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Research In Motion.
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -38,7 +38,7 @@
QT_BEGIN_NAMESPACE
/*!
- \qmlmodule QtQml.Models 2.1
+ \qmlmodule QtQml.Models 2.2
\title Qt QML Models QML Types
\ingroup qmlmodules
\brief Provides QML types for data models
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
To use the types in this module, import the module with the following line:
\code
- import QtQml.Models 2.1
+ import QtQml.Models 2.2
\endcode
Note that QtQml.Models module started at version 2.1 to match the version
diff --git a/src/imports/models/plugins.qmltypes b/src/imports/models/plugins.qmltypes
new file mode 100644
index 0000000000..e81a971e79
--- /dev/null
+++ b/src/imports/models/plugins.qmltypes
@@ -0,0 +1,540 @@
+import QtQuick.tooling 1.1
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable QtQml.Models 2.2'
+
+Module {
+ Component {
+ name: "QAbstractItemModel"
+ prototype: "QObject"
+ Enum {
+ name: "LayoutChangeHint"
+ values: {
+ "NoLayoutChangeHint": 0,
+ "VerticalSortHint": 1,
+ "HorizontalSortHint": 2
+ }
+ }
+ 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: [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: ["QtQml.Models/DelegateModelGroup 2.1"]
+ 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: "QQmlV4Handle" }
+ Parameter { name: "inserted"; type: "QQmlV4Handle" }
+ }
+ 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: "QQmlV4Handle"
+ Parameter { name: "index"; type: "int" }
+ }
+ }
+ Component { name: "QQmlDelegateModelParts"; prototype: "QObject" }
+ Component {
+ name: "QQmlListElement"
+ prototype: "QObject"
+ exports: ["QtQml.Models/ListElement 2.1"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQmlListModel"
+ prototype: "QAbstractListModel"
+ exports: ["QtQml.Models/ListModel 2.1"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "dynamicRoles"; type: "bool" }
+ 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: "QQmlV4Handle"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "set"
+ Parameter { name: "index"; type: "int" }
+ Parameter { type: "QQmlV4Handle" }
+ }
+ Method {
+ name: "setProperty"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "property"; type: "string" }
+ Parameter { name: "value"; type: "QVariant" }
+ }
+ Method {
+ name: "move"
+ Parameter { name: "from"; type: "int" }
+ Parameter { name: "to"; type: "int" }
+ Parameter { name: "count"; type: "int" }
+ }
+ Method { name: "sync" }
+ }
+ Component {
+ name: "QQmlObjectModel"
+ defaultProperty: "children"
+ prototype: "QQmlInstanceModel"
+ exports: ["QtQml.Models/ObjectModel 2.1"]
+ exportMetaObjectRevisions: [0]
+ attachedType: "QQmlObjectModelAttached"
+ Property { name: "children"; type: "QObject"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "QQmlObjectModelAttached"
+ prototype: "QObject"
+ Property { name: "index"; type: "int"; isReadonly: true }
+ }
+}
diff --git a/src/imports/particles/plugin.cpp b/src/imports/particles/plugin.cpp
index ce80f0bf21..56b611a408 100644
--- a/src/imports/particles/plugin.cpp
+++ b/src/imports/particles/plugin.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/imports/qtquick2/plugin.cpp b/src/imports/qtquick2/plugin.cpp
index ad3db2290f..36a57112b2 100644
--- a/src/imports/qtquick2/plugin.cpp
+++ b/src/imports/qtquick2/plugin.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/imports/settings/plugin.cpp b/src/imports/settings/plugin.cpp
index 262cd2b750..c32d370537 100644
--- a/src/imports/settings/plugin.cpp
+++ b/src/imports/settings/plugin.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/imports/settings/qqmlsettings.cpp b/src/imports/settings/qqmlsettings.cpp
index 5fdf40f0fc..954161b60b 100644
--- a/src/imports/settings/qqmlsettings.cpp
+++ b/src/imports/settings/qqmlsettings.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -315,14 +315,15 @@ void QQmlSettingsPrivate::load()
void QQmlSettingsPrivate::store()
{
- QHash<const char *, QVariant>::iterator it = changedProperties.begin();
- while (it != changedProperties.end()) {
+ QHash<const char *, QVariant>::const_iterator it = changedProperties.constBegin();
+ while (it != changedProperties.constEnd()) {
instance()->setValue(it.key(), it.value());
#ifdef SETTINGS_DEBUG
qDebug() << "QQmlSettings: store" << it.key() << ":" << it.value();
#endif
- it = changedProperties.erase(it);
+ ++it;
}
+ changedProperties.clear();
}
void QQmlSettingsPrivate::_q_propertyChanged()
@@ -394,12 +395,10 @@ void QQmlSettings::timerEvent(QTimerEvent *event)
{
Q_D(QQmlSettings);
if (event->timerId() == d->timerId) {
- if (d->changedProperties.isEmpty()) {
- killTimer(d->timerId);
- d->timerId = 0;
- } else {
- d->store();
- }
+ killTimer(d->timerId);
+ d->timerId = 0;
+
+ d->store();
}
QObject::timerEvent(event);
}
diff --git a/src/imports/settings/qqmlsettings_p.h b/src/imports/settings/qqmlsettings_p.h
index 2ec6ddedc9..a1207eb81c 100644
--- a/src/imports/settings/qqmlsettings_p.h
+++ b/src/imports/settings/qqmlsettings_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/imports/statemachine/childrenprivate.h b/src/imports/statemachine/childrenprivate.h
index d66454ca1c..d209a3532e 100644
--- a/src/imports/statemachine/childrenprivate.h
+++ b/src/imports/statemachine/childrenprivate.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Ford Motor Company
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/imports/statemachine/finalstate.cpp b/src/imports/statemachine/finalstate.cpp
index 9b3c05e294..1125213626 100644
--- a/src/imports/statemachine/finalstate.cpp
+++ b/src/imports/statemachine/finalstate.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Ford Motor Company
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/imports/statemachine/finalstate.h b/src/imports/statemachine/finalstate.h
index e2a54ec805..f5d98031e5 100644
--- a/src/imports/statemachine/finalstate.h
+++ b/src/imports/statemachine/finalstate.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Ford Motor Company
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/imports/statemachine/plugin.cpp b/src/imports/statemachine/plugin.cpp
index 5af90c99ff..4a711a3278 100644
--- a/src/imports/statemachine/plugin.cpp
+++ b/src/imports/statemachine/plugin.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Ford Motor Company
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/imports/statemachine/signaltransition.cpp b/src/imports/statemachine/signaltransition.cpp
index 37edd6eb87..92650f7e07 100644
--- a/src/imports/statemachine/signaltransition.cpp
+++ b/src/imports/statemachine/signaltransition.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Ford Motor Company
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -44,6 +44,7 @@
#include <private/qv8engine_p.h>
#include <private/qjsvalue_p.h>
#include <private/qv4scopedvalue_p.h>
+#include <private/qqmlcontext_p.h>
SignalTransition::SignalTransition(QState *parent)
: QSignalTransition(this, SIGNAL(invokeYourself()), parent)
@@ -60,7 +61,10 @@ bool SignalTransition::eventTest(QEvent *event)
if (m_guard.isEmpty())
return true;
- QQmlContext context(QQmlEngine::contextForObject(this));
+ QQmlContext *outerContext = QQmlEngine::contextForObject(this);
+ QQmlContext context(outerContext);
+ QQmlContextData::get(outerContext)->imports->addref();
+ QQmlContextData::get(&context)->imports = QQmlContextData::get(outerContext)->imports;
QStateMachine::SignalEvent *e = static_cast<QStateMachine::SignalEvent*>(event);
@@ -91,7 +95,7 @@ void SignalTransition::setSignal(const QJSValue &signal)
QV4::ExecutionEngine *jsEngine = QV8Engine::getV4(QQmlEngine::contextForObject(this)->engine());
QV4::Scope scope(jsEngine);
- QV4::Scoped<QV4::QObjectMethod> qobjectSignal(scope, QJSValuePrivate::get(m_signal)->getValue(jsEngine));
+ QV4::Scoped<QV4::QObjectMethod> qobjectSignal(scope, QJSValuePrivate::convertedToValue(jsEngine, m_signal));
Q_ASSERT(qobjectSignal);
QObject *sender = qobjectSignal->object();
diff --git a/src/imports/statemachine/signaltransition.h b/src/imports/statemachine/signaltransition.h
index 3ac563b15e..1b44af4de9 100644
--- a/src/imports/statemachine/signaltransition.h
+++ b/src/imports/statemachine/signaltransition.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Ford Motor Company
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/imports/statemachine/state.cpp b/src/imports/statemachine/state.cpp
index bcc14b5912..c4ca1502ac 100644
--- a/src/imports/statemachine/state.cpp
+++ b/src/imports/statemachine/state.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Ford Motor Company
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/imports/statemachine/state.h b/src/imports/statemachine/state.h
index af8783e90d..fa62e5c469 100644
--- a/src/imports/statemachine/state.h
+++ b/src/imports/statemachine/state.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Ford Motor Company
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/imports/statemachine/statemachine.cpp b/src/imports/statemachine/statemachine.cpp
index 7b9ebdb88b..d2c6da3782 100644
--- a/src/imports/statemachine/statemachine.cpp
+++ b/src/imports/statemachine/statemachine.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Ford Motor Company
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/imports/statemachine/statemachine.h b/src/imports/statemachine/statemachine.h
index 66a3d49a52..6abcfabb7c 100644
--- a/src/imports/statemachine/statemachine.h
+++ b/src/imports/statemachine/statemachine.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Ford Motor Company
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/imports/statemachine/timeouttransition.cpp b/src/imports/statemachine/timeouttransition.cpp
index fdfb70eaab..10a11a0fdd 100644
--- a/src/imports/statemachine/timeouttransition.cpp
+++ b/src/imports/statemachine/timeouttransition.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Ford Motor Company
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/imports/statemachine/timeouttransition.h b/src/imports/statemachine/timeouttransition.h
index 9f4ab73354..85ba4cb246 100644
--- a/src/imports/statemachine/timeouttransition.h
+++ b/src/imports/statemachine/timeouttransition.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Ford Motor Company
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/imports/testlib/SignalSpy.qml b/src/imports/testlib/SignalSpy.qml
index e483e6f71f..fd7dc55a32 100644
--- a/src/imports/testlib/SignalSpy.qml
+++ b/src/imports/testlib/SignalSpy.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml
index 160e0bdb62..039ee63f07 100644
--- a/src/imports/testlib/TestCase.qml
+++ b/src/imports/testlib/TestCase.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -191,7 +191,7 @@ import Qt.test.qtestroot 1.0
}
\endcode
- The mousePress(), mouseRelease(), mouseClick(), mouseDoubleClick(),
+ The mousePress(), mouseRelease(), mouseClick(), mouseDoubleClick(), mouseDoubleClickSequence()
and mouseMove() methods can be used to simulate mouse events in a
similar fashion.
@@ -846,6 +846,8 @@ Item {
function waitForRendering(item, timeout) {
if (timeout === undefined)
timeout = 5000
+ if (!item)
+ qtest_fail("No item given to waitForRendering", 1)
return qtest_results.waitForRendering(item, timeout)
}
@@ -932,19 +934,20 @@ Item {
}
/*!
- \qmlmethod TestCase::mousePress(item, x, y, button = Qt.LeftButton, modifiers = Qt.NoModifier, delay = -1)
+ \qmlmethod TestCase::mousePress(item, x = item.width / 2, y = item.height / 2, button = Qt.LeftButton, modifiers = Qt.NoModifier, delay = -1)
Simulates pressing a mouse \a button with an optional \a modifier
- on an \a item. The position is defined by \a x and \a y. If \a delay is
- specified, the test will wait for the specified amount of milliseconds
- before the press.
+ on an \a item. The position is defined by \a x and \a y.
+ If \a x or \a y are not defined the position will be the center of \a item.
+ If \a delay is specified, the test will wait for the specified amount of
+ milliseconds before the press.
The position given by \a x and \a y is transformed from the co-ordinate
system of \a item into window co-ordinates and then delivered.
If \a item is obscured by another item, or a child of \a item occupies
that position, then the event will be delivered to the other item instead.
- \sa mouseRelease(), mouseClick(), mouseDoubleClick(), mouseMove(), mouseDrag(), mouseWheel()
+ \sa mouseRelease(), mouseClick(), mouseDoubleClick(), mouseDoubleClickSequence(), mouseMove(), mouseDrag(), mouseWheel()
*/
function mousePress(item, x, y, button, modifiers, delay) {
if (button === undefined)
@@ -953,15 +956,20 @@ Item {
modifiers = Qt.NoModifier
if (delay == undefined)
delay = -1
+ if (x === undefined)
+ x = item.width / 2
+ if (y === undefined)
+ y = item.height / 2
if (!qtest_events.mousePress(item, x, y, button, modifiers, delay))
qtest_fail("window not shown", 2)
}
/*!
- \qmlmethod TestCase::mouseRelease(item, x, y, button = Qt.LeftButton, modifiers = Qt.NoModifier, delay = -1)
+ \qmlmethod TestCase::mouseRelease(item, x = item.width / 2, y = item.height / 2, button = Qt.LeftButton, modifiers = Qt.NoModifier, delay = -1)
Simulates releasing a mouse \a button with an optional \a modifier
on an \a item. The position of the release is defined by \a x and \a y.
+ If \a x or \a y are not defined the position will be the center of \a item.
If \a delay is specified, the test will wait for the specified amount of
milliseconds before releasing the button.
@@ -970,7 +978,7 @@ Item {
If \a item is obscured by another item, or a child of \a item occupies
that position, then the event will be delivered to the other item instead.
- \sa mousePress(), mouseClick(), mouseDoubleClick(), mouseMove(), mouseDrag(), mouseWheel()
+ \sa mousePress(), mouseClick(), mouseDoubleClick(), mouseDoubleClickSequence(), mouseMove(), mouseDrag(), mouseWheel()
*/
function mouseRelease(item, x, y, button, modifiers, delay) {
if (button === undefined)
@@ -979,6 +987,10 @@ Item {
modifiers = Qt.NoModifier
if (delay == undefined)
delay = -1
+ if (x === undefined)
+ x = item.width / 2
+ if (y === undefined)
+ y = item.height / 2
if (!qtest_events.mouseRelease(item, x, y, button, modifiers, delay))
qtest_fail("window not shown", 2)
}
@@ -999,7 +1011,7 @@ Item {
Note: this method does not imply a drop action, to make a drop, an additional
mouseRelease(item, x + dx, y + dy) is needed.
- \sa mousePress(), mouseClick(), mouseDoubleClick(), mouseMove(), mouseRelease(), mouseWheel()
+ \sa mousePress(), mouseClick(), mouseDoubleClick(), mouseDoubleClickSequence(), mouseMove(), mouseRelease(), mouseWheel()
*/
function mouseDrag(item, x, y, dx, dy, button, modifiers, delay) {
if (item.x === undefined || item.y === undefined)
@@ -1033,10 +1045,11 @@ Item {
}
/*!
- \qmlmethod TestCase::mouseClick(item, x, y, button = Qt.LeftButton, modifiers = Qt.NoModifier, delay = -1)
+ \qmlmethod TestCase::mouseClick(item, x = item.width / 2, y = item.height / 2, button = Qt.LeftButton, modifiers = Qt.NoModifier, delay = -1)
Simulates clicking a mouse \a button with an optional \a modifier
on an \a item. The position of the click is defined by \a x and \a y.
+ If \a x and \a y are not defined the position will be the center of \a item.
If \a delay is specified, the test will wait for the specified amount of
milliseconds before pressing and before releasing the button.
@@ -1045,7 +1058,7 @@ Item {
If \a item is obscured by another item, or a child of \a item occupies
that position, then the event will be delivered to the other item instead.
- \sa mousePress(), mouseRelease(), mouseDoubleClick(), mouseMove(), mouseDrag(), mouseWheel()
+ \sa mousePress(), mouseRelease(), mouseDoubleClick(), mouseDoubleClickSequence(), mouseMove(), mouseDrag(), mouseWheel()
*/
function mouseClick(item, x, y, button, modifiers, delay) {
if (button === undefined)
@@ -1054,15 +1067,20 @@ Item {
modifiers = Qt.NoModifier
if (delay == undefined)
delay = -1
+ if (x === undefined)
+ x = item.width / 2
+ if (y === undefined)
+ y = item.height / 2
if (!qtest_events.mouseClick(item, x, y, button, modifiers, delay))
qtest_fail("window not shown", 2)
}
/*!
- \qmlmethod TestCase::mouseDoubleClick(item, x, y, button = Qt.LeftButton, modifiers = Qt.NoModifier, delay = -1)
+ \qmlmethod TestCase::mouseDoubleClick(item, x = item.width / 2, y = item.height / 2, button = Qt.LeftButton, modifiers = Qt.NoModifier, delay = -1)
Simulates double-clicking a mouse \a button with an optional \a modifier
on an \a item. The position of the click is defined by \a x and \a y.
+ If \a x and \a y are not defined the position will be the center of \a item.
If \a delay is specified, the test will wait for the specified amount of
milliseconds before pressing and before releasing the button.
@@ -1071,7 +1089,7 @@ Item {
If \a item is obscured by another item, or a child of \a item occupies
that position, then the event will be delivered to the other item instead.
- \sa mousePress(), mouseRelease(), mouseClick(), mouseMove(), mouseDrag(), mouseWheel()
+ \sa mouseDoubleClickSequence(), mousePress(), mouseRelease(), mouseClick(), mouseMove(), mouseDrag(), mouseWheel()
*/
function mouseDoubleClick(item, x, y, button, modifiers, delay) {
if (button === undefined)
@@ -1080,11 +1098,53 @@ Item {
modifiers = Qt.NoModifier
if (delay == undefined)
delay = -1
+ if (x === undefined)
+ x = item.width / 2
+ if (y === undefined)
+ y = item.height / 2
if (!qtest_events.mouseDoubleClick(item, x, y, button, modifiers, delay))
qtest_fail("window not shown", 2)
}
/*!
+ \qmlmethod TestCase::mouseDoubleClickSequence(item, x = item.width / 2, y = item.height / 2, button = Qt.LeftButton, modifiers = Qt.NoModifier, delay = -1)
+
+ Simulates the full sequence of events generated by double-clicking a mouse
+ \a button with an optional \a modifier on an \a item.
+
+ This method reproduces the sequence of mouse events generated when a user makes
+ a double click: Press-Release-Press-DoubleClick-Release.
+
+ The position of the click is defined by \a x and \a y.
+ If \a x and \a y are not defined the position will be the center of \a item.
+ If \a delay is specified, the test will wait for the specified amount of
+ milliseconds before pressing and before releasing the button.
+
+ The position given by \a x and \a y is transformed from the co-ordinate
+ system of \a item into window co-ordinates and then delivered.
+ If \a item is obscured by another item, or a child of \a item occupies
+ that position, then the event will be delivered to the other item instead.
+
+ This QML method was introduced in Qt 5.5.
+
+ \sa mouseDoubleClick(), mousePress(), mouseRelease(), mouseClick(), mouseMove(), mouseDrag(), mouseWheel()
+ */
+ function mouseDoubleClickSequence(item, x, y, button, modifiers, delay) {
+ if (button === undefined)
+ button = Qt.LeftButton
+ if (modifiers === undefined)
+ modifiers = Qt.NoModifier
+ if (delay == undefined)
+ delay = -1
+ if (x === undefined)
+ x = item.width / 2
+ if (y === undefined)
+ y = item.height / 2
+ if (!qtest_events.mouseDoubleClickSequence(item, x, y, button, modifiers, delay))
+ qtest_fail("window not shown", 2)
+ }
+
+ /*!
\qmlmethod TestCase::mouseMove(item, x, y, delay = -1)
Moves the mouse pointer to the position given by \a x and \a y within
@@ -1096,7 +1156,7 @@ Item {
If \a item is obscured by another item, or a child of \a item occupies
that position, then the event will be delivered to the other item instead.
- \sa mousePress(), mouseRelease(), mouseClick(), mouseDoubleClick(), mouseDrag(), mouseWheel()
+ \sa mousePress(), mouseRelease(), mouseClick(), mouseDoubleClick(), mouseDoubleClickSequence(), mouseDrag(), mouseWheel()
*/
function mouseMove(item, x, y, delay, buttons) {
if (delay == undefined)
@@ -1121,7 +1181,7 @@ Item {
The \a xDelta and \a yDelta contain the wheel rotation distance in eighths of a degree. see \l QWheelEvent::angleDelta() for more details.
- \sa mousePress(), mouseClick(), mouseDoubleClick(), mouseMove(), mouseRelease(), mouseDrag(), QWheelEvent::angleDelta()
+ \sa mousePress(), mouseClick(), mouseDoubleClick(), mouseDoubleClickSequence(), mouseMove(), mouseRelease(), mouseDrag(), QWheelEvent::angleDelta()
*/
function mouseWheel(item, x, y, xDelta, yDelta, buttons, modifiers, delay) {
if (delay == undefined)
@@ -1211,6 +1271,9 @@ Item {
qtest_results.finishTestData()
qtest_runInternal("cleanup")
qtest_results.finishTestDataCleanup()
+ // wait(0) will call processEvents() so objects marked for deletion
+ // in the test function will be deleted.
+ wait(0)
}
}
@@ -1242,6 +1305,9 @@ Item {
// Run the cleanup function.
qtest_runInternal("cleanup")
qtest_results.finishTestDataCleanup()
+ // wait(0) will call processEvents() so objects marked for deletion
+ // in the test function will be deleted.
+ wait(0)
} while (!qtest_results.measurementAccepted())
qtest_results.endDataRun()
} while (qtest_results.needsMoreMeasurements())
@@ -1358,9 +1424,6 @@ Item {
} else {
qtest_runFunction(prop, null, isBenchmark)
}
- // wait(0) will call processEvents() so objects marked for deletion
- // in the test function will be deleted.
- wait(0)
qtest_results.finishTestFunction()
qtest_results.skipped = false
}
diff --git a/src/imports/testlib/main.cpp b/src/imports/testlib/main.cpp
index 6e28101530..c42ece5da5 100644
--- a/src/imports/testlib/main.cpp
+++ b/src/imports/testlib/main.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -66,7 +66,7 @@ public:
{
return QTest::printAvailableFunctions;
}
- int dragThreshold() const { return qApp->styleHints()->startDragDistance(); }
+ int dragThreshold() const { return QGuiApplication::styleHints()->startDragDistance(); }
Q_SIGNALS:
void printAvailableFunctionsChanged();
diff --git a/src/imports/testlib/testlogger.js b/src/imports/testlib/testlogger.js
index 64287cebb1..ade8b1f931 100644
--- a/src/imports/testlib/testlogger.js
+++ b/src/imports/testlib/testlogger.js
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/imports/window/plugin.cpp b/src/imports/window/plugin.cpp
index 68ecda2dce..010e9b3eed 100644
--- a/src/imports/window/plugin.cpp
+++ b/src/imports/window/plugin.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/imports/xmllistmodel/plugin.cpp b/src/imports/xmllistmodel/plugin.cpp
index 91adb3e2ad..8a9d4379c4 100644
--- a/src/imports/xmllistmodel/plugin.cpp
+++ b/src/imports/xmllistmodel/plugin.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
index 225eedb578..b078edcbc6 100644
--- a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
+++ b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -925,7 +925,7 @@ QQmlV4Handle QQuickXmlListModel::get(int index) const
ScopedValue value(scope);
for (int ii = 0; ii < d->roleObjects.count(); ++ii) {
name = v4engine->newIdentifier(d->roleObjects[ii]->name());
- value = v8engine->fromVariant(d->data.value(ii).value(index));
+ value = v4engine->fromVariant(d->data.value(ii).value(index));
o->insertMember(name.getPointer(), value);
}
diff --git a/src/imports/xmllistmodel/qqmlxmllistmodel_p.h b/src/imports/xmllistmodel/qqmlxmllistmodel_p.h
index 7b1431612f..5b54d0aff6 100644
--- a/src/imports/xmllistmodel/qqmlxmllistmodel_p.h
+++ b/src/imports/xmllistmodel/qqmlxmllistmodel_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickage.cpp b/src/particles/qquickage.cpp
index aa830784da..a99352cf7c 100644
--- a/src/particles/qquickage.cpp
+++ b/src/particles/qquickage.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickage_p.h b/src/particles/qquickage_p.h
index f21ffcb5d3..cf7d1d80cb 100644
--- a/src/particles/qquickage_p.h
+++ b/src/particles/qquickage_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickangledirection.cpp b/src/particles/qquickangledirection.cpp
index 9fec60e386..3fa5d21108 100644
--- a/src/particles/qquickangledirection.cpp
+++ b/src/particles/qquickangledirection.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -33,10 +33,8 @@
#include "qquickangledirection_p.h"
#include <stdlib.h>
-#include <cmath>
-#ifdef Q_OS_QNX
-#include <math.h>
-#endif
+#include <qmath.h>
+
QT_BEGIN_NAMESPACE
const qreal CONV = 0.017453292519943295;
/*!
@@ -106,8 +104,8 @@ const QPointF QQuickAngleDirection::sample(const QPointF &from)
QPointF ret;
qreal theta = m_angle*CONV - m_angleVariation*CONV + rand()/float(RAND_MAX) * m_angleVariation*CONV * 2;
qreal mag = m_magnitude- m_magnitudeVariation + rand()/float(RAND_MAX) * m_magnitudeVariation * 2;
- ret.setX(mag * cos(theta));
- ret.setY(mag * sin(theta));
+ ret.setX(mag * qCos(theta));
+ ret.setY(mag * qSin(theta));
return ret;
}
diff --git a/src/particles/qquickangledirection_p.h b/src/particles/qquickangledirection_p.h
index 433e88ea67..eaae53ef0a 100644
--- a/src/particles/qquickangledirection_p.h
+++ b/src/particles/qquickangledirection_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickcumulativedirection.cpp b/src/particles/qquickcumulativedirection.cpp
index d791060a08..20f31b7fac 100644
--- a/src/particles/qquickcumulativedirection.cpp
+++ b/src/particles/qquickcumulativedirection.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickcumulativedirection_p.h b/src/particles/qquickcumulativedirection_p.h
index 060f1f7642..d9e19542cf 100644
--- a/src/particles/qquickcumulativedirection_p.h
+++ b/src/particles/qquickcumulativedirection_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickcustomaffector.cpp b/src/particles/qquickcustomaffector.cpp
index 874371632e..bbaf2893e3 100644
--- a/src/particles/qquickcustomaffector.cpp
+++ b/src/particles/qquickcustomaffector.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -141,7 +141,7 @@ void QQuickCustomAffector::affectSystem(qreal dt)
QV4::ExecutionEngine *v4 = QV8Engine::getV4(qmlEngine->handle());
QV4::Scope scope(v4);
- QV4::Scoped<QV4::ArrayObject> array(scope, v4->newArrayObject(toAffect.size()));
+ QV4::ScopedArrayObject array(scope, v4->newArrayObject(toAffect.size()));
QV4::ScopedValue v(scope);
for (int i=0; i<toAffect.size(); i++)
array->putIndexed(i, (v = toAffect[i]->v4Value()));
diff --git a/src/particles/qquickcustomaffector_p.h b/src/particles/qquickcustomaffector_p.h
index e1c356cee3..931db97edf 100644
--- a/src/particles/qquickcustomaffector_p.h
+++ b/src/particles/qquickcustomaffector_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickcustomparticle.cpp b/src/particles/qquickcustomparticle.cpp
index b656e7ec28..32cde7c126 100644
--- a/src/particles/qquickcustomparticle.cpp
+++ b/src/particles/qquickcustomparticle.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -303,6 +303,8 @@ QQuickShaderEffectNode *QQuickCustomParticle::prepareNextFrame(QQuickShaderEffec
QQuickShaderEffectNode* QQuickCustomParticle::buildCustomNodes()
{
+ typedef QHash<int, QQuickShaderEffectNode*>::const_iterator NodeHashConstIt;
+
if (!QOpenGLContext::currentContext())
return 0;
@@ -368,10 +370,11 @@ QQuickShaderEffectNode* QQuickCustomParticle::buildCustomNodes()
}
}
- QHash<int, QQuickShaderEffectNode*>::const_iterator it = m_nodes.begin();
+ NodeHashConstIt it = m_nodes.begin();
rootNode = it.value();
rootNode->setFlag(QSGNode::OwnsMaterial, true);
- for (++it; it != m_nodes.end(); ++it)
+ const NodeHashConstIt cend = m_nodes.end();
+ for (++it; it != cend; ++it)
rootNode->appendChildNode(it.value());
return rootNode;
diff --git a/src/particles/qquickcustomparticle_p.h b/src/particles/qquickcustomparticle_p.h
index 8465e745ef..85e609a499 100644
--- a/src/particles/qquickcustomparticle_p.h
+++ b/src/particles/qquickcustomparticle_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickdirection.cpp b/src/particles/qquickdirection.cpp
index 1f1eb1a55e..1caecfc56a 100644
--- a/src/particles/qquickdirection.cpp
+++ b/src/particles/qquickdirection.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickdirection_p.h b/src/particles/qquickdirection_p.h
index ce2ef69c76..9dacb6db0e 100644
--- a/src/particles/qquickdirection_p.h
+++ b/src/particles/qquickdirection_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickellipseextruder.cpp b/src/particles/qquickellipseextruder.cpp
index da65f03c13..6d4e25197f 100644
--- a/src/particles/qquickellipseextruder.cpp
+++ b/src/particles/qquickellipseextruder.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -32,12 +32,8 @@
****************************************************************************/
#include "qquickellipseextruder_p.h"
+#include <qmath.h>
#include <stdlib.h>
-#include <cmath>
-
-#ifdef Q_OS_QNX
-#include <math.h>
-#endif
QT_BEGIN_NAMESPACE
/*!
@@ -68,8 +64,8 @@ QPointF QQuickEllipseExtruder::extrude(const QRectF & r)
{
qreal theta = ((qreal)rand()/RAND_MAX) * 6.2831853071795862;
qreal mag = m_fill ? ((qreal)rand()/RAND_MAX) : 1;
- return QPointF(r.x() + r.width()/2 + mag * (r.width()/2) * cos(theta),
- r.y() + r.height()/2 + mag * (r.height()/2) * sin(theta));
+ return QPointF(r.x() + r.width()/2 + mag * (r.width()/2) * qCos(theta),
+ r.y() + r.height()/2 + mag * (r.height()/2) * qSin(theta));
}
bool QQuickEllipseExtruder::contains(const QRectF &bounds, const QPointF &point)
diff --git a/src/particles/qquickellipseextruder_p.h b/src/particles/qquickellipseextruder_p.h
index 76ecfaea6c..bb766ac8de 100644
--- a/src/particles/qquickellipseextruder_p.h
+++ b/src/particles/qquickellipseextruder_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickfriction.cpp b/src/particles/qquickfriction.cpp
index 94e915fafc..8f46575e1c 100644
--- a/src/particles/qquickfriction.cpp
+++ b/src/particles/qquickfriction.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -32,7 +32,7 @@
****************************************************************************/
#include "qquickfriction_p.h"
-#include <math.h>
+#include <qmath.h>
QT_BEGIN_NAMESPACE
/*!
@@ -87,16 +87,16 @@ bool QQuickFrictionAffector::affectParticle(QQuickParticleData *d, qreal dt)
if (sign(curVY) != sign(newVY))
newVY = 0;
} else {
- qreal curMag = sqrt(curVX*curVX + curVY*curVY);
+ qreal curMag = qSqrt(curVX*curVX + curVY*curVY);
if (curMag <= m_threshold + epsilon)
return false;
- qreal newMag = sqrt(newVX*newVX + newVY*newVY);
+ qreal newMag = qSqrt(newVX*newVX + newVY*newVY);
if (newMag <= m_threshold + epsilon || //went past the threshold, stop there instead
sign(curVX) != sign(newVX) || //went so far past maybe it came out the other side!
sign(curVY) != sign(newVY)) {
- qreal theta = atan2(curVY, curVX);
- newVX = m_threshold * cos(theta);
- newVY = m_threshold * sin(theta);
+ qreal theta = qAtan2(curVY, curVX);
+ newVX = m_threshold * qCos(theta);
+ newVY = m_threshold * qSin(theta);
}
}
diff --git a/src/particles/qquickfriction_p.h b/src/particles/qquickfriction_p.h
index 3e8192e5b8..9f09e8ff97 100644
--- a/src/particles/qquickfriction_p.h
+++ b/src/particles/qquickfriction_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickgravity.cpp b/src/particles/qquickgravity.cpp
index 0e96b83ecd..e15fe95de1 100644
--- a/src/particles/qquickgravity.cpp
+++ b/src/particles/qquickgravity.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickgravity_p.h b/src/particles/qquickgravity_p.h
index 208fa94971..b20de84607 100644
--- a/src/particles/qquickgravity_p.h
+++ b/src/particles/qquickgravity_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickgroupgoal.cpp b/src/particles/qquickgroupgoal.cpp
index 0cd37f4472..18f91750fb 100644
--- a/src/particles/qquickgroupgoal.cpp
+++ b/src/particles/qquickgroupgoal.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickgroupgoal_p.h b/src/particles/qquickgroupgoal_p.h
index cb3cb8691b..fe5d653ecc 100644
--- a/src/particles/qquickgroupgoal_p.h
+++ b/src/particles/qquickgroupgoal_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickimageparticle.cpp b/src/particles/qquickimageparticle.cpp
index 3ba0e69039..7df3299325 100644
--- a/src/particles/qquickimageparticle.cpp
+++ b/src/particles/qquickimageparticle.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -148,8 +148,8 @@ public:
program()->setUniformValue(m_timestamp_id, (float) d->timestamp);
program()->setUniformValue(m_entry_id, (float) d->entry);
- program()->setUniformValueArray(m_sizetable_id, (float*) d->sizeTable, UNIFORM_ARRAY_SIZE, 1);
- program()->setUniformValueArray(m_opacitytable_id, (float*) d->opacityTable, UNIFORM_ARRAY_SIZE, 1);
+ program()->setUniformValueArray(m_sizetable_id, (const float*) d->sizeTable, UNIFORM_ARRAY_SIZE, 1);
+ program()->setUniformValueArray(m_opacitytable_id, (const float*) d->opacityTable, UNIFORM_ARRAY_SIZE, 1);
}
int m_entry_id;
@@ -295,8 +295,8 @@ public:
program()->setUniformValue(m_timestamp_id, (float) d->timestamp);
program()->setUniformValue(m_entry_id, (float) d->entry);
- program()->setUniformValueArray(m_sizetable_id, (float*) d->sizeTable, 64, 1);
- program()->setUniformValueArray(m_opacitytable_id, (float*) d->opacityTable, UNIFORM_ARRAY_SIZE, 1);
+ program()->setUniformValueArray(m_sizetable_id, (const float*) d->sizeTable, 64, 1);
+ program()->setUniformValueArray(m_opacitytable_id, (const float*) d->opacityTable, UNIFORM_ARRAY_SIZE, 1);
}
int m_timestamp_id;
@@ -1271,7 +1271,7 @@ void QQuickImageParticle::finishBuildParticleNodes(QSGNode** node)
#endif
#ifdef Q_OS_MAC
- // Mac OS X 10.8.3 introduced a bug in the AMD drivers, for at least the 2011 macbook pros,
+ // OS X 10.8.3 introduced a bug in the AMD drivers, for at least the 2011 macbook pros,
// causing point sprites who read gl_PointCoord in the frag shader to come out as
// green-red blobs.
if (perfLevel < Deformable && strstr((char *) glGetString(GL_VENDOR), "ATI")) {
@@ -1281,7 +1281,7 @@ void QQuickImageParticle::finishBuildParticleNodes(QSGNode** node)
#ifdef Q_OS_LINUX
// Nouveau drivers can potentially freeze a machine entirely when taking the point-sprite path.
- if (perfLevel < Deformable && strstr((char *) glGetString(GL_VENDOR), "nouveau"))
+ if (perfLevel < Deformable && strstr((const char *) glGetString(GL_VENDOR), "nouveau"))
perfLevel = Deformable;
#endif
diff --git a/src/particles/qquickimageparticle_p.h b/src/particles/qquickimageparticle_p.h
index 657d945bca..7d7d98dab6 100644
--- a/src/particles/qquickimageparticle_p.h
+++ b/src/particles/qquickimageparticle_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickitemparticle.cpp b/src/particles/qquickitemparticle.cpp
index 3c6e249a4a..787a63ebc5 100644
--- a/src/particles/qquickitemparticle.cpp
+++ b/src/particles/qquickitemparticle.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -65,11 +65,25 @@ QT_BEGIN_NAMESPACE
/*!
\qmlmethod QtQuick.Particles::ItemParticle::take(Item item, bool prioritize)
- Asks the ItemParticle to take over control of item. It will be emitted when there is a logical particle available.
+ Asks the ItemParticle to take over control of item positioning temporarily.
+ It will follow the movement of a logical particle when one is available.
By default items form a queue when waiting for a logical particle, but if prioritize is true then it will go immediately to the
head of the queue.
+
+ ItemParticle does not take ownership of the item, and will relinquish
+ control when the logical particle expires. Commonly at this point you will
+ want to put it back in the queue, you can do this with the below line in
+ the delegate definition:
+ \code
+ ItemParticle.onDetached: itemParticleInstance.take(delegateRootItem);
+ \endcode
+ or delete it, such as with the below line in the delegate definition:
+ \code
+ ItemParticle.onDetached: delegateRootItem.destroy();
+ \endcode
*/
+
/*!
\qmlmethod QtQuick.Particles::ItemParticle::give(Item item)
@@ -88,8 +102,13 @@ QT_BEGIN_NAMESPACE
/*!
\qmlproperty Component QtQuick.Particles::ItemParticle::delegate
- An instance of the delegate will be created for every logical
- particle, and moved along with it.
+ An instance of the delegate will be created for every logical particle, and
+ moved along with it. As an alternative to using delegate, you can create
+ Item instances yourself and hand them to the ItemParticle to move using the
+ \l take method.
+
+ Any delegate instances created by ItemParticle will be destroyed when
+ the logical particle expires.
*/
QQuickItemParticle::QQuickItemParticle(QQuickItem *parent) :
@@ -139,9 +158,8 @@ void QQuickItemParticle::commit(int, int)
{
}
-void QQuickItemParticle::tick(int time)
+void QQuickItemParticle::processDeletables()
{
- Q_UNUSED(time);//only needed because QTickAnimationProxy expects one
foreach (QQuickItem* item, m_deletables){
if (m_fade)
item->setOpacity(0.);
@@ -149,26 +167,39 @@ void QQuickItemParticle::tick(int time)
QQuickItemParticleAttached* mpa;
if ((mpa = qobject_cast<QQuickItemParticleAttached*>(qmlAttachedPropertiesObject<QQuickItemParticle>(item))))
mpa->detach();//reparent as well?
- //TODO: Delete iff we created it
+ int idx = -1;
+ if ((idx = m_managed.indexOf(item)) != -1) {
+ m_managed.takeAt(idx);
+ delete item;
+ }
m_activeCount--;
}
m_deletables.clear();
+}
+
+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)
+ if (d->delegate) {
m_deletables << d->delegate;
- d->delegate = 0;
+ d->delegate = 0;
+ }
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->delegate && d){//###Data can be zero if creating an item leads to a reset - this screws things up.
+ 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() - d->delegate->width()/2);//TODO: adjust for system?
d->delegate->setY(d->curY() - d->delegate->height()/2);
QQuickItemParticleAttached* mpa = qobject_cast<QQuickItemParticleAttached*>(qmlAttachedPropertiesObject<QQuickItemParticle>(d->delegate));
@@ -190,8 +221,18 @@ void QQuickItemParticle::reset()
{
QQuickParticlePainter::reset();
m_loadables.clear();
- //TODO: Cleanup items?
- //deletables?
+
+ // delete all managed items which had their logical particles cleared
+ // but leave it alone if the logical particle is maintained
+ QSet<QQuickItem*> lost = QSet<QQuickItem*>::fromList(m_managed);
+ foreach (const QString group, m_groups){
+ int gIdx = m_system->groupIds[group];
+ foreach (QQuickParticleData* d, m_system->groupData[gIdx]->data)
+ lost.remove(d->delegate);
+ }
+ m_deletables.append(lost.toList());
+ //TODO: This doesn't yet handle calling detach on taken particles in the system reset case
+ processDeletables();
}
diff --git a/src/particles/qquickitemparticle_p.h b/src/particles/qquickitemparticle_p.h
index 24c33319c9..4f804a232a 100644
--- a/src/particles/qquickitemparticle_p.h
+++ b/src/particles/qquickitemparticle_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -88,8 +88,10 @@ protected:
virtual void initialize(int gIdx, int pIdx);
void prepareNextFrame();
private:
+ void processDeletables();
void tick(int time = 0);
QList<QQuickItem* > m_deletables;
+ QList<QQuickItem* > m_managed;
QList< QQuickParticleData* > m_loadables;
bool m_fade;
diff --git a/src/particles/qquicklineextruder.cpp b/src/particles/qquicklineextruder.cpp
index 082a04cdb4..fb7c57ccc8 100644
--- a/src/particles/qquicklineextruder.cpp
+++ b/src/particles/qquicklineextruder.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquicklineextruder_p.h b/src/particles/qquicklineextruder_p.h
index 4a73e143ea..77896e86e0 100644
--- a/src/particles/qquicklineextruder_p.h
+++ b/src/particles/qquicklineextruder_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickmaskextruder.cpp b/src/particles/qquickmaskextruder.cpp
index 400343cf6d..35a9f70758 100644
--- a/src/particles/qquickmaskextruder.cpp
+++ b/src/particles/qquickmaskextruder.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickmaskextruder_p.h b/src/particles/qquickmaskextruder_p.h
index 87a3a40589..9fc84dd5aa 100644
--- a/src/particles/qquickmaskextruder_p.h
+++ b/src/particles/qquickmaskextruder_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickparticleaffector.cpp b/src/particles/qquickparticleaffector.cpp
index f81a4f5a53..a5a042deb6 100644
--- a/src/particles/qquickparticleaffector.cpp
+++ b/src/particles/qquickparticleaffector.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickparticleaffector_p.h b/src/particles/qquickparticleaffector_p.h
index a888fc1d73..8dfc98dde7 100644
--- a/src/particles/qquickparticleaffector_p.h
+++ b/src/particles/qquickparticleaffector_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickparticleemitter.cpp b/src/particles/qquickparticleemitter.cpp
index 9c7d9facf3..e34356aa66 100644
--- a/src/particles/qquickparticleemitter.cpp
+++ b/src/particles/qquickparticleemitter.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -234,8 +234,6 @@ QQuickParticleEmitter::QQuickParticleEmitter(QQuickItem *parent) :
{
//TODO: Reset velocity/acc back to null vector? Or allow null pointer?
- connect(this, SIGNAL(maximumEmittedChanged(int)),
- this, SIGNAL(particleCountChanged()));
connect(this, SIGNAL(particlesPerSecondChanged(qreal)),
this, SIGNAL(particleCountChanged()));
connect(this, SIGNAL(particleDurationChanged(int)),
@@ -311,6 +309,7 @@ void QQuickParticleEmitter::setMaxParticleCount(int arg)
m_overwrite = arg < 0;
m_maxParticleCount = arg;
emit maximumEmittedChanged(arg);
+ emit particleCountChanged();
}
}
@@ -479,7 +478,7 @@ void QQuickParticleEmitter::emitWindow(int timeStamp)
//Done after emitParticle so that the Painter::load is done first, this allows you to customize its static variables
//We then don't need to request another reload, because the first reload isn't scheduled until we get back to the render thread
- QV4::Scoped<QV4::ArrayObject> array(scope, v4->newArrayObject(toEmit.size()));
+ QV4::ScopedArrayObject array(scope, v4->newArrayObject(toEmit.size()));
QV4::ScopedValue v(scope);
for (int i=0; i<toEmit.size(); i++)
array->putIndexed(i, (v = toEmit[i]->v4Value()));
diff --git a/src/particles/qquickparticleemitter_p.h b/src/particles/qquickparticleemitter_p.h
index fe6d4dd0c0..65e2a34aa7 100644
--- a/src/particles/qquickparticleemitter_p.h
+++ b/src/particles/qquickparticleemitter_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickparticleextruder.cpp b/src/particles/qquickparticleextruder.cpp
index 2ae2decbc8..6360bddc74 100644
--- a/src/particles/qquickparticleextruder.cpp
+++ b/src/particles/qquickparticleextruder.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickparticleextruder_p.h b/src/particles/qquickparticleextruder_p.h
index a140ec96d0..6367c44429 100644
--- a/src/particles/qquickparticleextruder_p.h
+++ b/src/particles/qquickparticleextruder_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickparticlegroup.cpp b/src/particles/qquickparticlegroup.cpp
index 2e70f9afdb..3582ec8abc 100644
--- a/src/particles/qquickparticlegroup.cpp
+++ b/src/particles/qquickparticlegroup.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickparticlegroup_p.h b/src/particles/qquickparticlegroup_p.h
index 4b0323dd77..cbc1932524 100644
--- a/src/particles/qquickparticlegroup_p.h
+++ b/src/particles/qquickparticlegroup_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickparticlepainter.cpp b/src/particles/qquickparticlepainter.cpp
index f83e0cd278..77984e897e 100644
--- a/src/particles/qquickparticlepainter.cpp
+++ b/src/particles/qquickparticlepainter.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickparticlepainter_p.h b/src/particles/qquickparticlepainter_p.h
index b877643ccf..df6dc5c192 100644
--- a/src/particles/qquickparticlepainter_p.h
+++ b/src/particles/qquickparticlepainter_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickparticlesmodule.cpp b/src/particles/qquickparticlesmodule.cpp
index 725c00c0a9..9cde85479a 100644
--- a/src/particles/qquickparticlesmodule.cpp
+++ b/src/particles/qquickparticlesmodule.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickparticlesmodule_p.h b/src/particles/qquickparticlesmodule_p.h
index 426918dbe0..02168af8cd 100644
--- a/src/particles/qquickparticlesmodule_p.h
+++ b/src/particles/qquickparticlesmodule_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickparticlesystem.cpp b/src/particles/qquickparticlesystem.cpp
index 51a92de00f..affd19d981 100644
--- a/src/particles/qquickparticlesystem.cpp
+++ b/src/particles/qquickparticlesystem.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -427,11 +427,11 @@ void QQuickParticleGroupData::prepareRecycler(QQuickParticleData* d)
}
QQuickParticleData::QQuickParticleData(QQuickParticleSystem* sys)
- : group(0)
- , e(0)
+ : e(0)
, system(sys)
, index(0)
, systemIndex(-1)
+ , group(0)
, colorOwner(0)
, rotationOwner(0)
, deformationOwner(0)
@@ -931,19 +931,26 @@ void QQuickParticleSystem::emittersChanged()
if (!m_componentComplete)
return;
- m_emitters.removeAll(0);
-
-
- QList<int> previousSizes;
- QList<int> newSizes;
+ QVector<int> previousSizes;
+ QVector<int> newSizes;
+ previousSizes.reserve(m_nextGroupId);
+ newSizes.reserve(m_nextGroupId);
for (int i=0; i<m_nextGroupId; i++) {
previousSizes << groupData[i]->size();
newSizes << 0;
}
- foreach (QQuickParticleEmitter* e, m_emitters) {//Populate groups and set sizes.
- if (!groupIds.contains(e->group())
- || (!e->group().isEmpty() && !groupIds[e->group()])) {//or it was accidentally inserted by a failed lookup earlier
+ // Populate groups and set sizes.
+ for (int i = 0; i < m_emitters.count(); ++i) {
+ QQuickParticleEmitter *e = m_emitters.at(i);
+ if (!e) {
+ m_emitters.removeAt(i);
+ i--;
+ continue;
+ }
+
+ if (!e->group().isEmpty() &&
+ !groupIds.contains(e->group())) {
int id = m_nextGroupId++;
QQuickParticleGroupData* gd = new QQuickParticleGroupData(id, this);
groupIds.insert(e->group(), id);
diff --git a/src/particles/qquickparticlesystem_p.h b/src/particles/qquickparticlesystem_p.h
index 4d6c153282..c8061916b5 100644
--- a/src/particles/qquickparticlesystem_p.h
+++ b/src/particles/qquickparticlesystem_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -164,7 +164,6 @@ public:
qreal curVY() const;
qreal curAY() const { return ay; }
- int group;
QQuickParticleEmitter* e;//### Needed?
QQuickParticleSystem* system;
int index;
@@ -203,18 +202,24 @@ public:
float animY;
float animWidth;
float animHeight;
+
+ int group;
+
//Used by ImageParticle data shadowing
QQuickImageParticle* colorOwner;
QQuickImageParticle* rotationOwner;
QQuickImageParticle* deformationOwner;
QQuickImageParticle* animationOwner;
- //Used by CustomParticle
- float r;
+
//Used by ItemParticle
QQuickItem* delegate;
int modelIndex;
//Used by custom affectors
float update;
+ //Used by CustomParticle
+ float r;
+
+ // 4 bytes wasted
void debugDump();
diff --git a/src/particles/qquickpointattractor.cpp b/src/particles/qquickpointattractor.cpp
index caa544f2b6..a421e87899 100644
--- a/src/particles/qquickpointattractor.cpp
+++ b/src/particles/qquickpointattractor.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickpointattractor_p.h b/src/particles/qquickpointattractor_p.h
index ad265e57df..aa2c9f2083 100644
--- a/src/particles/qquickpointattractor_p.h
+++ b/src/particles/qquickpointattractor_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickpointdirection.cpp b/src/particles/qquickpointdirection.cpp
index 85d5eea6da..ce30ae5ff6 100644
--- a/src/particles/qquickpointdirection.cpp
+++ b/src/particles/qquickpointdirection.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickpointdirection_p.h b/src/particles/qquickpointdirection_p.h
index 9447b0afbf..3975389a6b 100644
--- a/src/particles/qquickpointdirection_p.h
+++ b/src/particles/qquickpointdirection_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickrectangleextruder.cpp b/src/particles/qquickrectangleextruder.cpp
index 00c168e0e0..ced925824d 100644
--- a/src/particles/qquickrectangleextruder.cpp
+++ b/src/particles/qquickrectangleextruder.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickrectangleextruder_p.h b/src/particles/qquickrectangleextruder_p.h
index 5fc9096eec..8ed535eaea 100644
--- a/src/particles/qquickrectangleextruder_p.h
+++ b/src/particles/qquickrectangleextruder_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickspritegoal.cpp b/src/particles/qquickspritegoal.cpp
index 83470c3f16..87b0a698cc 100644
--- a/src/particles/qquickspritegoal.cpp
+++ b/src/particles/qquickspritegoal.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickspritegoal_p.h b/src/particles/qquickspritegoal_p.h
index ee36ab38fd..1ddfe14ac3 100644
--- a/src/particles/qquickspritegoal_p.h
+++ b/src/particles/qquickspritegoal_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquicktargetdirection.cpp b/src/particles/qquicktargetdirection.cpp
index 98da6b1dda..2cd4675ae5 100644
--- a/src/particles/qquicktargetdirection.cpp
+++ b/src/particles/qquicktargetdirection.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquicktargetdirection_p.h b/src/particles/qquicktargetdirection_p.h
index 085d6f2da1..bde6144d7f 100644
--- a/src/particles/qquicktargetdirection_p.h
+++ b/src/particles/qquicktargetdirection_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquicktrailemitter.cpp b/src/particles/qquicktrailemitter.cpp
index d948f21820..98d34e06d5 100644
--- a/src/particles/qquicktrailemitter.cpp
+++ b/src/particles/qquicktrailemitter.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -264,7 +264,7 @@ void QQuickTrailEmitter::emitWindow(int timeStamp)
QV4::ExecutionEngine *v4 = QV8Engine::getV4(qmlEngine->handle());
QV4::Scope scope(v4);
- QV4::Scoped<QV4::ArrayObject> array(scope, v4->newArrayObject(toEmit.size()));
+ QV4::ScopedArrayObject array(scope, v4->newArrayObject(toEmit.size()));
QV4::ScopedValue v(scope);
for (int i=0; i<toEmit.size(); i++)
array->putIndexed(i, (v = toEmit[i]->v4Value()));
diff --git a/src/particles/qquicktrailemitter_p.h b/src/particles/qquicktrailemitter_p.h
index 163327393b..d1213158d8 100644
--- a/src/particles/qquicktrailemitter_p.h
+++ b/src/particles/qquicktrailemitter_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickturbulence.cpp b/src/particles/qquickturbulence.cpp
index 194df61eb8..11bae1107b 100644
--- a/src/particles/qquickturbulence.cpp
+++ b/src/particles/qquickturbulence.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickturbulence_p.h b/src/particles/qquickturbulence_p.h
index 4f47f2fe60..3c32bb6063 100644
--- a/src/particles/qquickturbulence_p.h
+++ b/src/particles/qquickturbulence_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickv4particledata.cpp b/src/particles/qquickv4particledata.cpp
index 4bac87eda4..fcab455cce 100644
--- a/src/particles/qquickv4particledata.cpp
+++ b/src/particles/qquickv4particledata.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -267,10 +267,9 @@ struct QV4ParticleData : public QV4::Object
{
struct Data : QV4::Object::Data {
Data(QV4::ExecutionEngine *engine, QQuickParticleData *datum)
- : Object::Data(engine)
+ : QV4::Heap::Object(engine)
, datum(datum)
{
- setVTable(QV4ParticleData::staticVTable());
}
QQuickParticleData* datum;//TODO: Guard needed?
};
@@ -279,11 +278,11 @@ struct QV4ParticleData : public QV4::Object
DEFINE_OBJECT_VTABLE(QV4ParticleData);
-class QV8ParticleDataDeletable : public QV8Engine::Deletable
+class QV4ParticleDataDeletable : public QV8Engine::Deletable
{
public:
- QV8ParticleDataDeletable(QV8Engine *engine);
- ~QV8ParticleDataDeletable();
+ QV4ParticleDataDeletable(QV4::ExecutionEngine *engine);
+ ~QV4ParticleDataDeletable();
QV4::PersistentValue proto;
};
@@ -291,10 +290,10 @@ public:
static QV4::ReturnedValue particleData_discard(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QV4ParticleData> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QV4ParticleData> r(scope, ctx->thisObject());
if (!r || !r->d()->datum)
- return ctx->throwError(QStringLiteral("Not a valid ParticleData object"));
+ return ctx->engine()->throwError(QStringLiteral("Not a valid ParticleData object"));
r->d()->datum->lifeSpan = 0; //Don't kill(), because it could still be in the middle of being created
return QV4::Encode::undefined();
@@ -303,10 +302,10 @@ static QV4::ReturnedValue particleData_discard(QV4::CallContext *ctx)
static QV4::ReturnedValue particleData_lifeLeft(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QV4ParticleData> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QV4ParticleData> r(scope, ctx->thisObject());
if (!r || !r->d()->datum)
- return ctx->throwError(QStringLiteral("Not a valid ParticleData object"));
+ return ctx->engine()->throwError(QStringLiteral("Not a valid ParticleData object"));
return QV4::Encode(r->d()->datum->lifeLeft());
}
@@ -314,19 +313,19 @@ static QV4::ReturnedValue particleData_lifeLeft(QV4::CallContext *ctx)
static QV4::ReturnedValue particleData_curSize(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QV4ParticleData> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QV4ParticleData> r(scope, ctx->thisObject());
if (!r || !r->d()->datum)
- return ctx->throwError(QStringLiteral("Not a valid ParticleData object"));
+ return ctx->engine()->throwError(QStringLiteral("Not a valid ParticleData object"));
return QV4::Encode(r->d()->datum->curSize());
}
#define COLOR_GETTER_AND_SETTER(VAR, NAME) static QV4::ReturnedValue particleData_get_ ## NAME (QV4::CallContext *ctx) \
{ \
QV4::Scope scope(ctx); \
- QV4::Scoped<QV4ParticleData> r(scope, ctx->d()->callData->thisObject); \
+ QV4::Scoped<QV4ParticleData> r(scope, ctx->thisObject()); \
if (!r || !r->d()->datum) \
- ctx->throwError(QStringLiteral("Not a valid ParticleData object")); \
+ ctx->engine()->throwError(QStringLiteral("Not a valid ParticleData object")); \
\
return QV4::Encode((r->d()->datum->color. VAR )/255.0);\
}\
@@ -334,12 +333,12 @@ static QV4::ReturnedValue particleData_curSize(QV4::CallContext *ctx)
static QV4::ReturnedValue particleData_set_ ## NAME (QV4::CallContext *ctx)\
{\
QV4::Scope scope(ctx); \
- QV4::Scoped<QV4ParticleData> r(scope, ctx->d()->callData->thisObject); \
+ QV4::Scoped<QV4ParticleData> r(scope, ctx->thisObject()); \
if (!r || !r->d()->datum)\
- ctx->throwError(QStringLiteral("Not a valid ParticleData object"));\
+ ctx->engine()->throwError(QStringLiteral("Not a valid ParticleData object"));\
\
- double d = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : 0; \
- r->d()->datum->color. VAR = qMin(255, qMax(0, (int)floor(d * 255.0)));\
+ double d = ctx->argc() ? ctx->args()[0].toNumber() : 0; \
+ r->d()->datum->color. VAR = qMin(255, qMax(0, (int)::floor(d * 255.0)));\
return QV4::Encode::undefined(); \
}
@@ -347,9 +346,9 @@ static QV4::ReturnedValue particleData_set_ ## NAME (QV4::CallContext *ctx)\
#define SEMIBOOL_GETTER_AND_SETTER(VARIABLE) static QV4::ReturnedValue particleData_get_ ## VARIABLE (QV4::CallContext *ctx) \
{ \
QV4::Scope scope(ctx); \
- QV4::Scoped<QV4ParticleData> r(scope, ctx->d()->callData->thisObject); \
+ QV4::Scoped<QV4ParticleData> r(scope, ctx->thisObject()); \
if (!r || !r->d()->datum) \
- ctx->throwError(QStringLiteral("Not a valid ParticleData object")); \
+ ctx->engine()->throwError(QStringLiteral("Not a valid ParticleData object")); \
\
return QV4::Encode(r->d()->datum-> VARIABLE);\
}\
@@ -357,20 +356,20 @@ static QV4::ReturnedValue particleData_set_ ## NAME (QV4::CallContext *ctx)\
static QV4::ReturnedValue particleData_set_ ## VARIABLE (QV4::CallContext *ctx)\
{\
QV4::Scope scope(ctx); \
- QV4::Scoped<QV4ParticleData> r(scope, ctx->d()->callData->thisObject); \
+ QV4::Scoped<QV4ParticleData> r(scope, ctx->thisObject()); \
if (!r || !r->d()->datum)\
- ctx->throwError(QStringLiteral("Not a valid ParticleData object"));\
+ ctx->engine()->throwError(QStringLiteral("Not a valid ParticleData object"));\
\
- r->d()->datum-> VARIABLE = (ctx->d()->callData->argc && ctx->d()->callData->args[0].toBoolean()) ? 1.0 : 0.0;\
+ r->d()->datum-> VARIABLE = (ctx->argc() && ctx->args()[0].toBoolean()) ? 1.0 : 0.0;\
return QV4::Encode::undefined(); \
}
#define FLOAT_GETTER_AND_SETTER(VARIABLE) static QV4::ReturnedValue particleData_get_ ## VARIABLE (QV4::CallContext *ctx) \
{ \
QV4::Scope scope(ctx); \
- QV4::Scoped<QV4ParticleData> r(scope, ctx->d()->callData->thisObject); \
+ QV4::Scoped<QV4ParticleData> r(scope, ctx->thisObject()); \
if (!r || !r->d()->datum) \
- ctx->throwError(QStringLiteral("Not a valid ParticleData object")); \
+ ctx->engine()->throwError(QStringLiteral("Not a valid ParticleData object")); \
\
return QV4::Encode(r->d()->datum-> VARIABLE);\
}\
@@ -378,20 +377,20 @@ static QV4::ReturnedValue particleData_set_ ## VARIABLE (QV4::CallContext *ctx)\
static QV4::ReturnedValue particleData_set_ ## VARIABLE (QV4::CallContext *ctx)\
{\
QV4::Scope scope(ctx); \
- QV4::Scoped<QV4ParticleData> r(scope, ctx->d()->callData->thisObject); \
+ QV4::Scoped<QV4ParticleData> r(scope, ctx->thisObject()); \
if (!r || !r->d()->datum)\
- ctx->throwError(QStringLiteral("Not a valid ParticleData object"));\
+ ctx->engine()->throwError(QStringLiteral("Not a valid ParticleData object"));\
\
- r->d()->datum-> VARIABLE = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();\
+ r->d()->datum-> VARIABLE = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();\
return QV4::Encode::undefined(); \
}
#define FAKE_FLOAT_GETTER_AND_SETTER(VARIABLE, GETTER, SETTER) static QV4::ReturnedValue particleData_get_ ## VARIABLE (QV4::CallContext *ctx) \
{ \
QV4::Scope scope(ctx); \
- QV4::Scoped<QV4ParticleData> r(scope, ctx->d()->callData->thisObject); \
+ QV4::Scoped<QV4ParticleData> r(scope, ctx->thisObject()); \
if (!r || !r->d()->datum) \
- ctx->throwError(QStringLiteral("Not a valid ParticleData object")); \
+ ctx->engine()->throwError(QStringLiteral("Not a valid ParticleData object")); \
\
return QV4::Encode(r->d()->datum-> GETTER ());\
}\
@@ -399,11 +398,11 @@ static QV4::ReturnedValue particleData_set_ ## VARIABLE (QV4::CallContext *ctx)\
static QV4::ReturnedValue particleData_set_ ## VARIABLE (QV4::CallContext *ctx)\
{\
QV4::Scope scope(ctx); \
- QV4::Scoped<QV4ParticleData> r(scope, ctx->d()->callData->thisObject); \
+ QV4::Scoped<QV4ParticleData> r(scope, ctx->thisObject()); \
if (!r || !r->d()->datum)\
- ctx->throwError(QStringLiteral("Not a valid ParticleData object"));\
+ ctx->engine()->throwError(QStringLiteral("Not a valid ParticleData object"));\
\
- r->d()->datum-> SETTER (ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN());\
+ r->d()->datum-> SETTER (ctx->argc() ? ctx->args()[0].toNumber() : qSNaN());\
return QV4::Encode::undefined(); \
}
@@ -445,11 +444,10 @@ FAKE_FLOAT_GETTER_AND_SETTER(curY, curY, setInstantaneousY)
FAKE_FLOAT_GETTER_AND_SETTER(curVY, curVY, setInstantaneousVY)
FAKE_FLOAT_GETTER_AND_SETTER(curAY, curAY, setInstantaneousAY)
-QV8ParticleDataDeletable::QV8ParticleDataDeletable(QV8Engine *engine)
+QV4ParticleDataDeletable::QV4ParticleDataDeletable(QV4::ExecutionEngine *v4)
{
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine);
QV4::Scope scope(v4);
- QV4::Scoped<QV4::Object> p(scope, v4->newObject());
+ QV4::ScopedObject p(scope, v4->newObject());
p->defineDefaultProperty(QStringLiteral("discard"), particleData_discard);
p->defineDefaultProperty(QStringLiteral("lifeLeft"), particleData_lifeLeft);
@@ -493,11 +491,11 @@ QV8ParticleDataDeletable::QV8ParticleDataDeletable(QV8Engine *engine)
proto = p;
}
-QV8ParticleDataDeletable::~QV8ParticleDataDeletable()
+QV4ParticleDataDeletable::~QV4ParticleDataDeletable()
{
}
-V8_DEFINE_EXTENSION(QV8ParticleDataDeletable, particleV8Data);
+V4_DEFINE_EXTENSION(QV4ParticleDataDeletable, particleV4Data);
QQuickV4ParticleData::QQuickV4ParticleData(QV8Engine* engine, QQuickParticleData* datum)
@@ -505,12 +503,12 @@ QQuickV4ParticleData::QQuickV4ParticleData(QV8Engine* engine, QQuickParticleData
if (!engine || !datum)
return;
- QV8ParticleDataDeletable *d = particleV8Data(engine);
QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine);
QV4::Scope scope(v4);
+ QV4ParticleDataDeletable *d = particleV4Data(scope.engine);
QV4::ScopedObject o(scope, v4->memoryManager->alloc<QV4ParticleData>(v4, datum));
QV4::ScopedObject p(scope, d->proto.value());
- o->setPrototype(p.getPointer());
+ o->setPrototype(p);
m_v4Value = o;
}
diff --git a/src/particles/qquickv4particledata_p.h b/src/particles/qquickv4particledata_p.h
index e33fcf47d4..f211ec7e7d 100644
--- a/src/particles/qquickv4particledata_p.h
+++ b/src/particles/qquickv4particledata_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickwander.cpp b/src/particles/qquickwander.cpp
index 1a14deda06..da0f2ef85b 100644
--- a/src/particles/qquickwander.cpp
+++ b/src/particles/qquickwander.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qquickwander_p.h b/src/particles/qquickwander_p.h
index 864781fe21..49c49c560e 100644
--- a/src/particles/qquickwander_p.h
+++ b/src/particles/qquickwander_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/particles/qtquickparticlesglobal_p.h b/src/particles/qtquickparticlesglobal_p.h
index 7c0b518edb..783dd1895c 100644
--- a/src/particles/qtquickparticlesglobal_p.h
+++ b/src/particles/qtquickparticlesglobal_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuickParticles module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/highlight.cpp b/src/plugins/qmltooling/qmldbg_qtquick2/highlight.cpp
index cda4021ec4..5af7a225fd 100644
--- a/src/plugins/qmltooling/qmldbg_qtquick2/highlight.cpp
+++ b/src/plugins/qmltooling/qmldbg_qtquick2/highlight.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/highlight.h b/src/plugins/qmltooling/qmldbg_qtquick2/highlight.h
index 9bff0ff597..29d2f0d911 100644
--- a/src/plugins/qmltooling/qmldbg_qtquick2/highlight.h
+++ b/src/plugins/qmltooling/qmldbg_qtquick2/highlight.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.cpp b/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.cpp
index 0a22ab5d20..f86225fa0a 100644
--- a/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.cpp
+++ b/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -75,7 +75,7 @@ InspectTool::InspectTool(QQuickViewInspector *inspector, QQuickView *view) :
connect(&m_pressAndHoldTimer, SIGNAL(timeout()), SLOT(zoomTo100()));
//Timer to display selected item's name
m_nameDisplayTimer.setSingleShot(true);
- m_nameDisplayTimer.setInterval(qApp->styleHints()->mouseDoubleClickInterval());
+ m_nameDisplayTimer.setInterval(QGuiApplication::styleHints()->mouseDoubleClickInterval());
connect(&m_nameDisplayTimer, SIGNAL(timeout()), SLOT(showSelectedItemName()));
enable(true);
}
@@ -256,7 +256,7 @@ void InspectTool::touchEvent(QTouchEvent *event)
!m_didPressAndHold && m_tapEvent) {
m_tapEvent = false;
bool doubleTap = event->timestamp() - m_touchTimestamp
- < static_cast<ulong>(qApp->styleHints()->mouseDoubleClickInterval());
+ < static_cast<ulong>(QGuiApplication::styleHints()->mouseDoubleClickInterval());
if (doubleTap) {
m_nameDisplayTimer.stop();
selectNextItem();
@@ -368,7 +368,7 @@ void InspectTool::moveItem(bool valid)
if (!m_dragStarted
&& valid
&& ((m_dragStartPosition - m_mousePosition).manhattanLength()
- > qApp->styleHints()->startDragDistance())) {
+ > QGuiApplication::styleHints()->startDragDistance())) {
m_pressAndHoldTimer.stop();
m_dragStarted = true;
}
diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.h b/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.h
index 653d3a0a54..0b1b49fd93 100644
--- a/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.h
+++ b/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.cpp b/src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.cpp
index d2225b91b2..e61c421bfa 100644
--- a/src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.cpp
+++ b/src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.h b/src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.h
index b15668d1a4..be3ede4d07 100644
--- a/src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.h
+++ b/src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/qtquick2plugin.cpp b/src/plugins/qmltooling/qmldbg_qtquick2/qtquick2plugin.cpp
index db5f68cc1b..88801ec9db 100644
--- a/src/plugins/qmltooling/qmldbg_qtquick2/qtquick2plugin.cpp
+++ b/src/plugins/qmltooling/qmldbg_qtquick2/qtquick2plugin.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/qtquick2plugin.h b/src/plugins/qmltooling/qmldbg_qtquick2/qtquick2plugin.h
index 2fb5b9ee03..6866e74aa1 100644
--- a/src/plugins/qmltooling/qmldbg_qtquick2/qtquick2plugin.h
+++ b/src/plugins/qmltooling/qmldbg_qtquick2/qtquick2plugin.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp b/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp
index 4388fa7eb1..2ae4edfce4 100644
--- a/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp
+++ b/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -134,7 +134,7 @@ bool QTcpServerConnection::waitForMessage()
return d->protocol->waitForReadyRead(-1);
}
-void QTcpServerConnection::setPortRange(int portFrom, int portTo, bool block,
+bool QTcpServerConnection::setPortRange(int portFrom, int portTo, bool block,
const QString &hostaddress)
{
Q_D(QTcpServerConnection);
@@ -143,12 +143,16 @@ void QTcpServerConnection::setPortRange(int portFrom, int portTo, bool block,
d->block = block;
d->hostaddress = hostaddress;
- listen();
- if (block)
- d->tcpServer->waitForNewConnection(-1);
+ return listen();
}
-void QTcpServerConnection::listen()
+void QTcpServerConnection::waitForConnection()
+{
+ Q_D(QTcpServerConnection);
+ d->tcpServer->waitForNewConnection(-1);
+}
+
+bool QTcpServerConnection::listen()
{
Q_D(QTcpServerConnection);
@@ -177,6 +181,9 @@ void QTcpServerConnection::listen()
qWarning("QML Debugger: Unable to listen to port %d.", d->portFrom);
else
qWarning("QML Debugger: Unable to listen to ports %d - %d.", d->portFrom, d->portTo);
+ return false;
+ } else {
+ return true;
}
}
diff --git a/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.h b/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.h
index 1b339f1239..942fb6e12c 100644
--- a/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.h
+++ b/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -53,14 +53,14 @@ public:
~QTcpServerConnection();
void setServer(QQmlDebugServer *server);
- void setPortRange(int portFrom, int portTo, bool bock, const QString &hostaddress);
+ bool setPortRange(int portFrom, int portTo, bool bock, const QString &hostaddress);
bool isConnected() const;
void send(const QList<QByteArray> &messages);
void disconnect();
bool waitForMessage();
- void listen();
+ bool listen();
void waitForConnection();
private Q_SLOTS:
diff --git a/src/plugins/qmltooling/shared/abstracttool.cpp b/src/plugins/qmltooling/shared/abstracttool.cpp
index a1cda8b10f..990bc704b9 100644
--- a/src/plugins/qmltooling/shared/abstracttool.cpp
+++ b/src/plugins/qmltooling/shared/abstracttool.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/qmltooling/shared/abstracttool.h b/src/plugins/qmltooling/shared/abstracttool.h
index a8d62add7d..85f2b5b9ad 100644
--- a/src/plugins/qmltooling/shared/abstracttool.h
+++ b/src/plugins/qmltooling/shared/abstracttool.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/qmltooling/shared/abstractviewinspector.cpp b/src/plugins/qmltooling/shared/abstractviewinspector.cpp
index 57ffc5bb1b..e718cf022f 100644
--- a/src/plugins/qmltooling/shared/abstractviewinspector.cpp
+++ b/src/plugins/qmltooling/shared/abstractviewinspector.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/qmltooling/shared/abstractviewinspector.h b/src/plugins/qmltooling/shared/abstractviewinspector.h
index cf88b20136..02b4247bec 100644
--- a/src/plugins/qmltooling/shared/abstractviewinspector.h
+++ b/src/plugins/qmltooling/shared/abstractviewinspector.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/qmltooling/shared/qmlinspectorconstants.h b/src/plugins/qmltooling/shared/qmlinspectorconstants.h
index f6ce099ff1..d76e172844 100644
--- a/src/plugins/qmltooling/shared/qmlinspectorconstants.h
+++ b/src/plugins/qmltooling/shared/qmlinspectorconstants.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/qmltooling/shared/qpacketprotocol.cpp b/src/plugins/qmltooling/shared/qpacketprotocol.cpp
index d52d730a5d..9a58f803c1 100644
--- a/src/plugins/qmltooling/shared/qpacketprotocol.cpp
+++ b/src/plugins/qmltooling/shared/qpacketprotocol.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/qmltooling/shared/qpacketprotocol.h b/src/plugins/qmltooling/shared/qpacketprotocol.h
index 61c13a9358..c571e8d2b8 100644
--- a/src/plugins/qmltooling/shared/qpacketprotocol.h
+++ b/src/plugins/qmltooling/shared/qpacketprotocol.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/animations/qabstractanimationjob.cpp b/src/qml/animations/qabstractanimationjob.cpp
index 38495bf191..d301c43822 100644
--- a/src/qml/animations/qabstractanimationjob.cpp
+++ b/src/qml/animations/qabstractanimationjob.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -652,7 +652,8 @@ void QAbstractAnimationJob::removeAnimationChangeListener(QAnimationJobChangeLis
void QAbstractAnimationJob::debugAnimation(QDebug d) const
{
- d << "AbstractAnimationJob(" << hex << (void *) this << dec << ")" << "duration:" << duration();
+ d << "AbstractAnimationJob(" << hex << (const void *) this << dec << ") state:"
+ << m_state << "duration:" << duration();
}
QDebug operator<<(QDebug d, const QAbstractAnimationJob *job)
diff --git a/src/qml/animations/qabstractanimationjob_p.h b/src/qml/animations/qabstractanimationjob_p.h
index 496116a8f6..5a3e9d2025 100644
--- a/src/qml/animations/qabstractanimationjob_p.h
+++ b/src/qml/animations/qabstractanimationjob_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -163,7 +163,7 @@ protected:
friend class QQmlAnimationTimer;
friend class QAnimationGroupJob;
- friend QDebug operator<<(QDebug, const QAbstractAnimationJob *job);
+ friend Q_QML_PRIVATE_EXPORT QDebug operator<<(QDebug, const QAbstractAnimationJob *job);
};
class Q_QML_PRIVATE_EXPORT QAnimationJobChangeListener
@@ -234,7 +234,7 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractAnimationJob::ChangeTypes)
-QDebug operator<<(QDebug, const QAbstractAnimationJob *job);
+Q_QML_PRIVATE_EXPORT QDebug operator<<(QDebug, const QAbstractAnimationJob *job);
QT_END_NAMESPACE
diff --git a/src/qml/animations/qanimationgroupjob.cpp b/src/qml/animations/qanimationgroupjob.cpp
index 84fe713d36..ca06a9b588 100644
--- a/src/qml/animations/qanimationgroupjob.cpp
+++ b/src/qml/animations/qanimationgroupjob.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/animations/qanimationgroupjob_p.h b/src/qml/animations/qanimationgroupjob_p.h
index 9dadfaa932..fa8fc08bfe 100644
--- a/src/qml/animations/qanimationgroupjob_p.h
+++ b/src/qml/animations/qanimationgroupjob_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/animations/qanimationjobutil_p.h b/src/qml/animations/qanimationjobutil_p.h
index 8bc891337e..3c38fc1599 100644
--- a/src/qml/animations/qanimationjobutil_p.h
+++ b/src/qml/animations/qanimationjobutil_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/animations/qcontinuinganimationgroupjob.cpp b/src/qml/animations/qcontinuinganimationgroupjob.cpp
index 9c7dc3b5ac..88005baf12 100644
--- a/src/qml/animations/qcontinuinganimationgroupjob.cpp
+++ b/src/qml/animations/qcontinuinganimationgroupjob.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -115,7 +115,7 @@ void QContinuingAnimationGroupJob::uncontrolledAnimationFinished(QAbstractAnimat
void QContinuingAnimationGroupJob::debugAnimation(QDebug d) const
{
- d << "ContinuingAnimationGroupJob(" << hex << (void *) this << dec << ")";
+ d << "ContinuingAnimationGroupJob(" << hex << (const void *) this << dec << ")";
debugChildren(d);
}
diff --git a/src/qml/animations/qcontinuinganimationgroupjob_p.h b/src/qml/animations/qcontinuinganimationgroupjob_p.h
index 6195fae1be..3df0e676a7 100644
--- a/src/qml/animations/qcontinuinganimationgroupjob_p.h
+++ b/src/qml/animations/qcontinuinganimationgroupjob_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/animations/qparallelanimationgroupjob.cpp b/src/qml/animations/qparallelanimationgroupjob.cpp
index fed1251096..fe56f2b1e8 100644
--- a/src/qml/animations/qparallelanimationgroupjob.cpp
+++ b/src/qml/animations/qparallelanimationgroupjob.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -233,7 +233,7 @@ void QParallelAnimationGroupJob::uncontrolledAnimationFinished(QAbstractAnimatio
void QParallelAnimationGroupJob::debugAnimation(QDebug d) const
{
- d << "ParallelAnimationGroupJob(" << hex << (void *) this << dec << ")";
+ d << "ParallelAnimationGroupJob(" << hex << (const void *) this << dec << ")";
debugChildren(d);
}
diff --git a/src/qml/animations/qparallelanimationgroupjob_p.h b/src/qml/animations/qparallelanimationgroupjob_p.h
index 715ba19e3f..1ac7709f21 100644
--- a/src/qml/animations/qparallelanimationgroupjob_p.h
+++ b/src/qml/animations/qparallelanimationgroupjob_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/animations/qpauseanimationjob.cpp b/src/qml/animations/qpauseanimationjob.cpp
index d4ccdd4f3d..0e95645f41 100644
--- a/src/qml/animations/qpauseanimationjob.cpp
+++ b/src/qml/animations/qpauseanimationjob.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -62,7 +62,7 @@ void QPauseAnimationJob::updateCurrentTime(int)
void QPauseAnimationJob::debugAnimation(QDebug d) const
{
- d << "PauseAnimationJob(" << hex << (void *) this << dec << ")" << "duration:" << m_duration;
+ d << "PauseAnimationJob(" << hex << (const void *) this << dec << ")" << "duration:" << m_duration;
}
QT_END_NAMESPACE
diff --git a/src/qml/animations/qpauseanimationjob_p.h b/src/qml/animations/qpauseanimationjob_p.h
index 3e17587189..b909c71f49 100644
--- a/src/qml/animations/qpauseanimationjob_p.h
+++ b/src/qml/animations/qpauseanimationjob_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/animations/qsequentialanimationgroupjob.cpp b/src/qml/animations/qsequentialanimationgroupjob.cpp
index 3f3d400f1b..b92caf3bc4 100644
--- a/src/qml/animations/qsequentialanimationgroupjob.cpp
+++ b/src/qml/animations/qsequentialanimationgroupjob.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -411,7 +411,7 @@ void QSequentialAnimationGroupJob::animationRemoved(QAbstractAnimationJob *anim,
void QSequentialAnimationGroupJob::debugAnimation(QDebug d) const
{
- d << "SequentialAnimationGroupJob(" << hex << (void *) this << dec << ")" << "currentAnimation:" << (void *)m_currentAnimation;
+ d << "SequentialAnimationGroupJob(" << hex << (const void *) this << dec << ")" << "currentAnimation:" << (void *)m_currentAnimation;
debugChildren(d);
}
diff --git a/src/qml/animations/qsequentialanimationgroupjob_p.h b/src/qml/animations/qsequentialanimationgroupjob_p.h
index 1a031c5ee9..5286fda28a 100644
--- a/src/qml/animations/qsequentialanimationgroupjob_p.h
+++ b/src/qml/animations/qsequentialanimationgroupjob_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/compiler/qqmlirbuilder.cpp b/src/qml/compiler/qqmlirbuilder.cpp
index 339278fbe8..63833504f1 100644
--- a/src/qml/compiler/qqmlirbuilder.cpp
+++ b/src/qml/compiler/qqmlirbuilder.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -216,60 +216,6 @@ static void replaceWithSpace(QString &str, int idx, int n)
*data++ = space;
}
-#define CHECK_LINE if (l.tokenStartLine() != startLine) return;
-#define CHECK_TOKEN(t) if (token != QQmlJSGrammar:: t) return;
-
-static const int uriTokens[] = {
- QQmlJSGrammar::T_IDENTIFIER,
- QQmlJSGrammar::T_PROPERTY,
- QQmlJSGrammar::T_SIGNAL,
- QQmlJSGrammar::T_READONLY,
- QQmlJSGrammar::T_ON,
- QQmlJSGrammar::T_BREAK,
- QQmlJSGrammar::T_CASE,
- QQmlJSGrammar::T_CATCH,
- QQmlJSGrammar::T_CONTINUE,
- QQmlJSGrammar::T_DEFAULT,
- QQmlJSGrammar::T_DELETE,
- QQmlJSGrammar::T_DO,
- QQmlJSGrammar::T_ELSE,
- QQmlJSGrammar::T_FALSE,
- QQmlJSGrammar::T_FINALLY,
- QQmlJSGrammar::T_FOR,
- QQmlJSGrammar::T_FUNCTION,
- QQmlJSGrammar::T_IF,
- QQmlJSGrammar::T_IN,
- QQmlJSGrammar::T_INSTANCEOF,
- QQmlJSGrammar::T_NEW,
- QQmlJSGrammar::T_NULL,
- QQmlJSGrammar::T_RETURN,
- QQmlJSGrammar::T_SWITCH,
- QQmlJSGrammar::T_THIS,
- QQmlJSGrammar::T_THROW,
- QQmlJSGrammar::T_TRUE,
- QQmlJSGrammar::T_TRY,
- QQmlJSGrammar::T_TYPEOF,
- QQmlJSGrammar::T_VAR,
- QQmlJSGrammar::T_VOID,
- QQmlJSGrammar::T_WHILE,
- QQmlJSGrammar::T_CONST,
- QQmlJSGrammar::T_DEBUGGER,
- QQmlJSGrammar::T_RESERVED_WORD,
- QQmlJSGrammar::T_WITH,
-
- QQmlJSGrammar::EOF_SYMBOL
-};
-static inline bool isUriToken(int token)
-{
- const int *current = uriTokens;
- while (*current != QQmlJSGrammar::EOF_SYMBOL) {
- if (*current == token)
- return true;
- ++current;
- }
- return false;
-}
-
void Document::collectTypeReferences()
{
foreach (Object *obj, objects) {
@@ -296,198 +242,6 @@ void Document::collectTypeReferences()
}
}
-void Document::extractScriptMetaData(QString &script, QQmlJS::DiagnosticMessage *error)
-{
- Q_ASSERT(error);
-
- const QString js(QLatin1String(".js"));
- const QString library(QLatin1String("library"));
-
- QQmlJS::MemoryPool *pool = jsParserEngine.pool();
-
- QQmlJS::Lexer l(0);
- l.setCode(script, 0);
-
- int token = l.lex();
-
- while (true) {
- if (token != QQmlJSGrammar::T_DOT)
- return;
-
- int startOffset = l.tokenOffset();
- int startLine = l.tokenStartLine();
- int startColumn = l.tokenStartColumn();
-
- error->loc.startLine = startLine + 1; // 0-based, adjust to be 1-based
-
- token = l.lex();
-
- CHECK_LINE;
-
- if (token == QQmlJSGrammar::T_IMPORT) {
-
- // .import <URI> <Version> as <Identifier>
- // .import <file.js> as <Identifier>
-
- token = l.lex();
-
- CHECK_LINE;
- QV4::CompiledData::Import *import = pool->New<QV4::CompiledData::Import>();
-
- if (token == QQmlJSGrammar::T_STRING_LITERAL) {
-
- QString file = l.tokenText();
-
- if (!file.endsWith(js)) {
- error->message = QCoreApplication::translate("QQmlParser","Imported file must be a script");
- error->loc.startColumn = l.tokenStartColumn();
- return;
- }
-
- bool invalidImport = false;
-
- token = l.lex();
-
- if ((token != QQmlJSGrammar::T_AS) || (l.tokenStartLine() != startLine)) {
- invalidImport = true;
- } else {
- token = l.lex();
-
- if ((token != QQmlJSGrammar::T_IDENTIFIER) || (l.tokenStartLine() != startLine))
- invalidImport = true;
- }
-
-
- if (invalidImport) {
- error->message = QCoreApplication::translate("QQmlParser","File import requires a qualifier");
- error->loc.startColumn = l.tokenStartColumn();
- return;
- }
-
- int endOffset = l.tokenLength() + l.tokenOffset();
-
- QString importId = script.mid(l.tokenOffset(), l.tokenLength());
-
- token = l.lex();
-
- if (!importId.at(0).isUpper() || (l.tokenStartLine() == startLine)) {
- error->message = QCoreApplication::translate("QQmlParser","Invalid import qualifier");
- error->loc.startColumn = l.tokenStartColumn();
- return;
- }
-
- replaceWithSpace(script, startOffset, endOffset - startOffset);
-
- import->type = QV4::CompiledData::Import::ImportScript;
- import->uriIndex = registerString(file);
- import->qualifierIndex = registerString(importId);
- import->location.line = startLine;
- import->location.column = startColumn;
- imports << import;
- } else {
- // URI
- QString uri;
-
- while (true) {
- if (!isUriToken(token)) {
- error->message = QCoreApplication::translate("QQmlParser","Invalid module URI");
- error->loc.startColumn = l.tokenStartColumn();
- return;
- }
-
- uri.append(l.tokenText());
-
- token = l.lex();
- CHECK_LINE;
- if (token != QQmlJSGrammar::T_DOT)
- break;
-
- uri.append(QLatin1Char('.'));
-
- token = l.lex();
- CHECK_LINE;
- }
-
- if (token != QQmlJSGrammar::T_NUMERIC_LITERAL) {
- error->message = QCoreApplication::translate("QQmlParser","Module import requires a version");
- error->loc.startColumn = l.tokenStartColumn();
- return;
- }
-
- int vmaj, vmin;
- IRBuilder::extractVersion(QStringRef(&script, l.tokenOffset(), l.tokenLength()),
- &vmaj, &vmin);
-
- bool invalidImport = false;
-
- token = l.lex();
-
- if ((token != QQmlJSGrammar::T_AS) || (l.tokenStartLine() != startLine)) {
- invalidImport = true;
- } else {
- token = l.lex();
-
- if ((token != QQmlJSGrammar::T_IDENTIFIER) || (l.tokenStartLine() != startLine))
- invalidImport = true;
- }
-
-
- if (invalidImport) {
- error->message = QCoreApplication::translate("QQmlParser","Module import requires a qualifier");
- error->loc.startColumn = l.tokenStartColumn();
- return;
- }
-
- int endOffset = l.tokenLength() + l.tokenOffset();
-
- QString importId = script.mid(l.tokenOffset(), l.tokenLength());
-
- token = l.lex();
-
- if (!importId.at(0).isUpper() || (l.tokenStartLine() == startLine)) {
- error->message = QCoreApplication::translate("QQmlParser","Invalid import qualifier");
- error->loc.startColumn = l.tokenStartColumn();
- return;
- }
-
- replaceWithSpace(script, startOffset, endOffset - startOffset);
-
- import->type = QV4::CompiledData::Import::ImportLibrary;
- import->uriIndex = registerString(uri);
- import->majorVersion = vmaj;
- import->minorVersion = vmin;
- import->qualifierIndex = registerString(importId);
- import->location.line = startLine;
- import->location.column = startColumn;
- imports << import;
- }
- } else if (token == QQmlJSGrammar::T_PRAGMA) {
- token = l.lex();
-
- CHECK_TOKEN(T_IDENTIFIER);
- CHECK_LINE;
-
- QString pragmaValue = script.mid(l.tokenOffset(), l.tokenLength());
- int endOffset = l.tokenLength() + l.tokenOffset();
-
- if (pragmaValue == library) {
- unitFlags |= QV4::CompiledData::Unit::IsSharedLibrary;
- replaceWithSpace(script, startOffset, endOffset - startOffset);
- } else {
- return;
- }
-
- token = l.lex();
- if (l.tokenStartLine() == startLine)
- return;
-
- } else {
- return;
- }
- }
- return;
-}
-
void Document::removeScriptPragmas(QString &script)
{
const QString pragma(QLatin1String("pragma"));
@@ -536,11 +290,51 @@ void Document::removeScriptPragmas(QString &script)
Document::Document(bool debugMode)
: jsModule(debugMode)
, program(0)
+ , indexOfRootObject(0)
, jsGenerator(&jsModule)
, unitFlags(0)
{
}
+ScriptDirectivesCollector::ScriptDirectivesCollector(QQmlJS::Engine *engine, QV4::Compiler::JSUnitGenerator *unitGenerator)
+ : engine(engine)
+ , jsGenerator(unitGenerator)
+ , hasPragmaLibrary(false)
+{
+}
+
+void ScriptDirectivesCollector::pragmaLibrary()
+{
+ hasPragmaLibrary = true;
+}
+
+void ScriptDirectivesCollector::importFile(const QString &jsfile, const QString &module, int lineNumber, int column)
+{
+ QV4::CompiledData::Import *import = engine->pool()->New<QV4::CompiledData::Import>();
+ import->type = QV4::CompiledData::Import::ImportScript;
+ import->uriIndex = jsGenerator->registerString(jsfile);
+ import->qualifierIndex = jsGenerator->registerString(module);
+ import->location.line = lineNumber;
+ import->location.column = column;
+ imports << import;
+}
+
+void ScriptDirectivesCollector::importModule(const QString &uri, const QString &version, const QString &module, int lineNumber, int column)
+{
+ QV4::CompiledData::Import *import = engine->pool()->New<QV4::CompiledData::Import>();
+ import->type = QV4::CompiledData::Import::ImportLibrary;
+ import->uriIndex = jsGenerator->registerString(uri);
+ int vmaj;
+ int vmin;
+ IRBuilder::extractVersion(QStringRef(&version), &vmaj, &vmin);
+ import->majorVersion = vmaj;
+ import->minorVersion = vmin;
+ import->qualifierIndex = jsGenerator->registerString(module);
+ import->location.line = lineNumber;
+ import->location.column = column;
+ imports << import;
+}
+
IRBuilder::IRBuilder(const QSet<QString> &illegalNames)
: illegalNames(illegalNames)
, _object(0)
@@ -1525,6 +1319,7 @@ QV4::CompiledData::Unit *QmlUnitGenerator::generate(Document &output)
const int totalSize = unitSize + importSize + objectOffsetTableSize + objectsSize + output.jsGenerator.stringTable.sizeOfTableAndData();
char *data = (char*)malloc(totalSize);
memcpy(data, jsUnit, unitSize);
+ memset(data + unitSize, 0, totalSize - unitSize);
if (jsUnit != compilationUnit->data)
free(jsUnit);
jsUnit = 0;
@@ -1780,8 +1575,6 @@ QQmlPropertyData *JSCodeGen::lookupQmlCompliantProperty(QQmlPropertyCache *cache
return pd;
}
-static void initMetaObjectResolver(QV4::IR::MemberExpressionResolver *resolver, QQmlPropertyCache *metaObject);
-
enum MetaObjectResolverFlags {
AllPropertiesAreFinal = 0x1,
LookupsIncludeEnums = 0x2,
@@ -1837,6 +1630,8 @@ static QV4::IR::Type resolveQmlType(QQmlEnginePrivate *qmlEngine, QV4::IR::Membe
static void initQmlTypeResolver(QV4::IR::MemberExpressionResolver *resolver, QQmlType *qmlType)
{
+ Q_ASSERT(resolver);
+
resolver->resolveMember = &resolveQmlType;
resolver->data = qmlType;
resolver->extraData = 0;
@@ -1941,8 +1736,8 @@ static QV4::IR::Type resolveMetaObjectProperty(QQmlEnginePrivate *qmlEngine, QV4
initMetaObjectResolver(resolver, cache);
return QV4::IR::QObjectType;
}
- } else if (QQmlValueType *valueType = QQmlValueTypeFactory::valueType(property->propType)) {
- if (QQmlPropertyCache *cache = qmlEngine->cache(valueType->metaObject())) {
+ } else if (const QMetaObject *valueTypeMetaObject = QQmlValueTypeFactory::metaObjectForMetaType(property->propType)) {
+ if (QQmlPropertyCache *cache = qmlEngine->cache(valueTypeMetaObject)) {
initMetaObjectResolver(resolver, cache);
resolver->flags |= ResolveTypeInformationOnly;
return QV4::IR::QObjectType;
@@ -1958,10 +1753,11 @@ static QV4::IR::Type resolveMetaObjectProperty(QQmlEnginePrivate *qmlEngine, QV4
static void initMetaObjectResolver(QV4::IR::MemberExpressionResolver *resolver, QQmlPropertyCache *metaObject)
{
+ Q_ASSERT(resolver);
+
resolver->resolveMember = &resolveMetaObjectProperty;
resolver->data = metaObject;
resolver->flags = 0;
- resolver->isQObjectResolver = true;
}
#endif // V4_BOOTSTRAP
@@ -1975,11 +1771,13 @@ void JSCodeGen::beginFunctionBodyHook()
#ifndef V4_BOOTSTRAP
QV4::IR::Temp *temp = _block->TEMP(_contextObjectTemp);
- initMetaObjectResolver(&temp->memberResolver, _contextObject);
+ temp->memberResolver = _function->New<QV4::IR::MemberExpressionResolver>();
+ initMetaObjectResolver(temp->memberResolver, _contextObject);
move(temp, _block->NAME(QV4::IR::Name::builtin_qml_context_object, 0, 0));
temp = _block->TEMP(_scopeObjectTemp);
- initMetaObjectResolver(&temp->memberResolver, _scopeObject);
+ temp->memberResolver = _function->New<QV4::IR::MemberExpressionResolver>();
+ initMetaObjectResolver(temp->memberResolver, _scopeObject);
move(temp, _block->NAME(QV4::IR::Name::builtin_qml_scope_object, 0, 0));
move(_block->TEMP(_importedScriptsTemp), _block->NAME(QV4::IR::Name::builtin_qml_imported_scripts_object, 0, 0));
@@ -2014,8 +1812,9 @@ QV4::IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int
_block->MOVE(result, s);
result = _block->TEMP(result->index);
if (mapping.type) {
- initMetaObjectResolver(&result->memberResolver, mapping.type);
- result->memberResolver.flags |= AllPropertiesAreFinal;
+ result->memberResolver = _function->New<QV4::IR::MemberExpressionResolver>();
+ initMetaObjectResolver(result->memberResolver, mapping.type);
+ result->memberResolver->flags |= AllPropertiesAreFinal;
}
result->isReadOnly = true; // don't allow use as lvalue
return result;
@@ -2035,14 +1834,16 @@ QV4::IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int
_block->MOVE(result, typeName);
result = _block->TEMP(result->index);
- initQmlTypeResolver(&result->memberResolver, r.type);
+ result->memberResolver = _function->New<QV4::IR::MemberExpressionResolver>();
+ initQmlTypeResolver(result->memberResolver, r.type);
return result;
} else {
Q_ASSERT(r.importNamespace);
QV4::IR::Name *namespaceName = _block->NAME(name, line, col);
namespaceName->freeOfSideEffects = true;
QV4::IR::Temp *result = _block->TEMP(_block->newTemp());
- initImportNamespaceResolver(&result->memberResolver, imports, r.importNamespace);
+ result->memberResolver = _function->New<QV4::IR::MemberExpressionResolver>();
+ initImportNamespaceResolver(result->memberResolver, imports, r.importNamespace);
_block->MOVE(result, namespaceName);
return _block->TEMP(result->index);
@@ -2057,7 +1858,8 @@ QV4::IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int
return 0;
if (pd) {
QV4::IR::Temp *base = _block->TEMP(_scopeObjectTemp);
- initMetaObjectResolver(&base->memberResolver, _scopeObject);
+ base->memberResolver = _function->New<QV4::IR::MemberExpressionResolver>();
+ initMetaObjectResolver(base->memberResolver, _scopeObject);
return _block->MEMBER(base, _function->newString(name), pd, QV4::IR::Member::MemberOfQmlScopeObject);
}
}
@@ -2069,7 +1871,8 @@ QV4::IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int
return 0;
if (pd) {
QV4::IR::Temp *base = _block->TEMP(_contextObjectTemp);
- initMetaObjectResolver(&base->memberResolver, _contextObject);
+ base->memberResolver = _function->New<QV4::IR::MemberExpressionResolver>();
+ initMetaObjectResolver(base->memberResolver, _contextObject);
return _block->MEMBER(base, _function->newString(name), pd, QV4::IR::Member::MemberOfQmlContextObject);
}
}
diff --git a/src/qml/compiler/qqmlirbuilder_p.h b/src/qml/compiler/qqmlirbuilder_p.h
index cc22023f8e..120de91321 100644
--- a/src/qml/compiler/qqmlirbuilder_p.h
+++ b/src/qml/compiler/qqmlirbuilder_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -41,6 +41,7 @@
#include <private/qqmljsmemorypool_p.h>
#include <private/qv4codegen_p.h>
#include <private/qv4compiler_p.h>
+#include <private/qqmljslexer_p.h>
#include <QTextStream>
#include <QCoreApplication>
@@ -326,10 +327,23 @@ struct Q_QML_PRIVATE_EXPORT Document
int registerString(const QString &str) { return jsGenerator.registerString(str); }
QString stringAt(int index) const { return jsGenerator.stringForIndex(index); }
- void extractScriptMetaData(QString &script, QQmlJS::DiagnosticMessage *error);
static void removeScriptPragmas(QString &script);
};
+struct Q_QML_PRIVATE_EXPORT ScriptDirectivesCollector : public QQmlJS::Directives
+{
+ ScriptDirectivesCollector(QQmlJS::Engine *engine, QV4::Compiler::JSUnitGenerator *unitGenerator);
+
+ QQmlJS::Engine *engine;
+ QV4::Compiler::JSUnitGenerator *jsGenerator;
+ QList<const QV4::CompiledData::Import *> imports;
+ bool hasPragmaLibrary;
+
+ virtual void pragmaLibrary();
+ virtual void importFile(const QString &jsfile, const QString &module, int lineNumber, int column);
+ virtual void importModule(const QString &uri, const QString &version, const QString &module, int lineNumber, int column);
+};
+
struct Q_QML_PRIVATE_EXPORT IRBuilder : public QQmlJS::AST::Visitor
{
Q_DECLARE_TR_FUNCTIONS(QQmlCodeGenerator)
diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp
index 2c7414db14..46b67d5983 100644
--- a/src/qml/compiler/qqmltypecompiler.cpp
+++ b/src/qml/compiler/qqmltypecompiler.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -392,6 +392,11 @@ void QQmlTypeCompiler::setDeferredBindingsPerObject(const QHash<int, QBitArray>
compiledData->deferredBindingsPerObject = deferredBindingsPerObject;
}
+void QQmlTypeCompiler::setBindingPropertyDataPerObject(const QVector<QV4::CompiledData::BindingPropertyData> &propertyData)
+{
+ compiledData->compilationUnit->bindingPropertyDataPerObject = propertyData;
+}
+
QString QQmlTypeCompiler::bindingAsString(const QmlIR::Object *object, int scriptIndex) const
{
return object->bindingAsString(document, scriptIndex);
@@ -402,7 +407,7 @@ QQmlCompilePass::QQmlCompilePass(QQmlTypeCompiler *typeCompiler)
{
}
-void QQmlCompilePass::recordError(const QV4::CompiledData::Location &location, const QString &description)
+void QQmlCompilePass::recordError(const QV4::CompiledData::Location &location, const QString &description) const
{
QQmlError error;
error.setLine(location.line);
@@ -463,8 +468,8 @@ bool QQmlPropertyCacheCreator::buildMetaObjectRecursively(int objectIndex, int r
if (instantiatingProperty->isQObject()) {
baseTypeCache = enginePrivate->rawPropertyCacheForType(instantiatingProperty->propType);
Q_ASSERT(baseTypeCache);
- } else if (QQmlValueType *vt = QQmlValueTypeFactory::valueType(instantiatingProperty->propType)) {
- baseTypeCache = enginePrivate->cache(vt->metaObject());
+ } else if (const QMetaObject *vtmo = QQmlValueTypeFactory::metaObjectForMetaType(instantiatingProperty->propType)) {
+ baseTypeCache = enginePrivate->cache(vtmo);
Q_ASSERT(baseTypeCache);
}
}
@@ -559,8 +564,7 @@ bool QQmlPropertyCacheCreator::ensureMetaObject(int objectIndex)
bool QQmlPropertyCacheCreator::createMetaObject(int objectIndex, const QmlIR::Object *obj, QQmlPropertyCache *baseTypeCache)
{
- QQmlPropertyCache *cache = baseTypeCache->copyAndReserve(QQmlEnginePrivate::get(enginePrivate),
- obj->propertyCount(),
+ QQmlPropertyCache *cache = baseTypeCache->copyAndReserve(obj->propertyCount(),
obj->functionCount() + obj->propertyCount() + obj->signalCount(),
obj->signalCount() + obj->propertyCount());
propertyCaches[objectIndex] = cache;
@@ -1618,7 +1622,7 @@ bool QQmlComponentAndAliasResolver::resolveAliases()
QQmlPropertyData *targetProperty = resolver.property(property.toString());
if (!targetProperty || targetProperty->coreIndex > 0x0000FFFF) {
- recordError(p->aliasLocation, tr("Invalid alias location"));
+ recordError(p->aliasLocation, tr("Invalid alias target location: %1").arg(property.toString()));
return false;
}
@@ -1630,27 +1634,27 @@ bool QQmlComponentAndAliasResolver::resolveAliases()
notifySignal = targetProperty->notifyIndex;
if (!subProperty.isEmpty()) {
- QQmlValueType *valueType = QQmlValueTypeFactory::valueType(type);
- if (!valueType) {
- recordError(p->aliasLocation, tr("Invalid alias location"));
+ const QMetaObject *valueTypeMetaObject = QQmlValueTypeFactory::metaObjectForMetaType(type);
+ if (!valueTypeMetaObject) {
+ recordError(p->aliasLocation, tr("Invalid alias target location: %1").arg(subProperty.toString()));
return false;
}
propType = type;
int valueTypeIndex =
- valueType->metaObject()->indexOfProperty(subProperty.toString().toUtf8().constData());
+ valueTypeMetaObject->indexOfProperty(subProperty.toString().toUtf8().constData());
if (valueTypeIndex == -1) {
- recordError(p->aliasLocation, tr("Invalid alias location"));
+ recordError(p->aliasLocation, tr("Invalid alias target location: %1").arg(subProperty.toString()));
return false;
}
Q_ASSERT(valueTypeIndex <= 0x0000FFFF);
- propIdx |= (valueTypeIndex << 16);
- if (valueType->metaObject()->property(valueTypeIndex).isEnumType())
+ propIdx = QQmlPropertyData::encodeValueTypePropertyIndex(propIdx, valueTypeIndex);
+ if (valueTypeMetaObject->property(valueTypeIndex).isEnumType())
type = QVariant::Int;
else
- type = valueType->metaObject()->property(valueTypeIndex).userType();
+ type = valueTypeMetaObject->property(valueTypeIndex).userType();
} else {
if (targetProperty->isEnum()) {
@@ -1713,9 +1717,11 @@ QQmlPropertyValidator::QQmlPropertyValidator(QQmlTypeCompiler *typeCompiler)
bool QQmlPropertyValidator::validate()
{
+ _bindingPropertyDataPerObject.resize(qmlUnit->nObjects);
if (!validateObject(qmlUnit->indexOfRootObject, /*instantiatingBinding*/0))
return false;
- compiler->setDeferredBindingsPerObject(deferredBindingsPerObject);
+ compiler->setDeferredBindingsPerObject(_deferredBindingsPerObject);
+ compiler->setBindingPropertyDataPerObject(_bindingPropertyDataPerObject);
return true;
}
@@ -1753,7 +1759,7 @@ struct BindingFinder
}
};
-bool QQmlPropertyValidator::validateObject(int objectIndex, const QV4::CompiledData::Binding *instantiatingBinding, bool populatingValueTypeGroupProperty)
+bool QQmlPropertyValidator::validateObject(int objectIndex, const QV4::CompiledData::Binding *instantiatingBinding, bool populatingValueTypeGroupProperty) const
{
const QV4::CompiledData::Object *obj = qmlUnit->objectAt(objectIndex);
if (obj->idIndex != 0)
@@ -1819,6 +1825,8 @@ bool QQmlPropertyValidator::validateObject(int objectIndex, const QV4::CompiledD
defaultProperty = propertyCache->defaultProperty();
}
+ QV4::CompiledData::BindingPropertyData collectedBindingPropertyData(obj->nBindings);
+
binding = obj->bindingTable();
for (quint32 i = 0; i < obj->nBindings; ++i, ++binding) {
QString name = stringAt(binding->propertyNameIndex);
@@ -1838,22 +1846,6 @@ bool QQmlPropertyValidator::validateObject(int objectIndex, const QV4::CompiledD
}
}
- // Signal handlers were resolved and checked earlier in the signal handler conversion pass.
- if (binding->flags & QV4::CompiledData::Binding::IsSignalHandlerExpression
- || binding->flags & QV4::CompiledData::Binding::IsSignalHandlerObject)
- continue;
-
- if (name.constData()->isUpper() && !binding->isAttachedProperty()) {
- QQmlType *type = 0;
- QQmlImportNamespace *typeNamespace = 0;
- compiler->imports()->resolveType(stringAt(binding->propertyNameIndex), &type, 0, 0, &typeNamespace);
- if (typeNamespace)
- recordError(binding->location, tr("Invalid use of namespace"));
- else
- recordError(binding->location, tr("Invalid attached object assignment"));
- return false;
- }
-
bool bindingToDefaultProperty = false;
bool notInRevision = false;
@@ -1883,11 +1875,25 @@ bool QQmlPropertyValidator::validateObject(int objectIndex, const QV4::CompiledD
bindingToDefaultProperty = true;
}
+ if (pd)
+ collectedBindingPropertyData[i] = pd;
+
+ if (name.constData()->isUpper() && !binding->isAttachedProperty()) {
+ QQmlType *type = 0;
+ QQmlImportNamespace *typeNamespace = 0;
+ compiler->imports()->resolveType(stringAt(binding->propertyNameIndex), &type, 0, 0, &typeNamespace);
+ if (typeNamespace)
+ recordError(binding->location, tr("Invalid use of namespace"));
+ else
+ recordError(binding->location, tr("Invalid attached object assignment"));
+ return false;
+ }
+
bool seenSubObjectWithId = false;
- if (binding->type >= QV4::CompiledData::Binding::Type_Object && !customParser) {
+ if (binding->type >= QV4::CompiledData::Binding::Type_Object && (pd || binding->isAttachedProperty())) {
qSwap(_seenObjectWithId, seenSubObjectWithId);
- const bool subObjectValid = validateObject(binding->value.objectIndex, binding, pd && QQmlValueTypeFactory::valueType(pd->propType));
+ const bool subObjectValid = validateObject(binding->value.objectIndex, binding, pd && QQmlValueTypeFactory::metaObjectForMetaType(pd->propType));
qSwap(_seenObjectWithId, seenSubObjectWithId);
if (!subObjectValid)
return false;
@@ -1903,6 +1909,11 @@ bool QQmlPropertyValidator::validateObject(int objectIndex, const QV4::CompiledD
deferredBindings.setBit(i);
}
+ // Signal handlers were resolved and checked earlier in the signal handler conversion pass.
+ if (binding->flags & QV4::CompiledData::Binding::IsSignalHandlerExpression
+ || binding->flags & QV4::CompiledData::Binding::IsSignalHandlerObject)
+ continue;
+
if (binding->type == QV4::CompiledData::Binding::Type_AttachedProperty) {
if (instantiatingBinding && (instantiatingBinding->isAttachedProperty() || instantiatingBinding->isGroupProperty())) {
recordError(binding->location, tr("Attached properties cannot be used here"));
@@ -1961,7 +1972,7 @@ bool QQmlPropertyValidator::validateObject(int objectIndex, const QV4::CompiledD
return false;
} else if (binding->isGroupProperty()) {
if (QQmlValueTypeFactory::isValueType(pd->propType)) {
- if (QQmlValueTypeFactory::valueType(pd->propType)) {
+ if (QQmlValueTypeFactory::metaObjectForMetaType(pd->propType)) {
if (!pd->isWritable()) {
recordError(binding->location, tr("Invalid property assignment: \"%1\" is a read-only property").arg(name));
return false;
@@ -1991,6 +2002,11 @@ bool QQmlPropertyValidator::validateObject(int objectIndex, const QV4::CompiledD
}
}
+ if (obj->idIndex) {
+ bool notInRevision = false;
+ collectedBindingPropertyData << propertyResolver.property(QStringLiteral("id"), &notInRevision);
+ }
+
if (customParser && !customBindings.isEmpty()) {
customParser->clearErrors();
customParser->compiler = this;
@@ -2008,12 +2024,14 @@ bool QQmlPropertyValidator::validateObject(int objectIndex, const QV4::CompiledD
}
if (!deferredBindings.isEmpty())
- deferredBindingsPerObject.insert(objectIndex, deferredBindings);
+ _deferredBindingsPerObject.insert(objectIndex, deferredBindings);
+
+ _bindingPropertyDataPerObject[objectIndex] = collectedBindingPropertyData;
return true;
}
-bool QQmlPropertyValidator::validateLiteralBinding(QQmlPropertyCache *propertyCache, QQmlPropertyData *property, const QV4::CompiledData::Binding *binding)
+bool QQmlPropertyValidator::validateLiteralBinding(QQmlPropertyCache *propertyCache, QQmlPropertyData *property, const QV4::CompiledData::Binding *binding) const
{
if (property->isQList()) {
recordError(binding->valueLocation, tr("Cannot assign primitives to lists"));
@@ -2289,7 +2307,7 @@ bool QQmlPropertyValidator::validateLiteralBinding(QQmlPropertyCache *propertyCa
Returns true if from can be assigned to a (QObject) property of type
to.
*/
-bool QQmlPropertyValidator::canCoerce(int to, QQmlPropertyCache *fromMo)
+bool QQmlPropertyValidator::canCoerce(int to, QQmlPropertyCache *fromMo) const
{
QQmlPropertyCache *toMo = enginePrivate->rawPropertyCacheForType(to);
@@ -2301,7 +2319,7 @@ bool QQmlPropertyValidator::canCoerce(int to, QQmlPropertyCache *fromMo)
return false;
}
-bool QQmlPropertyValidator::validateObjectBinding(QQmlPropertyData *property, const QString &propertyName, const QV4::CompiledData::Binding *binding)
+bool QQmlPropertyValidator::validateObjectBinding(QQmlPropertyData *property, const QString &propertyName, const QV4::CompiledData::Binding *binding) const
{
if (binding->flags & QV4::CompiledData::Binding::IsOnAssignment) {
Q_ASSERT(binding->type == QV4::CompiledData::Binding::Type_Object);
@@ -2347,7 +2365,7 @@ bool QQmlPropertyValidator::validateObjectBinding(QQmlPropertyData *property, co
if (!QQmlMetaType::isInterface(listType)) {
QQmlPropertyCache *source = propertyCaches.at(binding->value.objectIndex);
if (!canCoerce(listType, source)) {
- recordError(binding->valueLocation, tr("Cannot assign object to list"));
+ recordError(binding->valueLocation, tr("Cannot assign object to list property \"%1\"").arg(propertyName));
return false;
}
}
diff --git a/src/qml/compiler/qqmltypecompiler_p.h b/src/qml/compiler/qqmltypecompiler_p.h
index eec717788f..75987af656 100644
--- a/src/qml/compiler/qqmltypecompiler_p.h
+++ b/src/qml/compiler/qqmltypecompiler_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -93,6 +93,7 @@ public:
QStringRef newStringRef(const QString &string);
const QV4::Compiler::StringTableGenerator *stringPool() const;
void setDeferredBindingsPerObject(const QHash<int, QBitArray> &deferredBindingsPerObject);
+ void setBindingPropertyDataPerObject(const QVector<QV4::CompiledData::BindingPropertyData> &propertyData);
const QHash<int, QQmlCustomParser*> &customParserCache() const { return customParsers; }
@@ -116,7 +117,7 @@ struct QQmlCompilePass
QString stringAt(int idx) const { return compiler->stringAt(idx); }
protected:
- void recordError(const QV4::CompiledData::Location &location, const QString &description);
+ void recordError(const QV4::CompiledData::Location &location, const QString &description) const;
QQmlTypeCompiler *compiler;
};
@@ -276,13 +277,13 @@ public:
virtual QString bindingAsString(int objectIndex, const QV4::CompiledData::Binding *binding) const;
private:
- bool validateObject(int objectIndex, const QV4::CompiledData::Binding *instantiatingBinding, bool populatingValueTypeGroupProperty = false);
- bool validateLiteralBinding(QQmlPropertyCache *propertyCache, QQmlPropertyData *property, const QV4::CompiledData::Binding *binding);
- bool validateObjectBinding(QQmlPropertyData *property, const QString &propertyName, const QV4::CompiledData::Binding *binding);
+ bool validateObject(int objectIndex, const QV4::CompiledData::Binding *instantiatingBinding, bool populatingValueTypeGroupProperty = false) const;
+ bool validateLiteralBinding(QQmlPropertyCache *propertyCache, QQmlPropertyData *property, const QV4::CompiledData::Binding *binding) const;
+ bool validateObjectBinding(QQmlPropertyData *property, const QString &propertyName, const QV4::CompiledData::Binding *binding) const;
bool isComponent(int objectIndex) const { return objectIndexToIdPerComponent.contains(objectIndex); }
- bool canCoerce(int to, QQmlPropertyCache *fromMo);
+ bool canCoerce(int to, QQmlPropertyCache *fromMo) const;
QQmlEnginePrivate *enginePrivate;
const QV4::CompiledData::Unit *qmlUnit;
@@ -291,9 +292,11 @@ private:
const QVector<QQmlPropertyCache *> &propertyCaches;
const QHash<int, QHash<int, int> > objectIndexToIdPerComponent;
QHash<int, QBitArray> *customParserBindingsPerObject;
- QHash<int, QBitArray> deferredBindingsPerObject;
- bool _seenObjectWithId;
+ // collected state variables, essentially write-only
+ mutable QHash<int, QBitArray> _deferredBindingsPerObject;
+ mutable bool _seenObjectWithId;
+ mutable QVector<QV4::CompiledData::BindingPropertyData> _bindingPropertyDataPerObject;
};
// ### merge with QtQml::JSCodeGen and operate directly on object->functionsAndExpressions once old compiler is gone.
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index 260db0f0dd..9168889c8c 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -1965,7 +1965,7 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast,
// variables in global code are properties of the global context object, not locals as with other functions.
if (_env->compilationMode == FunctionCode || _env->compilationMode == QmlBinding) {
unsigned t = 0;
- for (Environment::MemberMap::iterator it = _env->members.begin(); it != _env->members.end(); ++it) {
+ for (Environment::MemberMap::iterator it = _env->members.begin(), end = _env->members.end(); it != end; ++it) {
const QString &local = it.key();
function->LOCAL(local);
(*it).index = t;
@@ -1984,7 +1984,7 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast,
}
IR::ExprList *args = 0;
- for (Environment::MemberMap::const_iterator it = _env->members.constBegin(); it != _env->members.constEnd(); ++it) {
+ for (Environment::MemberMap::const_iterator it = _env->members.constBegin(), cend = _env->members.constEnd(); it != cend; ++it) {
const QString &local = it.key();
IR::ExprList *next = function->New<IR::ExprList>();
next->expr = entryBlock->NAME(local, 0, 0);
@@ -2448,7 +2448,8 @@ bool Codegen::visit(SwitchStatement *ast)
IR::BasicBlock *switchend = _function->newBasicBlock(exceptionHandler());
if (ast->block) {
- Result lhs = expression(ast->expression);
+ int lhs = _block->newTemp();
+ move(_block->TEMP(lhs), *expression(ast->expression));
IR::BasicBlock *switchcond = _function->newBasicBlock(exceptionHandler());
_block->JUMP(switchcond);
IR::BasicBlock *previousBlock = 0;
@@ -2510,7 +2511,7 @@ bool Codegen::visit(SwitchStatement *ast)
Result rhs = expression(clause->expression);
IR::BasicBlock *iftrue = blockMap[clause];
IR::BasicBlock *iffalse = _function->newBasicBlock(exceptionHandler());
- setLocation(cjump(binop(IR::OpStrictEqual, *lhs, *rhs), iftrue, iffalse), clause->caseToken);
+ setLocation(cjump(binop(IR::OpStrictEqual, _block->TEMP(lhs), *rhs), iftrue, iffalse), clause->caseToken);
_block = iffalse;
}
@@ -2519,7 +2520,7 @@ bool Codegen::visit(SwitchStatement *ast)
Result rhs = expression(clause->expression);
IR::BasicBlock *iftrue = blockMap[clause];
IR::BasicBlock *iffalse = _function->newBasicBlock(exceptionHandler());
- setLocation(cjump(binop(IR::OpStrictEqual, *lhs, *rhs), iftrue, iffalse), clause->caseToken);
+ setLocation(cjump(binop(IR::OpStrictEqual, _block->TEMP(lhs), *rhs), iftrue, iffalse), clause->caseToken);
_block = iffalse;
}
@@ -2841,6 +2842,11 @@ QList<QQmlJS::DiagnosticMessage> Codegen::errors() const
QList<QQmlError> Codegen::qmlErrors() const
{
QList<QQmlError> qmlErrors;
+
+ // Short circuit to avoid costly (de)heap allocation of QUrl if there are no errors.
+ if (_errors.size() == 0)
+ return qmlErrors;
+
qmlErrors.reserve(_errors.size());
QUrl url(_fileNameIsUrl ? QUrl(_module->fileName) : QUrl::fromLocalFile(_module->fileName));
@@ -2861,7 +2867,7 @@ void RuntimeCodegen::throwSyntaxError(const AST::SourceLocation &loc, const QStr
if (hasError)
return;
hasError = true;
- context->throwSyntaxError(detail, _module->fileName, loc.startLine, loc.startColumn);
+ engine->throwSyntaxError(detail, _module->fileName, loc.startLine, loc.startColumn);
}
void RuntimeCodegen::throwReferenceError(const AST::SourceLocation &loc, const QString &detail)
@@ -2869,7 +2875,7 @@ void RuntimeCodegen::throwReferenceError(const AST::SourceLocation &loc, const Q
if (hasError)
return;
hasError = true;
- context->throwReferenceError(detail, _module->fileName, loc.startLine, loc.startColumn);
+ engine->throwReferenceError(detail, _module->fileName, loc.startLine, loc.startColumn);
}
#endif // V4_BOOTSTRAP
diff --git a/src/qml/compiler/qv4codegen_p.h b/src/qml/compiler/qv4codegen_p.h
index 323cd27aa9..aec51cc19c 100644
--- a/src/qml/compiler/qv4codegen_p.h
+++ b/src/qml/compiler/qv4codegen_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -47,10 +47,6 @@
QT_BEGIN_NAMESPACE
-namespace QV4 {
-struct ExecutionContext;
-}
-
namespace QQmlJS {
namespace AST {
class UiParameterList;
@@ -526,15 +522,15 @@ protected:
class RuntimeCodegen : public Codegen
{
public:
- RuntimeCodegen(QV4::ExecutionContext *ctx, bool strict)
+ RuntimeCodegen(QV4::ExecutionEngine *engine, bool strict)
: Codegen(strict)
- , context(ctx)
+ , engine(engine)
{}
virtual void throwSyntaxError(const AST::SourceLocation &loc, const QString &detail);
virtual void throwReferenceError(const AST::SourceLocation &loc, const QString &detail);
private:
- QV4::ExecutionContext *context;
+ QV4::ExecutionEngine *engine;
};
#endif // V4_BOOTSTRAP
diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp
index d242fb7b3a..5d954eb4fc 100644
--- a/src/qml/compiler/qv4compileddata.cpp
+++ b/src/qml/compiler/qv4compileddata.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -40,6 +40,7 @@
#include <private/qv4objectproto_p.h>
#include <private/qv4lookup_p.h>
#include <private/qv4regexpobject_p.h>
+#include <private/qqmlpropertycache_p.h>
#endif
#include <private/qqmlirbuilder_p.h>
#include <QCoreApplication>
@@ -53,6 +54,15 @@ namespace QV4 {
namespace CompiledData {
#ifndef V4_BOOTSTRAP
+CompilationUnit::CompilationUnit()
+ : data(0)
+ , engine(0)
+ , runtimeStrings(0)
+ , runtimeLookups(0)
+ , runtimeRegularExpressions(0)
+ , runtimeClasses(0)
+{}
+
CompilationUnit::~CompilationUnit()
{
unlink();
@@ -65,9 +75,9 @@ QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine)
Q_ASSERT(!runtimeStrings);
Q_ASSERT(data);
- runtimeStrings = (QV4::StringValue *)malloc(data->stringTableSize * sizeof(QV4::StringValue));
+ runtimeStrings = (QV4::Heap::String **)malloc(data->stringTableSize * sizeof(QV4::Heap::String*));
// memset the strings to 0 in case a GC run happens while we're within the loop below
- memset(runtimeStrings, 0, data->stringTableSize * sizeof(QV4::StringValue));
+ memset(runtimeStrings, 0, data->stringTableSize * sizeof(QV4::Heap::String*));
for (uint i = 0; i < data->stringTableSize; ++i)
runtimeStrings[i] = engine->newIdentifier(data->stringAt(i));
@@ -109,7 +119,7 @@ QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine)
l->classList[j] = 0;
l->level = -1;
l->index = UINT_MAX;
- l->name = runtimeStrings[compiledLookups[i].nameIndex].asString();
+ l->nameIndex = compiledLookups[i].nameIndex;
if (type == CompiledData::Lookup::Type_IndexedGetter || type == CompiledData::Lookup::Type_IndexedSetter)
l->engine = engine;
}
@@ -117,13 +127,12 @@ QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine)
if (data->jsClassTableSize) {
runtimeClasses = (QV4::InternalClass**)malloc(data->jsClassTableSize * sizeof(QV4::InternalClass*));
-
for (uint i = 0; i < data->jsClassTableSize; ++i) {
int memberCount = 0;
const CompiledData::JSClassMember *member = data->jsClassAt(i, &memberCount);
- QV4::InternalClass *klass = engine->objectClass;
+ QV4::InternalClass *klass = engine->emptyClass;
for (int j = 0; j < memberCount; ++j, ++member)
- klass = klass->addMember(runtimeStrings[member->nameOffset].asString(), member->isAccessor ? QV4::Attr_Accessor : QV4::Attr_Data);
+ klass = klass->addMember(runtimeStrings[member->nameOffset]->identifier, member->isAccessor ? QV4::Attr_Accessor : QV4::Attr_Data);
runtimeClasses[i] = klass;
}
@@ -166,15 +175,12 @@ void CompilationUnit::unlink()
void CompilationUnit::markObjects(QV4::ExecutionEngine *e)
{
for (uint i = 0; i < data->stringTableSize; ++i)
- runtimeStrings[i].mark(e);
+ if (runtimeStrings[i])
+ runtimeStrings[i]->mark(e);
if (runtimeRegularExpressions) {
for (uint i = 0; i < data->regexpTableSize; ++i)
runtimeRegularExpressions[i].mark(e);
}
- if (runtimeLookups) {
- for (uint i = 0; i < data->lookupTableSize; ++i)
- runtimeLookups[i].name->mark(e);
- }
}
#endif // V4_BOOTSTRAP
diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h
index 6791970461..48324fbbc4 100644
--- a/src/qml/compiler/qv4compileddata_p.h
+++ b/src/qml/compiler/qv4compileddata_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -37,12 +37,18 @@
#include <QVector>
#include <QStringList>
#include <QHash>
+#include <QUrl>
+
#include <private/qv4value_p.h>
#include <private/qv4executableallocator_p.h>
#include <private/qqmlrefcount_p.h>
+#include <private/qqmlnullablevalue_p.h>
QT_BEGIN_NAMESPACE
+class QQmlPropertyCache;
+class QQmlPropertyData;
+
namespace QmlIR {
struct Document;
}
@@ -53,7 +59,6 @@ struct Function;
}
struct Function;
-struct ExecutionContext;
namespace CompiledData {
@@ -130,7 +135,7 @@ struct String
// uint16 strdata[]
static int calculateSize(const QString &str) {
- return (sizeof(String) + (str.length() + 1) * sizeof(quint16) + 7) & ~0x7;
+ return (sizeof(String) + str.length() * sizeof(quint16) + 7) & ~0x7;
}
};
@@ -554,6 +559,9 @@ struct TypeReferenceMap : QHash<int, TypeReference>
}
};
+// index is per-object binding index
+typedef QVector<QQmlPropertyData*> BindingPropertyData;
+
// This is how this hooks into the existing structures:
//VM::Function
@@ -568,14 +576,7 @@ struct Q_QML_PRIVATE_EXPORT CompilationUnit : public QQmlRefCount
{}
virtual ~CompilationUnit() {}
#else
- CompilationUnit()
- : data(0)
- , engine(0)
- , runtimeStrings(0)
- , runtimeLookups(0)
- , runtimeRegularExpressions(0)
- , runtimeClasses(0)
- {}
+ CompilationUnit();
virtual ~CompilationUnit();
#endif
@@ -587,12 +588,19 @@ struct Q_QML_PRIVATE_EXPORT CompilationUnit : public QQmlRefCount
#ifndef V4_BOOTSTRAP
ExecutionEngine *engine;
QString fileName() const { return data->stringAt(data->sourceFileIndex); }
+ QUrl url() const { if (m_url.isNull) m_url = QUrl(fileName()); return m_url; }
- QV4::StringValue *runtimeStrings; // Array
+ QV4::Heap::String **runtimeStrings; // Array
QV4::Lookup *runtimeLookups;
QV4::Value *runtimeRegularExpressions;
QV4::InternalClass **runtimeClasses;
QVector<QV4::Function *> runtimeFunctions;
+ mutable QQmlNullableValue<QUrl> m_url;
+
+ // index is object index. This allows fast access to the
+ // property data when initializing bindings, avoiding expensive
+ // lookups by string (property name).
+ QVector<BindingPropertyData> bindingPropertyDataPerObject;
QV4::Function *linkToEngine(QV4::ExecutionEngine *engine);
void unlink();
diff --git a/src/qml/compiler/qv4compiler.cpp b/src/qml/compiler/qv4compiler.cpp
index 22107c4bd1..450889c275 100644
--- a/src/qml/compiler/qv4compiler.cpp
+++ b/src/qml/compiler/qv4compiler.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -78,7 +78,7 @@ void QV4::Compiler::StringTableGenerator::serialize(CompiledData::Unit *unit)
QV4::CompiledData::String *s = (QV4::CompiledData::String*)(stringData);
s->flags = 0; // ###
s->size = qstr.length();
- memcpy(s + 1, qstr.constData(), (qstr.length() + 1)*sizeof(ushort));
+ memcpy(s + 1, qstr.constData(), qstr.length()*sizeof(ushort));
stringData += QV4::CompiledData::String::calculateSize(qstr);
}
diff --git a/src/qml/compiler/qv4compiler_p.h b/src/qml/compiler/qv4compiler_p.h
index 7b349caaf8..3cf80a9791 100644
--- a/src/qml/compiler/qv4compiler_p.h
+++ b/src/qml/compiler/qv4compiler_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/compiler/qv4instr_moth.cpp b/src/qml/compiler/qv4instr_moth.cpp
index c9a0e65b82..5d6f1a8c7f 100644
--- a/src/qml/compiler/qv4instr_moth.cpp
+++ b/src/qml/compiler/qv4instr_moth.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/compiler/qv4instr_moth_p.h b/src/qml/compiler/qv4instr_moth_p.h
index e28d94b008..5c2ad45da2 100644
--- a/src/qml/compiler/qv4instr_moth_p.h
+++ b/src/qml/compiler/qv4instr_moth_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/compiler/qv4isel_moth.cpp b/src/qml/compiler/qv4isel_moth.cpp
index 39977375c4..eb78a0c054 100644
--- a/src/qml/compiler/qv4isel_moth.cpp
+++ b/src/qml/compiler/qv4isel_moth.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -188,15 +188,9 @@ public:
void forFunction(IR::Function *function)
{
- IR::Optimizer::showMeTheCode(function);
+ IR::Optimizer::showMeTheCode(function, "Before stack slot allocation");
_function = function;
toStackSlots(function);
-
-// QTextStream os(stdout, QIODevice::WriteOnly);
-// os << "Frame layout:" << endl;
-// foreach (int t, _stackSlotForTemp.keys()) {
-// os << "\t" << t << " -> " << _stackSlotForTemp[t] << endl;
-// }
}
protected:
@@ -364,7 +358,7 @@ void InstructionSelection::run(int functionIndex)
opt.convertOutOfSSA();
ConvertTemps().toStackSlots(_function);
}
- opt.showMeTheCode(_function);
+ opt.showMeTheCode(_function, "After stack slot allocation");
} else {
ConvertTemps().toStackSlots(_function);
}
diff --git a/src/qml/compiler/qv4isel_moth_p.h b/src/qml/compiler/qv4isel_moth_p.h
index 89f575c633..4ea0f1d07f 100644
--- a/src/qml/compiler/qv4isel_moth_p.h
+++ b/src/qml/compiler/qv4isel_moth_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/compiler/qv4isel_p.cpp b/src/qml/compiler/qv4isel_p.cpp
index 4bb866616d..54b184b4eb 100644
--- a/src/qml/compiler/qv4isel_p.cpp
+++ b/src/qml/compiler/qv4isel_p.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,14 +23,16 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
+#include <QtCore/QDebug>
+#include <QtCore/QBuffer>
#include "qv4jsir_p.h"
#include "qv4isel_p.h"
#include "qv4isel_util_p.h"
@@ -41,11 +43,6 @@
#include <QString>
-namespace {
-Q_GLOBAL_STATIC_WITH_ARGS(QTextStream, qout, (stderr, QIODevice::WriteOnly));
-#define qout *qout()
-} // anonymous namespace
-
using namespace QV4;
using namespace QV4::IR;
@@ -218,8 +215,12 @@ void IRDecoder::visitMove(IR::Move *s)
// For anything else...:
Q_UNIMPLEMENTED();
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ QTextStream qout(&buf);
IRPrinter(&qout).print(s);
qout << endl;
+ qDebug("%s", buf.data().constData());
Q_ASSERT(!"TODO");
}
@@ -398,7 +399,10 @@ void IRDecoder::callBuiltin(IR::Call *call, Expr *result)
}
Q_UNIMPLEMENTED();
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ QTextStream qout(&buf);
IRPrinter(&qout).print(call); qout << endl;
- Q_ASSERT(!"TODO!");
+ qDebug("%s", buf.data().constData());
Q_UNREACHABLE();
}
diff --git a/src/qml/compiler/qv4isel_p.h b/src/qml/compiler/qv4isel_p.h
index 504d255eaf..1e273df93e 100644
--- a/src/qml/compiler/qv4isel_p.h
+++ b/src/qml/compiler/qv4isel_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/compiler/qv4isel_util_p.h b/src/qml/compiler/qv4isel_util_p.h
index e96ed3caa6..521c345228 100644
--- a/src/qml/compiler/qv4isel_util_p.h
+++ b/src/qml/compiler/qv4isel_util_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/compiler/qv4jsir.cpp b/src/qml/compiler/qv4jsir.cpp
index e23ca1d516..5c9cc98ade 100644
--- a/src/qml/compiler/qv4jsir.cpp
+++ b/src/qml/compiler/qv4jsir.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -44,6 +44,8 @@
#include <QtCore/qset.h>
#include <cmath>
+#include <vector>
+
#ifdef CONST
#undef CONST
#endif
@@ -152,7 +154,7 @@ AluOp binaryOperator(int op)
struct RemoveSharedExpressions: IR::StmtVisitor, IR::ExprVisitor
{
CloneExpr clone;
- QSet<Expr *> subexpressions; // contains all the non-cloned subexpressions in the given function
+ std::vector<Expr *> subexpressions; // contains all the non-cloned subexpressions in the given function. sorted using std::lower_bound.
Expr *uniqueExpr;
RemoveSharedExpressions(): uniqueExpr(0) {}
@@ -176,18 +178,19 @@ struct RemoveSharedExpressions: IR::StmtVisitor, IR::ExprVisitor
template <typename _Expr>
_Expr *cleanup(_Expr *expr)
{
- if (subexpressions.contains(expr)) {
- // the cloned expression is unique by definition
- // so we don't need to add it to `subexpressions'.
- return clone(expr);
+ std::vector<Expr *>::iterator it = std::lower_bound(subexpressions.begin(), subexpressions.end(), expr);
+ if (it == subexpressions.end() || *it != expr) {
+ subexpressions.insert(it, expr);
+ IR::Expr *e = expr;
+ qSwap(uniqueExpr, e);
+ expr->accept(this);
+ qSwap(uniqueExpr, e);
+ return static_cast<_Expr *>(e);
}
- subexpressions.insert(expr);
- IR::Expr *e = expr;
- qSwap(uniqueExpr, e);
- expr->accept(this);
- qSwap(uniqueExpr, e);
- return static_cast<_Expr *>(e);
+ // the cloned expression is unique by definition
+ // so we don't need to add it to `subexpressions'.
+ return clone(expr);
}
// statements
@@ -508,8 +511,11 @@ void Function::setStatementCount(int cnt)
BasicBlock::~BasicBlock()
{
- foreach (Stmt *s, _statements)
- s->destroyData();
+ foreach (Stmt *s, _statements) {
+ Phi *p = s->asPhi();
+ if (p)
+ p->destroyData();
+ }
}
unsigned BasicBlock::newTemp()
@@ -763,8 +769,12 @@ void BasicBlock::setStatements(const QVector<Stmt *> &newStatements)
Q_ASSERT(newStatements.size() >= _statements.size());
// FIXME: this gets quite inefficient for large basic-blocks, so this function/case should be re-worked.
foreach (Stmt *s, _statements) {
- if (!newStatements.contains(s))
- s->destroyData();
+ Phi *p = s->asPhi();
+ if (!p)
+ continue;
+
+ if (!newStatements.contains(p))
+ p->destroyData();
}
_statements = newStatements;
}
@@ -813,21 +823,27 @@ void BasicBlock::insertStatementBeforeTerminator(Stmt *stmt)
void BasicBlock::replaceStatement(int index, Stmt *newStmt)
{
Q_ASSERT(!isRemoved());
- _statements[index]->destroyData();
+ Phi *p = _statements[index]->asPhi();
+ if (p)
+ p->destroyData();
_statements[index] = newStmt;
}
void BasicBlock::removeStatement(Stmt *stmt)
{
Q_ASSERT(!isRemoved());
- stmt->destroyData();
+ Phi *p = stmt->asPhi();
+ if (p)
+ p->destroyData();
_statements.remove(_statements.indexOf(stmt));
}
void BasicBlock::removeStatement(int idx)
{
Q_ASSERT(!isRemoved());
- _statements[idx]->destroyData();
+ Phi *p = _statements[idx]->asPhi();
+ if (p)
+ p->destroyData();
_statements.remove(idx);
}
diff --git a/src/qml/compiler/qv4jsir_p.h b/src/qml/compiler/qv4jsir_p.h
index 66528e8bc1..8daad97e8b 100644
--- a/src/qml/compiler/qv4jsir_p.h
+++ b/src/qml/compiler/qv4jsir_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -70,10 +70,6 @@ class QQmlPropertyCache;
class QQmlEnginePrivate;
namespace QV4 {
-struct ExecutionContext;
-}
-
-namespace QV4 {
inline bool isNegative(double d)
{
@@ -230,7 +226,7 @@ struct MemberExpressionResolver
typedef Type (*ResolveFunction)(QQmlEnginePrivate *engine, MemberExpressionResolver *resolver, Member *member);
MemberExpressionResolver()
- : resolveMember(0), data(0), extraData(0), flags(0), isQObjectResolver(false) {}
+ : resolveMember(0), data(0), extraData(0), flags(0) {}
bool isValid() const { return !!resolveMember; }
void clear() { *this = MemberExpressionResolver(); }
@@ -238,8 +234,7 @@ struct MemberExpressionResolver
ResolveFunction resolveMember;
void *data; // Could be pointer to meta object, importNameSpace, etc. - depends on resolveMember implementation
void *extraData; // Could be QQmlTypeNameCache
- unsigned int flags : 31;
- unsigned int isQObjectResolver; // neede for IR dump helpers
+ unsigned int flags;
};
struct Q_AUTOTEST_EXPORT Expr {
@@ -373,23 +368,25 @@ struct Q_AUTOTEST_EXPORT Temp: Expr {
StackSlot
};
+ // Used when temp is used as base in member expression
+ MemberExpressionResolver *memberResolver;
+
unsigned index : 28;
- unsigned kind : 3;
unsigned isReadOnly : 1;
- // Used when temp is used as base in member expression
- MemberExpressionResolver memberResolver;
+ unsigned kind : 3;
Temp()
- : index((1 << 28) - 1)
- , kind(Invalid)
+ : memberResolver(0)
+ , index((1 << 28) - 1)
, isReadOnly(0)
+ , kind(Invalid)
{}
void init(unsigned kind, unsigned index)
{
- this->kind = kind;
this->index = index;
this->isReadOnly = false;
+ this->kind = kind;
}
bool isInvalid() const { return kind == Invalid; }
@@ -605,16 +602,11 @@ struct Member: Expr {
};
struct Stmt {
- struct Data {
- QVector<Expr *> incoming; // used by Phi nodes
- };
-
enum { InvalidId = -1 };
- Data *d;
QQmlJS::AST::SourceLocation location;
- explicit Stmt(int id): d(0), _id(id) {}
+ explicit Stmt(int id): _id(id) {}
virtual ~Stmt()
{
@@ -638,10 +630,6 @@ struct Stmt {
private: // For memory management in BasicBlock
friend struct BasicBlock;
- void destroyData() {
- delete d;
- d = 0;
- }
private:
friend struct Function;
@@ -738,11 +726,21 @@ struct Ret: Stmt {
struct Phi: Stmt {
Temp *targetTemp;
+ struct Data {
+ QVector<Expr *> incoming; // used by Phi nodes
+ };
- Phi(int id): Stmt(id) {}
+ Data *d;
+
+ Phi(int id): Stmt(id), d(0) {}
virtual void accept(StmtVisitor *v) { v->visitPhi(this); }
virtual Phi *asPhi() { return this; }
+
+ void destroyData() {
+ delete d;
+ d = 0;
+ }
};
struct Q_QML_PRIVATE_EXPORT Module {
diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp
index 5861138dbe..e61a602e64 100644
--- a/src/qml/compiler/qv4ssa.cpp
+++ b/src/qml/compiler/qv4ssa.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -40,6 +40,7 @@
#include "qv4isel_util_p.h"
#include "qv4util_p.h"
+#include <QtCore/QBuffer>
#include <QtCore/QCoreApplication>
#include <QtCore/QStringList>
#include <QtCore/QSet>
@@ -51,9 +52,6 @@
#include <cassert>
#include <algorithm>
-#undef SHOW_SSA
-#undef DEBUG_MOVEMAPPING
-
QT_USE_NAMESPACE
using namespace QV4;
@@ -61,34 +59,151 @@ using namespace IR;
namespace {
+enum { DebugMoveMapping = 0 };
+
#ifdef QT_NO_DEBUG
enum { DoVerification = 0 };
#else
enum { DoVerification = 1 };
#endif
-Q_GLOBAL_STATIC_WITH_ARGS(QTextStream, qout, (stderr, QIODevice::WriteOnly));
-#define qout *qout()
-
-void showMeTheCode(IR::Function *function)
+static void showMeTheCode(IR::Function *function, const char *marker)
{
static bool showCode = !qgetenv("QV4_SHOW_IR").isNull();
if (showCode) {
- IRPrinter(&qout).print(function);
- qout << endl;
+ qDebug() << marker;
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ QTextStream stream(&buf);
+ IRPrinter(&stream).print(function);
+ stream << endl;
+ qDebug("%s", buf.data().constData());
}
}
-class ProcessedBlocks
+#if !defined(BROKEN_STD_VECTOR_BOOL_OR_BROKEN_STD_FIND)
+// Sanity:
+class BitVector
{
- QBitArray processed;
+ std::vector<bool> bits;
public:
- ProcessedBlocks(IR::Function *function)
+ BitVector(int size = 0, bool value = false)
+ : bits(size, value)
+ {}
+
+ void reserve(int size)
+ { bits.reserve(size); }
+
+ int size() const
+ {
+ Q_ASSERT(bits.size() < INT_MAX);
+ return static_cast<int>(bits.size());
+ }
+
+ void resize(int newSize)
+ { bits.resize(newSize); }
+
+ void assign(int newSize, bool value)
+ { bits.assign(newSize, value); }
+
+ int findNext(int start, bool value, bool wrapAround) const
{
- processed = QBitArray(function->basicBlockCount(), false);
+ // The ++operator of std::vector<bool>::iterator in libc++ has a bug when using it on an
+ // iterator pointing to the last element. It will not be set to ::end(), but beyond
+ // that. (It will be set to the first multiple of the native word size that is bigger
+ // than size().)
+ //
+ // See http://llvm.org/bugs/show_bug.cgi?id=19663
+ //
+ // The work-around is to calculate the distance, and compare it to the size() to see if it's
+ // beyond the end, or take the minimum of the distance and the size.
+
+ size_t pos = std::distance(bits.begin(),
+ std::find(bits.begin() + start, bits.end(), value));
+ if (wrapAround && pos >= static_cast<size_t>(size()))
+ pos = std::distance(bits.begin(),
+ std::find(bits.begin(), bits.begin() + start, value));
+
+ pos = qMin(pos, static_cast<size_t>(size()));
+
+ Q_ASSERT(pos <= static_cast<size_t>(size()));
+ Q_ASSERT(pos < INT_MAX);
+
+ return static_cast<int>(pos);
}
+ bool at(int idx) const
+ { return bits.at(idx); }
+
+ void setBit(int idx)
+ { bits[idx] = true; }
+
+ void clearBit(int idx)
+ { bits[idx] = false; }
+};
+#else // Insanity:
+class BitVector
+{
+ QBitArray bits;
+
+public:
+ BitVector(int size = 0, bool value = false)
+ : bits(size, value)
+ {}
+
+ void reserve(int size)
+ { Q_UNUSED(size); }
+
+ int size() const
+ { return bits.size(); }
+
+ void resize(int newSize)
+ { bits.resize(newSize); }
+
+ void assign(int newSize, bool value)
+ {
+ bits.resize(newSize);
+ bits.fill(value);
+ }
+
+ int findNext(int start, bool value, bool wrapAround) const
+ {
+ for (int i = start, ei = size(); i < ei; ++i) {
+ if (at(i) == value)
+ return i;
+ }
+
+ if (wrapAround) {
+ for (int i = 0, ei = start; i < ei; ++i) {
+ if (at(i) == value)
+ return i;
+ }
+ }
+
+ return size();
+ }
+
+ bool at(int idx) const
+ { return bits.at(idx); }
+
+ void setBit(int idx)
+ { bits[idx] = true; }
+
+ void clearBit(int idx)
+ { bits[idx] = false; }
+};
+#endif
+
+class ProcessedBlocks
+{
+ BitVector processed;
+
+public:
+ ProcessedBlocks(IR::Function *function)
+ : processed(function->basicBlockCount(), false)
+ {}
+
bool alreadyProcessed(BasicBlock *bb) const
{
Q_ASSERT(bb);
@@ -104,10 +219,9 @@ public:
class BasicBlockSet
{
- typedef std::vector<int> Numbers;
- typedef std::vector<bool> Flags;
+ typedef BitVector Flags;
- Numbers *blockNumbers;
+ QVarLengthArray<int, 8> blockNumbers;
Flags *blockFlags;
IR::Function *function;
enum { MaxVectorCapacity = 8 };
@@ -117,56 +231,40 @@ public:
{
const BasicBlockSet &set;
// ### These two members could go into a union, but clang won't compile (https://codereview.qt-project.org/#change,74259)
- Numbers::const_iterator numberIt;
- size_t flagIt;
+ QVarLengthArray<int, 8>::const_iterator numberIt;
+ int flagIt;
friend class BasicBlockSet;
const_iterator(const BasicBlockSet &set, bool end)
: set(set)
{
if (end || !set.function) {
- if (set.blockNumbers)
- numberIt = set.blockNumbers->end();
+ if (!set.blockFlags)
+ numberIt = set.blockNumbers.end();
else
flagIt = set.blockFlags->size();
} else {
- if (set.blockNumbers)
- numberIt = set.blockNumbers->begin();
+ if (!set.blockFlags)
+ numberIt = set.blockNumbers.begin();
else
findNextWithFlags(0);
}
}
- void findNextWithFlags(size_t start)
+ void findNextWithFlags(int start)
{
- flagIt = std::distance(set.blockFlags->begin(),
- std::find(set.blockFlags->begin() + start,
- set.blockFlags->end(),
- true));
-
- // The ++operator of std::vector<bool>::iterator in libc++ has a bug when using it on an
- // iterator pointing to the last element. It will not be set to ::end(), but beyond
- // that. (It will be set to the first multiple of the native word size that is bigger
- // than size().)
- //
- // See http://llvm.org/bugs/show_bug.cgi?id=19663
- //
- // As we use the size to for our end() iterator, take the minimum of the size and the
- // distance for the flagIt:
- flagIt = qMin(flagIt, set.blockFlags->size());
-
+ flagIt = set.blockFlags->findNext(start, true, /*wrapAround = */false);
Q_ASSERT(flagIt <= set.blockFlags->size());
}
public:
BasicBlock *operator*() const
{
-
- if (set.blockNumbers) {
+ if (!set.blockFlags) {
return set.function->basicBlock(*numberIt);
} else {
- Q_ASSERT(flagIt <= static_cast<size_t>(set.function->basicBlockCount()));
- return set.function->basicBlock(static_cast<int>(flagIt));
+ Q_ASSERT(flagIt <= set.function->basicBlockCount());
+ return set.function->basicBlock(flagIt);
}
}
@@ -174,7 +272,7 @@ public:
{
if (&set != &other.set)
return false;
- if (set.blockNumbers)
+ if (!set.blockFlags)
return numberIt == other.numberIt;
else
return flagIt == other.flagIt;
@@ -185,7 +283,7 @@ public:
const_iterator &operator++()
{
- if (set.blockNumbers)
+ if (!set.blockFlags)
++numberIt;
else
findNextWithFlags(flagIt + 1);
@@ -197,14 +295,14 @@ public:
friend class const_iterator;
public:
- BasicBlockSet(IR::Function *f = 0): blockNumbers(0), blockFlags(0), function(0)
+ BasicBlockSet(IR::Function *f = 0): blockFlags(0), function(0)
{
if (f)
init(f);
}
#ifdef Q_COMPILER_RVALUE_REFS
- BasicBlockSet(BasicBlockSet &&other): blockNumbers(0), blockFlags(0)
+ BasicBlockSet(BasicBlockSet &&other): blockFlags(0)
{
std::swap(blockNumbers, other.blockNumbers);
std::swap(blockFlags, other.blockFlags);
@@ -213,14 +311,12 @@ public:
#endif // Q_COMPILER_RVALUE_REFS
BasicBlockSet(const BasicBlockSet &other)
- : blockNumbers(0)
- , blockFlags(0)
+ : blockFlags(0)
, function(other.function)
{
if (other.blockFlags)
blockFlags = new Flags(*other.blockFlags);
- else if (other.blockNumbers)
- blockNumbers = new Numbers(*other.blockNumbers);
+ blockNumbers = other.blockNumbers;
}
BasicBlockSet &operator=(const BasicBlockSet &other)
@@ -228,27 +324,24 @@ public:
if (blockFlags) {
delete blockFlags;
blockFlags = 0;
- } else {
- delete blockNumbers;
- blockNumbers = 0;
}
function = other.function;
if (other.blockFlags)
blockFlags = new Flags(*other.blockFlags);
- else if (other.blockNumbers)
- blockNumbers = new Numbers(*other.blockNumbers);
+ blockNumbers = other.blockNumbers;
return *this;
}
- ~BasicBlockSet() { delete blockNumbers; delete blockFlags; }
+ ~BasicBlockSet()
+ {
+ delete blockFlags;
+ }
void init(IR::Function *f)
{
Q_ASSERT(!function);
Q_ASSERT(f);
function = f;
- blockNumbers = new Numbers;
- blockNumbers->reserve(MaxVectorCapacity);
}
bool empty() const
@@ -261,25 +354,24 @@ public:
Q_ASSERT(function);
if (blockFlags) {
- (*blockFlags)[bb->index()] = true;
+ blockFlags->setBit(bb->index());
return;
}
- for (std::vector<int>::const_iterator i = blockNumbers->begin(), ei = blockNumbers->end();
- i != ei; ++i)
- if (*i == bb->index())
+ for (int i = 0; i < blockNumbers.size(); ++i) {
+ if (blockNumbers[i] == bb->index())
return;
+ }
- if (blockNumbers->size() == MaxVectorCapacity) {
+ if (blockNumbers.size() == MaxVectorCapacity) {
blockFlags = new Flags(function->basicBlockCount(), false);
- for (std::vector<int>::const_iterator i = blockNumbers->begin(), ei = blockNumbers->end();
- i != ei; ++i)
- blockFlags->operator[](*i) = true;
- delete blockNumbers;
- blockNumbers = 0;
- blockFlags->operator[](bb->index()) = true;
+ for (int i = 0; i < blockNumbers.size(); ++i) {
+ blockFlags->setBit(blockNumbers[i]);
+ }
+ blockNumbers.clear();
+ blockFlags->setBit(bb->index());
} else {
- blockNumbers->push_back(bb->index());
+ blockNumbers.append(bb->index());
}
}
@@ -288,13 +380,13 @@ public:
Q_ASSERT(function);
if (blockFlags) {
- (*blockFlags)[bb->index()] = false;
+ blockFlags->clearBit(bb->index());
return;
}
- for (std::vector<int>::iterator i = blockNumbers->begin(), ei = blockNumbers->end(); i != ei; ++i) {
- if (*i == bb->index()) {
- blockNumbers->erase(i);
+ for (int i = 0; i < blockNumbers.size(); ++i) {
+ if (blockNumbers[i] == bb->index()) {
+ blockNumbers.remove(i);
return;
}
}
@@ -316,10 +408,10 @@ public:
Q_ASSERT(function);
if (blockFlags)
- return (*blockFlags)[bb->index()];
+ return blockFlags->at(bb->index());
- for (std::vector<int>::const_iterator i = blockNumbers->begin(), ei = blockNumbers->end(); i != ei; ++i) {
- if (*i == bb->index())
+ for (int i = 0; i < blockNumbers.size(); ++i) {
+ if (blockNumbers[i] == bb->index())
return true;
}
@@ -402,11 +494,6 @@ class DominatorTree
todo = worklist.back();
worklist.pop_back();
}
-
-#if defined(SHOW_SSA)
- for (int i = 0; i < nodes.size(); ++i)
- qDebug("\tL%d: dfnum = %d, parent = %d", i, dfnum[i], parent[i]);
-#endif // SHOW_SSA
}
BasicBlockIndex ancestorWithLowestSemi(BasicBlockIndex v, std::vector<BasicBlockIndex> &worklist) {
@@ -550,12 +637,12 @@ public:
np.todo = children[nodeIndex];
}
- std::vector<bool> DF_done(function->basicBlockCount(), false);
+ BitVector DF_done(function->basicBlockCount(), false);
while (!worklist.empty()) {
BasicBlockIndex node = worklist.back();
- if (DF_done[node]) {
+ if (DF_done.at(node)) {
worklist.pop_back();
continue;
}
@@ -563,7 +650,7 @@ public:
NodeProgress &np = nodeStatus[node];
std::vector<BasicBlockIndex>::iterator it = np.todo.begin();
while (it != np.todo.end()) {
- if (DF_done[*it]) {
+ if (DF_done.at(*it)) {
it = np.todo.erase(it);
} else {
worklist.push_back(*it);
@@ -586,12 +673,15 @@ public:
S.insert(w);
}
}
- DF_done[node] = true;
+ DF_done.setBit(node);
worklist.pop_back();
}
}
if (DebugDominatorFrontiers) {
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ QTextStream qout(&buf);
qout << "Dominator Frontiers:" << endl;
foreach (BasicBlock *n, function->basicBlocks()) {
if (n->isRemoved())
@@ -606,6 +696,7 @@ public:
}
qout << "}" << endl;
}
+ qDebug("%s", buf.data().constData());
}
if (DebugDominatorFrontiers && DebugCodeCanUseLotsOfCpu) {
@@ -624,7 +715,7 @@ public:
}
}
if (!hasDominatedSucc) {
- qout << fBlock << " in DF[" << n->index() << "] has no dominated predecessors" << endl;
+ qDebug("%d in DF[%d] has no dominated predecessors", fBlock->index(), n->index());
}
Q_ASSERT(hasDominatedSucc);
}
@@ -646,6 +737,9 @@ public:
void dumpImmediateDominators() const
{
if (DebugImmediateDominators) {
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ QTextStream qout(&buf);
qout << "Immediate dominators:" << endl;
foreach (BasicBlock *to, function->basicBlocks()) {
if (to->isRemoved())
@@ -659,6 +753,7 @@ public:
qout << "(none)";
qout << " -> " << to->index() << endl;
}
+ qDebug("%s", buf.data().constData());
}
}
@@ -687,7 +782,7 @@ public:
return;
for (size_t i = 0, ei = idom.size(); i != ei; ++i) {
if (idom[i] == dominator) {
- BasicBlock *bb = function->basicBlock(i);
+ BasicBlock *bb = function->basicBlock(int(i));
if (!bb->isRemoved())
siblings.insert(bb);
}
@@ -917,8 +1012,8 @@ class VariableCollector: public StmtVisitor, ExprVisitor {
std::vector<Temp> _allTemps;
std::vector<BasicBlockSet> _defsites;
std::vector<std::vector<int> > A_orig;
- std::vector<bool> nonLocals;
- std::vector<bool> killed;
+ BitVector nonLocals;
+ BitVector killed;
BasicBlock *currentBB;
bool isCollectable(Temp *t) const
@@ -949,14 +1044,11 @@ public:
for (int i = 0; i < function->tempCount; ++i)
_defsites[i].init(function);
nonLocals.resize(function->tempCount);
- A_orig.resize(function->basicBlockCount());
- for (int i = 0, ei = A_orig.size(); i != ei; ++i)
+ const size_t ei = function->basicBlockCount();
+ A_orig.resize(ei);
+ for (size_t i = 0; i != ei; ++i)
A_orig[i].reserve(8);
-#if defined(SHOW_SSA)
- qout << "Variables collected:" << endl;
-#endif // SHOW_SSA
-
foreach (BasicBlock *bb, function->basicBlocks()) {
if (bb->isRemoved())
continue;
@@ -966,17 +1058,6 @@ public:
foreach (Stmt *s, bb->statements())
s->accept(this);
}
-
-#if defined(SHOW_SSA)
- qout << "Non-locals:" << endl;
- foreach (const Temp &nonLocal, nonLocals) {
- qout << "\t";
- nonLocal.dump(qout);
- qout << endl;
- }
-
- qout << "end collected variables." << endl;
-#endif // SHOW_SSA
}
const std::vector<Temp> &allTemps() const
@@ -996,8 +1077,8 @@ public:
bool isNonLocal(const Temp &var) const
{
Q_ASSERT(!var.isInvalid());
- Q_ASSERT(var.index < nonLocals.size());
- return nonLocals[var.index];
+ Q_ASSERT(static_cast<int>(var.index) < nonLocals.size());
+ return nonLocals.at(var.index);
}
protected:
@@ -1038,17 +1119,11 @@ protected:
addTemp(t);
if (isCollectable(t)) {
-#if defined(SHOW_SSA)
- qout << '\t';
- t->dump(qout);
- qout << " -> L" << currentBB->index << endl;
-#endif // SHOW_SSA
-
_defsites[t->index].insert(currentBB);
addDefInCurrentBlock(t);
// For semi-pruned SSA:
- killed[t->index] = true;
+ killed.setBit(t->index);
}
} else {
s->target->accept(this);
@@ -1060,8 +1135,8 @@ protected:
addTemp(t);
if (isCollectable(t))
- if (!killed[t->index])
- nonLocals[t->index] = true;
+ if (!killed.at(t->index))
+ nonLocals.setBit(t->index);
}
};
@@ -1097,16 +1172,12 @@ public:
private:
std::vector<DefUse> _defUses;
- class Temps: public QVector<Temp> {
- public:
- Temps() { reserve(4); }
- };
+ typedef QVarLengthArray<Temp, 4> Temps;
std::vector<Temps> _usesPerStatement;
void ensure(Temp *newTemp)
{
if (_defUses.size() <= newTemp->index) {
- _defUses.reserve(newTemp->index + _defUses.size() / 3 + 1);
_defUses.resize(newTemp->index + 1);
}
}
@@ -1115,7 +1186,6 @@ private:
{
Q_ASSERT(s->id() >= 0);
if (static_cast<unsigned>(s->id()) >= _usesPerStatement.size()) {
- _usesPerStatement.reserve(s->id() + _usesPerStatement.size() / 3 + 1);
_usesPerStatement.resize(s->id() + 1);
}
}
@@ -1143,10 +1213,10 @@ public:
}
unsigned statementCount() const
- { return _usesPerStatement.size(); }
+ { return unsigned(_usesPerStatement.size()); }
unsigned tempCount() const
- { return _defUses.size(); }
+ { return unsigned(_defUses.size()); }
const Temp &temp(int idx) const
{ return _defUses[idx].temp; }
@@ -1161,9 +1231,10 @@ public:
defUse.blockOfStatement = defBlock;
}
- QList<UntypedTemp> defsUntyped() const
+ QVector<UntypedTemp> defsUntyped() const
{
- QList<UntypedTemp> res;
+ QVector<UntypedTemp> res;
+ res.reserve(tempCount());
foreach (const DefUse &du, _defUses)
if (du.isValid())
res.append(UntypedTemp(du.temp));
@@ -1172,8 +1243,9 @@ public:
std::vector<const Temp *> defs() const {
std::vector<const Temp *> res;
- res.reserve(_defUses.size());
- for (unsigned i = 0, ei = _defUses.size(); i != ei; ++i) {
+ const size_t ei = _defUses.size();
+ res.reserve(ei);
+ for (size_t i = 0; i != ei; ++i) {
const DefUse &du = _defUses.at(i);
if (du.isValid())
res.push_back(&du.temp);
@@ -1242,7 +1314,7 @@ public:
ensure(s);
}
- const QVector<Temp> &usedVars(Stmt *s) const
+ const Temps &usedVars(Stmt *s) const
{
Q_ASSERT(s->id() >= 0);
Q_ASSERT(static_cast<unsigned>(s->id()) < _usesPerStatement.size());
@@ -1274,6 +1346,9 @@ public:
void dump() const
{
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ QTextStream qout(&buf);
qout << "Defines and uses:" << endl;
foreach (const DefUse &du, _defUses) {
if (!du.isValid())
@@ -1288,24 +1363,19 @@ public:
qout << endl;
}
qout << "Uses per statement:" << endl;
- for (unsigned i = 0, ei = _usesPerStatement.size(); i != ei; ++i) {
+ for (size_t i = 0, ei = _usesPerStatement.size(); i != ei; ++i) {
qout << " " << i << ":";
foreach (const Temp &t, _usesPerStatement[i])
qout << ' ' << t.index;
qout << endl;
}
+ qDebug("%s", buf.data().constData());
}
};
void insertPhiNode(const Temp &a, BasicBlock *y, IR::Function *f) {
-#if defined(SHOW_SSA)
- qout << "-> inserted phi node for variable ";
- a.dump(qout);
- qout << " in block " << y->index << endl;
-#endif
-
Phi *phiNode = f->NewStmt<Phi>();
- phiNode->d = new Stmt::Data;
+ phiNode->d = new Phi::Data;
phiNode->targetTemp = f->New<Temp>();
phiNode->targetTemp->init(a.kind, a.index);
y->prependStatement(phiNode);
@@ -1643,22 +1713,14 @@ protected:
// see [Appel]. For the changes needed for semi-pruned SSA form, and for its advantages, see [Briggs].
void convertToSSA(IR::Function *function, const DominatorTree &df, DefUses &defUses)
{
-#if defined(SHOW_SSA)
- qout << "Converting function ";
- if (function->name)
- qout << *function->name;
- else
- qout << "<no name>";
- qout << " to SSA..." << endl;
-#endif // SHOW_SSA
-
// Collect all applicable variables:
VariableCollector variables(function);
// Prepare for phi node insertion:
- std::vector<std::vector<bool> > A_phi;
- A_phi.resize(function->basicBlockCount());
- for (int i = 0, ei = A_phi.size(); i != ei; ++i)
+ std::vector<BitVector > A_phi;
+ const size_t ei = function->basicBlockCount();
+ A_phi.resize(ei);
+ for (size_t i = 0; i != ei; ++i)
A_phi[i].assign(function->tempCount, false);
std::vector<BasicBlock *> W;
@@ -1682,7 +1744,7 @@ void convertToSSA(IR::Function *function, const DominatorTree &df, DefUses &defU
BasicBlock *y = *it;
if (!A_phi.at(y->index()).at(a.index)) {
insertPhiNode(a, y, function);
- A_phi[y->index()].at(a.index) = true;
+ A_phi[y->index()].setBit(a.index);
const std::vector<int> &varsInBlockY = variables.inBlock(y);
if (std::find(varsInBlockY.begin(), varsInBlockY.end(), a.index) == varsInBlockY.end())
W.push_back(y);
@@ -1759,10 +1821,10 @@ class StatementWorklist
{
IR::Function *theFunction;
std::vector<Stmt *> stmts;
- std::vector<bool> worklist;
+ BitVector worklist;
unsigned worklistSize;
std::vector<int> replaced;
- std::vector<bool> removed;
+ BitVector removed;
Q_DISABLE_COPY(StatementWorklist)
@@ -1786,7 +1848,7 @@ public:
continue;
stmts[s->id()] = s;
- worklist[s->id()] = true;
+ worklist.setBit(s->id());
++worklistSize;
}
}
@@ -1801,7 +1863,7 @@ public:
if (!s)
continue;
- worklist[s->id()] = true;
+ worklist.setBit(s->id());
++worklistSize;
}
@@ -1812,10 +1874,9 @@ public:
void remove(Stmt *stmt)
{
replaced[stmt->id()] = Stmt::InvalidId;
- removed[stmt->id()] = true;
- std::vector<bool>::reference inWorklist = worklist[stmt->id()];
- if (inWorklist) {
- inWorklist = false;
+ removed.setBit(stmt->id());
+ if (worklist.at(stmt->id())) {
+ worklist.clearBit(stmt->id());
Q_ASSERT(worklistSize > 0);
--worklistSize;
}
@@ -1825,15 +1886,15 @@ public:
{
Q_ASSERT(oldStmt);
Q_ASSERT(replaced[oldStmt->id()] == Stmt::InvalidId);
- Q_ASSERT(removed[oldStmt->id()] == false);
+ Q_ASSERT(removed.at(oldStmt->id()) == false);
Q_ASSERT(newStmt);
registerNewStatement(newStmt);
Q_ASSERT(replaced[newStmt->id()] == Stmt::InvalidId);
- Q_ASSERT(removed[newStmt->id()] == false);
+ Q_ASSERT(removed.at(newStmt->id()) == false);
replaced[oldStmt->id()] = newStmt->id();
- worklist[oldStmt->id()] = false;
+ worklist.clearBit(oldStmt->id());
}
void applyToFunction()
@@ -1854,7 +1915,7 @@ public:
Q_ASSERT(id != Stmt::InvalidId);
Q_ASSERT(static_cast<unsigned>(stmt->id()) < stmts.size());
- if (removed[id]) {
+ if (removed.at(id)) {
bb->removeStatement(i);
} else {
if (id != stmt->id())
@@ -1883,10 +1944,10 @@ public:
return *this;
Q_ASSERT(s->id() >= 0);
- Q_ASSERT(static_cast<unsigned>(s->id()) < worklist.size());
+ Q_ASSERT(s->id() < worklist.size());
- if (!worklist[s->id()]) {
- worklist[s->id()] = true;
+ if (!worklist.at(s->id())) {
+ worklist.setBit(s->id());
++worklistSize;
}
@@ -1896,11 +1957,10 @@ public:
StatementWorklist &operator-=(Stmt *s)
{
Q_ASSERT(s->id() >= 0);
- Q_ASSERT(static_cast<unsigned>(s->id()) < worklist.size());
+ Q_ASSERT(s->id() < worklist.size());
- std::vector<bool>::reference inWorklist = worklist[s->id()];
- if (inWorklist) {
- inWorklist = false;
+ if (worklist.at(s->id())) {
+ worklist.clearBit(s->id());
Q_ASSERT(worklistSize > 0);
--worklistSize;
}
@@ -1920,18 +1980,13 @@ public:
const int startAt = last ? last->id() + 1 : 0;
Q_ASSERT(startAt >= 0);
- Q_ASSERT(static_cast<unsigned>(startAt) <= worklist.size());
+ Q_ASSERT(startAt <= worklist.size());
- Q_ASSERT(worklist.size() == stmts.size());
+ Q_ASSERT(static_cast<size_t>(worklist.size()) == stmts.size());
- // Do not compare the result of find with the end iterator, because some libc++ versions
- // have a bug where the result of the ++operator is past-the-end of the vector, but unequal
- // to end().
- size_t pos = std::find(worklist.begin() + startAt, worklist.end(), true) - worklist.begin();
- if (pos >= worklist.size())
- pos = std::find(worklist.begin(), worklist.begin() + startAt, true) - worklist.begin();
+ int pos = worklist.findNext(startAt, true, /*wrapAround = */true);
- worklist[pos] = false;
+ worklist.clearBit(pos);
Q_ASSERT(worklistSize > 0);
--worklistSize;
Stmt *s = stmts.at(pos);
@@ -1953,9 +2008,9 @@ public:
int newSize = s->id() + 1;
stmts.resize(newSize, 0);
- worklist.resize(newSize, false);
+ worklist.resize(newSize);
replaced.resize(newSize, Stmt::InvalidId);
- removed.resize(newSize, false);
+ removed.resize(newSize);
}
stmts[s->id()] = s;
@@ -1964,7 +2019,8 @@ public:
private:
void grow()
{
- size_t newCapacity = ((stmts.capacity() + 1) * 3) / 2;
+ Q_ASSERT(stmts.capacity() < INT_MAX / 2);
+ int newCapacity = ((static_cast<int>(stmts.capacity()) + 1) * 3) / 2;
stmts.reserve(newCapacity);
worklist.reserve(newCapacity);
replaced.reserve(newCapacity);
@@ -2113,12 +2169,15 @@ protected:
struct DiscoveredType {
int type;
- MemberExpressionResolver memberResolver;
+ MemberExpressionResolver *memberResolver;
- DiscoveredType() : type(UnknownType) {}
- DiscoveredType(Type t) : type(t) { Q_ASSERT(type != QObjectType); }
- explicit DiscoveredType(int t) : type(t) { Q_ASSERT(type != QObjectType); }
- explicit DiscoveredType(MemberExpressionResolver memberResolver) : type(QObjectType), memberResolver(memberResolver) {}
+ DiscoveredType() : type(UnknownType), memberResolver(0) {}
+ DiscoveredType(Type t) : type(t), memberResolver(0) { Q_ASSERT(type != QObjectType); }
+ explicit DiscoveredType(int t) : type(t), memberResolver(0) { Q_ASSERT(type != QObjectType); }
+ explicit DiscoveredType(MemberExpressionResolver *memberResolver)
+ : type(QObjectType)
+ , memberResolver(memberResolver)
+ { Q_ASSERT(memberResolver); }
bool test(Type t) const { return type & t; }
bool isNumber() const { return (type & NumberType) && !(type & ~NumberType); }
@@ -2223,7 +2282,7 @@ class TypeInference: public StmtVisitor, public ExprVisitor
this->type = type;
fullyTyped = type.type != UnknownType;
}
- explicit TypingResult(MemberExpressionResolver memberResolver)
+ explicit TypingResult(MemberExpressionResolver *memberResolver)
: type(memberResolver)
, fullyTyped(true)
{}
@@ -2248,30 +2307,39 @@ public:
continue;
if (DebugTypeInference) {
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ QTextStream qout(&buf);
qout<<"Typing stmt ";
IRPrinter(&qout).print(s);
- qout<<endl;
+ qDebug("%s", buf.data().constData());
}
if (!run(s)) {
*_worklist += s;
if (DebugTypeInference) {
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ QTextStream qout(&buf);
qout<<"Pushing back stmt: ";
IRPrinter(&qout).print(s);
- qout<<endl;
+ qDebug("%s", buf.data().constData());
}
} else {
if (DebugTypeInference) {
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ QTextStream qout(&buf);
qout<<"Finished: ";
IRPrinter(&qout).print(s);
- qout<<endl;
+ qDebug("%s", buf.data().constData());
}
}
}
PropagateTempTypes propagator(_defUses);
- for (unsigned i = 0, ei = _tempTypes.size(); i != ei; ++i) {
- const Temp &temp = _defUses.temp(i);
+ for (size_t i = 0, ei = _tempTypes.size(); i != ei; ++i) {
+ const Temp &temp = _defUses.temp(int(i));
if (temp.kind == Temp::Invalid)
continue;
const DiscoveredType &tempType = _tempTypes[i];
@@ -2306,9 +2374,9 @@ private:
void setType(Expr *e, DiscoveredType ty) {
if (Temp *t = e->asTemp()) {
if (DebugTypeInference)
- qout << "Setting type for temp " << t->index
- << " to " << typeName(Type(ty.type)) << " (" << ty.type << ")"
- << endl;
+ qDebug() << "Setting type for temp" << t->index
+ << " to " << typeName(Type(ty.type)) << "(" << ty.type << ")"
+ << endl;
DiscoveredType &it = _tempTypes[t->index];
if (it != ty) {
@@ -2316,9 +2384,12 @@ private:
if (DebugTypeInference) {
foreach (Stmt *s, _defUses.uses(*t)) {
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ QTextStream qout(&buf);
qout << "Pushing back dependent stmt: ";
IRPrinter(&qout).print(s);
- qout<<endl;
+ qDebug("%s", buf.data().constData());
}
}
@@ -2345,7 +2416,7 @@ protected:
virtual void visitRegExp(IR::RegExp *) { _ty = TypingResult(VarType); }
virtual void visitName(Name *) { _ty = TypingResult(VarType); }
virtual void visitTemp(Temp *e) {
- if (e->memberResolver.isValid())
+ if (e->memberResolver && e->memberResolver->isValid())
_ty = TypingResult(e->memberResolver);
else
_ty = TypingResult(_tempTypes[e->index]);
@@ -2456,9 +2527,9 @@ protected:
virtual void visitMember(Member *e) {
_ty = run(e->base);
- if (_ty.fullyTyped && _ty.type.memberResolver.isValid()) {
- MemberExpressionResolver &resolver = _ty.type.memberResolver;
- _ty.type.type = resolver.resolveMember(qmlEngine, &resolver, e);
+ if (_ty.fullyTyped && _ty.type.memberResolver && _ty.type.memberResolver->isValid()) {
+ MemberExpressionResolver *resolver = _ty.type.memberResolver;
+ _ty.type.type = resolver->resolveMember(qmlEngine, resolver, e);
} else
_ty.type = VarType;
}
@@ -2492,8 +2563,8 @@ protected:
}
_ty.type.type |= ty.type.type;
_ty.fullyTyped &= ty.fullyTyped;
- if (_ty.type.test(QObjectType))
- _ty.type.memberResolver.clear(); // ### TODO: find common ancestor meta-object
+ if (_ty.type.test(QObjectType) && _ty.type.memberResolver)
+ _ty.type.memberResolver->clear(); // ### TODO: find common ancestor meta-object
}
switch (_ty.type.type) {
@@ -2539,7 +2610,7 @@ public:
Q_UNUSED(f);
QVector<UntypedTemp> knownOk;
- QList<UntypedTemp> candidates = _defUses.defsUntyped();
+ QVector<UntypedTemp> candidates = _defUses.defsUntyped();
while (!candidates.isEmpty()) {
UntypedTemp temp = candidates.last();
candidates.removeLast();
@@ -2711,15 +2782,6 @@ class TypePropagation: public StmtVisitor, public ExprVisitor {
if (requestedType != UnknownType) {
if (e->type != requestedType) {
if (requestedType & NumberType || requestedType == BoolType) {
-#ifdef SHOW_SSA
- QTextStream os(stdout, QIODevice::WriteOnly);
- os << "adding conversion from " << typeName(e->type)
- << " to " << typeName(requestedType) << " for expression ";
- e->dump(os);
- os << " in statement ";
- _currStmt->dump(os);
- os << endl;
-#endif
if (insertConversion)
addConversion(e, requestedType);
return true;
@@ -3416,15 +3478,9 @@ public:
QHash<BasicBlock *, BasicBlock *> go()
{
- showMeTheCode(function);
+ showMeTheCode(function, "Before block scheduling");
schedule(function->basicBlock(0));
-#if defined(SHOW_SSA)
- qDebug() << "Block sequence:";
- foreach (BasicBlock *bb, sequence)
- qDebug("\tL%d", bb->index());
-#endif // SHOW_SSA
-
Q_ASSERT(function->liveBasicBlocksCount() == sequence.size());
function->setScheduledBlocks(sequence);
function->renumberBasicBlocks();
@@ -3438,8 +3494,8 @@ void checkCriticalEdges(QVector<BasicBlock *> basicBlocks) {
if (bb && bb->out.size() > 1) {
foreach (BasicBlock *bb2, bb->out) {
if (bb2 && bb2->in.size() > 1) {
- qout << "found critical edge between block "
- << bb->index() << " and block " << bb2->index();
+ qDebug() << "found critical edge between block"
+ << bb->index() << "and block" << bb2->index();
Q_ASSERT(false);
}
}
@@ -3450,14 +3506,13 @@ void checkCriticalEdges(QVector<BasicBlock *> basicBlocks) {
void cleanupBasicBlocks(IR::Function *function)
{
- showMeTheCode(function);
+ showMeTheCode(function, "Before basic block cleanup");
// Algorithm: this is the iterative version of a depth-first search for all blocks that are
// reachable through outgoing edges, starting with the start block and all exception handler
// blocks.
QBitArray reachableBlocks(function->basicBlockCount());
- QVector<BasicBlock *> postponed;
- postponed.reserve(16);
+ QVarLengthArray<BasicBlock *, 16> postponed;
for (int i = 0, ei = function->basicBlockCount(); i != ei; ++i) {
BasicBlock *bb = function->basicBlock(i);
if (i == 0 || bb->isExceptionHandler())
@@ -3503,7 +3558,7 @@ void cleanupBasicBlocks(IR::Function *function)
function->removeBasicBlock(bb);
}
- showMeTheCode(function);
+ showMeTheCode(function, "After basic block cleanup");
}
inline Const *isConstPhi(Phi *phi)
@@ -3784,42 +3839,42 @@ bool tryOptimizingComparison(Expr *&expr)
switch (b->op) {
case OpGt:
- leftConst->value = Runtime::compareGreaterThan(&l, &r);
+ leftConst->value = Runtime::compareGreaterThan(l, r);
leftConst->type = BoolType;
expr = leftConst;
return true;
case OpLt:
- leftConst->value = Runtime::compareLessThan(&l, &r);
+ leftConst->value = Runtime::compareLessThan(l, r);
leftConst->type = BoolType;
expr = leftConst;
return true;
case OpGe:
- leftConst->value = Runtime::compareGreaterEqual(&l, &r);
+ leftConst->value = Runtime::compareGreaterEqual(l, r);
leftConst->type = BoolType;
expr = leftConst;
return true;
case OpLe:
- leftConst->value = Runtime::compareLessEqual(&l, &r);
+ leftConst->value = Runtime::compareLessEqual(l, r);
leftConst->type = BoolType;
expr = leftConst;
return true;
case OpStrictEqual:
- leftConst->value = Runtime::compareStrictEqual(&l, &r);
+ leftConst->value = Runtime::compareStrictEqual(l, r);
leftConst->type = BoolType;
expr = leftConst;
return true;
case OpEqual:
- leftConst->value = Runtime::compareEqual(&l, &r);
+ leftConst->value = Runtime::compareEqual(l, r);
leftConst->type = BoolType;
expr = leftConst;
return true;
case OpStrictNotEqual:
- leftConst->value = Runtime::compareStrictNotEqual(&l, &r);
+ leftConst->value = Runtime::compareStrictNotEqual(l, r);
leftConst->type = BoolType;
expr = leftConst;
return true;
case OpNotEqual:
- leftConst->value = Runtime::compareNotEqual(&l, &r);
+ leftConst->value = Runtime::compareNotEqual(l, r);
leftConst->type = BoolType;
expr = leftConst;
return true;
@@ -3836,8 +3891,14 @@ void cfg2dot(IR::Function *f, const QVector<LoopDetection::LoopInfo *> &loops =
if (!showCode)
return;
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ QTextStream qout(&buf);
+
struct Util {
- static void genLoop(LoopDetection::LoopInfo *loop)
+ QTextStream &qout;
+ Util(QTextStream &qout): qout(qout) {}
+ void genLoop(LoopDetection::LoopInfo *loop)
{
qout << " subgraph \"cluster" << quint64(loop) << "\" {\n";
qout << " L" << loop->loopHeader->index() << ";\n";
@@ -3856,7 +3917,7 @@ void cfg2dot(IR::Function *f, const QVector<LoopDetection::LoopInfo *> &loops =
foreach (LoopDetection::LoopInfo *l, loops) {
if (l->parentLoop == 0)
- Util::genLoop(l);
+ Util(qout).genLoop(l);
}
foreach (BasicBlock *bb, f->basicBlocks()) {
@@ -3874,7 +3935,9 @@ void cfg2dot(IR::Function *f, const QVector<LoopDetection::LoopInfo *> &loops =
qout << " L" << idx << " -> L" << out->index() << "\n";
}
- qout << "}\n" << flush;
+ qout << "}\n";
+ buf.close();
+ qDebug("%s", buf.data().constData());
}
} // anonymous namespace
@@ -4307,6 +4370,10 @@ public:
void dump() const
{
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ QTextStream qout(&buf);
+
qout << "Life ranges:" << endl;
qout << "Intervals:" << endl;
foreach (const LifeTimeInterval *range, _sortedIntervals->intervals()) {
@@ -4315,7 +4382,7 @@ public:
}
IRPrinter printer(&qout);
- for (int i = 0, ei = _liveIn.size(); i != ei; ++i) {
+ for (size_t i = 0, ei = _liveIn.size(); i != ei; ++i) {
qout << "L" << i <<" live-in: ";
QList<Temp> live = QList<Temp>::fromSet(_liveIn.at(i));
if (live.isEmpty())
@@ -4327,6 +4394,8 @@ public:
}
qout << endl;
}
+ buf.close();
+ qDebug("%s", buf.data().constData());
}
private:
@@ -4340,7 +4409,7 @@ private:
foreach (Stmt *s, successor->statements()) {
if (Phi *phi = s->asPhi()) {
- if (Temp *t = phi->d->incoming[bbIndex]->asTemp())
+ if (Temp *t = phi->d->incoming.at(bbIndex)->asTemp())
live.insert(*t);
} else {
break;
@@ -4376,7 +4445,7 @@ private:
_sortedIntervals->add(&lti);
}
//### TODO: use DefUses from the optimizer, because it already has all this information
- for (unsigned i = 0, ei = collector.inputs.size(); i != ei; ++i) {
+ for (size_t i = 0, ei = collector.inputs.size(); i != ei; ++i) {
Temp *opd = collector.inputs[i];
interval(opd).addRange(start(bb), usePosition(s));
live.insert(*opd);
@@ -4557,7 +4626,7 @@ protected:
clonedStmt = phi;
phi->targetTemp = clone(stmt->targetTemp);
- phi->d = new Stmt::Data;
+ phi->d = new Phi::Data;
foreach (Expr *in, stmt->d->incoming)
phi->d->incoming.append(clone(in));
block->appendStatement(phi);
@@ -4911,6 +4980,8 @@ void LifeTimeInterval::addRange(int from, int to) {
LifeTimeInterval LifeTimeInterval::split(int atPosition, int newStart)
{
Q_ASSERT(atPosition < newStart || newStart == InvalidPosition);
+ Q_ASSERT(atPosition <= _end);
+ Q_ASSERT(newStart <= _end || newStart == InvalidPosition);
if (_ranges.isEmpty() || atPosition < _ranges.first().start)
return LifeTimeInterval();
@@ -5074,12 +5145,7 @@ Optimizer::Optimizer(IR::Function *function)
void Optimizer::run(QQmlEnginePrivate *qmlEngine, bool doTypeInference, bool peelLoops)
{
-#if defined(SHOW_SSA)
- qout << "##### NOW IN FUNCTION " << (function->name ? qPrintable(*function->name) : "anonymous!")
- << " with " << function->basicBlocks.size() << " basic blocks." << endl << flush;
-#endif
-
-// showMeTheCode(function);
+ showMeTheCode(function, "Before running the optimizer");
cleanupBasicBlocks(function);
@@ -5093,7 +5159,7 @@ void Optimizer::run(QQmlEnginePrivate *qmlEngine, bool doTypeInference, bool pee
// qout << "SSA for " << (function->name ? qPrintable(*function->name) : "<anonymous>") << endl;
ConvertArgLocals(function).toTemps();
- showMeTheCode(function);
+ showMeTheCode(function, "After converting arguments to locals");
// Calculate the dominator tree:
DominatorTree df(function);
@@ -5105,7 +5171,7 @@ void Optimizer::run(QQmlEnginePrivate *qmlEngine, bool doTypeInference, bool pee
LoopDetection loopDetection(df);
loopDetection.run(function);
- showMeTheCode(function);
+ showMeTheCode(function, "After loop detection");
// cfg2dot(function, loopDetection.allLoops());
if (peelLoops) {
@@ -5113,7 +5179,7 @@ void Optimizer::run(QQmlEnginePrivate *qmlEngine, bool doTypeInference, bool pee
LoopPeeling(df).run(innerLoops);
// cfg2dot(function, loopDetection.allLoops());
- showMeTheCode(function);
+ showMeTheCode(function, "After loop peeling");
if (!innerLoops.isEmpty())
verifyImmediateDominators(df, function);
}
@@ -5136,14 +5202,14 @@ void Optimizer::run(QQmlEnginePrivate *qmlEngine, bool doTypeInference, bool pee
// qout << "Cleaning up phi nodes..." << endl;
cleanupPhis(defUses);
- showMeTheCode(function);
+ showMeTheCode(function, "After cleaning up phi-nodes");
StatementWorklist worklist(function);
if (doTypeInference) {
// qout << "Running type inference..." << endl;
TypeInference(qmlEngine, defUses).run(worklist);
- showMeTheCode(function);
+ showMeTheCode(function, "After type inference");
// qout << "Doing reverse inference..." << endl;
ReverseInference(defUses).run(function);
@@ -5160,7 +5226,7 @@ void Optimizer::run(QQmlEnginePrivate *qmlEngine, bool doTypeInference, bool pee
// qout << "Running SSA optimization..." << endl;
worklist.reset();
optimizeSSA(worklist, defUses, df);
- showMeTheCode(function);
+ showMeTheCode(function, "After optimization");
verifyImmediateDominators(df, function);
verifyCFG(function);
@@ -5186,7 +5252,7 @@ void Optimizer::run(QQmlEnginePrivate *qmlEngine, bool doTypeInference, bool pee
// qout << "Doing block scheduling..." << endl;
// df.dumpImmediateDominators();
startEndLoops = BlockScheduler(function, df).go();
- showMeTheCode(function);
+ showMeTheCode(function, "After basic block scheduling");
// cfg2dot(function);
#ifndef QT_NO_DEBUG
@@ -5223,16 +5289,20 @@ void Optimizer::convertOutOfSSA() {
}
}
- #if defined(DEBUG_MOVEMAPPING)
- QTextStream os(stdout, QIODevice::WriteOnly);
- os << "Move mapping for function ";
- if (function->name)
- os << *function->name;
- else
- os << (void *) function;
- os << " on basic-block L" << bb->index << ":" << endl;
- moves.dump();
- #endif // DEBUG_MOVEMAPPING
+ if (DebugMoveMapping) {
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ QTextStream os(&buf);
+ os << "Move mapping for function ";
+ if (function->name)
+ os << *function->name;
+ else
+ os << (void *) function;
+ os << " on basic-block L" << bb->index() << ":" << endl;
+ moves.dump();
+ buf.close();
+ qDebug("%s", buf.data().constData());
+ }
moves.order();
@@ -5288,22 +5358,12 @@ QSet<Jump *> Optimizer::calculateOptionalJumps()
reachableWithoutJump.insert(bb);
}
-#if 0
- QTextStream out(stdout, QIODevice::WriteOnly);
- out << "Jumps to ignore:" << endl;
- foreach (Jump *j, removed) {
- out << "\t" << j->id << ": ";
- j->dump(out, Stmt::MIR);
- out << endl;
- }
-#endif
-
return optional;
}
-void Optimizer::showMeTheCode(IR::Function *function)
+void Optimizer::showMeTheCode(IR::Function *function, const char *marker)
{
- ::showMeTheCode(function);
+ ::showMeTheCode(function, marker);
}
static inline bool overlappingStorage(const Temp &t1, const Temp &t2)
@@ -5345,14 +5405,18 @@ void MoveMapping::add(Expr *from, Temp *to) {
if (Temp *t = from->asTemp()) {
if (overlappingStorage(*t, *to)) {
// assignments like fp1 = fp1 or var{&1} = double{&1} can safely be skipped.
-#if defined(DEBUG_MOVEMAPPING)
- QTextStream os(stderr, QIODevice::WriteOnly);
- os << "Skipping ";
- to->dump(os);
- os << " <- ";
- from->dump(os);
- os << endl;
-#endif // DEBUG_MOVEMAPPING
+ if (DebugMoveMapping) {
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ QTextStream os(&buf);
+ IRPrinter printer(&os);
+ os << "Skipping ";
+ printer.print(to);
+ os << " <- ";
+ printer.print(from);
+ buf.close();
+ qDebug("%s", buf.data().constData());
+ }
return;
}
}
@@ -5403,20 +5467,24 @@ QList<IR::Move *> MoveMapping::insertMoves(BasicBlock *bb, IR::Function *functio
void MoveMapping::dump() const
{
-#if defined(DEBUG_MOVEMAPPING)
- QTextStream os(stdout, QIODevice::WriteOnly);
- os << "Move mapping has " << _moves.size() << " moves..." << endl;
- foreach (const Move &m, _moves) {
- os << "\t";
- m.to->dump(os);
- if (m.needsSwap)
- os << " <-> ";
- else
- os << " <-- ";
- m.from->dump(os);
- os << endl;
+ if (DebugMoveMapping) {
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ QTextStream os(&buf);
+ IRPrinter printer(&os);
+ os << "Move mapping has " << _moves.size() << " moves..." << endl;
+ foreach (const Move &m, _moves) {
+ os << "\t";
+ printer.print(m.to);
+ if (m.needsSwap)
+ os << " <-> ";
+ else
+ os << " <-- ";
+ printer.print(m.from);
+ os << endl;
+ }
+ qDebug("%s", buf.data().constData());
}
-#endif // DEBUG_MOVEMAPPING
}
MoveMapping::Action MoveMapping::schedule(const Move &m, QList<Move> &todo, QList<Move> &delayed,
@@ -5427,19 +5495,24 @@ MoveMapping::Action MoveMapping::schedule(const Move &m, QList<Move> &todo, QLis
if (!output.contains(dependency)) {
if (delayed.contains(dependency)) {
// We have a cycle! Break it by swapping instead of assigning.
-#if defined(DEBUG_MOVEMAPPING)
- delayed+=m;
- QTextStream out(stderr, QIODevice::WriteOnly);
- out<<"we have a cycle! temps:" << endl;
- foreach (const Move &m, delayed) {
- out<<"\t";
- m.to->dump(out);
- out<<" <- ";
- m.from->dump(out);
- out<<endl;
+ if (DebugMoveMapping) {
+ delayed += m;
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ QTextStream out(&buf);
+ IRPrinter printer(&out);
+ out<<"we have a cycle! temps:" << endl;
+ foreach (const Move &m, delayed) {
+ out<<"\t";
+ printer.print(m.to);
+ out<<" <- ";
+ printer.print(m.from);
+ out<<endl;
+ }
+ qDebug("%s", buf.data().constData());
+ delayed.removeOne(m);
}
- delayed.removeOne(m);
-#endif // DEBUG_MOVEMAPPING
+
return NeedsSwap;
} else {
delayed.append(m);
diff --git a/src/qml/compiler/qv4ssa_p.h b/src/qml/compiler/qv4ssa_p.h
index 21a5b038b6..3cfacaee27 100644
--- a/src/qml/compiler/qv4ssa_p.h
+++ b/src/qml/compiler/qv4ssa_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -219,7 +219,7 @@ public:
QSet<IR::Jump *> calculateOptionalJumps();
- static void showMeTheCode(Function *function);
+ static void showMeTheCode(Function *function, const char *marker);
private:
Function *function;
diff --git a/src/qml/debugger/qdebugmessageservice.cpp b/src/qml/debugger/qdebugmessageservice.cpp
index 299ac6d67e..deaa472ce0 100644
--- a/src/qml/debugger/qdebugmessageservice.cpp
+++ b/src/qml/debugger/qdebugmessageservice.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/debugger/qdebugmessageservice_p.h b/src/qml/debugger/qdebugmessageservice_p.h
index c4392d3926..694cd0e64c 100644
--- a/src/qml/debugger/qdebugmessageservice_p.h
+++ b/src/qml/debugger/qdebugmessageservice_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/debugger/qqmlabstractprofileradapter.cpp b/src/qml/debugger/qqmlabstractprofileradapter.cpp
index 165772335a..ac673a89a2 100644
--- a/src/qml/debugger/qqmlabstractprofileradapter.cpp
+++ b/src/qml/debugger/qqmlabstractprofileradapter.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -36,6 +36,7 @@
QT_BEGIN_NAMESPACE
/*!
+ * \internal
* \class QQmlAbstractProfilerAdapter
* \inmodule QtQml
* Abstract base class for all adapters between profilers and the QQmlProfilerService. Adapters have
@@ -45,6 +46,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ * \internal
* \fn void QQmlAbstractProfilerAdapter::dataRequested()
* Signals that data has been requested by the \c QQmlProfilerService. This signal should be
* connected to a slot in the profiler and the profiler should then transfer its currently available
@@ -52,6 +54,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ * \internal
* \fn qint64 QQmlAbstractProfilerAdapter::sendMessages(qint64 until, QList<QByteArray> &messages)
* Append the messages up to the timestamp \a until, chronologically sorted, to \a messages. Keep
* track of the messages already sent and with each subsequent call to this method start with the
@@ -64,10 +67,11 @@ QT_BEGIN_NAMESPACE
*/
/*!
- * \fn void QQmlAbstractProfilerAdapter::startProfiling()
- * Emits either \c profilingEnabled() or \c profilingEnabledWhileWaiting(), depending on \c waiting.
- * If the profiler's thread is waiting for an initial start signal we can emit the signal over a
- * \c Qt::DirectConnection to avoid the delay of the event loop.
+ * \internal
+ * Emits either \c profilingEnabled(quint64) or \c profilingEnabledWhileWaiting(quint64), depending
+ * on \c waiting. If the profiler's thread is waiting for an initial start signal, we can emit the
+ * signal over a Qt::DirectConnection to avoid the delay of the event loop. The \a features are
+ * passed on to the signal.
*/
void QQmlAbstractProfilerAdapter::startProfiling(quint64 features)
{
@@ -79,10 +83,10 @@ void QQmlAbstractProfilerAdapter::startProfiling(quint64 features)
}
/*!
- * \fn void QQmlAbstractProfilerAdapter::stopProfiling()
+ * \internal
* Emits either \c profilingDisabled() or \c profilingDisabledWhileWaiting(), depending on
- * \c waiting. If the profiler's thread is waiting for an initial start signal we can emit the
- * signal over a \c Qt::DirectConnection to avoid the delay of the event loop. This should trigger
+ * \c waiting. If the profiler's thread is waiting for an initial start signal, we can emit the
+ * signal over a Qt::DirectConnection to avoid the delay of the event loop. This should trigger
* the profiler to report its collected data and subsequently delete it.
*/
void QQmlAbstractProfilerAdapter::stopProfiling() {
@@ -94,56 +98,67 @@ void QQmlAbstractProfilerAdapter::stopProfiling() {
}
/*!
+ * \internal
* \fn bool QQmlAbstractProfilerAdapter::isRunning() const
* Returns if the profiler is currently running. The profiler is considered to be running after
- * \c startProfiling() has been called until \c stopProfiling() is called. That is independent of
- * \c waiting. The profiler may be running and waiting at the same time.
+ * \c startProfiling(quint64) has been called until \c stopProfiling() is called. That is
+ * independent of \c waiting. The profiler may be running and waiting at the same time.
*/
/*!
+ * \internal
* \fn void QQmlAbstractProfilerAdapter::profilingDisabled()
* This signal is emitted if \c stopProfiling() is called while the profiler is not considered to
* be waiting. The profiler is expected to handle the signal asynchronously.
*/
/*!
+ * \internal
* \fn void QQmlAbstractProfilerAdapter::profilingDisabledWhileWaiting()
* This signal is emitted if \c stopProfiling() is called while the profiler is considered to be
- * waiting. In many cases this signal can be connected with a \c Qt::DirectConnection.
+ * waiting. In many cases this signal can be connected with a Qt::DirectConnection.
*/
/*!
- * \fn void QQmlAbstractProfilerAdapter::profilingEnabled()
- * This signal is emitted if \c startProfiling() is called while the profiler is not considered to
- * be waiting. The profiler is expected to handle the signal asynchronously.
+ * \internal
+ * \fn void QQmlAbstractProfilerAdapter::profilingEnabled(quint64 features)
+ * This signal is emitted if \c startProfiling(quint64) is called while the profiler is not
+ * considered to be waiting. The profiler is expected to handle the signal asynchronously. The
+ * \a features are passed on from \c startProfiling(quint64).
*/
/*!
- * \fn void QQmlAbstractProfilerAdapter::profilingEnabledWhileWaiting()
- * This signal is emitted if \c startProfiling() is called while the profiler is considered to be
- * waiting. In many cases this signal can be connected with a \c Qt::DirectConnection. By starting
- * the profiler synchronously when the QML engine starts instead of waiting for the first iteration
- * of the event loop the engine startup can be profiled.
+ * \internal
+ * \fn void QQmlAbstractProfilerAdapter::profilingEnabledWhileWaiting(quint64 features)
+ * This signal is emitted if \c startProfiling(quint64) is called while the profiler is considered
+ * to be waiting. In many cases this signal can be connected with a Qt::DirectConnection. By
+ * starting the profiler synchronously when the QML engine starts instead of waiting for the first
+ * iteration of the event loop the engine startup can be profiled. The \a features are passed on
+ * from \c startProfiling(quint64).
*/
/*!
+ * \internal
* \fn void QQmlAbstractProfilerAdapter::referenceTimeKnown(const QElapsedTimer &timer)
* This signal is used to synchronize the profiler's timer to the QQmlProfilerservice's. The
* profiler is expected to save \a timer and use it for timestamps on its data.
*/
/*!
+ * \internal
* \fn void QQmlAbstractProfilerAdapter::synchronize(const QElapsedTimer &timer)
* Synchronize the profiler to \a timer. This emits \c referenceTimeKnown().
*/
/*!
+ * \internal
* \fn void QQmlAbstractProfilerAdapter::reportData()
* Make the profiler report its current data without stopping the collection. The same (and
* additional) data can later be requested again with \c stopProfiling() or \c reportData().
*/
/*!
+ * \internal
* \fn void QQmlAbstractProfilerAdapter::startWaiting()
* Consider the profiler to be waiting from now on. While the profiler is waiting it can be directly
* accessed even if it is in a different thread. This method should only be called if it is actually
@@ -151,6 +166,7 @@ void QQmlAbstractProfilerAdapter::stopProfiling() {
*/
/*!
+ * \internal
* \fn void QQmlAbstractProfilerAdapter::stopWaiting()
* Consider the profiler not to be waiting anymore. If it lives in a different threads any requests
* for it have to be done via a queued connection then.
diff --git a/src/qml/debugger/qqmlabstractprofileradapter_p.h b/src/qml/debugger/qqmlabstractprofileradapter_p.h
index 03f6645178..bfd1561d3d 100644
--- a/src/qml/debugger/qqmlabstractprofileradapter_p.h
+++ b/src/qml/debugger/qqmlabstractprofileradapter_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/debugger/qqmlconfigurabledebugservice.cpp b/src/qml/debugger/qqmlconfigurabledebugservice.cpp
index 2c3bf466f4..e3693e00a4 100644
--- a/src/qml/debugger/qqmlconfigurabledebugservice.cpp
+++ b/src/qml/debugger/qqmlconfigurabledebugservice.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/debugger/qqmlconfigurabledebugservice_p.h b/src/qml/debugger/qqmlconfigurabledebugservice_p.h
index 5901014276..cf69c3a1f6 100644
--- a/src/qml/debugger/qqmlconfigurabledebugservice_p.h
+++ b/src/qml/debugger/qqmlconfigurabledebugservice_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/debugger/qqmlconfigurabledebugservice_p_p.h b/src/qml/debugger/qqmlconfigurabledebugservice_p_p.h
index 128daab350..6d693b6352 100644
--- a/src/qml/debugger/qqmlconfigurabledebugservice_p_p.h
+++ b/src/qml/debugger/qqmlconfigurabledebugservice_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/debugger/qqmldebug.h b/src/qml/debugger/qqmldebug.h
index 876d0683ce..559c492dfd 100644
--- a/src/qml/debugger/qqmldebug.h
+++ b/src/qml/debugger/qqmldebug.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -35,13 +35,21 @@
#define QQMLDEBUG_H
#include <QtQml/qtqmlglobal.h>
+#include <QtCore/qstring.h>
QT_BEGIN_NAMESPACE
struct Q_QML_EXPORT QQmlDebuggingEnabler
{
+ enum StartMode {
+ DoNotWaitForClient,
+ WaitForClient
+ };
+
QQmlDebuggingEnabler(bool printWarning = true);
+ static bool startTcpDebugServer(int port, StartMode mode = DoNotWaitForClient,
+ const QString &hostName = QString());
};
// Execute code in constructor before first QQmlEngine is instantiated
diff --git a/src/qml/debugger/qqmldebugserver.cpp b/src/qml/debugger/qqmldebugserver.cpp
index 2a2ce663bc..b0302181ee 100644
--- a/src/qml/debugger/qqmldebugserver.cpp
+++ b/src/qml/debugger/qqmldebugserver.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -51,7 +51,7 @@
#include <private/qobject_p.h>
#include <private/qcoreapplication_p.h>
-#if defined(QT_STATIC) && ! defined(QT_QML_NO_DEBUGGER)
+#if defined(QT_STATIC) && ! defined(QT_NO_QML_DEBUGGER)
#include "../../plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.h"
#endif
@@ -104,6 +104,8 @@ class QQmlDebugServerPrivate : public QObjectPrivate
public:
QQmlDebugServerPrivate();
+ bool start(int portFrom, int portTo, bool block, const QString &hostAddress,
+ const QString &pluginName);
void advertisePlugins();
void cleanup();
QQmlDebugServerConnection *loadConnectionPlugin(const QString &pluginName);
@@ -142,6 +144,7 @@ private:
void _q_changeServiceState(const QString &serviceName,
QQmlDebugService::State newState);
void _q_sendMessages(const QList<QByteArray> &messages);
+ void _q_removeThread();
};
void QQmlDebugServerInstanceWrapper::cleanup()
@@ -154,7 +157,7 @@ public:
m_pluginName = pluginName;
}
- void setPortRange(int portFrom, int portTo, bool block, QString &hostAddress) {
+ void setPortRange(int portFrom, int portTo, bool block, const QString &hostAddress) {
m_portFrom = portFrom;
m_portTo = portTo;
m_block = block;
@@ -226,12 +229,13 @@ void QQmlDebugServerPrivate::cleanup()
while (!changeServiceStateCalls.testAndSetOrdered(0, 0))
loop.processEvents();
- // Stop the thread while the application is still there.
- if (thread) {
- thread->exit();
- thread->wait();
- delete thread;
- thread = 0;
+ // Stop the thread while the application is still there. Copy here as the thread will set itself
+ // to 0 when it stops. It will also do deleteLater, but as long as we don't allow the GUI
+ // thread's event loop to run we're safe from that.
+ QThread *threadCopy = thread;
+ if (threadCopy) {
+ threadCopy->exit();
+ threadCopy->wait();
}
}
@@ -252,6 +256,7 @@ QQmlDebugServerConnection *QQmlDebugServerPrivate::loadConnectionPlugin(
}
}
+ QQmlDebugServerConnection *loadedConnection = 0;
foreach (const QString &pluginPath, pluginCandidates) {
if (qmlDebugVerbose())
qDebug() << "QML Debugger: Trying to load plugin " << pluginPath << "...";
@@ -263,13 +268,13 @@ QQmlDebugServerConnection *QQmlDebugServerPrivate::loadConnectionPlugin(
continue;
}
if (QObject *instance = loader.instance())
- connection = qobject_cast<QQmlDebugServerConnection*>(instance);
+ loadedConnection = qobject_cast<QQmlDebugServerConnection*>(instance);
- if (connection) {
+ if (loadedConnection) {
if (qmlDebugVerbose())
qDebug() << "QML Debugger: Plugin successfully loaded.";
- return connection;
+ return loadedConnection;
}
if (qmlDebugVerbose())
@@ -286,21 +291,25 @@ void QQmlDebugServerThread::run()
QQmlDebugServerInstanceWrapper *wrapper = debugServerInstance();
Q_ASSERT_X(wrapper != 0, Q_FUNC_INFO, "There should always be a debug server available here.");
QQmlDebugServer *server = &wrapper->m_instance;
-#if defined(QT_STATIC) && ! defined(QT_QML_NO_DEBUGGER)
+#if defined(QT_STATIC) && ! defined(QT_NO_QML_DEBUGGER)
QQmlDebugServerConnection *connection
= new QTcpServerConnection;
- server->d_func()->connection = connection;
#else
QQmlDebugServerConnection *connection
= server->d_func()->loadConnectionPlugin(m_pluginName);
#endif
if (connection) {
connection->setServer(server);
- connection->setPortRange(m_portFrom, m_portTo, m_block, m_hostAddress);
+ if (!connection->setPortRange(m_portFrom, m_portTo, m_block, m_hostAddress)) {
+ delete connection;
+ return;
+ }
+ server->d_func()->connection = connection;
+ if (m_block)
+ connection->waitForConnection();
} else {
- QCoreApplicationPrivate *appD = static_cast<QCoreApplicationPrivate*>(QObjectPrivate::get(qApp));
- qWarning() << QString(QLatin1String("QML Debugger: Ignoring \"-qmljsdebugger=%1\". "
- "Remote debugger plugin has not been found.")).arg(appD->qmljsDebugArgumentsString());
+ qWarning() << "QML Debugger: Couldn't load plugin" << m_pluginName;
+ return;
}
exec();
@@ -318,6 +327,18 @@ bool QQmlDebugServer::hasDebuggingClient() const
&& d->gotHello;
}
+bool QQmlDebugServer::hasThread() const
+{
+ Q_D(const QQmlDebugServer);
+ return d->thread != 0;
+}
+
+bool QQmlDebugServer::hasConnection() const
+{
+ Q_D(const QQmlDebugServer);
+ return d->connection != 0;
+}
+
bool QQmlDebugServer::blockingMode() const
{
Q_D(const QQmlDebugServer);
@@ -339,19 +360,48 @@ QQmlDebugServer *QQmlDebugServer::instance()
}
}
-static void cleanup()
+static void cleanupOnShutdown()
{
QQmlDebugServerInstanceWrapper *wrapper = debugServerInstance();
if (wrapper)
wrapper->cleanup();
}
+bool QQmlDebugServerPrivate::start(int portFrom, int portTo, bool block, const QString &hostAddress,
+ const QString &pluginName)
+{
+ if (!QQmlEnginePrivate::qml_debugging_enabled)
+ return false;
+ if (thread)
+ return false;
+ static bool postRoutineAdded = false;
+ if (!postRoutineAdded) {
+ qAddPostRoutine(cleanupOnShutdown);
+ postRoutineAdded = true;
+ }
+ Q_Q(QQmlDebugServer);
+ thread = new QQmlDebugServerThread;
+ q->moveToThread(thread);
+
+ // Remove the thread immmediately when it finishes, so that we don't have to wait for the event
+ // loop to signal that.
+ QObject::connect(thread, SIGNAL(finished()), q, SLOT(_q_removeThread()), Qt::DirectConnection);
+
+ thread->setObjectName(QStringLiteral("QQmlDebugServerThread"));
+ thread->setPluginName(pluginName);
+ thread->setPortRange(portFrom, portTo == -1 ? portFrom : portTo, block, hostAddress);
+ blockingMode = block;
+ thread->start();
+ return true;
+}
QQmlDebugServer::QQmlDebugServer()
: QObject(*(new QQmlDebugServerPrivate))
{
+ if (qApp == 0)
+ return;
QCoreApplicationPrivate *appD = static_cast<QCoreApplicationPrivate*>(QObjectPrivate::get(qApp));
-#ifndef QT_QML_NO_DEBUGGER
+#ifndef QT_NO_QML_DEBUGGER
// ### remove port definition when protocol is changed
int portFrom = 0;
int portTo = 0;
@@ -400,17 +450,8 @@ QQmlDebugServer::QQmlDebugServer()
}
if (ok) {
- qAddPostRoutine(cleanup);
Q_D(QQmlDebugServer);
- d->thread = new QQmlDebugServerThread;
- moveToThread(d->thread);
- d->thread->setObjectName(QStringLiteral("QQmlDebugServerThread"));
- d->thread->setPluginName(pluginName);
- d->thread->setPortRange(portFrom, portTo, block, hostAddress);
-
- d->blockingMode = block;
- d->thread->start();
-
+ d->start(portFrom, portTo, block, hostAddress, pluginName);
} else {
qWarning() << QString(QLatin1String(
"QML Debugger: Ignoring \"-qmljsdebugger=%1\". "
@@ -419,7 +460,6 @@ QQmlDebugServer::QQmlDebugServer()
}
}
#else
- Q_UNUSED(&cleanup)
if (!appD->qmljsDebugArgumentsString().isEmpty()) {
qWarning() << QString(QLatin1String(
"QML Debugger: Ignoring \"-qmljsdebugger=%1\". "
@@ -429,17 +469,10 @@ QQmlDebugServer::QQmlDebugServer()
#endif
}
-// called from GUI thread!
-QQmlDebugServer::~QQmlDebugServer()
-{
- Q_D(QQmlDebugServer);
-
- delete d->thread;
- delete d->connection;
-}
-
void QQmlDebugServer::receiveMessage(const QByteArray &message)
{
+ typedef QHash<QString, QQmlDebugService*>::const_iterator DebugServiceConstIt;
+
// to be executed in debugger thread
Q_ASSERT(QThread::currentThread() == thread());
@@ -485,8 +518,7 @@ void QQmlDebugServer::receiveMessage(const QByteArray &message)
QMutexLocker helloLock(&d->helloMutex);
d->gotHello = true;
- QHash<QString, QQmlDebugService*>::ConstIterator iter = d->plugins.constBegin();
- for (; iter != d->plugins.constEnd(); ++iter) {
+ for (DebugServiceConstIt iter = d->plugins.constBegin(), cend = d->plugins.constEnd(); iter != cend; ++iter) {
QQmlDebugService::State newState = QQmlDebugService::Unavailable;
if (d->clientPlugins.contains(iter.key()))
newState = QQmlDebugService::Enabled;
@@ -503,8 +535,7 @@ void QQmlDebugServer::receiveMessage(const QByteArray &message)
QStringList oldClientPlugins = d->clientPlugins;
in >> d->clientPlugins;
- QHash<QString, QQmlDebugService*>::ConstIterator iter = d->plugins.constBegin();
- for (; iter != d->plugins.constEnd(); ++iter) {
+ for (DebugServiceConstIt iter = d->plugins.constBegin(), cend = d->plugins.constEnd(); iter != cend; ++iter) {
const QString pluginName = iter.key();
QQmlDebugService::State newState = QQmlDebugService::Unavailable;
if (d->clientPlugins.contains(pluginName))
@@ -575,6 +606,24 @@ void QQmlDebugServerPrivate::_q_sendMessages(const QList<QByteArray> &messages)
connection->send(messages);
}
+void QQmlDebugServerPrivate::_q_removeThread()
+{
+ Q_ASSERT(thread->isFinished());
+ Q_ASSERT(QThread::currentThread() == thread);
+
+ QThread *parentThread = thread->thread();
+
+ // We cannot delete it right away as it will access its data after the finished() signal.
+ thread->deleteLater();
+ thread = 0;
+
+ delete connection;
+ connection = 0;
+
+ // Move it back to the parent thread so that we can potentially restart it on a new thread.
+ q_func()->moveToThread(parentThread);
+}
+
QList<QQmlDebugService*> QQmlDebugServer::services() const
{
Q_D(const QQmlDebugServer);
@@ -681,6 +730,31 @@ void QQmlDebugServer::sendMessages(QQmlDebugService *service,
Q_ARG(QList<QByteArray>, prefixedMessages));
}
+bool QQmlDebugServer::enable(int portFrom, int portTo, bool block, const QString &hostAddress)
+{
+#ifndef QT_NO_QML_DEBUGGER
+ QQmlDebugServerInstanceWrapper *wrapper = debugServerInstance();
+ if (!wrapper)
+ return false;
+ QQmlDebugServerPrivate *d = wrapper->m_instance.d_func();
+ if (d->thread)
+ return false;
+ if (!d->start(portFrom, portTo, block, hostAddress, QLatin1String("qmldbg_tcp")))
+ return false;
+ while (!wrapper->m_instance.hasConnection()) {
+ if (!wrapper->m_instance.hasThread())
+ return false;
+ }
+ return true;
+#else
+ Q_UNUSED(portFrom);
+ Q_UNUSED(portTo);
+ Q_UNUSED(block);
+ Q_UNUSED(hostAddress);
+ return false;
+#endif
+}
+
void QQmlDebugServer::wakeEngine(QQmlEngine *engine)
{
// to be executed in debugger thread
diff --git a/src/qml/debugger/qqmldebugserver_p.h b/src/qml/debugger/qqmldebugserver_p.h
index 4ea71fb769..b2bd0b2463 100644
--- a/src/qml/debugger/qqmldebugserver_p.h
+++ b/src/qml/debugger/qqmldebugserver_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -59,10 +59,11 @@ class Q_QML_PRIVATE_EXPORT QQmlDebugServer : public QObject
Q_DECLARE_PRIVATE(QQmlDebugServer)
Q_DISABLE_COPY(QQmlDebugServer)
public:
- ~QQmlDebugServer();
static QQmlDebugServer *instance();
+ bool hasThread() const;
+ bool hasConnection() const;
bool hasDebuggingClient() const;
bool blockingMode() const;
@@ -78,6 +79,7 @@ public:
void receiveMessage(const QByteArray &message);
void sendMessages(QQmlDebugService *service, const QList<QByteArray> &messages);
+ static bool enable(int portFrom, int portTo, bool block, const QString &hostAddress);
private slots:
void wakeEngine(QQmlEngine *engine);
@@ -91,6 +93,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_changeServiceState(const QString &serviceName,
QQmlDebugService::State state))
Q_PRIVATE_SLOT(d_func(), void _q_sendMessages(QList<QByteArray>))
+ Q_PRIVATE_SLOT(d_func(), void _q_removeThread())
public:
static int s_dataStreamVersion;
diff --git a/src/qml/debugger/qqmldebugserverconnection_p.h b/src/qml/debugger/qqmldebugserverconnection_p.h
index 18a01544f3..9170238b46 100644
--- a/src/qml/debugger/qqmldebugserverconnection_p.h
+++ b/src/qml/debugger/qqmldebugserverconnection_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -59,10 +59,11 @@ public:
virtual ~QQmlDebugServerConnection() {}
virtual void setServer(QQmlDebugServer *server) = 0;
- virtual void setPortRange(int portFrom, int portTo, bool bock, const QString &hostaddress) = 0;
+ virtual bool setPortRange(int portFrom, int portTo, bool bock, const QString &hostaddress) = 0;
virtual bool isConnected() const = 0;
virtual void send(const QList<QByteArray> &messages) = 0;
virtual void disconnect() = 0;
+ virtual void waitForConnection() = 0;
virtual bool waitForMessage() = 0;
};
diff --git a/src/qml/debugger/qqmldebugservice.cpp b/src/qml/debugger/qqmldebugservice.cpp
index f02f2aa635..b37a7335a0 100644
--- a/src/qml/debugger/qqmldebugservice.cpp
+++ b/src/qml/debugger/qqmldebugservice.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -215,7 +215,7 @@ QList<QObject*> QQmlDebugService::objectForLocationInfo(const QString &filename,
} else {
QQmlData *ddata = QQmlData::get(iter.value());
if (ddata && ddata->outerContext) {
- if (QFileInfo(ddata->outerContext->urlString).fileName() == filename &&
+ if (QFileInfo(ddata->outerContext->urlString()).fileName() == filename &&
ddata->lineNumber == lineNumber &&
ddata->columnNumber >= columnNumber) {
objects << *iter;
diff --git a/src/qml/debugger/qqmldebugservice_p.h b/src/qml/debugger/qqmldebugservice_p.h
index 8f0be05784..9cdfc34ff1 100644
--- a/src/qml/debugger/qqmldebugservice_p.h
+++ b/src/qml/debugger/qqmldebugservice_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/debugger/qqmldebugservice_p_p.h b/src/qml/debugger/qqmldebugservice_p_p.h
index aa28c25f6e..7d60739f3a 100644
--- a/src/qml/debugger/qqmldebugservice_p_p.h
+++ b/src/qml/debugger/qqmldebugservice_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/debugger/qqmldebugstatesdelegate_p.h b/src/qml/debugger/qqmldebugstatesdelegate_p.h
index 8346a31a5d..16bf4824ca 100644
--- a/src/qml/debugger/qqmldebugstatesdelegate_p.h
+++ b/src/qml/debugger/qqmldebugstatesdelegate_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/debugger/qqmlenginecontrolservice.cpp b/src/qml/debugger/qqmlenginecontrolservice.cpp
index 118697d7da..07c6715524 100644
--- a/src/qml/debugger/qqmlenginecontrolservice.cpp
+++ b/src/qml/debugger/qqmlenginecontrolservice.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/debugger/qqmlenginecontrolservice_p.h b/src/qml/debugger/qqmlenginecontrolservice_p.h
index 171ed2e138..2171937efe 100644
--- a/src/qml/debugger/qqmlenginecontrolservice_p.h
+++ b/src/qml/debugger/qqmlenginecontrolservice_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/debugger/qqmlenginedebugservice.cpp b/src/qml/debugger/qqmlenginedebugservice.cpp
index 088f3203d6..da01d00f17 100644
--- a/src/qml/debugger/qqmlenginedebugservice.cpp
+++ b/src/qml/debugger/qqmlenginedebugservice.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -207,8 +207,22 @@ QVariant QQmlEngineDebugService::valueContents(QVariant value) const
return contents;
}
- if (QQmlValueTypeFactory::isValueType(userType))
+ if (QQmlValueTypeFactory::isValueType(userType)) {
+ const QMetaObject *mo = QQmlValueTypeFactory::metaObjectForMetaType(userType);
+ if (mo) {
+ int toStringIndex = mo->indexOfMethod("toString");
+ if (toStringIndex != -1) {
+ QMetaMethod mm = mo->method(toStringIndex);
+ QMetaType info(userType);
+ QString s;
+ if (info.flags() & QMetaType::IsGadget
+ && mm.invokeOnGadget(value.data(), Q_RETURN_ARG(QString, s)))
+ return s;
+ }
+ }
+
return value;
+ }
if (QQmlMetaType::isQObject(userType)) {
QObject *o = QQmlMetaType::toQObject(value);
@@ -377,7 +391,7 @@ QQmlEngineDebugService::objectData(QObject *object)
QQmlData *ddata = QQmlData::get(object);
QQmlObjectData rv;
if (ddata && ddata->outerContext) {
- rv.url = ddata->outerContext->url;
+ rv.url = ddata->outerContext->url();
rv.lineNumber = ddata->lineNumber;
rv.columnNumber = ddata->columnNumber;
} else {
@@ -748,7 +762,7 @@ bool QQmlEngineDebugService::setMethodBody(int objectId, const QString &method,
int lineNumber = vmeMetaObject->vmeMethodLineNumber(prop->coreIndex);
QV4::ExecutionEngine *v4 = QV8Engine::getV4(qmlEngine(object)->handle());
QV4::Scope scope(v4);
- QV4::ScopedValue v(scope, QQmlExpressionPrivate::evalFunction(contextData, object, jsfunction, contextData->url.toString(), lineNumber));
+ QV4::ScopedValue v(scope, QQmlExpressionPrivate::evalFunction(contextData, object, jsfunction, contextData->urlString(), lineNumber));
vmeMetaObject->setVmeMethod(prop->coreIndex, v);
return true;
}
diff --git a/src/qml/debugger/qqmlenginedebugservice_p.h b/src/qml/debugger/qqmlenginedebugservice_p.h
index 940ca7d99c..0a824b132f 100644
--- a/src/qml/debugger/qqmlenginedebugservice_p.h
+++ b/src/qml/debugger/qqmlenginedebugservice_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/debugger/qqmlinspectorinterface_p.h b/src/qml/debugger/qqmlinspectorinterface_p.h
index 48a43c46bf..9b29d383c7 100644
--- a/src/qml/debugger/qqmlinspectorinterface_p.h
+++ b/src/qml/debugger/qqmlinspectorinterface_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/debugger/qqmlinspectorservice.cpp b/src/qml/debugger/qqmlinspectorservice.cpp
index 89c2c17c45..5a8c4487d9 100644
--- a/src/qml/debugger/qqmlinspectorservice.cpp
+++ b/src/qml/debugger/qqmlinspectorservice.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/debugger/qqmlinspectorservice_p.h b/src/qml/debugger/qqmlinspectorservice_p.h
index 9ba8e3ad44..f49c36aacb 100644
--- a/src/qml/debugger/qqmlinspectorservice_p.h
+++ b/src/qml/debugger/qqmlinspectorservice_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/debugger/qqmlprofiler.cpp b/src/qml/debugger/qqmlprofiler.cpp
index b102201ff1..b35da8a714 100644
--- a/src/qml/debugger/qqmlprofiler.cpp
+++ b/src/qml/debugger/qqmlprofiler.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/debugger/qqmlprofiler_p.h b/src/qml/debugger/qqmlprofiler_p.h
index 13e6b8ddae..5c994b112f 100644
--- a/src/qml/debugger/qqmlprofiler_p.h
+++ b/src/qml/debugger/qqmlprofiler_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -112,11 +112,11 @@ Q_DECLARE_TYPEINFO(QQmlProfilerData, Q_MOVABLE_TYPE);
class QQmlProfiler : public QObject, public QQmlProfilerDefinitions {
Q_OBJECT
public:
- void startBinding(const QString &fileName, int line, int column)
+ void startBinding(const QQmlSourceLocation &location)
{
m_data.append(QQmlProfilerData(m_timer.nsecsElapsed(),
(1 << RangeStart | 1 << RangeLocation), 1 << Binding,
- fileName, line, column));
+ location.sourceFile, qmlSourceCoordinate(location.line), qmlSourceCoordinate(location.column)));
}
// Have toByteArrays() construct another RangeData event from the same QString later.
@@ -201,11 +201,11 @@ struct QQmlProfilerHelper : public QQmlProfilerDefinitions {
};
struct QQmlBindingProfiler : public QQmlProfilerHelper {
- QQmlBindingProfiler(QQmlProfiler *profiler, const QString &url, int line, int column) :
+ QQmlBindingProfiler(QQmlProfiler *profiler, const QV4::FunctionObject *function) :
QQmlProfilerHelper(profiler)
{
Q_QML_PROFILE(QQmlProfilerDefinitions::ProfileBinding, profiler,
- startBinding(url, line, column));
+ startBinding(function->sourceLocation()));
}
~QQmlBindingProfiler()
diff --git a/src/qml/debugger/qqmlprofilerdefinitions_p.h b/src/qml/debugger/qqmlprofilerdefinitions_p.h
index e8ee98433d..1213b67b3c 100644
--- a/src/qml/debugger/qqmlprofilerdefinitions_p.h
+++ b/src/qml/debugger/qqmlprofilerdefinitions_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -107,18 +107,20 @@ struct QQmlProfilerDefinitions {
};
enum SceneGraphFrameType {
- SceneGraphRendererFrame,
- SceneGraphAdaptationLayerFrame,
- SceneGraphContextFrame,
- SceneGraphRenderLoopFrame,
- SceneGraphTexturePrepare,
- SceneGraphTextureDeletion,
- SceneGraphPolishAndSync,
- SceneGraphWindowsRenderShow,
- SceneGraphWindowsAnimations,
- SceneGraphPolishFrame,
-
- MaximumSceneGraphFrameType
+ SceneGraphRendererFrame, // Render Thread
+ SceneGraphAdaptationLayerFrame, // Render Thread
+ SceneGraphContextFrame, // Render Thread
+ SceneGraphRenderLoopFrame, // Render Thread
+ SceneGraphTexturePrepare, // Render Thread
+ SceneGraphTextureDeletion, // Render Thread
+ SceneGraphPolishAndSync, // GUI Thread
+ SceneGraphWindowsRenderShow, // Unused
+ SceneGraphWindowsAnimations, // GUI Thread
+ SceneGraphPolishFrame, // GUI Thread
+
+ MaximumSceneGraphFrameType,
+ NumRenderThreadFrameTypes = SceneGraphPolishAndSync,
+ NumGUIThreadFrameTypes = MaximumSceneGraphFrameType - NumRenderThreadFrameTypes
};
typedef QV4::Profiling::MemoryType MemoryType;
diff --git a/src/qml/debugger/qqmlprofilerservice.cpp b/src/qml/debugger/qqmlprofilerservice.cpp
index 5ec8178f32..85556836e6 100644
--- a/src/qml/debugger/qqmlprofilerservice.cpp
+++ b/src/qml/debugger/qqmlprofilerservice.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/debugger/qqmlprofilerservice_p.h b/src/qml/debugger/qqmlprofilerservice_p.h
index c4c40adc4f..978d8413a7 100644
--- a/src/qml/debugger/qqmlprofilerservice_p.h
+++ b/src/qml/debugger/qqmlprofilerservice_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -58,6 +58,8 @@
#include <QtCore/qstringbuilder.h>
#include <QtCore/qwaitcondition.h>
+#include <limits>
+
QT_BEGIN_NAMESPACE
class QUrl;
diff --git a/src/qml/debugger/qv4debugservice.cpp b/src/qml/debugger/qv4debugservice.cpp
index b0cac272aa..cefb29e031 100644
--- a/src/qml/debugger/qv4debugservice.cpp
+++ b/src/qml/debugger/qv4debugservice.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -62,8 +62,8 @@ const char *V4_LINENUMBER = "linenumber";
#ifdef NO_PROTOCOL_TRACING
# define TRACE_PROTOCOL(x)
#else
+#include <QtCore/QDebug>
# define TRACE_PROTOCOL(x) x
-static QTextStream debug(stderr, QIODevice::WriteOnly);
#endif
QT_BEGIN_NAMESPACE
@@ -227,17 +227,17 @@ protected:
addHandle(name, o, QStringLiteral("string"));
}
- virtual void addObject(const QString &name, QV4::ValueRef value)
+ virtual void addObject(const QString &name, const QV4::Value &value)
{
QV4::Scope scope(engine());
- QV4::ScopedObject obj(scope, value->asObject());
+ QV4::ScopedObject obj(scope, value.asObject());
- int ref = cachedObjectRef(obj.getPointer());
+ int ref = cachedObjectRef(obj);
if (ref != -1) {
addNameRefPair(name, ref);
} else {
int ref = newRefId();
- cacheObjectRef(obj.getPointer(), ref);
+ cacheObjectRef(obj, ref);
QJsonArray properties, *prev = &properties;
QSet<int> used;
@@ -330,14 +330,14 @@ private:
refsToInclude.append(value);
}
- void cacheObjectRef(QV4::Object *obj, int ref)
+ void cacheObjectRef(QV4::Value obj, int ref)
{
- objectRefs.insert(obj, ref);
+ objectRefs.insert(obj.val, ref);
}
- int cachedObjectRef(QV4::Object *obj) const
+ int cachedObjectRef(QV4::Value obj) const
{
- return objectRefs.value(obj, -1);
+ return objectRefs.value(obj.val, -1);
}
private:
@@ -347,7 +347,7 @@ private:
QJsonArray *destination;
QSet<int> usedRefs;
QHash<int, QSet<int> > refsByHandle;
- QHash<QV4::Object *, int> objectRefs;
+ QHash<quint64, int> objectRefs;
};
class QV4DebugServicePrivate : public QQmlConfigurableDebugServicePrivate
@@ -378,7 +378,7 @@ public:
QByteArray responseData = doc.toJson(QJsonDocument::Indented);
#endif
- TRACE_PROTOCOL(debug << "sending response for: " << responseData << endl);
+ TRACE_PROTOCOL(qDebug() << "sending response for:" << responseData << endl);
q_func()->sendMessage(packMessage("v8message", responseData));
}
@@ -422,7 +422,7 @@ public:
QJsonArray scopes;
// Only type and index are used by Qt Creator, so we keep it easy:
- QVector<QV4::ExecutionContext::ContextType> scopeTypes = debugger->getScopeTypes(frameNr);
+ QVector<QV4::Heap::ExecutionContext::ContextType> scopeTypes = debugger->getScopeTypes(frameNr);
for (int i = 0, ei = scopeTypes.count(); i != ei; ++i) {
int type = encodeScopeType(scopeTypes[i]);
if (type == -1)
@@ -438,23 +438,23 @@ public:
return frame;
}
- int encodeScopeType(QV4::ExecutionContext::ContextType scopeType)
+ int encodeScopeType(QV4::Heap::ExecutionContext::ContextType scopeType)
{
switch (scopeType) {
- case QV4::ExecutionContext::Type_GlobalContext:
+ case QV4::Heap::ExecutionContext::Type_GlobalContext:
return 0;
break;
- case QV4::ExecutionContext::Type_CatchContext:
+ case QV4::Heap::ExecutionContext::Type_CatchContext:
return 4;
break;
- case QV4::ExecutionContext::Type_WithContext:
+ case QV4::Heap::ExecutionContext::Type_WithContext:
return 2;
break;
- case QV4::ExecutionContext::Type_SimpleCallContext:
- case QV4::ExecutionContext::Type_CallContext:
+ case QV4::Heap::ExecutionContext::Type_SimpleCallContext:
+ case QV4::Heap::ExecutionContext::Type_CallContext:
return 1;
break;
- case QV4::ExecutionContext::Type_QmlContext:
+ case QV4::Heap::ExecutionContext::Type_QmlContext:
default:
return -1;
}
@@ -470,7 +470,7 @@ public:
QJsonObject anonymous;
anonymous[QLatin1String("properties")] = properties;
- QVector<QV4::ExecutionContext::ContextType> scopeTypes = debugger->getScopeTypes(frameNr);
+ QVector<QV4::Heap::ExecutionContext::ContextType> scopeTypes = debugger->getScopeTypes(frameNr);
scope[QLatin1String("type")] = encodeScopeType(scopeTypes[scopeNr]);
scope[QLatin1String("index")] = scopeNr;
scope[QLatin1String("frameIndex")] = frameNr;
@@ -523,7 +523,7 @@ public:
void handle(const QJsonObject &request, QQmlDebugService *s, QV4DebugServicePrivate *p)
{
- TRACE_PROTOCOL(debug << "handling command " << command() << "..." << endl);
+ TRACE_PROTOCOL(qDebug() << "handling command" << command() << "...");
req = request;
seq = req.value(QStringLiteral("seq"));
@@ -1137,13 +1137,13 @@ void QV4DebugService::messageReceived(const QByteArray &message)
QByteArray header;
ms >> header;
- TRACE_PROTOCOL(debug << "received message with header " << header << endl);
+ TRACE_PROTOCOL(qDebug() << "received message with header" << header);
if (header == "V8DEBUG") {
QByteArray type;
QByteArray payload;
ms >> type >> payload;
- TRACE_PROTOCOL(debug << "... type: "<<type << endl);
+ TRACE_PROTOCOL(qDebug() << "... type:" << type);
if (type == V4_CONNECT) {
sendMessage(d->packMessage(type));
@@ -1164,7 +1164,7 @@ void QV4DebugService::messageReceived(const QByteArray &message)
} else if (type == "v8request") {
handleV8Request(payload);
} else if (type == V4_DISCONNECT) {
- TRACE_PROTOCOL(debug << "... payload:"<<payload << endl);
+ TRACE_PROTOCOL(qDebug() << "... payload:" << payload);
handleV8Request(payload);
} else {
sendSomethingToSomebody(type, 0);
@@ -1249,7 +1249,7 @@ void QV4DebugService::handleV8Request(const QByteArray &payload)
{
Q_D(QV4DebugService);
- TRACE_PROTOCOL(debug << "v8request, payload: " << payload << endl);
+ TRACE_PROTOCOL(qDebug() << "v8request, payload:" << payload);
QJsonDocument request = QJsonDocument::fromJson(payload);
QJsonObject o = request.object();
diff --git a/src/qml/debugger/qv4debugservice_p.h b/src/qml/debugger/qv4debugservice_p.h
index 6c464a34e5..f7b38b11b6 100644
--- a/src/qml/debugger/qv4debugservice_p.h
+++ b/src/qml/debugger/qv4debugservice_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/debugger/qv4profileradapter.cpp b/src/qml/debugger/qv4profileradapter.cpp
index a5492ce805..2b8183dc69 100644
--- a/src/qml/debugger/qv4profileradapter.cpp
+++ b/src/qml/debugger/qv4profileradapter.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/debugger/qv4profileradapter_p.h b/src/qml/debugger/qv4profileradapter_p.h
index 4a14024ec1..2f467f4beb 100644
--- a/src/qml/debugger/qv4profileradapter_p.h
+++ b/src/qml/debugger/qv4profileradapter_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/doc/snippets/code/src_script_qjsengine.cpp b/src/qml/doc/snippets/code/src_script_qjsengine.cpp
index 7428cedcaf..c9bd7dfcd9 100644
--- a/src/qml/doc/snippets/code/src_script_qjsengine.cpp
+++ b/src/qml/doc/snippets/code/src_script_qjsengine.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
@@ -74,7 +74,10 @@ QJSValue myNumberPlusOne = myEngine.evaluate("myNumber + 1");
//! [4]
QJSValue result = myEngine.evaluate(...);
if (result.isError())
- qDebug() << "uncaught exception:" << result.toString();
+ qDebug()
+ << "Uncaught exception at line"
+ << result.property("lineNumber").toInt()
+ << ":" << result.toString();
//! [4]
diff --git a/src/qml/doc/snippets/code/src_script_qjsvalue.cpp b/src/qml/doc/snippets/code/src_script_qjsvalue.cpp
index 6611121566..4068ff9e26 100644
--- a/src/qml/doc/snippets/code/src_script_qjsvalue.cpp
+++ b/src/qml/doc/snippets/code/src_script_qjsvalue.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/code/src_script_qjsvalueiterator.cpp b/src/qml/doc/snippets/code/src_script_qjsvalueiterator.cpp
index 1c9a0e8fba..604efc82ad 100644
--- a/src/qml/doc/snippets/code/src_script_qjsvalueiterator.cpp
+++ b/src/qml/doc/snippets/code/src_script_qjsvalueiterator.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/delegatemodel/visualdatagroup.qml b/src/qml/doc/snippets/delegatemodel/visualdatagroup.qml
index 4254b50e63..85ac83ae52 100644
--- a/src/qml/doc/snippets/delegatemodel/visualdatagroup.qml
+++ b/src/qml/doc/snippets/delegatemodel/visualdatagroup.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
@@ -39,11 +39,12 @@
****************************************************************************/
//![0]
import QtQuick 2.0
+import QtQml.Models 2.2
Rectangle {
width: 200; height: 100
- VisualDataModel {
+ DelegateModel {
id: visualModel
model: ListModel {
ListElement { name: "Apple" }
@@ -51,7 +52,7 @@ Rectangle {
}
groups: [
- VisualDataGroup { name: "selected" }
+ DelegateModelGroup { name: "selected" }
]
delegate: Rectangle {
@@ -61,14 +62,14 @@ Rectangle {
Text {
text: {
var text = "Name: " + name
- if (item.VisualDataModel.inSelected)
- text += " (" + item.VisualDataModel.selectedIndex + ")"
+ if (item.DelegateModel.inSelected)
+ text += " (" + item.DelegateModel.selectedIndex + ")"
return text;
}
}
MouseArea {
anchors.fill: parent
- onClicked: item.VisualDataModel.inSelected = !item.VisualDataModel.inSelected
+ onClicked: item.DelegateModel.inSelected = !item.DelegateModel.inSelected
}
}
}
diff --git a/src/qml/doc/snippets/delegatemodel/visualdatamodel.qml b/src/qml/doc/snippets/delegatemodel/visualdatamodel.qml
index 0513c5b5f2..438eafeed1 100644
--- a/src/qml/doc/snippets/delegatemodel/visualdatamodel.qml
+++ b/src/qml/doc/snippets/delegatemodel/visualdatamodel.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
@@ -39,11 +39,12 @@
****************************************************************************/
//![0]
import QtQuick 2.0
+import QtQml.Models 2.2
Rectangle {
width: 200; height: 100
- VisualDataModel {
+ DelegateModel {
id: visualModel
model: ListModel {
ListElement { name: "Apple" }
diff --git a/src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/main.cpp b/src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/main.cpp
index da1086146c..25dd48ef2d 100644
--- a/src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/main.cpp
+++ b/src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/main.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/view.qml b/src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/view.qml
index f46671e9a0..719d16ff7d 100644
--- a/src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/view.qml
+++ b/src/qml/doc/snippets/delegatemodel/visualdatamodel_rootindex/view.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
@@ -39,13 +39,14 @@
****************************************************************************/
//![0]
import QtQuick 2.0
+import QtQml.Models 2.2
ListView {
id: view
width: 300
height: 400
- model: VisualDataModel {
+ model: DelegateModel {
model: dirModel
delegate: Rectangle {
diff --git a/src/qml/doc/snippets/package/Delegate.qml b/src/qml/doc/snippets/package/Delegate.qml
index 641de67a62..a6b9783a53 100644
--- a/src/qml/doc/snippets/package/Delegate.qml
+++ b/src/qml/doc/snippets/package/Delegate.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/package/view.qml b/src/qml/doc/snippets/package/view.qml
index 820eb4068c..70056b617a 100644
--- a/src/qml/doc/snippets/package/view.qml
+++ b/src/qml/doc/snippets/package/view.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/Button.qml b/src/qml/doc/snippets/qml/Button.qml
index 7314311c75..fcbe902864 100644
--- a/src/qml/doc/snippets/qml/Button.qml
+++ b/src/qml/doc/snippets/qml/Button.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/DynamicText.qml b/src/qml/doc/snippets/qml/DynamicText.qml
index 7451812df5..e90c818c02 100644
--- a/src/qml/doc/snippets/qml/DynamicText.qml
+++ b/src/qml/doc/snippets/qml/DynamicText.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/SelfDestroyingRect.qml b/src/qml/doc/snippets/qml/SelfDestroyingRect.qml
index 16a73c204d..8a51a64b4c 100644
--- a/src/qml/doc/snippets/qml/SelfDestroyingRect.qml
+++ b/src/qml/doc/snippets/qml/SelfDestroyingRect.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/Sprite.qml b/src/qml/doc/snippets/qml/Sprite.qml
index 22d8313ebf..0b83fa589d 100644
--- a/src/qml/doc/snippets/qml/Sprite.qml
+++ b/src/qml/doc/snippets/qml/Sprite.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/application.qml b/src/qml/doc/snippets/qml/application.qml
index 9d8847e91e..2b42a7f601 100644
--- a/src/qml/doc/snippets/qml/application.qml
+++ b/src/qml/doc/snippets/qml/application.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/comments.qml b/src/qml/doc/snippets/qml/comments.qml
index d7d8dd9f5e..566254e1b5 100644
--- a/src/qml/doc/snippets/qml/comments.qml
+++ b/src/qml/doc/snippets/qml/comments.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/component.qml b/src/qml/doc/snippets/qml/component.qml
index 3c23e58817..bcba300b52 100644
--- a/src/qml/doc/snippets/qml/component.qml
+++ b/src/qml/doc/snippets/qml/component.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/component/MyItem.qml b/src/qml/doc/snippets/qml/component/MyItem.qml
index 1e2102e27c..5d09fbaa2f 100644
--- a/src/qml/doc/snippets/qml/component/MyItem.qml
+++ b/src/qml/doc/snippets/qml/component/MyItem.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/component/main.qml b/src/qml/doc/snippets/qml/component/main.qml
index 4b7f8ec250..11436c2baa 100644
--- a/src/qml/doc/snippets/qml/component/main.qml
+++ b/src/qml/doc/snippets/qml/component/main.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/createComponent-simple.qml b/src/qml/doc/snippets/qml/createComponent-simple.qml
index 30ead71756..1f5d1a6ac8 100644
--- a/src/qml/doc/snippets/qml/createComponent-simple.qml
+++ b/src/qml/doc/snippets/qml/createComponent-simple.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/createComponent.qml b/src/qml/doc/snippets/qml/createComponent.qml
index e95f86b5cb..0af198d485 100644
--- a/src/qml/doc/snippets/qml/createComponent.qml
+++ b/src/qml/doc/snippets/qml/createComponent.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/createQmlObject.qml b/src/qml/doc/snippets/qml/createQmlObject.qml
index 10f49f13c3..b12c6c2ea5 100644
--- a/src/qml/doc/snippets/qml/createQmlObject.qml
+++ b/src/qml/doc/snippets/qml/createQmlObject.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
@@ -49,7 +49,8 @@ Rectangle {
function createIt() {
//![0]
var newObject = Qt.createQmlObject('import QtQuick 2.0; Rectangle {color: "red"; width: 20; height: 20}',
- parentItem, "dynamicSnippet1");
+ parentItem,
+ "dynamicSnippet1");
//![0]
//![destroy]
diff --git a/src/qml/doc/snippets/qml/dynamicObjects-destroy.qml b/src/qml/doc/snippets/qml/dynamicObjects-destroy.qml
index 1cb1a761d9..099e039dc1 100644
--- a/src/qml/doc/snippets/qml/dynamicObjects-destroy.qml
+++ b/src/qml/doc/snippets/qml/dynamicObjects-destroy.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/events.qml b/src/qml/doc/snippets/qml/events.qml
index c51cdf3f26..19eac2f30d 100644
--- a/src/qml/doc/snippets/qml/events.qml
+++ b/src/qml/doc/snippets/qml/events.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/imports/chart.qml b/src/qml/doc/snippets/qml/imports/chart.qml
index 171505c815..204a6fc0d9 100644
--- a/src/qml/doc/snippets/qml/imports/chart.qml
+++ b/src/qml/doc/snippets/qml/imports/chart.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/imports/installed-module.qml b/src/qml/doc/snippets/qml/imports/installed-module.qml
index d988d6e0fb..844929239e 100644
--- a/src/qml/doc/snippets/qml/imports/installed-module.qml
+++ b/src/qml/doc/snippets/qml/imports/installed-module.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/imports/merged-named-imports.qml b/src/qml/doc/snippets/qml/imports/merged-named-imports.qml
index 65e2bfd4ce..bede8601e3 100644
--- a/src/qml/doc/snippets/qml/imports/merged-named-imports.qml
+++ b/src/qml/doc/snippets/qml/imports/merged-named-imports.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/imports/named-imports.qml b/src/qml/doc/snippets/qml/imports/named-imports.qml
index 6ddcffed1d..784f013177 100644
--- a/src/qml/doc/snippets/qml/imports/named-imports.qml
+++ b/src/qml/doc/snippets/qml/imports/named-imports.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/imports/network-imports.qml b/src/qml/doc/snippets/qml/imports/network-imports.qml
index d6cfc65a7d..e0553096fa 100644
--- a/src/qml/doc/snippets/qml/imports/network-imports.qml
+++ b/src/qml/doc/snippets/qml/imports/network-imports.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/imports/qtquick-1.0.qml b/src/qml/doc/snippets/qml/imports/qtquick-1.0.qml
index 1ebfa46850..3de2f0fc29 100644
--- a/src/qml/doc/snippets/qml/imports/qtquick-1.0.qml
+++ b/src/qml/doc/snippets/qml/imports/qtquick-1.0.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/imports/timeexample.qml b/src/qml/doc/snippets/qml/imports/timeexample.qml
index 3b597fa379..6b50f02c18 100644
--- a/src/qml/doc/snippets/qml/imports/timeexample.qml
+++ b/src/qml/doc/snippets/qml/imports/timeexample.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/integrating-javascript/connectjs.qml b/src/qml/doc/snippets/qml/integrating-javascript/connectjs.qml
index a2274008ed..715e832d48 100644
--- a/src/qml/doc/snippets/qml/integrating-javascript/connectjs.qml
+++ b/src/qml/doc/snippets/qml/integrating-javascript/connectjs.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/integrating-javascript/includejs/app.qml b/src/qml/doc/snippets/qml/integrating-javascript/includejs/app.qml
index a6e3a871e8..c5a4a74953 100644
--- a/src/qml/doc/snippets/qml/integrating-javascript/includejs/app.qml
+++ b/src/qml/doc/snippets/qml/integrating-javascript/includejs/app.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/integrating-javascript/includejs/factorial.js b/src/qml/doc/snippets/qml/integrating-javascript/includejs/factorial.js
index fdb33148c2..5e1b7d3473 100644
--- a/src/qml/doc/snippets/qml/integrating-javascript/includejs/factorial.js
+++ b/src/qml/doc/snippets/qml/integrating-javascript/includejs/factorial.js
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/integrating-javascript/includejs/script.js b/src/qml/doc/snippets/qml/integrating-javascript/includejs/script.js
index 436c465142..814e0b444f 100644
--- a/src/qml/doc/snippets/qml/integrating-javascript/includejs/script.js
+++ b/src/qml/doc/snippets/qml/integrating-javascript/includejs/script.js
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
@@ -42,7 +42,8 @@
Qt.include("factorial.js")
function showCalculations(value) {
- console.log("Call factorial() from script.js:",
+ console.log(
+ "Call factorial() from script.js:",
factorial(value));
}
//![0]
diff --git a/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/avatarExample.cpp b/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/avatarExample.cpp
index c2afa75cf2..ed44da8464 100644
--- a/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/avatarExample.cpp
+++ b/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/avatarExample.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/avatarExample.h b/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/avatarExample.h
index 14a12c256c..50bd53142a 100644
--- a/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/avatarExample.h
+++ b/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/avatarExample.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleFive.qml b/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleFive.qml
index d53171ca73..3ddf413310 100644
--- a/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleFive.qml
+++ b/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleFive.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleFour.js b/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleFour.js
index a1a91faf3e..46ea091c44 100644
--- a/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleFour.js
+++ b/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleFour.js
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleFour.qml b/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleFour.qml
index 0fc54219da..8a8dd8a155 100644
--- a/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleFour.qml
+++ b/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleFour.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleOne.qml b/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleOne.qml
index 119a434d72..ccbcb310a6 100644
--- a/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleOne.qml
+++ b/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleOne.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleThree.js b/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleThree.js
index 86095df791..dce7aa4a9b 100644
--- a/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleThree.js
+++ b/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleThree.js
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleThree.qml b/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleThree.qml
index 2614ed7d78..a1ed413e3f 100644
--- a/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleThree.qml
+++ b/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleThree.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleTwo.qml b/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleTwo.qml
index bab636a5fd..8498dbdb46 100644
--- a/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleTwo.qml
+++ b/src/qml/doc/snippets/qml/integrating-javascript/scarceresources/exampleTwo.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/integrating-javascript/script.js b/src/qml/doc/snippets/qml/integrating-javascript/script.js
index 01ad2bdf7f..25e44bc36b 100644
--- a/src/qml/doc/snippets/qml/integrating-javascript/script.js
+++ b/src/qml/doc/snippets/qml/integrating-javascript/script.js
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/listmodel/listelements.qml b/src/qml/doc/snippets/qml/listmodel/listelements.qml
index a553476e46..38e1d1a3c0 100644
--- a/src/qml/doc/snippets/qml/listmodel/listelements.qml
+++ b/src/qml/doc/snippets/qml/listmodel/listelements.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/listmodel/listmodel-modify.qml b/src/qml/doc/snippets/qml/listmodel/listmodel-modify.qml
index 6f59183e9a..202e1c6209 100644
--- a/src/qml/doc/snippets/qml/listmodel/listmodel-modify.qml
+++ b/src/qml/doc/snippets/qml/listmodel/listmodel-modify.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/listmodel/listmodel-nested.qml b/src/qml/doc/snippets/qml/listmodel/listmodel-nested.qml
index 3c836d81cf..898d496c49 100644
--- a/src/qml/doc/snippets/qml/listmodel/listmodel-nested.qml
+++ b/src/qml/doc/snippets/qml/listmodel/listmodel-nested.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/listmodel/listmodel-simple.qml b/src/qml/doc/snippets/qml/listmodel/listmodel-simple.qml
index 8571b4231e..f1d9ebe120 100644
--- a/src/qml/doc/snippets/qml/listmodel/listmodel-simple.qml
+++ b/src/qml/doc/snippets/qml/listmodel/listmodel-simple.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/listmodel/listmodel.qml b/src/qml/doc/snippets/qml/listmodel/listmodel.qml
index ed2bbab3fe..7e9ec987bd 100644
--- a/src/qml/doc/snippets/qml/listmodel/listmodel.qml
+++ b/src/qml/doc/snippets/qml/listmodel/listmodel.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/properties.qml b/src/qml/doc/snippets/qml/properties.qml
index 24180c503e..69e5628d8f 100644
--- a/src/qml/doc/snippets/qml/properties.qml
+++ b/src/qml/doc/snippets/qml/properties.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qml-documents/inline-component.qml b/src/qml/doc/snippets/qml/qml-documents/inline-component.qml
index b8144c263f..2a577317e1 100644
--- a/src/qml/doc/snippets/qml/qml-documents/inline-component.qml
+++ b/src/qml/doc/snippets/qml/qml-documents/inline-component.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qml-documents/inline-text-component.qml b/src/qml/doc/snippets/qml/qml-documents/inline-text-component.qml
index e731ce998f..9b43ae3e59 100644
--- a/src/qml/doc/snippets/qml/qml-documents/inline-text-component.qml
+++ b/src/qml/doc/snippets/qml/qml-documents/inline-text-component.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qml-documents/non-trivial.qml b/src/qml/doc/snippets/qml/qml-documents/non-trivial.qml
index cedd09d3ce..58fe0cf1ac 100644
--- a/src/qml/doc/snippets/qml/qml-documents/non-trivial.qml
+++ b/src/qml/doc/snippets/qml/qml-documents/non-trivial.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qml-documents/qmldocuments.qml b/src/qml/doc/snippets/qml/qml-documents/qmldocuments.qml
index fd582db061..02de077c1f 100644
--- a/src/qml/doc/snippets/qml/qml-documents/qmldocuments.qml
+++ b/src/qml/doc/snippets/qml/qml-documents/qmldocuments.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qsTr.qml b/src/qml/doc/snippets/qml/qsTr.qml
index 0fb782ca5a..8298eb0ef5 100644
--- a/src/qml/doc/snippets/qml/qsTr.qml
+++ b/src/qml/doc/snippets/qml/qsTr.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qsTrId.1.qml b/src/qml/doc/snippets/qml/qsTrId.1.qml
index 5ac7426887..cffe0c0d2d 100644
--- a/src/qml/doc/snippets/qml/qsTrId.1.qml
+++ b/src/qml/doc/snippets/qml/qsTrId.1.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qsTrId.qml b/src/qml/doc/snippets/qml/qsTrId.qml
index 6b578388c8..11939f34c2 100644
--- a/src/qml/doc/snippets/qml/qsTrId.qml
+++ b/src/qml/doc/snippets/qml/qsTrId.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qsTranslate.qml b/src/qml/doc/snippets/qml/qsTranslate.qml
index f4efc8cb5a..061b4e3210 100644
--- a/src/qml/doc/snippets/qml/qsTranslate.qml
+++ b/src/qml/doc/snippets/qml/qsTranslate.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qtBinding.1.qml b/src/qml/doc/snippets/qml/qtBinding.1.qml
index 3721b245c1..f9bc0e08f7 100644
--- a/src/qml/doc/snippets/qml/qtBinding.1.qml
+++ b/src/qml/doc/snippets/qml/qtBinding.1.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qtBinding.2.qml b/src/qml/doc/snippets/qml/qtBinding.2.qml
index 6dbeec9066..6a9a2de750 100644
--- a/src/qml/doc/snippets/qml/qtBinding.2.qml
+++ b/src/qml/doc/snippets/qml/qtBinding.2.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qtBinding.3.qml b/src/qml/doc/snippets/qml/qtBinding.3.qml
index 77b774a703..dc5b74a897 100644
--- a/src/qml/doc/snippets/qml/qtBinding.3.qml
+++ b/src/qml/doc/snippets/qml/qtBinding.3.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qtBinding.4.qml b/src/qml/doc/snippets/qml/qtBinding.4.qml
index a535ab10ad..12a082ba69 100644
--- a/src/qml/doc/snippets/qml/qtBinding.4.qml
+++ b/src/qml/doc/snippets/qml/qtBinding.4.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qtTrIdNoOp.qml b/src/qml/doc/snippets/qml/qtTrIdNoOp.qml
index 53a77d5657..55d073dbd0 100644
--- a/src/qml/doc/snippets/qml/qtTrIdNoOp.qml
+++ b/src/qml/doc/snippets/qml/qtTrIdNoOp.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qtTrNoOp.qml b/src/qml/doc/snippets/qml/qtTrNoOp.qml
index a11bb5d163..38c339c8d4 100644
--- a/src/qml/doc/snippets/qml/qtTrNoOp.qml
+++ b/src/qml/doc/snippets/qml/qtTrNoOp.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qtTranslateNoOp.qml b/src/qml/doc/snippets/qml/qtTranslateNoOp.qml
index c2bef5b334..eb998a093a 100644
--- a/src/qml/doc/snippets/qml/qtTranslateNoOp.qml
+++ b/src/qml/doc/snippets/qml/qtTranslateNoOp.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qtbinding/context-advanced/MyItem.qml b/src/qml/doc/snippets/qml/qtbinding/context-advanced/MyItem.qml
index a13e27a1a5..8cae690fa3 100644
--- a/src/qml/doc/snippets/qml/qtbinding/context-advanced/MyItem.qml
+++ b/src/qml/doc/snippets/qml/qtbinding/context-advanced/MyItem.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qtbinding/context-advanced/applicationdata.h b/src/qml/doc/snippets/qml/qtbinding/context-advanced/applicationdata.h
index 97aea30134..6bf3c27e76 100644
--- a/src/qml/doc/snippets/qml/qtbinding/context-advanced/applicationdata.h
+++ b/src/qml/doc/snippets/qml/qtbinding/context-advanced/applicationdata.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qtbinding/context-advanced/connections.qml b/src/qml/doc/snippets/qml/qtbinding/context-advanced/connections.qml
index 09f15e1fe0..adbfaf75ee 100644
--- a/src/qml/doc/snippets/qml/qtbinding/context-advanced/connections.qml
+++ b/src/qml/doc/snippets/qml/qtbinding/context-advanced/connections.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qtbinding/context-advanced/main.cpp b/src/qml/doc/snippets/qml/qtbinding/context-advanced/main.cpp
index 06a75ad031..c32cd2b3db 100644
--- a/src/qml/doc/snippets/qml/qtbinding/context-advanced/main.cpp
+++ b/src/qml/doc/snippets/qml/qtbinding/context-advanced/main.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qtbinding/context/MyItem.qml b/src/qml/doc/snippets/qml/qtbinding/context/MyItem.qml
index f80c4886c7..e8cccf4db1 100644
--- a/src/qml/doc/snippets/qml/qtbinding/context/MyItem.qml
+++ b/src/qml/doc/snippets/qml/qtbinding/context/MyItem.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qtbinding/context/main.cpp b/src/qml/doc/snippets/qml/qtbinding/context/main.cpp
index 64c3dba74d..0a300e36ab 100644
--- a/src/qml/doc/snippets/qml/qtbinding/context/main.cpp
+++ b/src/qml/doc/snippets/qml/qtbinding/context/main.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qtbinding/functions-qml/MyItem.qml b/src/qml/doc/snippets/qml/qtbinding/functions-qml/MyItem.qml
index ce92961f23..5fa6838c10 100644
--- a/src/qml/doc/snippets/qml/qtbinding/functions-qml/MyItem.qml
+++ b/src/qml/doc/snippets/qml/qtbinding/functions-qml/MyItem.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qtbinding/functions-qml/main.cpp b/src/qml/doc/snippets/qml/qtbinding/functions-qml/main.cpp
index 764a053e91..760b648f28 100644
--- a/src/qml/doc/snippets/qml/qtbinding/functions-qml/main.cpp
+++ b/src/qml/doc/snippets/qml/qtbinding/functions-qml/main.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qtbinding/loading/MyItem.qml b/src/qml/doc/snippets/qml/qtbinding/loading/MyItem.qml
index 655d0ae1f3..ee86938136 100644
--- a/src/qml/doc/snippets/qml/qtbinding/loading/MyItem.qml
+++ b/src/qml/doc/snippets/qml/qtbinding/loading/MyItem.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qtbinding/loading/main.cpp b/src/qml/doc/snippets/qml/qtbinding/loading/main.cpp
index 2c1785ecd1..a2048d9bfd 100644
--- a/src/qml/doc/snippets/qml/qtbinding/loading/main.cpp
+++ b/src/qml/doc/snippets/qml/qtbinding/loading/main.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qtbinding/properties-qml/MyItem.qml b/src/qml/doc/snippets/qml/qtbinding/properties-qml/MyItem.qml
index 7cc124c74f..c7371cd456 100644
--- a/src/qml/doc/snippets/qml/qtbinding/properties-qml/MyItem.qml
+++ b/src/qml/doc/snippets/qml/qtbinding/properties-qml/MyItem.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qtbinding/properties-qml/main.cpp b/src/qml/doc/snippets/qml/qtbinding/properties-qml/main.cpp
index 42e29dbca2..87857f31d1 100644
--- a/src/qml/doc/snippets/qml/qtbinding/properties-qml/main.cpp
+++ b/src/qml/doc/snippets/qml/qtbinding/properties-qml/main.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qtbinding/resources/example.qdoc b/src/qml/doc/snippets/qml/qtbinding/resources/example.qdoc
index c3b85ce15a..8f6633cffe 100644
--- a/src/qml/doc/snippets/qml/qtbinding/resources/example.qdoc
+++ b/src/qml/doc/snippets/qml/qtbinding/resources/example.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qtbinding/signals-qml/MyItem.qml b/src/qml/doc/snippets/qml/qtbinding/signals-qml/MyItem.qml
index ee3e50bcfc..2532660a0f 100644
--- a/src/qml/doc/snippets/qml/qtbinding/signals-qml/MyItem.qml
+++ b/src/qml/doc/snippets/qml/qtbinding/signals-qml/MyItem.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qtbinding/signals-qml/main.cpp b/src/qml/doc/snippets/qml/qtbinding/signals-qml/main.cpp
index 2bd92b39bf..b0c7607872 100644
--- a/src/qml/doc/snippets/qml/qtbinding/signals-qml/main.cpp
+++ b/src/qml/doc/snippets/qml/qtbinding/signals-qml/main.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qtbinding/signals-qml/myclass.h b/src/qml/doc/snippets/qml/qtbinding/signals-qml/myclass.h
index 87587522b7..c7246aee40 100644
--- a/src/qml/doc/snippets/qml/qtbinding/signals-qml/myclass.h
+++ b/src/qml/doc/snippets/qml/qtbinding/signals-qml/myclass.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qtbinding/variantlistmap/MyItem.qml b/src/qml/doc/snippets/qml/qtbinding/variantlistmap/MyItem.qml
index a02033c58a..fc28a30490 100644
--- a/src/qml/doc/snippets/qml/qtbinding/variantlistmap/MyItem.qml
+++ b/src/qml/doc/snippets/qml/qtbinding/variantlistmap/MyItem.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qtbinding/variantlistmap/main.cpp b/src/qml/doc/snippets/qml/qtbinding/variantlistmap/main.cpp
index f3879e0785..0978f238a2 100644
--- a/src/qml/doc/snippets/qml/qtbinding/variantlistmap/main.cpp
+++ b/src/qml/doc/snippets/qml/qtbinding/variantlistmap/main.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/qtobject.qml b/src/qml/doc/snippets/qml/qtobject.qml
index 6fdf7f74d3..98b19a0e15 100644
--- a/src/qml/doc/snippets/qml/qtobject.qml
+++ b/src/qml/doc/snippets/qml/qtobject.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/reusablecomponents/Button.qml b/src/qml/doc/snippets/qml/reusablecomponents/Button.qml
index 28c5e83a5f..2bd454f122 100644
--- a/src/qml/doc/snippets/qml/reusablecomponents/Button.qml
+++ b/src/qml/doc/snippets/qml/reusablecomponents/Button.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/reusablecomponents/application.qml b/src/qml/doc/snippets/qml/reusablecomponents/application.qml
index ef2aaa5319..b90b42fea7 100644
--- a/src/qml/doc/snippets/qml/reusablecomponents/application.qml
+++ b/src/qml/doc/snippets/qml/reusablecomponents/application.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/reusablecomponents/component.qml b/src/qml/doc/snippets/qml/reusablecomponents/component.qml
index 2b388dc79a..2d5e0bf292 100644
--- a/src/qml/doc/snippets/qml/reusablecomponents/component.qml
+++ b/src/qml/doc/snippets/qml/reusablecomponents/component.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/reusablecomponents/focusbutton.qml b/src/qml/doc/snippets/qml/reusablecomponents/focusbutton.qml
index aac3719dc0..bdb1746bb8 100644
--- a/src/qml/doc/snippets/qml/reusablecomponents/focusbutton.qml
+++ b/src/qml/doc/snippets/qml/reusablecomponents/focusbutton.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/statemachine/Button.qml b/src/qml/doc/snippets/qml/statemachine/Button.qml
index 2baad4cbfb..3f57e6e796 100644
--- a/src/qml/doc/snippets/qml/statemachine/Button.qml
+++ b/src/qml/doc/snippets/qml/statemachine/Button.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/statemachine/basicstate.qml b/src/qml/doc/snippets/qml/statemachine/basicstate.qml
index ccdd2b2ec1..e61898c77b 100644
--- a/src/qml/doc/snippets/qml/statemachine/basicstate.qml
+++ b/src/qml/doc/snippets/qml/statemachine/basicstate.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Ford Motor Company
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/statemachine/finalstate.qml b/src/qml/doc/snippets/qml/statemachine/finalstate.qml
index 5865436a52..3441b6095e 100644
--- a/src/qml/doc/snippets/qml/statemachine/finalstate.qml
+++ b/src/qml/doc/snippets/qml/statemachine/finalstate.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Ford Motor Company
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/statemachine/guardcondition.qml b/src/qml/doc/snippets/qml/statemachine/guardcondition.qml
index 3d4badb350..f5c4873b63 100644
--- a/src/qml/doc/snippets/qml/statemachine/guardcondition.qml
+++ b/src/qml/doc/snippets/qml/statemachine/guardcondition.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Ford Motor Company
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/statemachine/historystate.qml b/src/qml/doc/snippets/qml/statemachine/historystate.qml
index 7559bfe06c..f93d948a36 100644
--- a/src/qml/doc/snippets/qml/statemachine/historystate.qml
+++ b/src/qml/doc/snippets/qml/statemachine/historystate.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Ford Motor Company
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/statemachine/signaltransition.qml b/src/qml/doc/snippets/qml/statemachine/signaltransition.qml
index d00a103d7c..9712060997 100644
--- a/src/qml/doc/snippets/qml/statemachine/signaltransition.qml
+++ b/src/qml/doc/snippets/qml/statemachine/signaltransition.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Ford Motor Company
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/statemachine/signaltransitionsignal.qml b/src/qml/doc/snippets/qml/statemachine/signaltransitionsignal.qml
index 90ebd70eb5..2893d15b9e 100644
--- a/src/qml/doc/snippets/qml/statemachine/signaltransitionsignal.qml
+++ b/src/qml/doc/snippets/qml/statemachine/signaltransitionsignal.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Ford Motor Company
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/statemachine/simplestatemachine.qml b/src/qml/doc/snippets/qml/statemachine/simplestatemachine.qml
index 4e5ea9b65c..e3a4e90a68 100644
--- a/src/qml/doc/snippets/qml/statemachine/simplestatemachine.qml
+++ b/src/qml/doc/snippets/qml/statemachine/simplestatemachine.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Ford Motor Company
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/statemachine/statemachine-button-history.qml b/src/qml/doc/snippets/qml/statemachine/statemachine-button-history.qml
index c161a10610..4d7f417333 100644
--- a/src/qml/doc/snippets/qml/statemachine/statemachine-button-history.qml
+++ b/src/qml/doc/snippets/qml/statemachine/statemachine-button-history.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Ford Motor Company
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/statemachine/statemachine-button-nested-ignore-quit.qml b/src/qml/doc/snippets/qml/statemachine/statemachine-button-nested-ignore-quit.qml
index 5bbd9ca9df..8f34ebd1c1 100644
--- a/src/qml/doc/snippets/qml/statemachine/statemachine-button-nested-ignore-quit.qml
+++ b/src/qml/doc/snippets/qml/statemachine/statemachine-button-nested-ignore-quit.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Ford Motor Company
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/statemachine/statemachine-button-nested.qml b/src/qml/doc/snippets/qml/statemachine/statemachine-button-nested.qml
index 932a9249d3..0a0946b103 100644
--- a/src/qml/doc/snippets/qml/statemachine/statemachine-button-nested.qml
+++ b/src/qml/doc/snippets/qml/statemachine/statemachine-button-nested.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Ford Motor Company
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/statemachine/statemachine-button.qml b/src/qml/doc/snippets/qml/statemachine/statemachine-button.qml
index 6c4ed846e5..5c38586e23 100644
--- a/src/qml/doc/snippets/qml/statemachine/statemachine-button.qml
+++ b/src/qml/doc/snippets/qml/statemachine/statemachine-button.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Ford Motor Company
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/statemachine/timeouttransition.qml b/src/qml/doc/snippets/qml/statemachine/timeouttransition.qml
index 7b8fa77b13..a554e35175 100644
--- a/src/qml/doc/snippets/qml/statemachine/timeouttransition.qml
+++ b/src/qml/doc/snippets/qml/statemachine/timeouttransition.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Ford Motor Company
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qml/workerscript/workerscript.qml b/src/qml/doc/snippets/qml/workerscript/workerscript.qml
index 3bae722953..a00431f98b 100644
--- a/src/qml/doc/snippets/qml/workerscript/workerscript.qml
+++ b/src/qml/doc/snippets/qml/workerscript/workerscript.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qtjavascript/evaluation/main.cpp b/src/qml/doc/snippets/qtjavascript/evaluation/main.cpp
index 763dd703c7..1d46db7f20 100644
--- a/src/qml/doc/snippets/qtjavascript/evaluation/main.cpp
+++ b/src/qml/doc/snippets/qtjavascript/evaluation/main.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qtjavascript/registeringobjects/main.cpp b/src/qml/doc/snippets/qtjavascript/registeringobjects/main.cpp
index e6c937c506..80ff1aa315 100644
--- a/src/qml/doc/snippets/qtjavascript/registeringobjects/main.cpp
+++ b/src/qml/doc/snippets/qtjavascript/registeringobjects/main.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/snippets/qtjavascript/registeringvalues/main.cpp b/src/qml/doc/snippets/qtjavascript/registeringvalues/main.cpp
index d0680114b1..001f71e956 100644
--- a/src/qml/doc/snippets/qtjavascript/registeringvalues/main.cpp
+++ b/src/qml/doc/snippets/qtjavascript/registeringvalues/main.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/qml/doc/src/cppclasses/topic.qdoc b/src/qml/doc/src/cppclasses/topic.qdoc
index 4a72e684a0..ddb29fbb14 100644
--- a/src/qml/doc/src/cppclasses/topic.qdoc
+++ b/src/qml/doc/src/cppclasses/topic.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/cppintegration/contextproperties.qdoc b/src/qml/doc/src/cppintegration/contextproperties.qdoc
index d30cc87345..83f49bdcf0 100644
--- a/src/qml/doc/src/cppintegration/contextproperties.qdoc
+++ b/src/qml/doc/src/cppintegration/contextproperties.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
@@ -65,10 +65,13 @@ QML code invokes a method on the object instance:
\table
\row
+\li C++
\li
\snippet qml/qtbinding/context-advanced/applicationdata.h 0
\codeline
\snippet qml/qtbinding/context-advanced/main.cpp 0
+\row
+\li QML
\li
\snippet qml/qtbinding/context-advanced/MyItem.qml 0
\endtable
diff --git a/src/qml/doc/src/cppintegration/data.qdoc b/src/qml/doc/src/cppintegration/data.qdoc
index c083d63e51..e153ca3d8b 100644
--- a/src/qml/doc/src/cppintegration/data.qdoc
+++ b/src/qml/doc/src/cppintegration/data.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
@@ -176,7 +176,10 @@ converted to JavaScript array and object values, repectively:
\table
\header
\row
+\li QML
\li \snippet qml/qtbinding/variantlistmap/MyItem.qml 0
+\row
+\li C++
\li \snippet qml/qtbinding/variantlistmap/main.cpp 0
\endtable
@@ -223,7 +226,7 @@ Item {
}
}
\endqml
-
+\row
\li
\code
// C++
@@ -307,6 +310,33 @@ them with default constructed values, do not use the indexed delete operator
("delete sequence[i]") but instead use the \c {splice} function
("sequence.splice(startIndex, deleteCount)").
+\section2 Value types
+
+Some value types in Qt such as QPoint are represented in JavaScript as objects
+that have the same properties and functions like in the C++ API. The same
+representation is possible with custom C++ value types. To enable a custom
+value type with the QML engine, the class declaration needs to be annotated
+with \c{Q_GADGET}. Properties that are intended to be visible in the JavaScript
+representation need to be declared with \c Q_PROPERTY. Similarly functions need
+to be marked with \c Q_INVOKABLE. This is the same with QObject based C++ APIs.
+For example, the \c Actor class below is annotated as gadget and has
+properties:
+
+\code
+ class Actor
+ {
+ Q_GADGET
+ Q_PROPERTY(QString name READ name WRITE setName)
+ public:
+ QString name() const { return m_name; }
+ void setName(const QString &name) { m_name = name; }
+
+ private:
+ QString m_name;
+ }
+
+ Q_DECLARE_METATYPE(Actor)
+\endcode
\section1 Enumeration Types
diff --git a/src/qml/doc/src/cppintegration/definetypes.qdoc b/src/qml/doc/src/cppintegration/definetypes.qdoc
index 2f780503b2..54ed3f1e6e 100644
--- a/src/qml/doc/src/cppintegration/definetypes.qdoc
+++ b/src/qml/doc/src/cppintegration/definetypes.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/cppintegration/exposecppattributes.qdoc b/src/qml/doc/src/cppintegration/exposecppattributes.qdoc
index d8e05b4358..e1db5c9d57 100644
--- a/src/qml/doc/src/cppintegration/exposecppattributes.qdoc
+++ b/src/qml/doc/src/cppintegration/exposecppattributes.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
@@ -395,6 +395,7 @@ methods, as shown below right:
\table
\row
+\li C++
\li
\code
int main(int argc, char *argv[]) {
@@ -409,6 +410,8 @@ methods, as shown below right:
return app.exec();
}
\endcode
+\row
+\li QML
\li
\qml
// MyItem.qml
diff --git a/src/qml/doc/src/cppintegration/extending-tutorial.qdoc b/src/qml/doc/src/cppintegration/extending-tutorial.qdoc
index b593753d33..d862b50fcb 100644
--- a/src/qml/doc/src/cppintegration/extending-tutorial.qdoc
+++ b/src/qml/doc/src/cppintegration/extending-tutorial.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/cppintegration/interactqmlfromcpp.qdoc b/src/qml/doc/src/cppintegration/interactqmlfromcpp.qdoc
index 15d98ec405..2a644cafff 100644
--- a/src/qml/doc/src/cppintegration/interactqmlfromcpp.qdoc
+++ b/src/qml/doc/src/cppintegration/interactqmlfromcpp.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
@@ -170,7 +170,10 @@ QMetaObject::invokeMethod():
\table
\row
+\li QML
\li \snippet qml/qtbinding/functions-qml/MyItem.qml 0
+\row
+\li C++
\li \snippet qml/qtbinding/functions-qml/main.cpp 0
\endtable
@@ -195,6 +198,7 @@ QObject::connect(), so that the \c cppSlot() method is called whenever the
\row
\li
\snippet qml/qtbinding/signals-qml/MyItem.qml 0
+\row
\li
\snippet qml/qtbinding/signals-qml/myclass.h 0
\codeline
@@ -235,8 +239,10 @@ QVariant type:
void cppSlot(const QVariant &v) {
qDebug() << "Called the C++ slot with value:" << v;
- QQuickItem *item = qobject_cast<QQuickItem*>(v.value<QObject*>());
- qDebug() << "Item dimensions:" << item->width() << item->height();
+ QQuickItem *item =
+ qobject_cast<QQuickItem*>(v.value<QObject*>());
+ qDebug() << "Item dimensions:" << item->width()
+ << item->height();
}
};
diff --git a/src/qml/doc/src/cppintegration/topic.qdoc b/src/qml/doc/src/cppintegration/topic.qdoc
index 67e76e3e5e..a349fd0713 100644
--- a/src/qml/doc/src/cppintegration/topic.qdoc
+++ b/src/qml/doc/src/cppintegration/topic.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/examples.qdoc b/src/qml/doc/src/examples.qdoc
index 29424053a4..f3550ae199 100644
--- a/src/qml/doc/src/examples.qdoc
+++ b/src/qml/doc/src/examples.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/external-resources.qdoc b/src/qml/doc/src/external-resources.qdoc
index 671246d7ab..202d1e4ae2 100644
--- a/src/qml/doc/src/external-resources.qdoc
+++ b/src/qml/doc/src/external-resources.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/javascript/date.qdoc b/src/qml/doc/src/javascript/date.qdoc
index 4f897af928..fd1be1b65c 100644
--- a/src/qml/doc/src/javascript/date.qdoc
+++ b/src/qml/doc/src/javascript/date.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
@@ -132,6 +132,25 @@
hour, if DST is currently in effect, while it was not for the time specified, or
vice versa.
+ Note: There are different date formats with different understandings of negative years. Common
+ human language does not have a year 0. The year after 1BC is 1AD. This understanding is
+ reflected when printing or parsing dates in one of the formats not standardized by ECMAScript.
+ That is: toString(), toLocaleString(), toUTCString() and friends. ECMAScript does standardize
+ one format: ISO 8601. This is what you get when you call toISOString(). This format does include
+ a year 0, which is 1BC in other formats. Thus you get different years when printing negative
+ dates with toISOString() and toString().
+
+ When setting the year using the Date constructor or set(UTC)FullYear(), the convention set by
+ ISO 8601 is used and 0 is a valid year. This means negative years set with the constructor or
+ set(UTC)FullYear() are zero-based and thus offset by one year from what is printed with
+ toString() and friends. Parsing the output of any of the to*String() methods will yield the same
+ date value you printed from. Date.parse() will recognize the different formats and their
+ convention on the existence of year 0.
+
+ Note that all this is different from what you get in other JavaScript implementations which
+ usually treat year 0 as valid in all string representations. As the date formats are
+ "implementation-dependent" in the ECMAScript standard, this is still valid, though.
+
\sa {QtQml::Locale}{Locale}
*/
diff --git a/src/qml/doc/src/javascript/dynamicobjectcreation.qdoc b/src/qml/doc/src/javascript/dynamicobjectcreation.qdoc
index 1372858ca5..acd7188db7 100644
--- a/src/qml/doc/src/javascript/dynamicobjectcreation.qdoc
+++ b/src/qml/doc/src/javascript/dynamicobjectcreation.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
@@ -143,6 +143,15 @@ If the string of QML imports files using relative paths, the path should be
relative to the file in which the parent object (the second argument to the
method) is defined.
+\important When building static QML applications, which is enforced on platforms like iOS,
+QML files are scanned to detect import dependencies. That way, all
+necessary plugins and resources are resolved at compile time.
+However, only explicit import statements are considered (those found at
+the top of a QML file), and not import statements enclosed within string literals.
+To support static builds, you therefore need to ensure that QML files
+using \l{QtQml::Qt::createQmlObject()}{Qt.createQmlObject()},
+explicitly contain all necessary imports at the top of the file in addition
+to inside the string literals.
\section1 Maintaining Dynamically Created Objects
@@ -191,10 +200,10 @@ destroy itself:
\table
\row
\li \c application.qml
-\li \c SelfDestroyingRect.qml
+\li \snippet qml/dynamicObjects-destroy.qml 0
\row
-\li \snippet qml/dynamicObjects-destroy.qml 0
+\li \c SelfDestroyingRect.qml
\li \snippet qml/SelfDestroyingRect.qml 0
\endtable
diff --git a/src/qml/doc/src/javascript/expressions.qdoc b/src/qml/doc/src/javascript/expressions.qdoc
index 4e969f05a7..0782960d82 100644
--- a/src/qml/doc/src/javascript/expressions.qdoc
+++ b/src/qml/doc/src/javascript/expressions.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/javascript/functionlist.qdoc b/src/qml/doc/src/javascript/functionlist.qdoc
index 2386ecda74..7f0e844b65 100644
--- a/src/qml/doc/src/javascript/functionlist.qdoc
+++ b/src/qml/doc/src/javascript/functionlist.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/javascript/hostenvironment.qdoc b/src/qml/doc/src/javascript/hostenvironment.qdoc
index bd3ff63bf8..3b1763bd50 100644
--- a/src/qml/doc/src/javascript/hostenvironment.qdoc
+++ b/src/qml/doc/src/javascript/hostenvironment.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/javascript/imports.qdoc b/src/qml/doc/src/javascript/imports.qdoc
index d70d33fee6..d4ce25c92b 100644
--- a/src/qml/doc/src/javascript/imports.qdoc
+++ b/src/qml/doc/src/javascript/imports.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/javascript/number.qdoc b/src/qml/doc/src/javascript/number.qdoc
index 1dd7f4213c..94d90d4070 100644
--- a/src/qml/doc/src/javascript/number.qdoc
+++ b/src/qml/doc/src/javascript/number.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/javascript/qmlglobalobject.qdoc b/src/qml/doc/src/javascript/qmlglobalobject.qdoc
index 62ec296178..e37b35451c 100644
--- a/src/qml/doc/src/javascript/qmlglobalobject.qdoc
+++ b/src/qml/doc/src/javascript/qmlglobalobject.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
@@ -57,7 +57,6 @@ The XMLHttpRequest API implements the same \l {http://www.w3.org/TR/XMLHttpReque
as many popular web browsers with following exceptions:
\list
\li QML's XMLHttpRequest does not enforce the same origin policy.
-\li QML's XMLHttpRequest does not support \e synchronous requests.
\endlist
Additionally, the \c responseXML XML DOM tree currently supported by QML is a reduced subset
diff --git a/src/qml/doc/src/javascript/qtjavascript.qdoc b/src/qml/doc/src/javascript/qtjavascript.qdoc
index 8fcfe0515f..8df1330f64 100644
--- a/src/qml/doc/src/javascript/qtjavascript.qdoc
+++ b/src/qml/doc/src/javascript/qtjavascript.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/javascript/resources.qdoc b/src/qml/doc/src/javascript/resources.qdoc
index 783b43c763..51354e9bf0 100644
--- a/src/qml/doc/src/javascript/resources.qdoc
+++ b/src/qml/doc/src/javascript/resources.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/javascript/string.qdoc b/src/qml/doc/src/javascript/string.qdoc
index 5c3c2b52f4..abce72a639 100644
--- a/src/qml/doc/src/javascript/string.qdoc
+++ b/src/qml/doc/src/javascript/string.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/javascript/topic.qdoc b/src/qml/doc/src/javascript/topic.qdoc
index f341816201..24a7a40715 100644
--- a/src/qml/doc/src/javascript/topic.qdoc
+++ b/src/qml/doc/src/javascript/topic.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/qmlfunctions.qdoc b/src/qml/doc/src/qmlfunctions.qdoc
index 9942c52aa7..25bb0d6068 100644
--- a/src/qml/doc/src/qmlfunctions.qdoc
+++ b/src/qml/doc/src/qmlfunctions.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
@@ -183,7 +183,7 @@
\a versionMinor.
While the type has a name and a type, it cannot be created, and the
- given error \a message will result if creation is attempted.
+ given error \a reason will result if creation is attempted.
This is useful where the type is only intended for providing attached
properties, enum values or an abstract base class with its extension.
diff --git a/src/qml/doc/src/qmllanguageref/documents/definetypes.qdoc b/src/qml/doc/src/qmllanguageref/documents/definetypes.qdoc
index 4e1d4a2c86..4b4b25796c 100644
--- a/src/qml/doc/src/qmllanguageref/documents/definetypes.qdoc
+++ b/src/qml/doc/src/qmllanguageref/documents/definetypes.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/qmllanguageref/documents/networktransparency.qdoc b/src/qml/doc/src/qmllanguageref/documents/networktransparency.qdoc
index 481e449a01..7fa271c2d9 100644
--- a/src/qml/doc/src/qmllanguageref/documents/networktransparency.qdoc
+++ b/src/qml/doc/src/qmllanguageref/documents/networktransparency.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/qmllanguageref/documents/scope.qdoc b/src/qml/doc/src/qmllanguageref/documents/scope.qdoc
index 67ae881908..3e3bbaca98 100644
--- a/src/qml/doc/src/qmllanguageref/documents/scope.qdoc
+++ b/src/qml/doc/src/qmllanguageref/documents/scope.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/qmllanguageref/documents/structure.qdoc b/src/qml/doc/src/qmllanguageref/documents/structure.qdoc
index e526e47b00..015b0e8b6b 100644
--- a/src/qml/doc/src/qmllanguageref/documents/structure.qdoc
+++ b/src/qml/doc/src/qmllanguageref/documents/structure.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/qmllanguageref/documents/topic.qdoc b/src/qml/doc/src/qmllanguageref/documents/topic.qdoc
index aa13229165..840afa9a0e 100644
--- a/src/qml/doc/src/qmllanguageref/documents/topic.qdoc
+++ b/src/qml/doc/src/qmllanguageref/documents/topic.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/qmllanguageref/modules/cppplugins.qdoc b/src/qml/doc/src/qmllanguageref/modules/cppplugins.qdoc
index a481847136..79bd3df9d9 100644
--- a/src/qml/doc/src/qmllanguageref/modules/cppplugins.qdoc
+++ b/src/qml/doc/src/qmllanguageref/modules/cppplugins.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/qmllanguageref/modules/identifiedmodules.qdoc b/src/qml/doc/src/qmllanguageref/modules/identifiedmodules.qdoc
index 63267420e2..0bd9c3603f 100644
--- a/src/qml/doc/src/qmllanguageref/modules/identifiedmodules.qdoc
+++ b/src/qml/doc/src/qmllanguageref/modules/identifiedmodules.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/qmllanguageref/modules/legacymodules.qdoc b/src/qml/doc/src/qmllanguageref/modules/legacymodules.qdoc
index 26981334b7..64cd2e41cb 100644
--- a/src/qml/doc/src/qmllanguageref/modules/legacymodules.qdoc
+++ b/src/qml/doc/src/qmllanguageref/modules/legacymodules.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/qmllanguageref/modules/qmldir.qdoc b/src/qml/doc/src/qmllanguageref/modules/qmldir.qdoc
index def2216cbd..201cee16e6 100644
--- a/src/qml/doc/src/qmllanguageref/modules/qmldir.qdoc
+++ b/src/qml/doc/src/qmllanguageref/modules/qmldir.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
@@ -43,17 +43,14 @@ documentation about
\section1 Contents of a Module Definition qmldir File
-A \c qmldir file which defines a module is a plain-text file which consists
-of the following commands:
+A \c qmldir file is a plain-text file that contains
+the following commands:
-\table
+\table 70%
\header
- \li Command
\li Syntax
\li Usage
-
\row
- \li Module Identifier Directive
\li
\code
module <ModuleIdentifier>
@@ -73,14 +70,14 @@ module ExampleModule
\endcode
\row
- \li Object Type Declaration
\li
\code
-<TypeName> <InitialVersion> <File>
+[singleton] <TypeName> <InitialVersion> <File>
\endcode
\li Declares a \l{qtqml-typesystem-objecttypes.html}{QML object type}
to be made available by the module.
\list
+ \li \c [singleton] Optional. Used to declare a singleton type.
\li \c <TypeName> is the type being made available
\li \c <InitialVersion> is the module version for which the type is to be made available
\li \c <File> is the (relative) file name of the QML file that defines the type
@@ -89,14 +86,36 @@ module ExampleModule
Zero or more object type declarations may exist in the \c qmldir
file, however each object type must have a unique type name within
any particular version of the module.
+ \note To declare a \c singleton type, the QML file defining the
+ type must include the \c {pragma Singleton} statement.
Example:
\code
-MyCustomType 1.0 MyCustomType.qml
+//Style.qml with custom singleton type definition
+pragma Singleton
+import QtQuick 2.0
+
+QtObject {
+ property int textSize: 20
+ property color textColor: "green"
+}
+
+// qmldir declaring the singleton type
+module CustomStyles
+singleton Style 1.0 Style.qml
+
+// singleton type in use
+import QtQuick 2.0
+import CustomStyles 1.0
+
+Text {
+ font.pixelSize: Style.textSize
+ color: Style.textColor
+ text: "Hello World"
+}
\endcode
\row
- \li Internal Object Type Declaration
\li
\code
internal <TypeName> <File>
@@ -119,7 +138,6 @@ internal MyPrivateType MyPrivateType.qml
load the non-exported type.
\row
- \li JavaScript Resource Declaration
\li
\code
<ResourceIdentifier> <InitialVersion> <File>
@@ -143,7 +161,6 @@ MyScript 1.0 MyScript.js
{Importing JavaScript Resources In QML} for more information.
\row
- \li C++ Plugin Declaration
\li
\code
plugin <Name> [<Path>]
@@ -178,7 +195,6 @@ plugin <Name> [<Path>]
plugin MyPluginLibrary
\endcode
\row
- \li C++ Plugin Class
\li
\code
classname <C++ plugin class>
@@ -191,7 +207,6 @@ classname <C++ plugin class>
this information.
\row
- \li Type Information Description File Declaration
\li
\code
typeinfo <File>
@@ -210,7 +225,6 @@ typeinfo mymodule.qmltypes
as code completion for the types defined in your plugins.
\row
- \li Dependency Declaration
\li
\code
depends <ModuleIdentifier> <InitialVersion>
@@ -229,7 +243,6 @@ depends MyOtherModule 1.0
to include the other modules in application packages.
\row
- \li Comment
\li
\code
# <Comment>
@@ -242,10 +255,9 @@ depends MyOtherModule 1.0
\endcode
\row
- \li designersupported
\li
- \code
- designersupported
+ \code
+designersupported
\endcode
\li Set this property if the plugin is supported by Qt Quick Designer.
diff --git a/src/qml/doc/src/qmllanguageref/modules/topic.qdoc b/src/qml/doc/src/qmllanguageref/modules/topic.qdoc
index 9d4173a883..1a5504e277 100644
--- a/src/qml/doc/src/qmllanguageref/modules/topic.qdoc
+++ b/src/qml/doc/src/qmllanguageref/modules/topic.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/qmllanguageref/qmlreference.qdoc b/src/qml/doc/src/qmllanguageref/qmlreference.qdoc
index 5111990b46..d832367f7f 100644
--- a/src/qml/doc/src/qmllanguageref/qmlreference.qdoc
+++ b/src/qml/doc/src/qmllanguageref/qmlreference.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/qmllanguageref/syntax/basics.qdoc b/src/qml/doc/src/qmllanguageref/syntax/basics.qdoc
index 8d71a04ac2..ddb307cf75 100644
--- a/src/qml/doc/src/qmllanguageref/syntax/basics.qdoc
+++ b/src/qml/doc/src/qmllanguageref/syntax/basics.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/qmllanguageref/syntax/directoryimports.qdoc b/src/qml/doc/src/qmllanguageref/syntax/directoryimports.qdoc
index 51701cfe74..8c512b65db 100644
--- a/src/qml/doc/src/qmllanguageref/syntax/directoryimports.qdoc
+++ b/src/qml/doc/src/qmllanguageref/syntax/directoryimports.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/qmllanguageref/syntax/imports.qdoc b/src/qml/doc/src/qmllanguageref/syntax/imports.qdoc
index 0939a460fe..9eb792bd2e 100644
--- a/src/qml/doc/src/qmllanguageref/syntax/imports.qdoc
+++ b/src/qml/doc/src/qmllanguageref/syntax/imports.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc b/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc
index cd37e8a6a2..a8177d29d8 100644
--- a/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc
+++ b/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
@@ -590,8 +590,8 @@ Item {
}
\endqml
-\note A read-only property cannot also be a \l{Default Properties}{default} or
-\l {Property Aliases}{alias} property.
+\note A read-only property cannot also be a \l{Default Properties}{default}
+property.
\section3 Property Modifier Objects
diff --git a/src/qml/doc/src/qmllanguageref/syntax/propertybinding.qdoc b/src/qml/doc/src/qmllanguageref/syntax/propertybinding.qdoc
index 4f4d6ed9d8..3aa228c8eb 100644
--- a/src/qml/doc/src/qmllanguageref/syntax/propertybinding.qdoc
+++ b/src/qml/doc/src/qmllanguageref/syntax/propertybinding.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/qmllanguageref/syntax/signals.qdoc b/src/qml/doc/src/qmllanguageref/syntax/signals.qdoc
index 16d1ac32c4..e7d75a89bc 100644
--- a/src/qml/doc/src/qmllanguageref/syntax/signals.qdoc
+++ b/src/qml/doc/src/qmllanguageref/syntax/signals.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/qmllanguageref/typesystem/basictypes.qdoc b/src/qml/doc/src/qmllanguageref/typesystem/basictypes.qdoc
index 93a36e80fc..780086cfc7 100644
--- a/src/qml/doc/src/qmllanguageref/typesystem/basictypes.qdoc
+++ b/src/qml/doc/src/qmllanguageref/typesystem/basictypes.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/qmllanguageref/typesystem/objecttypes.qdoc b/src/qml/doc/src/qmllanguageref/typesystem/objecttypes.qdoc
index 9209ebe68e..b0aab1c73a 100644
--- a/src/qml/doc/src/qmllanguageref/typesystem/objecttypes.qdoc
+++ b/src/qml/doc/src/qmllanguageref/typesystem/objecttypes.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/qmllanguageref/typesystem/topic.qdoc b/src/qml/doc/src/qmllanguageref/typesystem/topic.qdoc
index 76e28f7ef1..26e7a072da 100644
--- a/src/qml/doc/src/qmllanguageref/typesystem/topic.qdoc
+++ b/src/qml/doc/src/qmllanguageref/typesystem/topic.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/qmltypereference.qdoc b/src/qml/doc/src/qmltypereference.qdoc
index 5d04a8a637..31133c862f 100644
--- a/src/qml/doc/src/qmltypereference.qdoc
+++ b/src/qml/doc/src/qmltypereference.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
@@ -55,7 +55,7 @@ are also provided by the \c QtQuick namespace which may be imported as
follows:
\qml
-import QtQuick 2.3
+import QtQuick 2.5
\endqml
See the \l{Qt Quick} module documentation for more information about the \c
@@ -208,6 +208,9 @@ Or use the \l{QtQml::Qt::rect()}{Qt.rect()} function:
CustomObject { myRectProperty: Qt.rect(50, 50, 100, 100) }
\endqml
+The \c rect type also exposes read-only \c left, \c right, \c top and \c bottom
+attributes. These are the same as their \l {QRectF}{C++ counterparts}.
+
When integrating with C++, note that any QRect or QRectF value
\l{qtqml-cppintegration-data.html}{passed into QML from C++} is automatically
converted into a \c rect value, and vice-versa. When a \c rect value is passed to C++, it
diff --git a/src/qml/doc/src/qtqml-cpp.qdoc b/src/qml/doc/src/qtqml-cpp.qdoc
index 07aca29f7d..dc6171c32e 100644
--- a/src/qml/doc/src/qtqml-cpp.qdoc
+++ b/src/qml/doc/src/qtqml-cpp.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/qtqml.qdoc b/src/qml/doc/src/qtqml.qdoc
index 7350f65024..64d6bb9ac4 100644
--- a/src/qml/doc/src/qtqml.qdoc
+++ b/src/qml/doc/src/qtqml.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/statemachine.qdoc b/src/qml/doc/src/statemachine.qdoc
index f200f6f3c0..56a8746e1e 100644
--- a/src/qml/doc/src/statemachine.qdoc
+++ b/src/qml/doc/src/statemachine.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/qml/doc/src/whatsnew.qdoc b/src/qml/doc/src/whatsnew.qdoc
deleted file mode 100644
index 11b899e926..0000000000
--- a/src/qml/doc/src/whatsnew.qdoc
+++ /dev/null
@@ -1,130 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\title Qt QML Release Notes
-\page qtqml-releasenotes.html
-
-\section1 Qt QML in Qt 5.1
-
-Qt 5.1 introduces several bug fixes and new functionalities to Qt QML. This is
-a summary of the new changes:
-\list
-\li New QQmlApplicationEngine convenience class for QML applications.
-\li New Instantiatior type for generic, dynamic object creation.
-\li New properties for \l {Qt::application}{Qt.application}: arguments, name, and version.
-\li The 'with' statement has been deprecated and is slated for removal in a
- future version of the language.
-\li New \l {Qt::platform}{Qt.platform} object with an \c os property
-\li New \l qmlClearTypeRegistrations() function drops all data from qmlRegisterType() calls
-\li New \l qmlRegisterType() function for registering composite types.
-\endlist
-
-\section2 New Submodule
-
-The \l{Qt QML Models QML Types}{Qt QML Models} is a new submodule in Qt 5.1 and
-provides several QML types for handling data with models and lists. These types
-replace types such as \l VisualItemModel, \l VisualDataModel, and \l VisualDataGroup.
-
-\list
-\li \l{Qt QML Models QML Types}{Models}
-\endlist
-
-The \l{What's New in Qt 5.1} has more information about the Qt 5.1 release.
-
-\section1 Qt QML in Qt 5.0
-
-The \l{Qt QML} module is new in Qt 5.0. It provides the QML engine and
-implements the QML language supporting infrastructure.
-
-(Prior to Qt 5, this functionality was provided by the \l {Qt Quick 1}{QtDeclarative} module, which
-has now been replaced by the new \l {Qt QML} and \l {Qt Quick} modules. See the
-\l {Porting QML Applications to Qt 5} page for more information.)
-
-\section2 QML Engine
-
-\list
-\li JavaScript engine has changed to V8.
-\li Various parser and compiler optimizations have been implemented, as well as a new bindings optimizer.
-\li New QQmlEngine::trimComponentCache() method safely discards unused data in the engine's component cache to free memory.
-\endlist
-
-\section2 Component and Object Creation
-
-\list
-\li QML objects can now be created asynchronously to improve application performance.
- \list
- \li New QQmlIncubator and QQmlIncubationController C++ classes can be used to create objects asynchronously.
- \li From QML code, this behavior can enabled by:
- \list
- \li Calling the new Component \l{Component::incubateObject} method
- \li Passing the \c Component.Asynchronous parameter to \c Qt.createComponent()
- \li Loading a \l Loader object asynchronously using the \l{Loader::}{asynchronous} property
- \endlist
- \endlist
-\li The component returned by \c Qt.createComponent() is no longer parented to the engine. Be sure to hold a reference, or provide a parent.
-\endlist
-
-\section2 Type System
-
-\list
-\li New \l var property type. This is a general-purpose property type which obsoletes the \l variant type.
- Properties of the \l var type may hold JavaScript references.
-\li QML properties of type \l var and \l variant can now hold pixmaps.
-\li Value type improvements:
- \list
- \li QML now supports defining properties of value type basic types within QML documents. Supported types include
- QSizeF, QPointF and QRectF as \c size, \c point and \c rect respectively.
- \li QColor is now a value type provided by the \c QtQuick module. The red, green, blue and alpha channels
- of a \l color property can be accessed via \c r, \c g, \c b and \c a properties.
- \li Factory functions for various value types have been added to the \c Qt object exposed to QML.
- Some of those functions require the \c QtQuick module to be imported in order to return valid values.
- See the \l {Qt Quick Release Notes} for more information about these functions.
- \endlist
-\li Support for sequence types QList<int>, QList<qreal>, QList<bool>, QList<QUrl>,
- QList<QString> and QStringList has been improved. QObjects can define Q_PROPERTYs of
- these types which can be accessed transparently from JavaScript.
-\endlist
-
-\section2 Modules and Imports
-
-\list
-\li Arbitrary functionality may be provided in a namespace through a singleton type. See qmlRegisterSingletonType() for more information.
-\li JavaScript (.js) files may now import QML modules and other JavaScript files using the ".import" syntax.
-\li Plugins may now use QQmlExtensionPlugin::baseUrl to get the directory from which the plugin is loaded.
- This will be useful if the plugin needs to load QML or other assets from the same directory.
-\endlist
-
-\section2 Other
-
-\list
-\li QQmlExpression can now be constructed directly (and more efficiently) from a QQmlScriptString.
-\li The \l {QtQml::Qt}{Qt} global object now provides an \l{QtQml::Qt::inputMethod}{inputMethod} property to access the active
- text input method for an application.
-\endlist
-
-*/
diff --git a/src/qml/jit/qv4assembler.cpp b/src/qml/jit/qv4assembler.cpp
index ed342740ac..09e5b14c97 100644
--- a/src/qml/jit/qv4assembler.cpp
+++ b/src/qml/jit/qv4assembler.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -68,7 +68,7 @@ void CompilationUnit::linkBackendToEngine(ExecutionEngine *engine)
const CompiledData::Function *compiledFunction = data->functionAt(i);
QV4::Function *runtimeFunction = new QV4::Function(engine, this, compiledFunction,
- (ReturnedValue (*)(QV4::ExecutionContext *, const uchar *)) codeRefs[i].code().executableAddress());
+ (ReturnedValue (*)(QV4::ExecutionEngine *, const uchar *)) codeRefs[i].code().executableAddress());
runtimeFunctions[i] = runtimeFunction;
}
}
@@ -182,25 +182,24 @@ Assembler::Pointer Assembler::loadArgLocalAddress(RegisterID baseReg, IR::ArgLoc
{
int32_t offset = 0;
int scope = al->scope;
- RegisterID context = ContextRegister;
+ loadPtr(Address(EngineRegister, qOffsetOf(ExecutionEngine, current)), baseReg);
if (scope) {
- loadPtr(Address(ContextRegister, qOffsetOf(ExecutionContext::Data, outer)), baseReg);
+ loadPtr(Address(baseReg, qOffsetOf(ExecutionContext::Data, outer)), baseReg);
--scope;
- context = baseReg;
while (scope) {
- loadPtr(Address(context, qOffsetOf(ExecutionContext::Data, outer)), context);
+ loadPtr(Address(baseReg, qOffsetOf(ExecutionContext::Data, outer)), baseReg);
--scope;
}
}
switch (al->kind) {
case IR::ArgLocal::Formal:
case IR::ArgLocal::ScopedFormal: {
- loadPtr(Address(context, qOffsetOf(ExecutionContext::Data, callData)), baseReg);
+ loadPtr(Address(baseReg, qOffsetOf(ExecutionContext::Data, callData)), baseReg);
offset = sizeof(CallData) + (al->index - 1) * sizeof(Value);
} break;
case IR::ArgLocal::Local:
case IR::ArgLocal::ScopedLocal: {
- loadPtr(Address(context, qOffsetOf(CallContext::Data, locals)), baseReg);
+ loadPtr(Address(baseReg, qOffsetOf(CallContext::Data, locals)), baseReg);
offset = al->index * sizeof(Value);
} break;
default:
@@ -211,18 +210,17 @@ Assembler::Pointer Assembler::loadArgLocalAddress(RegisterID baseReg, IR::ArgLoc
Assembler::Pointer Assembler::loadStringAddress(RegisterID reg, const QString &string)
{
- loadPtr(Address(Assembler::ContextRegister, qOffsetOf(QV4::ExecutionContext::Data, compilationUnit)), Assembler::ScratchRegister);
+ loadPtr(Address(Assembler::EngineRegister, qOffsetOf(QV4::ExecutionEngine, current)), Assembler::ScratchRegister);
+ loadPtr(Address(Assembler::ScratchRegister, qOffsetOf(QV4::Heap::ExecutionContext, compilationUnit)), Assembler::ScratchRegister);
loadPtr(Address(Assembler::ScratchRegister, qOffsetOf(QV4::CompiledData::CompilationUnit, runtimeStrings)), reg);
const int id = _isel->registerString(string);
- return Pointer(reg, id * sizeof(QV4::StringValue));
+ return Pointer(reg, id * sizeof(QV4::String*));
}
void Assembler::loadStringRef(RegisterID reg, const QString &string)
{
- loadPtr(Address(Assembler::ContextRegister, qOffsetOf(QV4::ExecutionContext::Data, compilationUnit)), reg);
- loadPtr(Address(reg, qOffsetOf(QV4::CompiledData::CompilationUnit, runtimeStrings)), reg);
const int id = _isel->registerString(string);
- loadPtr(Address(reg, id * sizeof(QV4::StringValue)), reg);
+ move(TrustedImm32(id), reg);
}
void Assembler::storeValue(QV4::Primitive value, IR::Expr *destination)
diff --git a/src/qml/jit/qv4assembler_p.h b/src/qml/jit/qv4assembler_p.h
index 87875f1120..3b65acb26c 100644
--- a/src/qml/jit/qv4assembler_p.h
+++ b/src/qml/jit/qv4assembler_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -101,27 +101,27 @@ struct ExceptionCheck {
};
// push_catch and pop context methods shouldn't check for exceptions
template <>
-struct ExceptionCheck<QV4::ExecutionContext *(*)(QV4::ExecutionContext *)> {
+struct ExceptionCheck<void (*)(QV4::ExecutionEngine *)> {
enum { NeedsCheck = 0 };
};
template <typename A>
-struct ExceptionCheck<QV4::ExecutionContext *(*)(QV4::ExecutionContext *, A)> {
+struct ExceptionCheck<void (*)(A, QV4::NoThrowEngine)> {
enum { NeedsCheck = 0 };
};
template <>
-struct ExceptionCheck<QV4::ReturnedValue (*)(QV4::NoThrowContext *)> {
+struct ExceptionCheck<QV4::ReturnedValue (*)(QV4::NoThrowEngine *)> {
enum { NeedsCheck = 0 };
};
template <typename A>
-struct ExceptionCheck<QV4::ReturnedValue (*)(QV4::NoThrowContext *, A)> {
+struct ExceptionCheck<QV4::ReturnedValue (*)(QV4::NoThrowEngine *, A)> {
enum { NeedsCheck = 0 };
};
template <typename A, typename B>
-struct ExceptionCheck<QV4::ReturnedValue (*)(QV4::NoThrowContext *, A, B)> {
+struct ExceptionCheck<QV4::ReturnedValue (*)(QV4::NoThrowEngine *, A, B)> {
enum { NeedsCheck = 0 };
};
template <typename A, typename B, typename C>
-struct ExceptionCheck<void (*)(QV4::NoThrowContext *, A, B, C)> {
+struct ExceptionCheck<void (*)(QV4::NoThrowEngine *, A, B, C)> {
enum { NeedsCheck = 0 };
};
@@ -316,8 +316,8 @@ public:
{}
IR::Expr *value;
};
- struct PointerToString {
- explicit PointerToString(const QString &string) : string(string) {}
+ struct StringToIndex {
+ explicit StringToIndex(const QString &string) : string(string) {}
QString string;
};
struct Reference {
@@ -446,7 +446,7 @@ public:
loadArgumentInRegister(addr, dest, argumentNumber);
}
}
- void loadArgumentInRegister(PointerToString temp, RegisterID dest, int argumentNumber)
+ void loadArgumentInRegister(StringToIndex temp, RegisterID dest, int argumentNumber)
{
Q_UNUSED(argumentNumber);
loadStringRef(dest, temp.string);
@@ -662,7 +662,7 @@ public:
}
template <int StackSlot>
- void loadArgumentOnStack(PointerToString temp, int argumentNumber)
+ void loadArgumentOnStack(StringToIndex temp, int argumentNumber)
{
Q_UNUSED(argumentNumber);
loadStringRef(ScratchRegister, temp.string);
@@ -797,8 +797,7 @@ public:
const RegisterInformation &fpRegistersToSave);
void checkException() {
- loadPtr(Address(ContextRegister, qOffsetOf(QV4::ExecutionContext::Data, engine)), ScratchRegister);
- load32(Address(ScratchRegister, qOffsetOf(QV4::ExecutionEngine, hasException)), ScratchRegister);
+ load32(Address(EngineRegister, qOffsetOf(QV4::ExecutionEngine, hasException)), ScratchRegister);
Jump exceptionThrown = branch32(NotEqual, ScratchRegister, TrustedImm32(0));
if (catchBlock)
addPatch(catchBlock, exceptionThrown);
@@ -917,25 +916,25 @@ public:
template <typename ArgRet, typename Callable, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
void generateFunctionCallImp(ArgRet r, const char* functionName, Callable function, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4)
{
- generateFunctionCallImp(r, functionName, function, arg1, arg2, arg3, arg4, VoidType());
+ generateFunctionCallImp(r, functionName, function, arg1, arg2, arg3, arg4, VoidType(), VoidType());
}
template <typename ArgRet, typename Callable, typename Arg1, typename Arg2, typename Arg3>
void generateFunctionCallImp(ArgRet r, const char* functionName, Callable function, Arg1 arg1, Arg2 arg2, Arg3 arg3)
{
- generateFunctionCallImp(r, functionName, function, arg1, arg2, arg3, VoidType(), VoidType());
+ generateFunctionCallImp(r, functionName, function, arg1, arg2, arg3, VoidType(), VoidType(), VoidType());
}
template <typename ArgRet, typename Callable, typename Arg1, typename Arg2>
void generateFunctionCallImp(ArgRet r, const char* functionName, Callable function, Arg1 arg1, Arg2 arg2)
{
- generateFunctionCallImp(r, functionName, function, arg1, arg2, VoidType(), VoidType(), VoidType());
+ generateFunctionCallImp(r, functionName, function, arg1, arg2, VoidType(), VoidType(), VoidType(), VoidType());
}
template <typename ArgRet, typename Callable, typename Arg1>
void generateFunctionCallImp(ArgRet r, const char* functionName, Callable function, Arg1 arg1)
{
- generateFunctionCallImp(r, functionName, function, arg1, VoidType(), VoidType(), VoidType(), VoidType());
+ generateFunctionCallImp(r, functionName, function, arg1, VoidType(), VoidType(), VoidType(), VoidType(), VoidType());
}
Pointer toAddress(RegisterID tmpReg, IR::Expr *e, int offset)
@@ -1226,7 +1225,8 @@ template <typename T> inline bool prepareCall(T &, Assembler *)
template <> inline bool prepareCall(RelativeCall &relativeCall, Assembler *as)
{
- as->loadPtr(Assembler::Address(Assembler::ContextRegister, qOffsetOf(QV4::ExecutionContext::Data, lookups)),
+ as->loadPtr(Assembler::Address(Assembler::EngineRegister, qOffsetOf(QV4::ExecutionEngine, current)), Assembler::ScratchRegister);
+ as->loadPtr(Assembler::Address(Assembler::ScratchRegister, qOffsetOf(QV4::Heap::ExecutionContext, lookups)),
relativeCall.addr.base);
return true;
}
@@ -1236,7 +1236,8 @@ template <> inline bool prepareCall(LookupCall &lookupCall, Assembler *as)
// IMPORTANT! See generateLookupCall in qv4isel_masm_p.h for details!
// same as prepareCall(RelativeCall ....) : load the table from the context
- as->loadPtr(Assembler::Address(Assembler::ContextRegister, qOffsetOf(QV4::ExecutionContext::Data, lookups)),
+ as->loadPtr(Assembler::Address(Assembler::EngineRegister, qOffsetOf(QV4::ExecutionEngine, current)), Assembler::ScratchRegister);
+ as->loadPtr(Assembler::Address(Assembler::ScratchRegister, qOffsetOf(QV4::Heap::ExecutionContext, lookups)),
lookupCall.addr.base);
// pre-calculate the indirect address for the lookupCall table:
if (lookupCall.addr.offset)
diff --git a/src/qml/jit/qv4binop.cpp b/src/qml/jit/qv4binop.cpp
index 7d6f3977a9..c6c8023cd7 100644
--- a/src/qml/jit/qv4binop.cpp
+++ b/src/qml/jit/qv4binop.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -125,7 +125,7 @@ void Binop::generate(IR::Expr *lhs, IR::Expr *rhs, IR::Expr *target)
Assembler::PointerToValue(rhs));
} else if (info.contextImplementation) {
as->generateFunctionCallImp(target, info.name, info.contextImplementation,
- Assembler::ContextRegister,
+ Assembler::EngineRegister,
Assembler::PointerToValue(lhs),
Assembler::PointerToValue(rhs));
} else {
diff --git a/src/qml/jit/qv4binop_p.h b/src/qml/jit/qv4binop_p.h
index 7de9a75130..4fa2369312 100644
--- a/src/qml/jit/qv4binop_p.h
+++ b/src/qml/jit/qv4binop_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/jit/qv4isel_masm.cpp b/src/qml/jit/qv4isel_masm.cpp
index f4a1ec5f69..da511cd1eb 100644
--- a/src/qml/jit/qv4isel_masm.cpp
+++ b/src/qml/jit/qv4isel_masm.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -69,13 +69,14 @@ inline bool isPregOrConst(IR::Expr *e)
return e->asConst() != 0;
}
-class QIODevicePrintStream: public PrintStream
+class QIODevicePrintStream: public FilePrintStream
{
Q_DISABLE_COPY(QIODevicePrintStream)
public:
explicit QIODevicePrintStream(QIODevice *dest)
- : dest(dest)
+ : FilePrintStream(0)
+ , dest(dest)
, buf(4096, '0')
{
Q_ASSERT(dest);
@@ -115,8 +116,8 @@ static void printDisassembledOutputWithCalls(QByteArray processedOutput, const Q
continue;
processedOutput = processedOutput.insert(idx, QByteArrayLiteral(" ; call ") + it.value());
}
- fprintf(stderr, "%s\n", processedOutput.constData());
- fflush(stderr);
+
+ qDebug("%s", processedOutput.constData());
}
JSC::MacroAssemblerCodeRef Assembler::link(int *codeSize)
@@ -209,7 +210,6 @@ InstructionSelection::~InstructionSelection()
void InstructionSelection::run(int functionIndex)
{
IR::Function *function = irModule->functions[functionIndex];
- QVector<Lookup> lookups;
qSwap(_function, function);
IR::Optimizer opt(_function);
@@ -225,7 +225,7 @@ void InstructionSelection::run(int functionIndex)
// No register allocator available for this platform, or env. var was set, so:
opt.convertOutOfSSA();
ConvertTemps().toStackSlots(_function);
- IR::Optimizer::showMeTheCode(_function);
+ IR::Optimizer::showMeTheCode(_function, "After stack slot allocation");
calculateRegistersToSave(Assembler::getRegisterInfo()); // FIXME: this saves all registers. We can probably do with a subset: those that are not used by the register allocator.
}
QSet<IR::Jump *> removableJumps = opt.calculateOptionalJumps();
@@ -239,16 +239,36 @@ void InstructionSelection::run(int functionIndex)
_as->enterStandardStackFrame(regularRegistersToSave, fpRegistersToSave);
#ifdef ARGUMENTS_IN_REGISTERS
- _as->move(_as->registerForArgument(0), Assembler::ContextRegister);
+ _as->move(_as->registerForArgument(0), Assembler::EngineRegister);
#else
- _as->loadPtr(addressForArgument(0), Assembler::ContextRegister);
+ _as->loadPtr(addressForArgument(0), Assembler::EngineRegister);
#endif
const int locals = _as->stackLayout().calculateJSStackFrameSize();
- _as->loadPtr(Address(Assembler::ContextRegister, qOffsetOf(ExecutionContext::Data, engine)), Assembler::ScratchRegister);
- _as->loadPtr(Address(Assembler::ScratchRegister, qOffsetOf(ExecutionEngine, jsStackTop)), Assembler::LocalsRegister);
- _as->addPtr(Assembler::TrustedImm32(sizeof(QV4::Value)*locals), Assembler::LocalsRegister);
- _as->storePtr(Assembler::LocalsRegister, Address(Assembler::ScratchRegister, qOffsetOf(ExecutionEngine, jsStackTop)));
+ if (locals > 0) {
+ _as->loadPtr(Address(Assembler::EngineRegister, qOffsetOf(ExecutionEngine, jsStackTop)), Assembler::LocalsRegister);
+#ifdef VALUE_FITS_IN_REGISTER
+ _as->move(Assembler::TrustedImm64(0), Assembler::ReturnValueRegister);
+ _as->move(Assembler::TrustedImm32(locals), Assembler::ScratchRegister);
+ Assembler::Label loop = _as->label();
+ _as->store64(Assembler::ReturnValueRegister, Assembler::Address(Assembler::LocalsRegister));
+ _as->add64(Assembler::TrustedImm32(8), Assembler::LocalsRegister);
+ Assembler::Jump jump = _as->branchSub32(Assembler::NonZero, Assembler::TrustedImm32(1), Assembler::ScratchRegister);
+ jump.linkTo(loop, _as);
+#else
+ _as->move(Assembler::TrustedImm32(0), Assembler::ReturnValueRegister);
+ _as->move(Assembler::TrustedImm32(locals), Assembler::ScratchRegister);
+ Assembler::Label loop = _as->label();
+ _as->store32(Assembler::ReturnValueRegister, Assembler::Address(Assembler::LocalsRegister));
+ _as->add32(Assembler::TrustedImm32(4), Assembler::LocalsRegister);
+ _as->store32(Assembler::ReturnValueRegister, Assembler::Address(Assembler::LocalsRegister));
+ _as->add32(Assembler::TrustedImm32(4), Assembler::LocalsRegister);
+ Assembler::Jump jump = _as->branchSub32(Assembler::NonZero, Assembler::TrustedImm32(1), Assembler::ScratchRegister);
+ jump.linkTo(loop, _as);
+#endif
+ _as->storePtr(Assembler::LocalsRegister, Address(Assembler::EngineRegister, qOffsetOf(ExecutionEngine, jsStackTop)));
+ }
+
int lastLine = 0;
for (int i = 0, ei = _function->basicBlockCount(); i != ei; ++i) {
@@ -261,7 +281,8 @@ void InstructionSelection::run(int functionIndex)
foreach (IR::Stmt *s, _block->statements()) {
if (s->location.isValid()) {
if (int(s->location.startLine) != lastLine) {
- Assembler::Address lineAddr(Assembler::ContextRegister, qOffsetOf(QV4::ExecutionContext::Data, lineNumber));
+ _as->loadPtr(Address(Assembler::EngineRegister, qOffsetOf(QV4::ExecutionEngine, current)), Assembler::ScratchRegister);
+ Assembler::Address lineAddr(Assembler::ScratchRegister, qOffsetOf(QV4::ExecutionContext::Data, lineNumber));
_as->store32(Assembler::TrustedImm32(s->location.startLine), lineAddr);
lastLine = s->location.startLine;
}
@@ -307,13 +328,13 @@ void InstructionSelection::callBuiltinInvalid(IR::Name *func, IR::ExprList *args
if (useFastLookups && func->global) {
uint index = registerGlobalGetterLookup(*func->id);
generateFunctionCall(result, Runtime::callGlobalLookup,
- Assembler::ContextRegister,
+ Assembler::EngineRegister,
Assembler::TrustedImm32(index),
baseAddressForCallData());
} else {
generateFunctionCall(result, Runtime::callActivationProperty,
- Assembler::ContextRegister,
- Assembler::PointerToString(*func->id),
+ Assembler::EngineRegister,
+ Assembler::StringToIndex(*func->id),
baseAddressForCallData());
}
}
@@ -321,47 +342,47 @@ void InstructionSelection::callBuiltinInvalid(IR::Name *func, IR::ExprList *args
void InstructionSelection::callBuiltinTypeofMember(IR::Expr *base, const QString &name,
IR::Expr *result)
{
- generateFunctionCall(result, Runtime::typeofMember, Assembler::ContextRegister,
- Assembler::PointerToValue(base), Assembler::PointerToString(name));
+ generateFunctionCall(result, Runtime::typeofMember, Assembler::EngineRegister,
+ Assembler::PointerToValue(base), Assembler::StringToIndex(name));
}
void InstructionSelection::callBuiltinTypeofSubscript(IR::Expr *base, IR::Expr *index,
IR::Expr *result)
{
generateFunctionCall(result, Runtime::typeofElement,
- Assembler::ContextRegister,
+ Assembler::EngineRegister,
Assembler::PointerToValue(base), Assembler::PointerToValue(index));
}
void InstructionSelection::callBuiltinTypeofName(const QString &name, IR::Expr *result)
{
- generateFunctionCall(result, Runtime::typeofName, Assembler::ContextRegister,
- Assembler::PointerToString(name));
+ generateFunctionCall(result, Runtime::typeofName, Assembler::EngineRegister,
+ Assembler::StringToIndex(name));
}
void InstructionSelection::callBuiltinTypeofValue(IR::Expr *value, IR::Expr *result)
{
- generateFunctionCall(result, Runtime::typeofValue, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::typeofValue, Assembler::EngineRegister,
Assembler::PointerToValue(value));
}
void InstructionSelection::callBuiltinDeleteMember(IR::Expr *base, const QString &name, IR::Expr *result)
{
- generateFunctionCall(result, Runtime::deleteMember, Assembler::ContextRegister,
- Assembler::Reference(base), Assembler::PointerToString(name));
+ generateFunctionCall(result, Runtime::deleteMember, Assembler::EngineRegister,
+ Assembler::Reference(base), Assembler::StringToIndex(name));
}
void InstructionSelection::callBuiltinDeleteSubscript(IR::Expr *base, IR::Expr *index,
IR::Expr *result)
{
- generateFunctionCall(result, Runtime::deleteElement, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::deleteElement, Assembler::EngineRegister,
Assembler::Reference(base), Assembler::PointerToValue(index));
}
void InstructionSelection::callBuiltinDeleteName(const QString &name, IR::Expr *result)
{
- generateFunctionCall(result, Runtime::deleteName, Assembler::ContextRegister,
- Assembler::PointerToString(name));
+ generateFunctionCall(result, Runtime::deleteName, Assembler::EngineRegister,
+ Assembler::StringToIndex(name));
}
void InstructionSelection::callBuiltinDeleteValue(IR::Expr *result)
@@ -371,7 +392,7 @@ void InstructionSelection::callBuiltinDeleteValue(IR::Expr *result)
void InstructionSelection::callBuiltinThrow(IR::Expr *arg)
{
- generateFunctionCall(Assembler::ReturnValueRegister, Runtime::throwException, Assembler::ContextRegister,
+ generateFunctionCall(Assembler::ReturnValueRegister, Runtime::throwException, Assembler::EngineRegister,
Assembler::PointerToValue(arg));
}
@@ -382,13 +403,13 @@ void InstructionSelection::callBuiltinReThrow()
void InstructionSelection::callBuiltinUnwindException(IR::Expr *result)
{
- generateFunctionCall(result, Runtime::unwindException, Assembler::ContextRegister);
+ generateFunctionCall(result, Runtime::unwindException, Assembler::EngineRegister);
}
void InstructionSelection::callBuiltinPushCatchScope(const QString &exceptionName)
{
- generateFunctionCall(Assembler::ContextRegister, Runtime::pushCatchScope, Assembler::ContextRegister, Assembler::PointerToString(exceptionName));
+ generateFunctionCall(Assembler::Void, Runtime::pushCatchScope, Assembler::EngineRegister, Assembler::StringToIndex(exceptionName));
}
void InstructionSelection::callBuiltinForeachIteratorObject(IR::Expr *arg, IR::Expr *result)
@@ -396,7 +417,7 @@ void InstructionSelection::callBuiltinForeachIteratorObject(IR::Expr *arg, IR::E
Q_ASSERT(arg);
Q_ASSERT(result);
- generateFunctionCall(result, Runtime::foreachIterator, Assembler::ContextRegister, Assembler::PointerToValue(arg));
+ generateFunctionCall(result, Runtime::foreachIterator, Assembler::EngineRegister, Assembler::PointerToValue(arg));
}
void InstructionSelection::callBuiltinForeachNextPropertyname(IR::Expr *arg, IR::Expr *result)
@@ -411,18 +432,18 @@ void InstructionSelection::callBuiltinPushWithScope(IR::Expr *arg)
{
Q_ASSERT(arg);
- generateFunctionCall(Assembler::ContextRegister, Runtime::pushWithScope, Assembler::Reference(arg), Assembler::ContextRegister);
+ generateFunctionCall(Assembler::Void, Runtime::pushWithScope, Assembler::Reference(arg), Assembler::EngineRegister);
}
void InstructionSelection::callBuiltinPopScope()
{
- generateFunctionCall(Assembler::ContextRegister, Runtime::popScope, Assembler::ContextRegister);
+ generateFunctionCall(Assembler::Void, Runtime::popScope, Assembler::EngineRegister);
}
void InstructionSelection::callBuiltinDeclareVar(bool deletable, const QString &name)
{
- generateFunctionCall(Assembler::Void, Runtime::declareVar, Assembler::ContextRegister,
- Assembler::TrustedImm32(deletable), Assembler::PointerToString(name));
+ generateFunctionCall(Assembler::Void, Runtime::declareVar, Assembler::EngineRegister,
+ Assembler::TrustedImm32(deletable), Assembler::StringToIndex(name));
}
void InstructionSelection::callBuiltinDefineArray(IR::Expr *result, IR::ExprList *args)
@@ -430,7 +451,7 @@ void InstructionSelection::callBuiltinDefineArray(IR::Expr *result, IR::ExprList
Q_ASSERT(result);
int length = prepareVariableArguments(args);
- generateFunctionCall(result, Runtime::arrayLiteral, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::arrayLiteral, Assembler::EngineRegister,
baseAddressForCallArguments(), Assembler::TrustedImm32(length));
}
@@ -510,19 +531,19 @@ void InstructionSelection::callBuiltinDefineObjectLiteral(IR::Expr *result, int
it = it->next;
}
- generateFunctionCall(result, Runtime::objectLiteral, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::objectLiteral, Assembler::EngineRegister,
baseAddressForCallArguments(), Assembler::TrustedImm32(classId),
Assembler::TrustedImm32(arrayValueCount), Assembler::TrustedImm32(arrayGetterSetterCount | (needSparseArray << 30)));
}
void InstructionSelection::callBuiltinSetupArgumentObject(IR::Expr *result)
{
- generateFunctionCall(result, Runtime::setupArgumentsObject, Assembler::ContextRegister);
+ generateFunctionCall(result, Runtime::setupArgumentsObject, Assembler::EngineRegister);
}
void InstructionSelection::callBuiltinConvertThisToObject()
{
- generateFunctionCall(Assembler::Void, Runtime::convertThisToObject, Assembler::ContextRegister);
+ generateFunctionCall(Assembler::Void, Runtime::convertThisToObject, Assembler::EngineRegister);
}
void InstructionSelection::callValue(IR::Expr *value, IR::ExprList *args, IR::Expr *result)
@@ -531,18 +552,19 @@ void InstructionSelection::callValue(IR::Expr *value, IR::ExprList *args, IR::Ex
prepareCallData(args, 0);
if (value->asConst())
- generateFunctionCall(result, Runtime::callValue, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::callValue, Assembler::EngineRegister,
Assembler::PointerToValue(value),
baseAddressForCallData());
else
- generateFunctionCall(result, Runtime::callValue, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::callValue, Assembler::EngineRegister,
Assembler::Reference(value),
baseAddressForCallData());
}
void InstructionSelection::loadThisObject(IR::Expr *temp)
{
- _as->loadPtr(Address(Assembler::ContextRegister, qOffsetOf(ExecutionContext::Data, callData)), Assembler::ScratchRegister);
+ _as->loadPtr(Address(Assembler::EngineRegister, qOffsetOf(QV4::ExecutionEngine, current)), Assembler::ScratchRegister);
+ _as->loadPtr(Address(Assembler::ScratchRegister, qOffsetOf(ExecutionContext::Data, callData)), Assembler::ScratchRegister);
#if defined(VALUE_FITS_IN_REGISTER)
_as->load64(Pointer(Assembler::ScratchRegister, qOffsetOf(CallData, thisObject)),
Assembler::ReturnValueRegister);
@@ -554,27 +576,27 @@ void InstructionSelection::loadThisObject(IR::Expr *temp)
void InstructionSelection::loadQmlIdArray(IR::Expr *temp)
{
- generateFunctionCall(temp, Runtime::getQmlIdArray, Assembler::ContextRegister);
+ generateFunctionCall(temp, Runtime::getQmlIdArray, Assembler::EngineRegister);
}
void InstructionSelection::loadQmlImportedScripts(IR::Expr *temp)
{
- generateFunctionCall(temp, Runtime::getQmlImportedScripts, Assembler::ContextRegister);
+ generateFunctionCall(temp, Runtime::getQmlImportedScripts, Assembler::EngineRegister);
}
void InstructionSelection::loadQmlContextObject(IR::Expr *temp)
{
- generateFunctionCall(temp, Runtime::getQmlContextObject, Assembler::ContextRegister);
+ generateFunctionCall(temp, Runtime::getQmlContextObject, Assembler::EngineRegister);
}
void InstructionSelection::loadQmlScopeObject(IR::Expr *temp)
{
- generateFunctionCall(temp, Runtime::getQmlScopeObject, Assembler::ContextRegister);
+ generateFunctionCall(temp, Runtime::getQmlScopeObject, Assembler::EngineRegister);
}
void InstructionSelection::loadQmlSingleton(const QString &name, IR::Expr *temp)
{
- generateFunctionCall(temp, Runtime::getQmlSingleton, Assembler::ContextRegister, Assembler::PointerToString(name));
+ generateFunctionCall(temp, Runtime::getQmlSingleton, Assembler::EngineRegister, Assembler::StringToIndex(name));
}
void InstructionSelection::loadConst(IR::Const *sourceConst, IR::Expr *target)
@@ -621,52 +643,52 @@ void InstructionSelection::loadString(const QString &str, IR::Expr *target)
void InstructionSelection::loadRegexp(IR::RegExp *sourceRegexp, IR::Expr *target)
{
int id = registerRegExp(sourceRegexp);
- generateFunctionCall(target, Runtime::regexpLiteral, Assembler::ContextRegister, Assembler::TrustedImm32(id));
+ generateFunctionCall(target, Runtime::regexpLiteral, Assembler::EngineRegister, Assembler::TrustedImm32(id));
}
void InstructionSelection::getActivationProperty(const IR::Name *name, IR::Expr *target)
{
if (useFastLookups && name->global) {
uint index = registerGlobalGetterLookup(*name->id);
- generateLookupCall(target, index, qOffsetOf(QV4::Lookup, globalGetter), Assembler::ContextRegister, Assembler::Void);
+ generateLookupCall(target, index, qOffsetOf(QV4::Lookup, globalGetter), Assembler::EngineRegister, Assembler::Void);
return;
}
- generateFunctionCall(target, Runtime::getActivationProperty, Assembler::ContextRegister, Assembler::PointerToString(*name->id));
+ generateFunctionCall(target, Runtime::getActivationProperty, Assembler::EngineRegister, Assembler::StringToIndex(*name->id));
}
void InstructionSelection::setActivationProperty(IR::Expr *source, const QString &targetName)
{
// ### should use a lookup call here
generateFunctionCall(Assembler::Void, Runtime::setActivationProperty,
- Assembler::ContextRegister, Assembler::PointerToString(targetName), Assembler::PointerToValue(source));
+ Assembler::EngineRegister, Assembler::StringToIndex(targetName), Assembler::PointerToValue(source));
}
void InstructionSelection::initClosure(IR::Closure *closure, IR::Expr *target)
{
int id = closure->value;
- generateFunctionCall(target, Runtime::closure, Assembler::ContextRegister, Assembler::TrustedImm32(id));
+ generateFunctionCall(target, Runtime::closure, Assembler::EngineRegister, Assembler::TrustedImm32(id));
}
void InstructionSelection::getProperty(IR::Expr *base, const QString &name, IR::Expr *target)
{
if (useFastLookups) {
uint index = registerGetterLookup(name);
- generateLookupCall(target, index, qOffsetOf(QV4::Lookup, getter), Assembler::PointerToValue(base), Assembler::Void);
+ generateLookupCall(target, index, qOffsetOf(QV4::Lookup, getter), Assembler::EngineRegister, Assembler::PointerToValue(base), Assembler::Void);
} else {
- generateFunctionCall(target, Runtime::getProperty, Assembler::ContextRegister,
- Assembler::PointerToValue(base), Assembler::PointerToString(name));
+ generateFunctionCall(target, Runtime::getProperty, Assembler::EngineRegister,
+ Assembler::PointerToValue(base), Assembler::StringToIndex(name));
}
}
void InstructionSelection::getQObjectProperty(IR::Expr *base, int propertyIndex, bool captureRequired, bool isSingleton, int attachedPropertiesId, IR::Expr *target)
{
if (attachedPropertiesId != 0)
- generateFunctionCall(target, Runtime::getQmlAttachedProperty, Assembler::ContextRegister, Assembler::TrustedImm32(attachedPropertiesId), Assembler::TrustedImm32(propertyIndex));
+ generateFunctionCall(target, Runtime::getQmlAttachedProperty, Assembler::EngineRegister, Assembler::TrustedImm32(attachedPropertiesId), Assembler::TrustedImm32(propertyIndex));
else if (isSingleton)
- generateFunctionCall(target, Runtime::getQmlSingletonQObjectProperty, Assembler::ContextRegister, Assembler::PointerToValue(base), Assembler::TrustedImm32(propertyIndex),
+ generateFunctionCall(target, Runtime::getQmlSingletonQObjectProperty, Assembler::EngineRegister, Assembler::PointerToValue(base), Assembler::TrustedImm32(propertyIndex),
Assembler::TrustedImm32(captureRequired));
else
- generateFunctionCall(target, Runtime::getQmlQObjectProperty, Assembler::ContextRegister, Assembler::PointerToValue(base), Assembler::TrustedImm32(propertyIndex),
+ generateFunctionCall(target, Runtime::getQmlQObjectProperty, Assembler::EngineRegister, Assembler::PointerToValue(base), Assembler::TrustedImm32(propertyIndex),
Assembler::TrustedImm32(captureRequired));
}
@@ -676,18 +698,19 @@ void InstructionSelection::setProperty(IR::Expr *source, IR::Expr *targetBase,
if (useFastLookups) {
uint index = registerSetterLookup(targetName);
generateLookupCall(Assembler::Void, index, qOffsetOf(QV4::Lookup, setter),
+ Assembler::EngineRegister,
Assembler::PointerToValue(targetBase),
Assembler::PointerToValue(source));
} else {
- generateFunctionCall(Assembler::Void, Runtime::setProperty, Assembler::ContextRegister,
- Assembler::PointerToValue(targetBase), Assembler::PointerToString(targetName),
+ generateFunctionCall(Assembler::Void, Runtime::setProperty, Assembler::EngineRegister,
+ Assembler::PointerToValue(targetBase), Assembler::StringToIndex(targetName),
Assembler::PointerToValue(source));
}
}
void InstructionSelection::setQObjectProperty(IR::Expr *source, IR::Expr *targetBase, int propertyIndex)
{
- generateFunctionCall(Assembler::Void, Runtime::setQmlQObjectProperty, Assembler::ContextRegister, Assembler::PointerToValue(targetBase),
+ generateFunctionCall(Assembler::Void, Runtime::setQmlQObjectProperty, Assembler::EngineRegister, Assembler::PointerToValue(targetBase),
Assembler::TrustedImm32(propertyIndex), Assembler::PointerToValue(source));
}
@@ -701,7 +724,7 @@ void InstructionSelection::getElement(IR::Expr *base, IR::Expr *index, IR::Expr
return;
}
- generateFunctionCall(target, Runtime::getElement, Assembler::ContextRegister,
+ generateFunctionCall(target, Runtime::getElement, Assembler::EngineRegister,
Assembler::PointerToValue(base), Assembler::PointerToValue(index));
}
@@ -714,7 +737,7 @@ void InstructionSelection::setElement(IR::Expr *source, IR::Expr *targetBase, IR
Assembler::PointerToValue(source));
return;
}
- generateFunctionCall(Assembler::Void, Runtime::setElement, Assembler::ContextRegister,
+ generateFunctionCall(Assembler::Void, Runtime::setElement, Assembler::EngineRegister,
Assembler::PointerToValue(targetBase), Assembler::PointerToValue(targetIndex),
Assembler::PointerToValue(source));
}
@@ -888,12 +911,12 @@ void InstructionSelection::callProperty(IR::Expr *base, const QString &name, IR:
if (useFastLookups) {
uint index = registerGetterLookup(name);
generateFunctionCall(result, Runtime::callPropertyLookup,
- Assembler::ContextRegister,
+ Assembler::EngineRegister,
Assembler::TrustedImm32(index),
baseAddressForCallData());
} else {
- generateFunctionCall(result, Runtime::callProperty, Assembler::ContextRegister,
- Assembler::PointerToString(name),
+ generateFunctionCall(result, Runtime::callProperty, Assembler::EngineRegister,
+ Assembler::StringToIndex(name),
baseAddressForCallData());
}
}
@@ -904,7 +927,7 @@ void InstructionSelection::callSubscript(IR::Expr *base, IR::Expr *index, IR::Ex
Q_ASSERT(base != 0);
prepareCallData(args, base);
- generateFunctionCall(result, Runtime::callElement, Assembler::ContextRegister,
+ generateFunctionCall(result, Runtime::callElement, Assembler::EngineRegister,
Assembler::PointerToValue(index),
baseAddressForCallData());
}
@@ -1214,14 +1237,14 @@ void InstructionSelection::constructActivationProperty(IR::Name *func, IR::ExprL
if (useFastLookups && func->global) {
uint index = registerGlobalGetterLookup(*func->id);
generateFunctionCall(result, Runtime::constructGlobalLookup,
- Assembler::ContextRegister,
+ Assembler::EngineRegister,
Assembler::TrustedImm32(index), baseAddressForCallData());
return;
}
generateFunctionCall(result, Runtime::constructActivationProperty,
- Assembler::ContextRegister,
- Assembler::PointerToString(*func->id),
+ Assembler::EngineRegister,
+ Assembler::StringToIndex(*func->id),
baseAddressForCallData());
}
@@ -1232,14 +1255,14 @@ void InstructionSelection::constructProperty(IR::Expr *base, const QString &name
if (useFastLookups) {
uint index = registerGetterLookup(name);
generateFunctionCall(result, Runtime::constructPropertyLookup,
- Assembler::ContextRegister,
+ Assembler::EngineRegister,
Assembler::TrustedImm32(index),
baseAddressForCallData());
return;
}
- generateFunctionCall(result, Runtime::constructProperty, Assembler::ContextRegister,
- Assembler::PointerToString(name),
+ generateFunctionCall(result, Runtime::constructProperty, Assembler::EngineRegister,
+ Assembler::StringToIndex(name),
baseAddressForCallData());
}
@@ -1249,7 +1272,7 @@ void InstructionSelection::constructValue(IR::Expr *value, IR::ExprList *args, I
prepareCallData(args, 0);
generateFunctionCall(result, Runtime::constructValue,
- Assembler::ContextRegister,
+ Assembler::EngineRegister,
Assembler::Reference(value),
baseAddressForCallData());
}
@@ -1340,7 +1363,7 @@ void InstructionSelection::visitCJump(IR::CJump *s)
// elimination (which isn't there either) would remove the whole else block.
if (opContext)
_as->generateFunctionCallImp(Assembler::ReturnValueRegister, opName, opContext,
- Assembler::ContextRegister,
+ Assembler::EngineRegister,
Assembler::PointerToValue(b->left),
Assembler::PointerToValue(b->right));
else
@@ -1462,15 +1485,29 @@ void InstructionSelection::visitRet(IR::Ret *s)
Q_UNUSED(s);
}
- _as->exceptionReturnLabel = _as->label();
+ Assembler::Label leaveStackFrame = _as->label();
const int locals = _as->stackLayout().calculateJSStackFrameSize();
_as->subPtr(Assembler::TrustedImm32(sizeof(QV4::Value)*locals), Assembler::LocalsRegister);
- _as->loadPtr(Address(Assembler::ContextRegister, qOffsetOf(ExecutionContext::Data, engine)), Assembler::ScratchRegister);
+ _as->loadPtr(Address(Assembler::EngineRegister, qOffsetOf(QV4::ExecutionEngine, current)), Assembler::ScratchRegister);
+ _as->loadPtr(Address(Assembler::ScratchRegister, qOffsetOf(ExecutionContext::Data, engine)), Assembler::ScratchRegister);
_as->storePtr(Assembler::LocalsRegister, Address(Assembler::ScratchRegister, qOffsetOf(ExecutionEngine, jsStackTop)));
_as->leaveStandardStackFrame(regularRegistersToSave, fpRegistersToSave);
_as->ret();
+
+ _as->exceptionReturnLabel = _as->label();
+ QV4::Primitive retVal = Primitive::undefinedValue();
+#if CPU(X86)
+ _as->move(Assembler::TrustedImm32(retVal.int_32), JSC::X86Registers::eax);
+ _as->move(Assembler::TrustedImm32(retVal.tag), JSC::X86Registers::edx);
+#elif CPU(ARM)
+ _as->move(Assembler::TrustedImm32(retVal.int_32), JSC::ARMRegisters::r0);
+ _as->move(Assembler::TrustedImm32(retVal.tag), JSC::ARMRegisters::r1);
+#else
+ _as->move(Assembler::TrustedImm64(retVal.val), Assembler::ReturnValueRegister);
+#endif
+ _as->jump(leaveStackFrame);
}
int InstructionSelection::prepareVariableArguments(IR::ExprList* args)
diff --git a/src/qml/jit/qv4isel_masm_p.h b/src/qml/jit/qv4isel_masm_p.h
index 8ad97c640b..87b4a20bfc 100644
--- a/src/qml/jit/qv4isel_masm_p.h
+++ b/src/qml/jit/qv4isel_masm_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/jit/qv4regalloc.cpp b/src/qml/jit/qv4regalloc.cpp
index f9f494c561..ae06a99d2a 100644
--- a/src/qml/jit/qv4regalloc.cpp
+++ b/src/qml/jit/qv4regalloc.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the V4VM module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,19 +23,24 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
+#include <QtCore/QBuffer>
+#include <QtCore/QDebug>
#include "qv4regalloc_p.h"
#include "qv4alloca_p.h"
#include <private/qv4value_inl_p.h>
#include <algorithm>
+#if defined(Q_CC_MINGW)
+# include <malloc.h>
+#endif
namespace {
enum { DebugRegAlloc = 0 };
@@ -124,6 +129,10 @@ protected:
class RegAllocInfo: public IRDecoder
{
+public:
+ typedef QVarLengthArray<Temp, 4> Hints;
+
+private:
struct Def {
unsigned valid : 1;
unsigned canHaveReg : 1;
@@ -144,7 +153,7 @@ class RegAllocInfo: public IRDecoder
std::vector<Def> _defs;
std::vector<std::vector<Use> > _uses;
std::vector<int> _calls;
- std::vector<QList<Temp> > _hints;
+ std::vector<Hints> _hints;
int usePosition(Stmt *s) const
{
@@ -176,21 +185,7 @@ public:
const std::vector<Use> &uses(const Temp &t) const
{
- return _uses[t.index];
- }
-
- bool useMustHaveReg(const Temp &t, int position) {
- foreach (const Use &use, uses(t))
- if (use.pos == position)
- return use.mustHaveRegister();
- return false;
- }
-
- bool isUsedAt(const Temp &t, int position) {
- foreach (const Use &use, uses(t))
- if (use.pos == position)
- return true;
- return false;
+ return _uses.at(t.index);
}
bool canHaveRegister(const Temp &t) const {
@@ -203,15 +198,15 @@ public:
}
const std::vector<int> &calls() const { return _calls; }
- const QList<Temp> &hints(const Temp &t) const { return _hints[t.index]; }
+ const Hints &hints(const Temp &t) const { return _hints[t.index]; }
void addHint(const Temp &t, int physicalRegister)
{ addHint(t, Temp::PhysicalRegister, physicalRegister); }
void addHint(const Temp &t, Temp::Kind kind, int hintedIndex)
{
- QList<Temp> &hints = _hints[t.index];
- foreach (const Temp &hint, hints)
- if (hint.index == hintedIndex)
+ Hints &hints = _hints[t.index];
+ for (Hints::iterator i = hints.begin(), ei = hints.end(); i != ei; ++i)
+ if (i->index == hintedIndex)
return;
Temp hint;
@@ -224,7 +219,9 @@ public:
if (!DebugRegAlloc)
return;
- QTextStream qout(stdout, QIODevice::WriteOnly);
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ QTextStream qout(&buf);
IRPrinterWithPositions printer(&qout, _lifeTimeIntervals);
qout << "RegAllocInfo:" << endl << "Defs/uses:" << endl;
@@ -258,13 +255,14 @@ public:
if (_uses[t].empty())
continue;
qout << "\t%" << t << ": ";
- QList<Temp> hints = _hints[t];
+ const Hints &hints = _hints[t];
for (int i = 0; i < hints.size(); ++i) {
if (i > 0) qout << ", ";
printer.print(hints[i]);
}
qout << endl;
}
+ qDebug("%s", buf.data().constData());
}
protected: // IRDecoder
@@ -687,9 +685,13 @@ protected: // IRDecoder
virtual void visitPhi(IR::Phi *s)
{
addDef(s->targetTemp, true);
- foreach (Expr *e, s->d->incoming) {
+ for (int i = 0, ei = s->d->incoming.size(); i < ei; ++i) {
+ Expr *e = s->d->incoming.at(i);
if (Temp *t = e->asTemp()) {
- addUses(t, Use::CouldHaveRegister);
+ // The actual use of an incoming value in a phi node is right before the terminator
+ // of the other side of the incoming edge.
+ const int usePos = _lifeTimeIntervals->positionForStatement(_currentBB->in.at(i)->terminator()) - 1;
+ addUses(t, Use::CouldHaveRegister, usePos);
addHint(s->targetTemp, t);
addHint(t, s->targetTemp);
}
@@ -735,6 +737,11 @@ private:
void addUses(Expr *e, Use::RegisterFlag flag)
{
const int usePos = usePosition(_currentStmt);
+ addUses(e, flag, usePos);
+ }
+
+ void addUses(Expr *e, Use::RegisterFlag flag, int usePos)
+ {
Q_ASSERT(usePos > 0);
if (!e)
return;
@@ -824,8 +831,11 @@ public:
void run() {
renumber();
if (DebugRegAlloc) {
- QTextStream qout(stdout, QIODevice::WriteOnly);
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ QTextStream qout(&buf);
IRPrinterWithPositions(&qout, _intervals).print(_function);
+ qDebug("%s", buf.data().constData());
}
resolve();
}
@@ -843,12 +853,14 @@ private:
void renumber()
{
+ QVector<Stmt *> newStatements;
+
foreach (BasicBlock *bb, _function->basicBlocks()) {
_currentStmt = 0;
QVector<Stmt *> statements = bb->statements();
- QVector<Stmt *> newStatements;
newStatements.reserve(bb->statements().size() + 7);
+ newStatements.erase(newStatements.begin(), newStatements.end());
cleanOldIntervals(_intervals->startPosition(bb));
addNewIntervals(_intervals->startPosition(bb));
@@ -877,7 +889,9 @@ private:
_liveAtEnd[bb] = _intervalForTemp.values();
if (DebugRegAlloc) {
- QTextStream os(stdout, QIODevice::WriteOnly);
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ QTextStream os(&buf);
os << "Intervals live at the start of L" << bb->index() << ":" << endl;
if (_liveAtStart[bb].isEmpty())
os << "\t(none)" << endl;
@@ -894,6 +908,7 @@ private:
i->dump(os);
os << endl;
}
+ qDebug("%s", buf.data().constData());
}
bb->setStatements(newStatements);
@@ -968,11 +983,13 @@ private:
{
if (DebugRegAlloc) {
qDebug() << "Resolving edge" << predecessor->index() << "->" << successor->index();
- QTextStream qout(stdout, QIODevice::WriteOnly);
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ QTextStream qout(&buf);
IRPrinterWithPositions printer(&qout, _intervals);
printer.print(predecessor);
printer.print(successor);
- qout.flush();
+ qDebug("%s", buf.data().constData());
}
MoveMapping mapping;
@@ -1089,11 +1106,13 @@ private:
if (DebugRegAlloc) {
qDebug() << ".. done, result:";
- QTextStream qout(stdout, QIODevice::WriteOnly);
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ QTextStream qout(&buf);
IRPrinterWithPositions printer(&qout, _intervals);
printer.print(predecessor);
printer.print(successor);
- qout.flush();
+ qDebug("%s", buf.data().constData());
}
}
@@ -1261,7 +1280,9 @@ void RegisterAllocator::run(IR::Function *function, const Optimizer &opt)
_info->collect(function, _lifeTimeIntervals);
if (DebugRegAlloc) {
- QTextStream qout(stdout, QIODevice::WriteOnly);
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ QTextStream qout(&buf);
qout << "Ranges:" << endl;
QVector<LifeTimeInterval *> intervals = _unhandled;
std::reverse(intervals.begin(), intervals.end());
@@ -1269,13 +1290,13 @@ void RegisterAllocator::run(IR::Function *function, const Optimizer &opt)
r->dump(qout);
qout << endl;
}
+ qDebug("%s", buf.data().constData());
_info->dump();
- }
- if (DebugRegAlloc) {
qDebug() << "*** Before register allocation:";
- QTextStream qout(stdout, QIODevice::WriteOnly);
+ buf.setData(QByteArray());
IRPrinterWithPositions(&qout, _lifeTimeIntervals).print(function);
+ qDebug("%s", buf.data().constData());
}
prepareRanges();
@@ -1294,8 +1315,11 @@ void RegisterAllocator::run(IR::Function *function, const Optimizer &opt)
static bool showCode = !qgetenv("QV4_SHOW_IR").isNull();
if (showCode) {
- QTextStream qout(stdout, QIODevice::WriteOnly);
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ QTextStream qout(&buf);
IRPrinterWithRegisters(&qout, _lifeTimeIntervals, _registerInformation).print(function);
+ qDebug("%s", buf.data().constData());
}
}
@@ -1356,7 +1380,7 @@ LifeTimeInterval *RegisterAllocator::cloneFixedInterval(int reg, bool isFP, cons
// saved registers.
void RegisterAllocator::prepareRanges()
{
- LifeTimeInterval ltiWithCalls = createFixedInterval(_info->calls().size());
+ LifeTimeInterval ltiWithCalls = createFixedInterval(int(_info->calls().size()));
foreach (int callPosition, _info->calls())
ltiWithCalls.addRange(callPosition, callPosition);
@@ -1551,7 +1575,9 @@ void RegisterAllocator::tryAllocateFreeReg(LifeTimeInterval &current)
int reg = LifeTimeInterval::InvalidRegister;
int freeUntilPos_reg = 0;
- foreach (const Temp &hint, _info->hints(current.temp())) {
+ const RegAllocInfo::Hints &hints = _info->hints(current.temp());
+ for (RegAllocInfo::Hints::const_iterator i = hints.begin(), ei = hints.end(); i != ei; ++i) {
+ const Temp &hint = *i;
int candidate;
if (hint.kind == Temp::PhysicalRegister)
candidate = hint.index;
@@ -1578,7 +1604,7 @@ void RegisterAllocator::tryAllocateFreeReg(LifeTimeInterval &current)
if (freeUntilPos_reg == 0) {
// no register available without spilling
if (DebugRegAlloc)
- qDebug() << "*** no register available for %" << current.temp().index;
+ qDebug("*** no register available for %u", current.temp().index);
return;
} else if (current.end() < freeUntilPos_reg) {
// register available for the whole interval
@@ -1676,10 +1702,12 @@ void RegisterAllocator::allocateBlockedReg(LifeTimeInterval &current)
// spill interval that currently block reg
if (DebugRegAlloc) {
- QTextStream out(stderr, QIODevice::WriteOnly);
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ QTextStream out(&buf);
out << "*** spilling intervals that block reg " <<reg<< " for interval ";
current.dump(out);
- out << endl;
+ qDebug("%s", buf.data().constData());
}
current.setReg(reg);
_lastAssignedRegister[current.temp().index] = reg;
@@ -1687,7 +1715,7 @@ void RegisterAllocator::allocateBlockedReg(LifeTimeInterval &current)
Q_ASSERT(nextUse);
Q_ASSERT(!nextUse->isFixedInterval());
- split(*nextUse, position);
+ split(*nextUse, position, /*skipOptionalRegisterUses =*/ true);
// We might have chosen a register that is used by a range that has a hole in its life time.
// If that's the case, check if the current interval completely fits in the hole. Or rephrased:
@@ -1702,8 +1730,7 @@ void RegisterAllocator::allocateBlockedReg(LifeTimeInterval &current)
int ni = nextIntersection(current, *fixedRegRange);
if (ni != -1) {
if (DebugRegAlloc) {
- QTextStream out(stderr, QIODevice::WriteOnly);
- out << "***-- current range intersects with a fixed reg use at " << ni << ", so splitting it." << endl;
+ qDebug("***-- current range intersects with a fixed reg use at %d, so splitting it.", ni);
}
// current does overlap with a fixed interval, so split current before that intersection.
split(current, ni, true);
@@ -1738,13 +1765,21 @@ int RegisterAllocator::nextIntersection(const LifeTimeInterval &current,
}
/// Find the first use after the start position for the given temp.
+///
+/// This is only called when all registers are in use, and when one of them has to be spilled to the
+/// stack. So, uses where a register is optional can be ignored.
int RegisterAllocator::nextUse(const Temp &t, int startPosition) const
{
+ typedef std::vector<Use>::const_iterator ConstIt;
+
const std::vector<Use> &usePositions = _info->uses(t);
- for (int i = 0, ei = usePositions.size(); i != ei; ++i) { //### FIXME: use an iterator
- const int usePos = usePositions.at(i).pos;
- if (usePos >= startPosition)
- return usePos;
+ const ConstIt cend = usePositions.end();
+ for (ConstIt it = usePositions.begin(); it != cend; ++it) {
+ if (it->mustHaveRegister()) {
+ const int usePos = it->pos;
+ if (usePos >= startPosition)
+ return usePos;
+ }
}
return -1;
@@ -1768,8 +1803,14 @@ void RegisterAllocator::split(LifeTimeInterval &current, int beforePosition,
Q_ASSERT(!current.isFixedInterval());
if (DebugRegAlloc) {
- QTextStream out(stderr, QIODevice::WriteOnly);
- out << "***** split request for range ";current.dump(out);out<<" before position "<<beforePosition<<" and skipOptionalRegisterUses = "<<skipOptionalRegisterUses<<endl;
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ QTextStream out(&buf);
+ out << "***** split request for range ";
+ current.dump(out);
+ out << " before position " << beforePosition
+ << " and skipOptionalRegisterUses = " << skipOptionalRegisterUses << endl;
+ qDebug("%s", buf.data().constData());
}
assignSpillSlot(current.temp(), current.start(), current.end());
@@ -1780,7 +1821,7 @@ void RegisterAllocator::split(LifeTimeInterval &current, int beforePosition,
int lastUse = firstPosition;
int nextUse = -1;
const std::vector<Use> &usePositions = _info->uses(current.temp());
- for (int i = 0, ei = usePositions.size(); i != ei; ++i) {
+ for (size_t i = 0, ei = usePositions.size(); i != ei; ++i) {
const Use &usePosition = usePositions.at(i);
const int usePos = usePosition.pos;
if (lastUse < usePos && usePos < beforePosition) {
@@ -1797,10 +1838,17 @@ void RegisterAllocator::split(LifeTimeInterval &current, int beforePosition,
LifeTimeInterval newInterval = current.split(lastUse, nextUse);
if (DebugRegAlloc) {
- QTextStream out(stderr, QIODevice::WriteOnly);
- out << "***** last use = "<<lastUse<<", nextUse = " << nextUse<<endl;
- out << "***** new interval: "; newInterval.dump(out); out << endl;
- out << "***** preceding interval: "; current.dump(out); out << endl;
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ QTextStream out(&buf);
+ out << "***** last use = " << lastUse << ", nextUse = " << nextUse << endl;
+ out << "***** new interval: ";
+ newInterval.dump(out);
+ out << endl;
+ out << "***** preceding interval: ";
+ current.dump(out);
+ out << endl;
+ qDebug("%s", buf.data().constData());
}
if (newInterval.isValid()) {
if (current.reg() != LifeTimeInterval::InvalidRegister)
@@ -1849,7 +1897,9 @@ void RegisterAllocator::assignSpillSlot(const Temp &t, int startPos, int endPos)
void RegisterAllocator::dump(IR::Function *function) const
{
- QTextStream qout(stdout, QIODevice::WriteOnly);
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ QTextStream qout(&buf);
IRPrinterWithPositions printer(&qout, _lifeTimeIntervals);
qout << "Ranges:" << endl;
@@ -1866,6 +1916,7 @@ void RegisterAllocator::dump(IR::Function *function) const
qout << "\t%" << i << " -> " << _assignedSpillSlots[i] << endl;
printer.print(function);
+ qDebug("%s", buf.data().constData());
}
// References:
diff --git a/src/qml/jit/qv4regalloc_p.h b/src/qml/jit/qv4regalloc_p.h
index ac881e71da..f0d78cf0d3 100644
--- a/src/qml/jit/qv4regalloc_p.h
+++ b/src/qml/jit/qv4regalloc_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the V4VM module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/jit/qv4registerinfo_p.h b/src/qml/jit/qv4registerinfo_p.h
index d851c0096c..ebd8537a85 100644
--- a/src/qml/jit/qv4registerinfo_p.h
+++ b/src/qml/jit/qv4registerinfo_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/jit/qv4targetplatform_p.h b/src/qml/jit/qv4targetplatform_p.h
index 17098d6aad..05741f0ae5 100644
--- a/src/qml/jit/qv4targetplatform_p.h
+++ b/src/qml/jit/qv4targetplatform_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -71,7 +71,7 @@ public:
static const JSC::MacroAssembler::RegisterID StackFrameRegister = JSC::X86Registers::ebp;
static const JSC::MacroAssembler::RegisterID StackPointerRegister = JSC::X86Registers::esp;
static const JSC::MacroAssembler::RegisterID LocalsRegister = JSC::X86Registers::edi;
- static const JSC::MacroAssembler::RegisterID ContextRegister = JSC::X86Registers::esi;
+ static const JSC::MacroAssembler::RegisterID EngineRegister = JSC::X86Registers::esi;
static const JSC::MacroAssembler::RegisterID ReturnValueRegister = JSC::X86Registers::eax;
static const JSC::MacroAssembler::RegisterID ScratchRegister = JSC::X86Registers::ecx;
static const JSC::MacroAssembler::FPRegisterID FPGpr0 = JSC::X86Registers::xmm0;
@@ -140,7 +140,7 @@ public:
static const JSC::MacroAssembler::RegisterID StackFrameRegister = JSC::X86Registers::ebp;
static const JSC::MacroAssembler::RegisterID StackPointerRegister = JSC::X86Registers::esp;
static const JSC::MacroAssembler::RegisterID LocalsRegister = JSC::X86Registers::r12;
- static const JSC::MacroAssembler::RegisterID ContextRegister = JSC::X86Registers::r14;
+ static const JSC::MacroAssembler::RegisterID EngineRegister = JSC::X86Registers::r14;
static const JSC::MacroAssembler::RegisterID ReturnValueRegister = JSC::X86Registers::eax;
static const JSC::MacroAssembler::RegisterID ScratchRegister = JSC::X86Registers::r10;
static const JSC::MacroAssembler::FPRegisterID FPGpr0 = JSC::X86Registers::xmm0;
@@ -205,7 +205,7 @@ public:
static const JSC::MacroAssembler::RegisterID StackFrameRegister = JSC::X86Registers::ebp;
static const JSC::MacroAssembler::RegisterID StackPointerRegister = JSC::X86Registers::esp;
static const JSC::MacroAssembler::RegisterID LocalsRegister = JSC::X86Registers::r12;
- static const JSC::MacroAssembler::RegisterID ContextRegister = JSC::X86Registers::r14;
+ static const JSC::MacroAssembler::RegisterID EngineRegister = JSC::X86Registers::r14;
static const JSC::MacroAssembler::RegisterID ReturnValueRegister = JSC::X86Registers::eax;
static const JSC::MacroAssembler::RegisterID ScratchRegister = JSC::X86Registers::r10;
static const JSC::MacroAssembler::FPRegisterID FPGpr0 = JSC::X86Registers::xmm0;
@@ -276,8 +276,8 @@ public:
static const JSC::MacroAssembler::RegisterID LocalsRegister = JSC::ARMRegisters::r7;
#endif
static const JSC::MacroAssembler::RegisterID StackPointerRegister = JSC::ARMRegisters::r13;
- static const JSC::MacroAssembler::RegisterID ScratchRegister = JSC::ARMRegisters::r6;
- static const JSC::MacroAssembler::RegisterID ContextRegister = JSC::ARMRegisters::r5;
+ static const JSC::MacroAssembler::RegisterID ScratchRegister = JSC::ARMRegisters::r5;
+ static const JSC::MacroAssembler::RegisterID EngineRegister = JSC::ARMRegisters::r10;
static const JSC::MacroAssembler::RegisterID ReturnValueRegister = JSC::ARMRegisters::r0;
static const JSC::MacroAssembler::FPRegisterID FPGpr0 = JSC::ARMRegisters::d0;
static const JSC::MacroAssembler::FPRegisterID FPGpr1 = JSC::ARMRegisters::d1;
diff --git a/src/qml/jit/qv4unop.cpp b/src/qml/jit/qv4unop.cpp
index b7e78eff62..367750e974 100644
--- a/src/qml/jit/qv4unop.cpp
+++ b/src/qml/jit/qv4unop.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/jit/qv4unop_p.h b/src/qml/jit/qv4unop_p.h
index 67bea10759..f96898ce1b 100644
--- a/src/qml/jit/qv4unop_p.h
+++ b/src/qml/jit/qv4unop_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/jsapi/qjsengine.cpp b/src/qml/jsapi/qjsengine.cpp
index d7f45b56e0..ee27c21aed 100644
--- a/src/qml/jsapi/qjsengine.cpp
+++ b/src/qml/jsapi/qjsengine.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -103,8 +103,8 @@ Q_DECLARE_METATYPE(QList<int>)
Here we pass the name of the file as the second argument to
evaluate(). This does not affect evaluation in any way; the second
- argument is a general-purpose string that is used to identify the
- script for debugging purposes.
+ argument is a general-purpose string that is stored in the \c Error
+ object for debugging purposes.
\section1 Engine Configuration
@@ -125,11 +125,21 @@ Q_DECLARE_METATYPE(QList<int>)
\section1 Script Exceptions
evaluate() can throw a script exception (e.g. due to a syntax
- error); in that case, the return value is the value that was thrown
- (typically an \c{Error} object). You can check whether the
- evaluation caused an exception by calling isError() on the return
- value. If isError() returns true, you can call toString() on the
- error object to obtain an error message.
+ error). If it does, then evaluate() returns the value that was thrown
+ (typically an \c{Error} object). Use \l QJSValue::isError() to check
+ for exceptions.
+
+ For detailed information about the error, use \l QJSValue::toString() to
+ obtain an error message, and use \l QJSValue::property() to query the
+ properties of the \c Error object. The following properties are available:
+
+ \list
+ \li \c name
+ \li \c message
+ \li \c fileName
+ \li \c lineNumber
+ \li \c stack
+ \endlist
\snippet code/src_script_qjsengine.cpp 4
@@ -165,7 +175,8 @@ QT_BEGIN_NAMESPACE
\l{ECMA-262}, Section 15.1.
*/
QJSEngine::QJSEngine()
- : d(new QV8Engine(this))
+ : QObject(*new QJSEnginePrivate, 0)
+ , d(new QV8Engine(this))
{
}
@@ -177,7 +188,7 @@ QJSEngine::QJSEngine()
*/
QJSEngine::QJSEngine(QObject *parent)
- : QObject(parent)
+ : QObject(*new QJSEnginePrivate, parent)
, d(new QV8Engine(this))
{
}
@@ -249,12 +260,18 @@ void QJSEngine::collectGarbage()
*/
void QJSEngine::installTranslatorFunctions(const QJSValue &object)
{
- QV4::ExecutionEngine *v4 = d->m_v4Engine;
- QV4::Scope scope(v4);
- QJSValuePrivate *vp = QJSValuePrivate::get(object);
- QV4::ScopedObject obj(scope, vp->getValue(v4));
+ QV4::ExecutionEngine *otherEngine = QJSValuePrivate::engine(&object);
+ if (otherEngine && otherEngine != d->m_v4Engine) {
+ qWarning("QJSEngine: Trying to install a translator function from a different engine");
+ return;
+ }
+ QV4::Scope scope(d->m_v4Engine);
+ QV4::ScopedObject obj(scope);
+ QV4::Value *val = QJSValuePrivate::getValue(&object);
+ if (val)
+ obj = val;
if (!obj)
- obj = v4->globalObject;
+ obj = scope.engine->globalObject();
#ifndef QT_NO_TRANSLATION
obj->defineDefaultProperty(QStringLiteral("qsTranslate"), QV4::GlobalExtensions::method_qsTranslate);
obj->defineDefaultProperty(QStringLiteral("QT_TRANSLATE_NOOP"), QV4::GlobalExtensions::method_qsTranslateNoOp);
@@ -264,8 +281,8 @@ void QJSEngine::installTranslatorFunctions(const QJSValue &object)
obj->defineDefaultProperty(QStringLiteral("QT_TRID_NOOP"), QV4::GlobalExtensions::method_qsTrIdNoOp);
// string prototype extension
- v4->stringObjectClass->prototype->defineDefaultProperty(QStringLiteral("arg"),
- QV4::GlobalExtensions::method_string_arg);
+ scope.engine->stringPrototype.asObject()->defineDefaultProperty(QStringLiteral("arg"),
+ QV4::GlobalExtensions::method_string_arg);
#endif
}
@@ -275,7 +292,7 @@ void QJSEngine::installTranslatorFunctions(const QJSValue &object)
The script code will be evaluated in the context of the global object.
- The evaluation of \a program can cause an exception in the
+ The evaluation of \a program can cause an \l{Script Exceptions}{exception} in the
engine; in this case the return value will be the exception
that was thrown (typically an \c{Error} object; see
QJSValue::isError()).
@@ -301,8 +318,8 @@ QJSValue QJSEngine::evaluate(const QString& program, const QString& fileName, in
{
QV4::ExecutionEngine *v4 = d->m_v4Engine;
QV4::Scope scope(v4);
- QV4::ExecutionContext *ctx = v4->currentContext();
- if (ctx != v4->rootContext)
+ QV4::ScopedContext ctx(scope, v4->currentContext());
+ if (ctx->d() != v4->rootContext())
ctx = v4->pushGlobalContext();
QV4::ScopedValue result(scope);
@@ -313,10 +330,10 @@ QJSValue QJSEngine::evaluate(const QString& program, const QString& fileName, in
if (!scope.engine->hasException)
result = script.run();
if (scope.engine->hasException)
- result = ctx->catchException();
- if (ctx != v4->rootContext)
+ result = v4->catchException();
+ if (ctx->d() != v4->rootContext())
v4->popContext();
- return new QJSValuePrivate(v4, result);
+ return QJSValue(v4, result->asReturnedValue());
}
/*!
@@ -331,7 +348,7 @@ QJSValue QJSEngine::newObject()
{
QV4::Scope scope(d->m_v4Engine);
QV4::ScopedValue v(scope, d->m_v4Engine->newObject());
- return new QJSValuePrivate(d->m_v4Engine, v);
+ return QJSValue(d->m_v4Engine, v->asReturnedValue());
}
/*!
@@ -342,11 +359,11 @@ QJSValue QJSEngine::newObject()
QJSValue QJSEngine::newArray(uint length)
{
QV4::Scope scope(d->m_v4Engine);
- QV4::Scoped<QV4::ArrayObject> array(scope, d->m_v4Engine->newArrayObject());
+ QV4::ScopedArrayObject array(scope, d->m_v4Engine->newArrayObject());
if (length < 0x1000)
array->arrayReserve(length);
array->setArrayLengthUnchecked(length);
- return new QJSValuePrivate(d->m_v4Engine, array);
+ return QJSValue(d->m_v4Engine, array.asReturnedValue());
}
/*!
@@ -365,7 +382,7 @@ QJSValue QJSEngine::newArray(uint length)
If the given \a object is deleted outside of the engine's control, any
attempt to access the deleted QObject's members through the JavaScript
wrapper object (either by script code or C++) will result in a
- script exception.
+ \l{Script Exceptions}{script exception}.
\sa QJSValue::toQObject()
*/
@@ -380,7 +397,7 @@ QJSValue QJSEngine::newQObject(QObject *object)
QQmlEngine::setObjectOwnership(object, QQmlEngine::JavaScriptOwnership);
}
QV4::ScopedValue v(scope, QV4::QObjectWrapper::wrap(v4, object));
- return new QJSValuePrivate(v4, v);
+ return QJSValue(v4, v->asReturnedValue());
}
/*!
@@ -397,8 +414,8 @@ QJSValue QJSEngine::globalObject() const
{
Q_D(const QJSEngine);
QV4::Scope scope(d->m_v4Engine);
- QV4::ScopedValue v(scope, d->m_v4Engine->globalObject);
- return new QJSValuePrivate(d->m_v4Engine, v);
+ QV4::ScopedValue v(scope, d->m_v4Engine->globalObject());
+ return QJSValue(d->m_v4Engine, v->asReturnedValue());
}
/*!
@@ -409,8 +426,8 @@ QJSValue QJSEngine::create(int type, const void *ptr)
{
Q_D(QJSEngine);
QV4::Scope scope(d->m_v4Engine);
- QV4::ScopedValue v(scope, d->metaTypeToJS(type, ptr));
- return new QJSValuePrivate(d->m_v4Engine, v);
+ QV4::ScopedValue v(scope, scope.engine->metaTypeToJS(type, ptr));
+ return QJSValue(d->m_v4Engine, v->asReturnedValue());
}
/*!
@@ -419,15 +436,21 @@ QJSValue QJSEngine::create(int type, const void *ptr)
*/
bool QJSEngine::convertV2(const QJSValue &value, int type, void *ptr)
{
- QJSValuePrivate *vp = QJSValuePrivate::get(value);
- QV8Engine *engine = vp->engine ? vp->engine->v8Engine : 0;
- if (engine) {
- QV4::Scope scope(engine->m_v4Engine);
- QV4::ScopedValue v(scope, vp->getValue(engine->m_v4Engine));
- return engine->metaTypeFromJS(v, type, ptr);
- } else if (vp->value.isEmpty()) {
- if (vp->unboundData.userType() == QMetaType::QString) {
- QString string = vp->unboundData.toString();
+ QV4::ExecutionEngine *v4 = QJSValuePrivate::engine(&value);
+ QV4::Value scratch;
+ QV4::Value *val = QJSValuePrivate::valueForData(&value, &scratch);
+ if (v4) {
+ QV4::Scope scope(v4);
+ QV4::ScopedValue v(scope, *val);
+ return scope.engine->metaTypeFromJS(v, type, ptr);
+ }
+
+ if (!val) {
+ QVariant *variant = QJSValuePrivate::getVariant(&value);
+ Q_ASSERT(variant);
+
+ if (variant->userType() == QMetaType::QString) {
+ QString string = variant->toString();
// have a string based value without engine. Do conversion manually
if (type == QMetaType::Bool) {
*reinterpret_cast<bool*>(ptr) = string.length() != 0;
@@ -476,60 +499,62 @@ bool QJSEngine::convertV2(const QJSValue &value, int type, void *ptr)
return false;
}
} else {
- return QMetaType::convert(&vp->unboundData.data_ptr(), vp->unboundData.userType(), ptr, type);
- }
- } else {
- switch (type) {
- case QMetaType::Bool:
- *reinterpret_cast<bool*>(ptr) = vp->value.toBoolean();
- return true;
- case QMetaType::Int:
- *reinterpret_cast<int*>(ptr) = vp->value.toInt32();
- return true;
- case QMetaType::UInt:
- *reinterpret_cast<uint*>(ptr) = vp->value.toUInt32();
- return true;
- case QMetaType::LongLong:
- *reinterpret_cast<qlonglong*>(ptr) = vp->value.toInteger();
- return true;
- case QMetaType::ULongLong:
- *reinterpret_cast<qulonglong*>(ptr) = vp->value.toInteger();
- return true;
- case QMetaType::Double:
- *reinterpret_cast<double*>(ptr) = vp->value.toNumber();
- return true;
- case QMetaType::QString:
- *reinterpret_cast<QString*>(ptr) = value.toString();
- return true;
- case QMetaType::Float:
- *reinterpret_cast<float*>(ptr) = vp->value.toNumber();
- return true;
- case QMetaType::Short:
- *reinterpret_cast<short*>(ptr) = vp->value.toInt32();
- return true;
- case QMetaType::UShort:
- *reinterpret_cast<unsigned short*>(ptr) = vp->value.toUInt16();
- return true;
- case QMetaType::Char:
- *reinterpret_cast<char*>(ptr) = vp->value.toInt32();
- return true;
- case QMetaType::UChar:
- *reinterpret_cast<unsigned char*>(ptr) = vp->value.toUInt16();
- return true;
- case QMetaType::QChar:
- *reinterpret_cast<QChar*>(ptr) = vp->value.toUInt16();
- return true;
- default:
- return false;
+ return QMetaType::convert(&variant->data_ptr(), variant->userType(), ptr, type);
}
}
+
+ Q_ASSERT(val);
+
+ switch (type) {
+ case QMetaType::Bool:
+ *reinterpret_cast<bool*>(ptr) = val->toBoolean();
+ return true;
+ case QMetaType::Int:
+ *reinterpret_cast<int*>(ptr) = val->toInt32();
+ return true;
+ case QMetaType::UInt:
+ *reinterpret_cast<uint*>(ptr) = val->toUInt32();
+ return true;
+ case QMetaType::LongLong:
+ *reinterpret_cast<qlonglong*>(ptr) = val->toInteger();
+ return true;
+ case QMetaType::ULongLong:
+ *reinterpret_cast<qulonglong*>(ptr) = val->toInteger();
+ return true;
+ case QMetaType::Double:
+ *reinterpret_cast<double*>(ptr) = val->toNumber();
+ return true;
+ case QMetaType::QString:
+ *reinterpret_cast<QString*>(ptr) = val->toQStringNoThrow();
+ return true;
+ case QMetaType::Float:
+ *reinterpret_cast<float*>(ptr) = val->toNumber();
+ return true;
+ case QMetaType::Short:
+ *reinterpret_cast<short*>(ptr) = val->toInt32();
+ return true;
+ case QMetaType::UShort:
+ *reinterpret_cast<unsigned short*>(ptr) = val->toUInt16();
+ return true;
+ case QMetaType::Char:
+ *reinterpret_cast<char*>(ptr) = val->toInt32();
+ return true;
+ case QMetaType::UChar:
+ *reinterpret_cast<unsigned char*>(ptr) = val->toUInt16();
+ return true;
+ case QMetaType::QChar:
+ *reinterpret_cast<QChar*>(ptr) = val->toUInt16();
+ return true;
+ default:
+ return false;
+ }
}
/*! \fn QJSValue QJSEngine::toScriptValue(const T &value)
Creates a QJSValue with the given \a value.
- \sa fromScriptValue()
+ \sa fromScriptValue(), newVariant()
*/
/*! \fn T QJSEngine::fromScriptValue(const QJSValue &value)
@@ -539,6 +564,52 @@ bool QJSEngine::convertV2(const QJSValue &value, int type, void *ptr)
\sa toScriptValue()
*/
+
+QJSEnginePrivate *QJSEnginePrivate::get(QV4::ExecutionEngine *e)
+{
+ return e->v8Engine->publicEngine()->d_func();
+}
+
+QJSEnginePrivate::~QJSEnginePrivate()
+{
+ typedef QHash<const QMetaObject *, QQmlPropertyCache *>::Iterator PropertyCacheIt;
+
+ for (PropertyCacheIt iter = propertyCache.begin(), end = propertyCache.end(); iter != end; ++iter)
+ (*iter)->release();
+}
+
+QQmlPropertyCache *QJSEnginePrivate::createCache(const QMetaObject *mo)
+{
+ if (!mo->superClass()) {
+ QQmlPropertyCache *rv = new QQmlPropertyCache(q_func(), mo);
+ propertyCache.insert(mo, rv);
+ return rv;
+ } else {
+ QQmlPropertyCache *super = cache(mo->superClass());
+ QQmlPropertyCache *rv = super->copyAndAppend(mo);
+ propertyCache.insert(mo, rv);
+ return rv;
+ }
+}
+
+/*!
+ \since 5.5
+ \relates QJSEngine
+
+ Returns the QJSEngine associated with \a object, if any.
+
+ This function is useful if you have exposed a QObject to the JavaScript environment
+ and later in your program would like to regain access. It does not require you to
+ keep the wrapper around that was returned from QJSEngine::newQObject().
+ */
+QJSEngine *qjsEngine(const QObject *object)
+{
+ QQmlData *data = QQmlData::get(object, false);
+ if (!data || data->jsWrapper.isNullOrUndefined())
+ return 0;
+ return data->jsWrapper.engine()->jsEngine();
+}
+
QT_END_NAMESPACE
#include "moc_qjsengine.cpp"
diff --git a/src/qml/jsapi/qjsengine.h b/src/qml/jsapi/qjsengine.h
index bddc6f133c..123eb727df 100644
--- a/src/qml/jsapi/qjsengine.h
+++ b/src/qml/jsapi/qjsengine.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -127,6 +127,8 @@ inline QVariant qjsvalue_cast<QVariant>(const QJSValue &value)
return value.toVariant();
}
+Q_QML_EXPORT QJSEngine *qjsEngine(const QObject *);
+
QT_END_NAMESPACE
#endif // QJSENGINE_H
diff --git a/src/qml/jsapi/qjsengine_p.h b/src/qml/jsapi/qjsengine_p.h
index 654d0dee56..8fdec08085 100644
--- a/src/qml/jsapi/qjsengine_p.h
+++ b/src/qml/jsapi/qjsengine_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -46,22 +46,150 @@
//
#include <QtCore/private/qobject_p.h>
+#include <QtCore/qmutex.h>
#include "qjsengine.h"
-
+#include "private/qtqmlglobal_p.h"
QT_BEGIN_NAMESPACE
+class QQmlPropertyCache;
+
+namespace QV4 {
+struct ExecutionEngine;
+}
-class QJSEnginePrivate : public QObjectPrivate
+class Q_QML_PRIVATE_EXPORT QJSEnginePrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QJSEngine)
public:
static QJSEnginePrivate* get(QJSEngine*e) { return e->d_func(); }
+ static const QJSEnginePrivate* get(const QJSEngine*e) { return e->d_func(); }
+ static QJSEnginePrivate* get(QV4::ExecutionEngine *e);
+
+ QJSEnginePrivate() : mutex(QMutex::Recursive) {}
+ ~QJSEnginePrivate();
+
+ // Locker locks the QQmlEnginePrivate data structures for read and write, if necessary.
+ // Currently, locking is only necessary if the threaded loader is running concurrently. If it is
+ // either idle, or is running with the main thread blocked, no locking is necessary. This way
+ // we only pay for locking when we have to.
+ // Consequently, this class should only be used to protect simple accesses or modifications of the
+ // QQmlEnginePrivate structures or operations that can be guaranteed not to start activity
+ // on the loader thread.
+ // The Locker API is identical to QMutexLocker. Locker reuses the QQmlEnginePrivate::mutex
+ // QMutex instance and multiple Lockers are recursive in the same thread.
+ class Locker
+ {
+ public:
+ inline Locker(const QJSEngine *);
+ inline Locker(const QJSEnginePrivate *);
+ inline ~Locker();
+
+ inline void unlock();
+ inline void relock();
+
+ private:
+ const QJSEnginePrivate *m_ep;
+ quint32 m_locked:1;
+ };
+
+ // Shared by QQmlEngine
+ mutable QMutex mutex;
+
- QJSEnginePrivate() {}
+ // These methods may be called from the QML loader thread
+ inline QQmlPropertyCache *cache(QObject *obj);
+ inline QQmlPropertyCache *cache(const QMetaObject *);
+
+private:
+ // Must be called locked
+ QQmlPropertyCache *createCache(const QMetaObject *);
+
+ // These members must be protected by a QJSEnginePrivate::Locker as they are required by
+ // the threaded loader. Only access them through their respective accessor methods.
+ QHash<const QMetaObject *, QQmlPropertyCache *> propertyCache;
};
+QJSEnginePrivate::Locker::Locker(const QJSEngine *e)
+: m_ep(QJSEnginePrivate::get(e))
+{
+ relock();
+}
+
+QJSEnginePrivate::Locker::Locker(const QJSEnginePrivate *e)
+: m_ep(e), m_locked(false)
+{
+ relock();
+}
+
+QJSEnginePrivate::Locker::~Locker()
+{
+ unlock();
+}
+
+void QJSEnginePrivate::Locker::unlock()
+{
+ if (m_locked) {
+ m_ep->mutex.unlock();
+ m_locked = false;
+ }
+}
+
+void QJSEnginePrivate::Locker::relock()
+{
+ Q_ASSERT(!m_locked);
+ m_ep->mutex.lock();
+ m_locked = true;
+}
+
+/*!
+Returns a QQmlPropertyCache for \a obj if one is available.
+
+If \a obj is null, being deleted or contains a dynamic meta object 0
+is returned.
+
+The returned cache is not referenced, so if it is to be stored, call addref().
+
+XXX thread There is a potential future race condition in this and all the cache()
+functions. As the QQmlPropertyCache is returned unreferenced, when called
+from the loader thread, it is possible that the cache will have been dereferenced
+and deleted before the loader thread has a chance to use or reference it. This
+can't currently happen as the cache holds a reference to the
+QQmlPropertyCache until the QQmlEngine is destroyed.
+*/
+QQmlPropertyCache *QJSEnginePrivate::cache(QObject *obj)
+{
+ if (!obj || QObjectPrivate::get(obj)->metaObject || QObjectPrivate::get(obj)->wasDeleted)
+ return 0;
+
+ Locker locker(this);
+ const QMetaObject *mo = obj->metaObject();
+ QQmlPropertyCache *rv = propertyCache.value(mo);
+ if (!rv) rv = createCache(mo);
+ return rv;
+}
+
+/*!
+Returns a QQmlPropertyCache for \a metaObject.
+
+As the cache is persisted for the life of the engine, \a metaObject must be
+a static "compile time" meta-object, or a meta-object that is otherwise known to
+exist for the lifetime of the QQmlEngine.
+
+The returned cache is not referenced, so if it is to be stored, call addref().
+*/
+QQmlPropertyCache *QJSEnginePrivate::cache(const QMetaObject *metaObject)
+{
+ Q_ASSERT(metaObject);
+
+ Locker locker(this);
+ QQmlPropertyCache *rv = propertyCache.value(metaObject);
+ if (!rv) rv = createCache(metaObject);
+ return rv;
+}
+
+
QT_END_NAMESPACE
#endif // QJSENGINE_P_H
diff --git a/src/qml/jsapi/qjsvalue.cpp b/src/qml/jsapi/qjsvalue.cpp
index 47a764e641..50669c46a8 100644
--- a/src/qml/jsapi/qjsvalue.cpp
+++ b/src/qml/jsapi/qjsvalue.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -48,27 +48,6 @@
#include <private/qv4mm_p.h>
#include <private/qv4scopedvalue_p.h>
-QV4::ReturnedValue QJSValuePrivate::getValue(QV4::ExecutionEngine *e)
-{
- if (!this->engine) {
- this->engine = e;
- } else if (this->engine != e) {
- qWarning("JSValue can't be reassigned to another engine.");
- return QV4::Encode::undefined();
- }
-
- if (value.isEmpty()) {
- value = QV4::Encode(engine->v8Engine->fromVariant(unboundData));
- PersistentValuePrivate **listRoot = &engine->memoryManager->m_persistentValues;
- prev = listRoot;
- next = *listRoot;
- *prev = this;
- if (next)
- next->prev = &this->next;
- unboundData.clear();
- }
- return value.asReturnedValue();
-}
/*!
\since 5.0
@@ -142,61 +121,66 @@ using namespace QV4;
Constructs a new QJSValue with a boolean \a value.
*/
QJSValue::QJSValue(bool value)
- : d(new QJSValuePrivate(Encode(value)))
{
+ QJSValuePrivate::setVariant(this, QVariant(value));
}
-QJSValue::QJSValue(QJSValuePrivate *dd)
- : d(dd)
+/*!
+ \internal
+*/
+QJSValue::QJSValue(ExecutionEngine *e, quint64 val)
{
+ QJSValuePrivate::setValue(this, e, val);
}
/*!
Constructs a new QJSValue with a number \a value.
*/
QJSValue::QJSValue(int value)
- : d(new QJSValuePrivate(Encode(value)))
{
+ QJSValuePrivate::setVariant(this, QVariant(value));
}
/*!
Constructs a new QJSValue with a number \a value.
*/
QJSValue::QJSValue(uint value)
- : d(new QJSValuePrivate(Encode(value)))
{
+ QJSValuePrivate::setVariant(this, QVariant((double)value));
}
/*!
Constructs a new QJSValue with a number \a value.
*/
QJSValue::QJSValue(double value)
- : d(new QJSValuePrivate(Encode(value)))
{
+ QJSValuePrivate::setVariant(this, QVariant(value));
}
/*!
Constructs a new QJSValue with a string \a value.
*/
QJSValue::QJSValue(const QString& value)
- : d(new QJSValuePrivate(value))
{
+ QJSValuePrivate::setVariant(this, QVariant(value));
}
/*!
Constructs a new QJSValue with a special \a value.
*/
QJSValue::QJSValue(SpecialValue value)
- : d(new QJSValuePrivate(value == UndefinedValue ? Encode::undefined() : Encode::null()))
+ : d(0)
{
+ if (value == NullValue)
+ QJSValuePrivate::setVariant(this, QVariant(QMetaType::VoidStar, (void *)0));
}
/*!
Constructs a new QJSValue with a string \a value.
*/
QJSValue::QJSValue(const QLatin1String &value)
- : d(new QJSValuePrivate(value))
{
+ QJSValuePrivate::setVariant(this, QVariant(value));
}
/*!
@@ -204,8 +188,8 @@ QJSValue::QJSValue(const QLatin1String &value)
*/
#ifndef QT_NO_CAST_FROM_ASCII
QJSValue::QJSValue(const char *value)
- : d(new QJSValuePrivate(QString::fromUtf8(value)))
{
+ QJSValuePrivate::setVariant(this, QVariant(QString::fromUtf8(value)));
}
#endif
@@ -217,9 +201,14 @@ QJSValue::QJSValue(const char *value)
the new script value (i.e., the object itself is not copied).
*/
QJSValue::QJSValue(const QJSValue& other)
- : d(other.d)
+ : d(0)
{
- d->ref();
+ QV4::Value *v = QJSValuePrivate::getValue(&other);
+ if (v) {
+ QJSValuePrivate::setValue(this, QJSValuePrivate::engine(&other), *v);
+ } else if (QVariant *v = QJSValuePrivate::getVariant(&other)) {
+ QJSValuePrivate::setVariant(this, *v);
+ }
}
/*!
@@ -227,7 +216,7 @@ QJSValue::QJSValue(const QJSValue& other)
*/
QJSValue::~QJSValue()
{
- d->deref();
+ QJSValuePrivate::free(this);
}
/*!
@@ -238,7 +227,11 @@ QJSValue::~QJSValue()
*/
bool QJSValue::isBool() const
{
- return d->value.isBoolean();
+ QV4::Value *val = QJSValuePrivate::getValue(this);
+ if (val)
+ return val->isBoolean();
+ QVariant *variant = QJSValuePrivate::getVariant(this);
+ return variant && variant->type() == QVariant::Bool;
}
/*!
@@ -249,7 +242,27 @@ bool QJSValue::isBool() const
*/
bool QJSValue::isNumber() const
{
- return d->value.isNumber();
+ QV4::Value *val = QJSValuePrivate::getValue(this);
+ if (val)
+ return val->isNumber();
+ QVariant *variant = QJSValuePrivate::getVariant(this);
+ if (!variant)
+ return false;
+
+ switch (variant->userType()) {
+ case QMetaType::Double:
+ case QMetaType::Int:
+ case QMetaType::UInt:
+ case QMetaType::Long:
+ case QMetaType::ULong:
+ case QMetaType::Short:
+ case QMetaType::UShort:
+ case QMetaType::LongLong:
+ case QMetaType::ULongLong:
+ return true;
+ default:
+ return false;
+ }
}
/*!
@@ -258,7 +271,11 @@ bool QJSValue::isNumber() const
*/
bool QJSValue::isNull() const
{
- return d->value.isNull();
+ QV4::Value *val = QJSValuePrivate::getValue(this);
+ if (val)
+ return val->isNull();
+ QVariant *variant = QJSValuePrivate::getVariant(this);
+ return variant && variant->userType() == QMetaType::VoidStar;
}
/*!
@@ -269,7 +286,11 @@ bool QJSValue::isNull() const
*/
bool QJSValue::isString() const
{
- return d->value.isEmpty() || d->value.isString();
+ QV4::Value *val = QJSValuePrivate::getValue(this);
+ if (val)
+ return val->isString();
+ QVariant *variant = QJSValuePrivate::getVariant(this);
+ return variant && variant->userType() == QMetaType::QString;
}
/*!
@@ -278,16 +299,25 @@ bool QJSValue::isString() const
*/
bool QJSValue::isUndefined() const
{
- return d->value.isUndefined();
+ QV4::Value *val = QJSValuePrivate::getValue(this);
+ if (val)
+ return val->isUndefined();
+ QVariant *variant = QJSValuePrivate::getVariant(this);
+ return !variant || variant->userType() == QMetaType::UnknownType || variant->userType() == QMetaType::Void;
}
/*!
Returns true if this QJSValue is an object of the Error class;
otherwise returns false.
+
+ \sa {QJSEngine#Script Exceptions}{QJSEngine - Script Exceptions}
*/
bool QJSValue::isError() const
{
- Object *o = d->value.asObject();
+ QV4::Value *val = QJSValuePrivate::getValue(this);
+ if (!val)
+ return false;
+ Object *o = val->asObject();
return o && o->asErrorObject();
}
@@ -299,7 +329,10 @@ bool QJSValue::isError() const
*/
bool QJSValue::isArray() const
{
- return d->value.asArrayObject();
+ QV4::Value *val = QJSValuePrivate::getValue(this);
+ if (!val)
+ return false;
+ return val->asArrayObject();
}
/*!
@@ -313,7 +346,10 @@ bool QJSValue::isArray() const
*/
bool QJSValue::isObject() const
{
- return d->value.asObject();
+ QV4::Value *val = QJSValuePrivate::getValue(this);
+ if (!val)
+ return false;
+ return val->asObject();
}
/*!
@@ -324,7 +360,10 @@ bool QJSValue::isObject() const
*/
bool QJSValue::isCallable() const
{
- return d->value.asFunctionObject();
+ QV4::Value *val = QJSValuePrivate::getValue(this);
+ if (!val)
+ return false;
+ return val->asFunctionObject();
}
/*!
@@ -335,8 +374,10 @@ bool QJSValue::isCallable() const
*/
bool QJSValue::isVariant() const
{
- Managed *m = d->value.asManaged();
- return m ? m->as<QV4::VariantObject>() : 0;
+ QV4::Value *val = QJSValuePrivate::getValue(this);
+ if (!val)
+ return false;
+ return val->as<QV4::VariantObject>();
}
/*!
@@ -353,11 +394,16 @@ bool QJSValue::isVariant() const
*/
QString QJSValue::toString() const
{
- if (d->value.isEmpty()) {
- if (d->unboundData.type() == QVariant::Map)
+ QV4::Value scratch;
+ QV4::Value *val = QJSValuePrivate::valueForData(this, &scratch);
+
+ if (!val) {
+ QVariant *variant = QJSValuePrivate::getVariant(this);
+ Q_ASSERT(variant);
+ if (variant->type() == QVariant::Map)
return QStringLiteral("[object Object]");
- else if (d->unboundData.type() == QVariant::List) {
- const QVariantList list = d->unboundData.toList();
+ else if (variant->type() == QVariant::List) {
+ const QVariantList list = variant->toList();
QString result;
for (int i = 0; i < list.count(); ++i) {
if (i > 0)
@@ -366,9 +412,9 @@ QString QJSValue::toString() const
}
return result;
}
- return d->unboundData.toString();
+ return variant->toString();
}
- return d->value.toQStringNoThrow();
+ return val->toQStringNoThrow();
}
/*!
@@ -385,19 +431,25 @@ QString QJSValue::toString() const
*/
double QJSValue::toNumber() const
{
- if (d->value.isEmpty()) {
- if (d->unboundData.type() == QVariant::String)
- return RuntimeHelpers::stringToNumber(d->unboundData.toString());
- else if (d->unboundData.canConvert<double>())
- return d->unboundData.value<double>();
+ QV4::Value scratch;
+ QV4::Value *val = QJSValuePrivate::valueForData(this, &scratch);
+
+ if (!val) {
+ QVariant *variant = QJSValuePrivate::getVariant(this);
+ Q_ASSERT(variant);
+
+ if (variant->type() == QVariant::String)
+ return RuntimeHelpers::stringToNumber(variant->toString());
+ else if (variant->canConvert<double>())
+ return variant->value<double>();
else
return std::numeric_limits<double>::quiet_NaN();
}
- QV4::ExecutionContext *ctx = d->engine ? d->engine->currentContext() : 0;
- double dbl = d->value.toNumber();
- if (ctx && ctx->d()->engine->hasException) {
- ctx->catchException();
+ double dbl = val->toNumber();
+ QV4::ExecutionEngine *engine = QJSValuePrivate::engine(this);
+ if (engine && engine->hasException) {
+ engine->catchException();
return 0;
}
return dbl;
@@ -417,17 +469,21 @@ double QJSValue::toNumber() const
*/
bool QJSValue::toBool() const
{
- if (d->value.isEmpty()) {
- if (d->unboundData.userType() == QMetaType::QString)
- return d->unboundData.toString().length() > 0;
+ QV4::Value scratch;
+ QV4::Value *val = QJSValuePrivate::valueForData(this, &scratch);
+
+ if (!val) {
+ QVariant *variant = QJSValuePrivate::getVariant(this);
+ if (variant->userType() == QMetaType::QString)
+ return variant->toString().length() > 0;
else
- return d->unboundData.toBool();
+ return variant->toBool();
}
- QV4::ExecutionContext *ctx = d->engine ? d->engine->currentContext() : 0;
- bool b = d->value.toBoolean();
- if (ctx && ctx->d()->engine->hasException) {
- ctx->catchException();
+ bool b = val->toBoolean();
+ QV4::ExecutionEngine *engine = QJSValuePrivate::engine(this);
+ if (engine && engine->hasException) {
+ engine->catchException();
return false;
}
return b;
@@ -447,17 +503,21 @@ bool QJSValue::toBool() const
*/
qint32 QJSValue::toInt() const
{
- if (d->value.isEmpty()) {
- if (d->unboundData.userType() == QMetaType::QString)
- return QV4::Primitive::toInt32(RuntimeHelpers::stringToNumber(d->unboundData.toString()));
+ QV4::Value scratch;
+ QV4::Value *val = QJSValuePrivate::valueForData(this, &scratch);
+
+ if (!val) {
+ QVariant *variant = QJSValuePrivate::getVariant(this);
+ if (variant->userType() == QMetaType::QString)
+ return QV4::Primitive::toInt32(RuntimeHelpers::stringToNumber(variant->toString()));
else
- return d->unboundData.toInt();
+ return variant->toInt();
}
- QV4::ExecutionContext *ctx = d->engine ? d->engine->currentContext() : 0;
- qint32 i = d->value.toInt32();
- if (ctx && ctx->d()->engine->hasException) {
- ctx->catchException();
+ qint32 i = val->toInt32();
+ QV4::ExecutionEngine *engine = QJSValuePrivate::engine(this);
+ if (engine && engine->hasException) {
+ engine->catchException();
return 0;
}
return i;
@@ -477,17 +537,21 @@ qint32 QJSValue::toInt() const
*/
quint32 QJSValue::toUInt() const
{
- if (d->value.isEmpty()) {
- if (d->unboundData.userType() == QMetaType::QString)
- return QV4::Primitive::toUInt32(RuntimeHelpers::stringToNumber(d->unboundData.toString()));
+ QV4::Value scratch;
+ QV4::Value *val = QJSValuePrivate::valueForData(this, &scratch);
+
+ if (!val) {
+ QVariant *variant = QJSValuePrivate::getVariant(this);
+ if (variant->userType() == QMetaType::QString)
+ return QV4::Primitive::toUInt32(RuntimeHelpers::stringToNumber(variant->toString()));
else
- return d->unboundData.toUInt();
+ return variant->toUInt();
}
- QV4::ExecutionContext *ctx = d->engine ? d->engine->currentContext() : 0;
- quint32 u = d->value.toUInt32();
- if (ctx && ctx->d()->engine->hasException) {
- ctx->catchException();
+ quint32 u = val->toUInt32();
+ QV4::ExecutionEngine *engine = QJSValuePrivate::engine(this);
+ if (engine && engine->hasException) {
+ engine->catchException();
return 0;
}
return u;
@@ -517,10 +581,30 @@ quint32 QJSValue::toUInt() const
*/
QVariant QJSValue::toVariant() const
{
- if (d->value.isEmpty())
- return d->unboundData;
-
- return QV4::VariantObject::toVariant(d->value);
+ QVariant *variant = QJSValuePrivate::getVariant(this);
+ if (variant)
+ return *variant;
+
+ QV4::Value scratch;
+ QV4::Value *val = QJSValuePrivate::valueForData(this, &scratch);
+ Q_ASSERT(val);
+
+ if (Object *o = val->asObject())
+ return o->engine()->toVariant(*val, /*typeHint*/ -1, /*createJSValueForObjects*/ false);
+
+ if (val->isString())
+ return QVariant(val->stringValue()->toQString());
+ if (val->isBoolean())
+ return QVariant(val->booleanValue());
+ if (val->isNumber()) {
+ if (val->isInt32())
+ return QVariant(val->integerValue());
+ return QVariant(val->asDouble());
+ }
+ if (val->isNull())
+ return QVariant(QMetaType::VoidStar, 0);
+ Q_ASSERT(val->isUndefined());
+ return QVariant();
}
/*!
@@ -540,31 +624,33 @@ QVariant QJSValue::toVariant() const
*/
QJSValue QJSValue::call(const QJSValueList &args)
{
- FunctionObject *f = d->value.asFunctionObject();
+ QV4::Value *val = QJSValuePrivate::getValue(this);
+ if (!val)
+ return QJSValue();
+
+ FunctionObject *f = val->asFunctionObject();
if (!f)
return QJSValue();
- ExecutionEngine *engine = d->engine;
+ QV4::ExecutionEngine *engine = QJSValuePrivate::engine(this);
Q_ASSERT(engine);
Scope scope(engine);
ScopedCallData callData(scope, args.length());
- callData->thisObject = engine->globalObject->asReturnedValue();
+ callData->thisObject = engine->globalObject()->asReturnedValue();
for (int i = 0; i < args.size(); ++i) {
- if (!args.at(i).d->checkEngine(engine)) {
+ if (!QJSValuePrivate::checkEngine(engine, args.at(i))) {
qWarning("QJSValue::call() failed: cannot call function with argument created in a different engine");
return QJSValue();
}
- callData->args[i] = args.at(i).d->getValue(engine);
+ callData->args[i] = QJSValuePrivate::convertedToValue(engine, args.at(i));
}
- ScopedValue result(scope);
- QV4::ExecutionContext *ctx = engine->currentContext();
- result = f->call(callData);
- if (scope.hasException())
- result = ctx->catchException();
+ ScopedValue result(scope, f->call(callData));
+ if (engine->hasException)
+ result = engine->catchException();
- return new QJSValuePrivate(engine, result);
+ return QJSValue(engine, result->asReturnedValue());
}
/*!
@@ -589,36 +675,38 @@ QJSValue QJSValue::call(const QJSValueList &args)
*/
QJSValue QJSValue::callWithInstance(const QJSValue &instance, const QJSValueList &args)
{
- FunctionObject *f = d->value.asFunctionObject();
+ QV4::Value *val = QJSValuePrivate::getValue(this);
+ if (!val)
+ return QJSValue();
+
+ FunctionObject *f = val->asFunctionObject();
if (!f)
return QJSValue();
- ExecutionEngine *engine = d->engine;
+ QV4::ExecutionEngine *engine = QJSValuePrivate::engine(this);
Q_ASSERT(engine);
Scope scope(engine);
- if (!instance.d->checkEngine(engine)) {
+ if (!QJSValuePrivate::checkEngine(engine, instance)) {
qWarning("QJSValue::call() failed: cannot call function with thisObject created in a different engine");
return QJSValue();
}
ScopedCallData callData(scope, args.size());
- callData->thisObject = instance.d->getValue(engine);
+ callData->thisObject = QJSValuePrivate::convertedToValue(engine, instance);
for (int i = 0; i < args.size(); ++i) {
- if (!args.at(i).d->checkEngine(engine)) {
+ if (!QJSValuePrivate::checkEngine(engine, args.at(i))) {
qWarning("QJSValue::call() failed: cannot call function with argument created in a different engine");
return QJSValue();
}
- callData->args[i] = args.at(i).d->getValue(engine);
+ callData->args[i] = QJSValuePrivate::convertedToValue(engine, args.at(i));
}
- ScopedValue result(scope);
- QV4::ExecutionContext *ctx = engine->currentContext();
- result = f->call(callData);
- if (scope.hasException())
- result = ctx->catchException();
+ ScopedValue result(scope, f->call(callData));
+ if (engine->hasException)
+ result = engine->catchException();
- return new QJSValuePrivate(engine, result);
+ return QJSValue(engine, result->asReturnedValue());
}
/*!
@@ -641,30 +729,32 @@ QJSValue QJSValue::callWithInstance(const QJSValue &instance, const QJSValueList
*/
QJSValue QJSValue::callAsConstructor(const QJSValueList &args)
{
- FunctionObject *f = d->value.asFunctionObject();
+ QV4::Value *val = QJSValuePrivate::getValue(this);
+ if (!val)
+ return QJSValue();
+
+ FunctionObject *f = val->asFunctionObject();
if (!f)
return QJSValue();
- ExecutionEngine *engine = d->engine;
+ QV4::ExecutionEngine *engine = QJSValuePrivate::engine(this);
Q_ASSERT(engine);
Scope scope(engine);
ScopedCallData callData(scope, args.size());
for (int i = 0; i < args.size(); ++i) {
- if (!args.at(i).d->checkEngine(engine)) {
+ if (!QJSValuePrivate::checkEngine(engine, args.at(i))) {
qWarning("QJSValue::callAsConstructor() failed: cannot construct function with argument created in a different engine");
return QJSValue();
}
- callData->args[i] = args.at(i).d->getValue(engine);
+ callData->args[i] = QJSValuePrivate::convertedToValue(engine, args.at(i));
}
- ScopedValue result(scope);
- QV4::ExecutionContext *ctx = engine->currentContext();
- result = f->construct(callData);
- if (scope.hasException())
- result = ctx->catchException();
+ ScopedValue result(scope, f->construct(callData));
+ if (engine->hasException)
+ result = engine->catchException();
- return new QJSValuePrivate(engine, result);
+ return QJSValue(engine, result->asReturnedValue());
}
#ifdef QT_DEPRECATED
@@ -678,9 +768,9 @@ QJSValue QJSValue::callAsConstructor(const QJSValueList &args)
*/
QJSEngine* QJSValue::engine() const
{
- QV4::ExecutionEngine *engine = d->engine;
+ QV4::ExecutionEngine *engine = QJSValuePrivate::engine(this);
if (engine)
- return engine->v8Engine->publicEngine();
+ return engine->jsEngine();
return 0;
}
@@ -695,17 +785,17 @@ QJSEngine* QJSValue::engine() const
*/
QJSValue QJSValue::prototype() const
{
- QV4::ExecutionEngine *engine = d->engine;
+ QV4::ExecutionEngine *engine = QJSValuePrivate::engine(this);
if (!engine)
return QJSValue();
QV4::Scope scope(engine);
- Scoped<Object> o(scope, d->value.asObject());
+ ScopedObject o(scope, QJSValuePrivate::getValue(this)->asObject());
if (!o)
return QJSValue();
- Scoped<Object> p(scope, o->prototype());
+ ScopedObject p(scope, o->prototype());
if (!p)
return QJSValue(NullValue);
- return new QJSValuePrivate(o->internalClass()->engine, p);
+ return QJSValue(o->internalClass()->engine, p.asReturnedValue());
}
/*!
@@ -722,26 +812,30 @@ QJSValue QJSValue::prototype() const
*/
void QJSValue::setPrototype(const QJSValue& prototype)
{
- ExecutionEngine *v4 = d->engine;
- if (!v4)
+ QV4::ExecutionEngine *engine = QJSValuePrivate::engine(this);
+ if (!engine)
return;
- Scope scope(v4);
- ScopedObject o(scope, d->value);
+ Scope scope(engine);
+ ScopedObject o(scope, QJSValuePrivate::getValue(this));
if (!o)
return;
- if (prototype.d->value.isNull()) {
+ QV4::Value scratch;
+ QV4::Value *val = QJSValuePrivate::valueForData(&prototype, &scratch);
+ if (!val)
+ return;
+ if (val->isNull()) {
o->setPrototype(0);
return;
}
- ScopedObject p(scope, prototype.d->value);
+ ScopedObject p(scope, val);
if (!p)
return;
if (o->engine() != p->engine()) {
qWarning("QJSValue::setPrototype() failed: cannot set a prototype created in a different engine");
return;
}
- if (!o->setPrototype(p.getPointer()))
+ if (!o->setPrototype(p))
qWarning("QJSValue::setPrototype() failed: cyclic prototype value");
}
@@ -754,24 +848,31 @@ void QJSValue::setPrototype(const QJSValue& prototype)
*/
QJSValue& QJSValue::operator=(const QJSValue& other)
{
- if (d != other.d) {
- d->deref();
- d = other.d;
- d->ref();
+ if (d == other.d)
+ return *this;
+
+ QJSValuePrivate::free(this);
+ d = 0;
+
+ QV4::Value *v = QJSValuePrivate::getValue(&other);
+ if (v) {
+ QJSValuePrivate::setValue(this, QJSValuePrivate::engine(&other), *v);
+ } else if (QVariant *v = QJSValuePrivate::getVariant(&other)) {
+ QJSValuePrivate::setVariant(this, *v);
}
return *this;
}
-static bool js_equal(const QString &string, QV4::ValueRef value)
+static bool js_equal(const QString &string, const QV4::Value &value)
{
- if (value->isString())
- return string == value->stringValue()->toQString();
- if (value->isNumber())
- return RuntimeHelpers::stringToNumber(string) == value->asDouble();
- if (value->isBoolean())
- return RuntimeHelpers::stringToNumber(string) == double(value->booleanValue());
- if (value->isObject()) {
- Scope scope(value->objectValue()->engine());
+ if (value.isString())
+ return string == value.stringValue()->toQString();
+ if (value.isNumber())
+ return RuntimeHelpers::stringToNumber(string) == value.asDouble();
+ if (value.isBoolean())
+ return RuntimeHelpers::stringToNumber(string) == double(value.booleanValue());
+ if (value.isObject()) {
+ Scope scope(value.objectValue()->engine());
ScopedValue p(scope, RuntimeHelpers::toPrimitive(value, PREFERREDTYPE_HINT));
return js_equal(string, p);
}
@@ -804,17 +905,23 @@ static bool js_equal(const QString &string, QV4::ValueRef value)
*/
bool QJSValue::equals(const QJSValue& other) const
{
- if (d->value.isEmpty()) {
- if (other.d->value.isEmpty())
- return d->unboundData == other.d->unboundData;
- if (d->unboundData.type() == QVariant::Map || d->unboundData.type() == QVariant::List)
+ QV4::Value s1, s2;
+ QV4::Value *v = QJSValuePrivate::valueForData(this, &s1);
+ QV4::Value *ov = QJSValuePrivate::valueForData(&other, &s2);
+
+ if (!v) {
+ QVariant *variant = QJSValuePrivate::getVariant(this);
+ Q_ASSERT(variant);
+ if (!ov)
+ return *variant == *QJSValuePrivate::getVariant(&other);
+ if (variant->type() == QVariant::Map || variant->type() == QVariant::List)
return false;
- return js_equal(d->unboundData.toString(), QV4::ValueRef(other.d->value));
- }
- if (other.d->value.isEmpty())
+ return js_equal(variant->toString(), *ov);
+ }
+ if (!ov)
return other.equals(*this);
- return Runtime::compareEqual(QV4::ValueRef(d), QV4::ValueRef(other.d));
+ return Runtime::compareEqual(*v, *ov);
}
/*!
@@ -841,19 +948,25 @@ bool QJSValue::equals(const QJSValue& other) const
*/
bool QJSValue::strictlyEquals(const QJSValue& other) const
{
- if (d->value.isEmpty()) {
- if (other.d->value.isEmpty())
- return d->unboundData == other.d->unboundData;
- if (d->unboundData.type() == QVariant::Map || d->unboundData.type() == QVariant::List)
+ QV4::Value s1, s2;
+ QV4::Value *v = QJSValuePrivate::valueForData(this, &s1);
+ QV4::Value *ov = QJSValuePrivate::valueForData(&other, &s2);
+
+ if (!v) {
+ QVariant *variant = QJSValuePrivate::getVariant(this);
+ Q_ASSERT(variant);
+ if (!ov)
+ return *variant == *QJSValuePrivate::getVariant(&other);
+ if (variant->type() == QVariant::Map || variant->type() == QVariant::List)
return false;
- if (other.d->value.isString())
- return d->unboundData.toString() == other.d->value.stringValue()->toQString();
+ if (ov->isString())
+ return variant->toString() == ov->stringValue()->toQString();
return false;
}
- if (other.d->value.isEmpty())
+ if (!ov)
return other.strictlyEquals(*this);
- return RuntimeHelpers::strictEqual(QV4::ValueRef(d), QV4::ValueRef(other.d));
+ return RuntimeHelpers::strictEqual(*v, *ov);
}
/*!
@@ -871,12 +984,12 @@ bool QJSValue::strictlyEquals(const QJSValue& other) const
*/
QJSValue QJSValue::property(const QString& name) const
{
- ExecutionEngine *engine = d->engine;
+ QV4::ExecutionEngine *engine = QJSValuePrivate::engine(this);
if (!engine)
return QJSValue();
- QV4::Scope scope(engine);
- ScopedObject o(scope, d->value);
+ QV4::Scope scope(engine);
+ ScopedObject o(scope, QJSValuePrivate::getValue(this));
if (!o)
return QJSValue();
@@ -885,14 +998,12 @@ QJSValue QJSValue::property(const QString& name) const
if (idx < UINT_MAX)
return property(idx);
- s->makeIdentifier();
- QV4::ExecutionContext *ctx = engine->currentContext();
- QV4::ScopedValue result(scope);
- result = o->get(s.getPointer());
- if (scope.hasException())
- result = ctx->catchException();
+ s->makeIdentifier(engine);
+ QV4::ScopedValue result(scope, o->get(s));
+ if (engine->hasException)
+ result = engine->catchException();
- return new QJSValuePrivate(engine, result);
+ return QJSValue(engine, result->asReturnedValue());
}
/*!
@@ -909,21 +1020,19 @@ QJSValue QJSValue::property(const QString& name) const
*/
QJSValue QJSValue::property(quint32 arrayIndex) const
{
- ExecutionEngine *engine = d->engine;
+ QV4::ExecutionEngine *engine = QJSValuePrivate::engine(this);
if (!engine)
return QJSValue();
QV4::Scope scope(engine);
- ScopedObject o(scope, d->value);
+ ScopedObject o(scope, QJSValuePrivate::getValue(this));
if (!o)
return QJSValue();
- QV4::ExecutionContext *ctx = engine->currentContext();
- QV4::ScopedValue result(scope);
- result = arrayIndex == UINT_MAX ? o->get(engine->id_uintMax.getPointer()) : o->getIndexed(arrayIndex);
- if (scope.hasException())
- result = ctx->catchException();
- return new QJSValuePrivate(engine, result);
+ QV4::ScopedValue result(scope, arrayIndex == UINT_MAX ? o->get(engine->id_uintMax) : o->getIndexed(arrayIndex));
+ if (engine->hasException)
+ engine->catchException();
+ return QJSValue(engine, result->asReturnedValue());
}
/*!
@@ -939,16 +1048,16 @@ QJSValue QJSValue::property(quint32 arrayIndex) const
*/
void QJSValue::setProperty(const QString& name, const QJSValue& value)
{
- ExecutionEngine *engine = d->engine;
+ QV4::ExecutionEngine *engine = QJSValuePrivate::engine(this);
if (!engine)
return;
Scope scope(engine);
- Scoped<Object> o(scope, d->value);
+ ScopedObject o(scope, QJSValuePrivate::getValue(this));
if (!o)
return;
- if (!value.d->checkEngine(o->engine())) {
+ if (!QJSValuePrivate::checkEngine(engine, value)) {
qWarning("QJSValue::setProperty(%s) failed: cannot set value created in a different engine", name.toUtf8().constData());
return;
}
@@ -960,12 +1069,11 @@ void QJSValue::setProperty(const QString& name, const QJSValue& value)
return;
}
- QV4::ExecutionContext *ctx = engine->currentContext();
- s->makeIdentifier();
- QV4::ScopedValue v(scope, value.d->getValue(engine));
- o->put(s.getPointer(), v);
- if (scope.hasException())
- ctx->catchException();
+ s->makeIdentifier(scope.engine);
+ QV4::ScopedValue v(scope, QJSValuePrivate::convertedToValue(engine, value));
+ o->put(s, v);
+ if (engine->hasException)
+ engine->catchException();
}
/*!
@@ -982,23 +1090,27 @@ void QJSValue::setProperty(const QString& name, const QJSValue& value)
*/
void QJSValue::setProperty(quint32 arrayIndex, const QJSValue& value)
{
- ExecutionEngine *engine = d->engine;
+ QV4::ExecutionEngine *engine = QJSValuePrivate::engine(this);
if (!engine)
return;
Scope scope(engine);
- Scoped<Object> o(scope, d->value);
+ ScopedObject o(scope, QJSValuePrivate::getValue(this));
if (!o)
return;
- QV4::ExecutionContext *ctx = engine->currentContext();
- QV4::ScopedValue v(scope, value.d->getValue(engine));
+ if (!QJSValuePrivate::checkEngine(engine, value)) {
+ qWarning("QJSValue::setProperty(%d) failed: cannot set value created in a different engine", arrayIndex);
+ return;
+ }
+
+ QV4::ScopedValue v(scope, QJSValuePrivate::convertedToValue(engine, value));
if (arrayIndex != UINT_MAX)
o->putIndexed(arrayIndex, v);
else
- o->put(engine->id_uintMax.getPointer(), v);
- if (scope.hasException())
- ctx->catchException();
+ o->put(engine->id_uintMax, v);
+ if (engine->hasException)
+ engine->catchException();
}
/*!
@@ -1023,17 +1135,16 @@ void QJSValue::setProperty(quint32 arrayIndex, const QJSValue& value)
*/
bool QJSValue::deleteProperty(const QString &name)
{
- ExecutionEngine *engine = d->engine;
- ExecutionContext *ctx = engine->currentContext();
+ QV4::ExecutionEngine *engine = QJSValuePrivate::engine(this);
Scope scope(engine);
- ScopedObject o(scope, d->value.asObject());
+ ScopedObject o(scope, QJSValuePrivate::getValue(this));
if (!o)
return false;
ScopedString s(scope, engine->newString(name));
- bool b = o->deleteProperty(s.getPointer());
- if (scope.hasException())
- ctx->catchException();
+ bool b = o->deleteProperty(s);
+ if (engine->hasException)
+ engine->catchException();
return b;
}
@@ -1045,17 +1156,17 @@ bool QJSValue::deleteProperty(const QString &name)
*/
bool QJSValue::hasProperty(const QString &name) const
{
- ExecutionEngine *engine = d->engine;
+ QV4::ExecutionEngine *engine = QJSValuePrivate::engine(this);
if (!engine)
return false;
Scope scope(engine);
- ScopedObject o(scope, d->value);
+ ScopedObject o(scope, QJSValuePrivate::getValue(this));
if (!o)
return false;
ScopedString s(scope, engine->newIdentifier(name));
- return o->hasProperty(s.getPointer());
+ return o->hasProperty(s);
}
/*!
@@ -1066,17 +1177,17 @@ bool QJSValue::hasProperty(const QString &name) const
*/
bool QJSValue::hasOwnProperty(const QString &name) const
{
- ExecutionEngine *engine = d->engine;
+ QV4::ExecutionEngine *engine = QJSValuePrivate::engine(this);
if (!engine)
return false;
Scope scope(engine);
- ScopedObject o(scope, d->value);
+ ScopedObject o(scope, QJSValuePrivate::getValue(this));
if (!o)
return false;
ScopedString s(scope, engine->newIdentifier(name));
- return o->hasOwnProperty(s.getPointer());
+ return o->hasOwnProperty(s);
}
/*!
@@ -1091,11 +1202,15 @@ bool QJSValue::hasOwnProperty(const QString &name) const
*/
QObject *QJSValue::toQObject() const
{
- Returned<QV4::QObjectWrapper> *o = d->value.as<QV4::QObjectWrapper>();
- if (!o)
+ QV4::ExecutionEngine *engine = QJSValuePrivate::engine(this);
+ if (!engine)
+ return 0;
+ QV4::Scope scope(engine);
+ QV4::Scoped<QV4::QObjectWrapper> wrapper(scope, QJSValuePrivate::getValue(this));
+ if (!wrapper)
return 0;
- return o->getPointer()->object();
+ return wrapper->object();
}
/*!
@@ -1107,10 +1222,13 @@ QObject *QJSValue::toQObject() const
*/
QDateTime QJSValue::toDateTime() const
{
- QV4::DateObject *date = d->value.asDateObject();
- if (!date)
- return QDateTime();
- return date->toQDateTime();
+ QV4::Value *val = QJSValuePrivate::getValue(this);
+ if (val) {
+ QV4::DateObject *date = val->asDateObject();
+ if (date)
+ return date->toQDateTime();
+ }
+ return QDateTime();
}
/*!
@@ -1119,7 +1237,8 @@ QDateTime QJSValue::toDateTime() const
*/
bool QJSValue::isDate() const
{
- return d->value.asDateObject();
+ QV4::Value *val = QJSValuePrivate::getValue(this);
+ return val && val->asDateObject();
}
/*!
@@ -1128,7 +1247,8 @@ bool QJSValue::isDate() const
*/
bool QJSValue::isRegExp() const
{
- return d->value.as<RegExpObject>();
+ QV4::Value *val = QJSValuePrivate::getValue(this);
+ return val && val->as<RegExpObject>();
}
/*!
@@ -1142,7 +1262,8 @@ bool QJSValue::isRegExp() const
*/
bool QJSValue::isQObject() const
{
- return d->value.as<QV4::QObjectWrapper>() != 0;
+ QV4::Value *val = QJSValuePrivate::getValue(this);
+ return val && val->as<QV4::QObjectWrapper>() != 0;
}
QT_END_NAMESPACE
diff --git a/src/qml/jsapi/qjsvalue.h b/src/qml/jsapi/qjsvalue.h
index d184cf6537..88ccac497d 100644
--- a/src/qml/jsapi/qjsvalue.h
+++ b/src/qml/jsapi/qjsvalue.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -41,7 +41,6 @@
QT_BEGIN_NAMESPACE
-
class QJSValue;
class QJSEngine;
class QVariant;
@@ -50,7 +49,10 @@ struct QMetaObject;
class QDateTime;
typedef QList<QJSValue> QJSValueList;
-class QJSValuePrivate;
+namespace QV4 {
+ struct ExecutionEngine;
+ struct Value;
+}
class Q_QML_EXPORT QJSValue
{
@@ -65,6 +67,12 @@ public:
~QJSValue();
QJSValue(const QJSValue &other);
+#ifdef Q_COMPILER_RVALUE_REFS
+ inline QJSValue(QJSValue && other) : d(other.d) { other.d = 0; }
+ inline QJSValue &operator=(QJSValue &&other)
+ { qSwap(d, other.d); return *this; }
+#endif
+
QJSValue(bool value);
QJSValue(int value);
QJSValue(uint value);
@@ -125,13 +133,13 @@ public:
QT_DEPRECATED QJSEngine *engine() const;
#endif
- QJSValue(QJSValuePrivate *dd);
+ QJSValue(QV4::ExecutionEngine *e, quint64 val);
private:
friend class QJSValuePrivate;
// force compile error, prevent QJSValue(bool) to be called
QJSValue(void *) Q_DECL_EQ_DELETE;
- QJSValuePrivate *d;
+ mutable quintptr d;
};
QT_END_NAMESPACE
diff --git a/src/qml/jsapi/qjsvalue_p.h b/src/qml/jsapi/qjsvalue_p.h
index 43a3a74e38..93a28a4a5f 100644
--- a/src/qml/jsapi/qjsvalue_p.h
+++ b/src/qml/jsapi/qjsvalue_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -52,37 +52,122 @@
#include <private/qv4engine_p.h>
#include <private/qv4object_p.h>
#include <private/qflagpointer_p.h>
+#include <private/qv4mm_p.h>
+#include <private/qv4persistent_p.h>
QT_BEGIN_NAMESPACE
-/*!
- \internal
- \class QJSValuePrivate
-*/
-class Q_QML_PRIVATE_EXPORT QJSValuePrivate : public QV4::PersistentValuePrivate
+class QJSValuePrivate
{
public:
- QJSValuePrivate(QV4::ExecutionEngine *engine, const QV4::ValueRef v)
- : PersistentValuePrivate(v.asReturnedValue(), engine)
+ static inline QV4::Value *getValue(const QJSValue *jsval)
{
- Q_ASSERT(!value.isEmpty());
+ if (jsval->d & 3)
+ return 0;
+ return reinterpret_cast<QV4::Value *>(jsval->d);
}
- QJSValuePrivate(QV4::ReturnedValue v)
- : PersistentValuePrivate(v)
+
+ static inline QVariant *getVariant(const QJSValue *jsval)
{
- Q_ASSERT(!value.isEmpty());
+ if (jsval->d & 1)
+ return reinterpret_cast<QVariant *>(jsval->d & ~3);
+ return 0;
+ }
+
+ static inline void setVariant(QJSValue *jsval, const QVariant &v) {
+ QVariant *val = new QVariant(v);
+ jsval->d = reinterpret_cast<quintptr>(val) | 1;
+ }
+
+ static inline void setValue(QJSValue *jsval, QV4::ExecutionEngine *engine, const QV4::Value &v) {
+ QV4::Value *value = engine->memoryManager->m_persistentValues->allocate();
+ *value = v;
+ jsval->d = reinterpret_cast<quintptr>(value);
}
- QJSValuePrivate(const QString &s)
- : PersistentValuePrivate(QV4::Primitive::emptyValue().asReturnedValue()),
- unboundData(s)
+
+ static inline void setValue(QJSValue *jsval, QV4::ExecutionEngine *engine, QV4::ReturnedValue v) {
+ QV4::Value *value = engine->memoryManager->m_persistentValues->allocate();
+ *value = v;
+ jsval->d = reinterpret_cast<quintptr>(value);
+ }
+
+ static QV4::ReturnedValue convertedToValue(QV4::ExecutionEngine *e, const QJSValue &jsval)
{
+ QV4::Value *v = getValue(&jsval);
+ if (!v) {
+ QVariant *variant = getVariant(&jsval);
+ v = e->memoryManager->m_persistentValues->allocate();
+ *v = variant ? e->fromVariant(*variant) : QV4::Encode::undefined();
+ jsval.d = reinterpret_cast<quintptr>(v);
+ delete variant;
+ }
+
+ if (QV4::PersistentValueStorage::getEngine(v) != e) {
+ qWarning("JSValue can't be reassigned to another engine.");
+ return QV4::Encode::undefined();
+ }
+
+ return v->asReturnedValue();
+ }
+
+ static QV4::Value *valueForData(const QJSValue *jsval, QV4::Value *scratch)
+ {
+ QV4::Value *v = getValue(jsval);
+ if (v)
+ return v;
+ v = scratch;
+ QVariant *variant = getVariant(jsval);
+ if (!variant) {
+ *v = QV4::Encode::undefined();
+ return v;
+ }
+
+ switch (variant->userType()) {
+ case QMetaType::UnknownType:
+ case QMetaType::Void:
+ *v = QV4::Encode::undefined();
+ break;
+ case QMetaType::VoidStar:
+ *v = QV4::Encode::null();
+ break;
+ case QMetaType::Bool:
+ *v = QV4::Encode(variant->toBool());
+ break;
+ case QMetaType::Double:
+ *v = QV4::Encode(variant->toDouble());
+ break;
+ case QMetaType::Int:
+ case QMetaType::Short:
+ case QMetaType::UShort:
+ case QMetaType::Char:
+ case QMetaType::UChar:
+ *v = QV4::Encode(variant->toInt());
+ break;
+ case QMetaType::UInt:
+ *v = QV4::Encode(variant->toUInt());
+ break;
+ default:
+ return 0;
+ }
+ return v;
}
- QV4::ReturnedValue getValue(QV4::ExecutionEngine *e);
+ static QV4::ExecutionEngine *engine(const QJSValue *jsval) {
+ QV4::Value *v = getValue(jsval);
+ return v ? QV4::PersistentValueStorage::getEngine(v) : 0;
+ }
- static QJSValuePrivate *get(const QJSValue &v) { return v.d; }
+ static inline bool checkEngine(QV4::ExecutionEngine *e, const QJSValue &jsval) {
+ QV4::ExecutionEngine *v4 = engine(&jsval);
+ return !v4 || v4 == e;
+ }
- QVariant unboundData;
+ static inline void free(QJSValue *jsval) {
+ if (QV4::Value *v = QJSValuePrivate::getValue(jsval))
+ QV4::PersistentValueStorage::free(v);
+ else if (QVariant *v = QJSValuePrivate::getVariant(jsval))
+ delete v;
+ }
};
QT_END_NAMESPACE
diff --git a/src/qml/jsapi/qjsvalueiterator.cpp b/src/qml/jsapi/qjsvalueiterator.cpp
index f7976e7cfc..1ee4121f5c 100644
--- a/src/qml/jsapi/qjsvalueiterator.cpp
+++ b/src/qml/jsapi/qjsvalueiterator.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -36,6 +36,7 @@
#include "qjsvalue_p.h"
#include "private/qv4string_p.h"
#include "private/qv4object_p.h"
+#include "private/qv4context_p.h"
QT_BEGIN_NAMESPACE
@@ -44,14 +45,13 @@ QJSValueIteratorPrivate::QJSValueIteratorPrivate(const QJSValue &v)
, currentIndex(UINT_MAX)
, nextIndex(UINT_MAX)
{
- QJSValuePrivate *jsp = QJSValuePrivate::get(value);
- QV4::ExecutionEngine *e = jsp->engine;
+ QV4::ExecutionEngine *e = QJSValuePrivate::engine(&v);
if (!e)
return;
QV4::Scope scope(e);
- QV4::ScopedObject o(scope, jsp->value);
- iterator = e->newForEachIteratorObject(e->currentContext(), o)->asReturnedValue();
+ QV4::ScopedObject o(scope, QJSValuePrivate::getValue(&v));
+ iterator.set(e, e->newForEachIteratorObject(o));
currentName = (QV4::String *)0;
nextName = (QV4::String *)0;
@@ -101,8 +101,8 @@ QJSValueIterator::QJSValueIterator(const QJSValue& object)
QV4::Scope scope(v4);
QV4::Scoped<QV4::ForEachIteratorObject> it(scope, d_ptr->iterator.value());
it->d()->it.flags = QV4::ObjectIterator::NoFlags;
- QV4::String *nm = 0;
- it->d()->it.next(nm, &d_ptr->nextIndex, &d_ptr->nextProperty, &d_ptr->nextAttributes);
+ QV4::ScopedString nm(scope);
+ it->d()->it.next(nm.getRef(), &d_ptr->nextIndex, &d_ptr->nextProperty, &d_ptr->nextAttributes);
d_ptr->nextName = nm;
}
@@ -122,7 +122,8 @@ QJSValueIterator::~QJSValueIterator()
*/
bool QJSValueIterator::hasNext() const
{
- if (!QJSValuePrivate::get(d_ptr->value)->value.isObject())
+ QV4::Value *val = QJSValuePrivate::getValue(&d_ptr->value);
+ if (!val || !val->isObject())
return false;
return !!d_ptr->nextName || d_ptr->nextIndex != UINT_MAX;
}
@@ -137,11 +138,12 @@ bool QJSValueIterator::hasNext() const
*/
bool QJSValueIterator::next()
{
- if (!QJSValuePrivate::get(d_ptr->value)->value.isObject())
+ QV4::Value *val = QJSValuePrivate::getValue(&d_ptr->value);
+ if (!val || !val->isObject())
return false;
d_ptr->currentName = d_ptr->nextName;
d_ptr->currentIndex = d_ptr->nextIndex;
- d_ptr->currentProperty.copy(d_ptr->nextProperty, d_ptr->nextAttributes);
+ d_ptr->currentProperty.copy(&d_ptr->nextProperty, d_ptr->nextAttributes);
d_ptr->currentAttributes = d_ptr->nextAttributes;
QV4::ExecutionEngine *v4 = d_ptr->iterator.engine();
@@ -149,8 +151,8 @@ bool QJSValueIterator::next()
return false;
QV4::Scope scope(v4);
QV4::Scoped<QV4::ForEachIteratorObject> it(scope, d_ptr->iterator.value());
- QV4::String *nm = 0;
- it->d()->it.next(nm, &d_ptr->nextIndex, &d_ptr->nextProperty, &d_ptr->nextAttributes);
+ QV4::ScopedString nm(scope);
+ it->d()->it.next(nm.getRef(), &d_ptr->nextIndex, &d_ptr->nextProperty, &d_ptr->nextAttributes);
d_ptr->nextName = nm;
return !!d_ptr->currentName || d_ptr->currentIndex != UINT_MAX;
}
@@ -163,7 +165,8 @@ bool QJSValueIterator::next()
*/
QString QJSValueIterator::name() const
{
- if (!QJSValuePrivate::get(d_ptr->value)->value.isObject())
+ QV4::Value *val = QJSValuePrivate::getValue(&d_ptr->value);
+ if (!val || !val->isObject())
return QString();
if (!!d_ptr->currentName)
return d_ptr->currentName->toQString();
@@ -185,20 +188,19 @@ QJSValue QJSValueIterator::value() const
if (!engine)
return QJSValue();
QV4::Scope scope(engine);
- QV4::ScopedObject obj(scope, QJSValuePrivate::get(d_ptr->value)->value);
+ QV4::ScopedObject obj(scope, QJSValuePrivate::getValue(&d_ptr->value));
if (!obj)
return QJSValue();
- QV4::ExecutionContext *ctx = engine->currentContext();
if (!d_ptr->currentName && d_ptr->currentIndex == UINT_MAX)
return QJSValue();
- QV4::ScopedValue v(scope, obj->getValue(obj, &d_ptr->currentProperty, d_ptr->currentAttributes));
+ QV4::ScopedValue v(scope, obj->getValue(*obj, &d_ptr->currentProperty, d_ptr->currentAttributes));
if (scope.hasException()) {
- ctx->catchException();
+ engine->catchException();
return QJSValue();
}
- return new QJSValuePrivate(engine, v);
+ return QJSValue(engine, v->asReturnedValue());
}
@@ -216,18 +218,17 @@ QJSValueIterator& QJSValueIterator::operator=(QJSValue& object)
d_ptr->nextName = (QV4::String *)0;
QV4::ExecutionEngine *v4 = d_ptr->iterator.engine();
if (!v4) {
- d_ptr->iterator = QV4::Encode::undefined();
+ d_ptr->iterator.clear();
return *this;
}
- QJSValuePrivate *jsp = QJSValuePrivate::get(object);
QV4::Scope scope(v4);
- QV4::ScopedObject o(scope, jsp->value);
- d_ptr->iterator = v4->newForEachIteratorObject(v4->currentContext(), o)->asReturnedValue();
+ QV4::ScopedObject o(scope, QJSValuePrivate::getValue(&object));
+ d_ptr->iterator.set(v4, v4->newForEachIteratorObject(o));
QV4::Scoped<QV4::ForEachIteratorObject> it(scope, d_ptr->iterator.value());
it->d()->it.flags = QV4::ObjectIterator::NoFlags;
- QV4::String *nm = 0;
- it->d()->it.next(nm, &d_ptr->nextIndex, &d_ptr->nextProperty, &d_ptr->nextAttributes);
+ QV4::ScopedString nm(scope);
+ it->d()->it.next(nm.getRef(), &d_ptr->nextIndex, &d_ptr->nextProperty, &d_ptr->nextAttributes);
d_ptr->nextName = nm;
return *this;
}
diff --git a/src/qml/jsapi/qjsvalueiterator.h b/src/qml/jsapi/qjsvalueiterator.h
index 0cca5a9f97..7ef348adb5 100644
--- a/src/qml/jsapi/qjsvalueiterator.h
+++ b/src/qml/jsapi/qjsvalueiterator.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/jsapi/qjsvalueiterator_p.h b/src/qml/jsapi/qjsvalueiterator_p.h
index fe1d3aa932..c17fedf73e 100644
--- a/src/qml/jsapi/qjsvalueiterator_p.h
+++ b/src/qml/jsapi/qjsvalueiterator_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -48,10 +48,12 @@ public:
QJSValue value;
QV4::PersistentValue iterator;
+ // ### GC
QV4::Property currentProperty;
QV4::PropertyAttributes currentAttributes;
QV4::StringValue currentName;
uint currentIndex;
+ // ### GC
QV4::Property nextProperty;
QV4::PropertyAttributes nextAttributes;
QV4::StringValue nextName;
diff --git a/src/qml/jsruntime/jsruntime.pri b/src/qml/jsruntime/jsruntime.pri
index c27aaa90d8..ef44ca6f4d 100644
--- a/src/qml/jsruntime/jsruntime.pri
+++ b/src/qml/jsruntime/jsruntime.pri
@@ -42,7 +42,10 @@ SOURCES += \
$$PWD/qv4qobjectwrapper.cpp \
$$PWD/qv4qmlextensions.cpp \
$$PWD/qv4vme_moth.cpp \
- $$PWD/qv4profiling.cpp
+ $$PWD/qv4profiling.cpp \
+ $$PWD/qv4arraybuffer.cpp \
+ $$PWD/qv4typedarray.cpp \
+ $$PWD/qv4dataview.cpp
HEADERS += \
$$PWD/qv4global_p.h \
@@ -89,7 +92,10 @@ HEADERS += \
$$PWD/qv4qobjectwrapper_p.h \
$$PWD/qv4qmlextensions_p.h \
$$PWD/qv4vme_moth_p.h \
- $$PWD/qv4profiling_p.h
+ $$PWD/qv4profiling_p.h \
+ $$PWD/qv4arraybuffer_p.h \
+ $$PWD/qv4typedarray_p.h \
+ $$PWD/qv4dataview_p.h
}
diff --git a/src/qml/jsruntime/qv4alloca_p.h b/src/qml/jsruntime/qv4alloca_p.h
index 31eabf0748..a4537868e2 100644
--- a/src/qml/jsruntime/qv4alloca_p.h
+++ b/src/qml/jsruntime/qv4alloca_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/jsruntime/qv4argumentsobject.cpp b/src/qml/jsruntime/qv4argumentsobject.cpp
index 4af8927a2e..92c77570af 100644
--- a/src/qml/jsruntime/qv4argumentsobject.cpp
+++ b/src/qml/jsruntime/qv4argumentsobject.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -38,18 +38,19 @@ using namespace QV4;
DEFINE_OBJECT_VTABLE(ArgumentsObject);
-ArgumentsObject::Data::Data(CallContext *context)
- : Object::Data(context->d()->strictMode ? context->d()->engine->strictArgumentsObjectClass : context->d()->engine->argumentsObjectClass)
- , context(context)
+Heap::ArgumentsObject::ArgumentsObject(QV4::CallContext *context)
+ : Heap::Object(context->d()->strictMode ? context->d()->engine->strictArgumentsObjectClass : context->d()->engine->argumentsObjectClass,
+ context->d()->engine->objectPrototype.asObject())
+ , context(context->d())
, fullyCreated(false)
{
- Q_ASSERT(internalClass->vtable == staticVTable());
+ Q_ASSERT(vtable == QV4::ArgumentsObject::staticVTable());
ExecutionEngine *v4 = context->d()->engine;
Scope scope(v4);
- Scoped<ArgumentsObject> args(scope, this);
+ Scoped<QV4::ArgumentsObject> args(scope, this);
- args->setArrayType(ArrayData::Complex);
+ args->setArrayType(Heap::ArrayData::Complex);
if (context->d()->strictMode) {
Q_ASSERT(CalleePropertyIndex == args->internalClass()->find(context->d()->engine->id_callee));
@@ -59,16 +60,15 @@ ArgumentsObject::Data::Data(CallContext *context)
args->propertyAt(CallerPropertyIndex)->value = v4->thrower;
args->propertyAt(CallerPropertyIndex)->set = v4->thrower;
- args->arrayReserve(context->d()->callData->argc);
- args->arrayPut(0, context->d()->callData->args, context->d()->callData->argc);
+ args->arrayReserve(context->argc());
+ args->arrayPut(0, context->args(), context->argc());
args->d()->fullyCreated = true;
} else {
- args->setHasAccessorProperty();
Q_ASSERT(CalleePropertyIndex == args->internalClass()->find(context->d()->engine->id_callee));
- args->memberData()[CalleePropertyIndex] = context->d()->function->asReturnedValue();
+ args->memberData()->data[CalleePropertyIndex] = context->d()->function->asReturnedValue();
}
Q_ASSERT(LengthPropertyIndex == args->internalClass()->find(context->d()->engine->id_length));
- args->memberData()[LengthPropertyIndex] = Primitive::fromInt32(context->d()->realArgumentCount);
+ args->memberData()->data[LengthPropertyIndex] = Primitive::fromInt32(context->d()->callData->argc);
}
void ArgumentsObject::fullyCreate()
@@ -76,55 +76,61 @@ void ArgumentsObject::fullyCreate()
if (fullyCreated())
return;
- uint numAccessors = qMin((int)context()->d()->function->formalParameterCount(), context()->d()->realArgumentCount);
- uint argCount = qMin(context()->d()->realArgumentCount, context()->d()->callData->argc);
- ArrayData::realloc(this, ArrayData::Sparse, argCount, true);
- context()->d()->engine->requireArgumentsAccessors(numAccessors);
- mappedArguments().ensureIndex(engine(), numAccessors);
+ uint numAccessors = qMin((int)context()->function->formalParameterCount(), context()->callData->argc);
+ uint argCount = context()->callData->argc;
+ ArrayData::realloc(this, Heap::ArrayData::Sparse, argCount, true);
+ context()->engine->requireArgumentsAccessors(numAccessors);
+
+ Scope scope(engine());
+ Scoped<MemberData> md(scope, d()->mappedArguments);
+ if (!md || md->size() < numAccessors)
+ d()->mappedArguments = md->reallocate(engine(), d()->mappedArguments, numAccessors);
for (uint i = 0; i < (uint)numAccessors; ++i) {
- mappedArguments()[i] = context()->d()->callData->args[i];
- arraySet(i, context()->d()->engine->argumentsAccessors[i], Attr_Accessor);
+ mappedArguments()->data[i] = context()->callData->args[i];
+ arraySet(i, context()->engine->argumentsAccessors + i, Attr_Accessor);
}
- arrayPut(numAccessors, context()->d()->callData->args + numAccessors, argCount - numAccessors);
+ arrayPut(numAccessors, context()->callData->args + numAccessors, argCount - numAccessors);
for (uint i = numAccessors; i < argCount; ++i)
setArrayAttributes(i, Attr_Data);
d()->fullyCreated = true;
}
-bool ArgumentsObject::defineOwnProperty(ExecutionContext *ctx, uint index, const Property &desc, PropertyAttributes attrs)
+bool ArgumentsObject::defineOwnProperty(ExecutionEngine *engine, uint index, const Property *desc, PropertyAttributes attrs)
{
fullyCreate();
- Scope scope(ctx);
+ Scope scope(engine);
Property *pd = arrayData() ? arrayData()->getProperty(index) : 0;
- Property map;
+ ScopedProperty map(scope);
PropertyAttributes mapAttrs;
bool isMapped = false;
- uint numAccessors = qMin((int)context()->d()->function->formalParameterCount(), context()->d()->realArgumentCount);
+ uint numAccessors = qMin((int)context()->function->formalParameterCount(), context()->callData->argc);
if (pd && index < (uint)numAccessors)
- isMapped = arrayData()->attributes(index).isAccessor() && pd->getter() == context()->d()->engine->argumentsAccessors[index].getter();
+ isMapped = arrayData()->attributes(index).isAccessor() &&
+ pd->getter() == context()->engine->argumentsAccessors[index].getter();
if (isMapped) {
Q_ASSERT(arrayData());
mapAttrs = arrayData()->attributes(index);
- map.copy(*pd, mapAttrs);
+ map->copy(pd, mapAttrs);
setArrayAttributes(index, Attr_Data);
pd = arrayData()->getProperty(index);
- pd->value = mappedArguments()[index];
+ pd->value = mappedArguments()->data[index];
}
- bool strict = ctx->d()->strictMode;
- ctx->d()->strictMode = false;
- bool result = Object::defineOwnProperty2(ctx, index, desc, attrs);
- ctx->d()->strictMode = strict;
+ bool strict = engine->currentContext()->strictMode;
+ engine->currentContext()->strictMode = false;
+ bool result = Object::defineOwnProperty2(scope.engine, index, desc, attrs);
+ engine->currentContext()->strictMode = strict;
if (isMapped && attrs.isData()) {
Q_ASSERT(arrayData());
+ ScopedFunctionObject setter(scope, map->setter());
ScopedCallData callData(scope, 1);
callData->thisObject = this->asReturnedValue();
- callData->args[0] = desc.value;
- map.setter()->call(callData);
+ callData->args[0] = desc->value;
+ setter->call(callData);
if (attrs.isWritable()) {
setArrayAttributes(index, mapAttrs);
@@ -133,8 +139,8 @@ bool ArgumentsObject::defineOwnProperty(ExecutionContext *ctx, uint index, const
}
}
- if (ctx->d()->strictMode && !result)
- return ctx->throwTypeError();
+ if (engine->currentContext()->strictMode && !result)
+ return engine->throwTypeError();
return result;
}
@@ -144,20 +150,20 @@ ReturnedValue ArgumentsObject::getIndexed(Managed *m, uint index, bool *hasPrope
if (args->fullyCreated())
return Object::getIndexed(m, index, hasProperty);
- if (index < static_cast<uint>(args->context()->d()->callData->argc)) {
+ if (index < static_cast<uint>(args->context()->callData->argc)) {
if (hasProperty)
*hasProperty = true;
- return args->context()->d()->callData->args[index].asReturnedValue();
+ return args->context()->callData->args[index].asReturnedValue();
}
if (hasProperty)
*hasProperty = false;
return Encode::undefined();
}
-void ArgumentsObject::putIndexed(Managed *m, uint index, const ValueRef value)
+void ArgumentsObject::putIndexed(Managed *m, uint index, const Value &value)
{
ArgumentsObject *args = static_cast<ArgumentsObject *>(m);
- if (!args->fullyCreated() && index >= static_cast<uint>(args->context()->d()->callData->argc))
+ if (!args->fullyCreated() && index >= static_cast<uint>(args->context()->callData->argc))
args->fullyCreate();
if (args->fullyCreated()) {
@@ -165,7 +171,7 @@ void ArgumentsObject::putIndexed(Managed *m, uint index, const ValueRef value)
return;
}
- args->context()->d()->callData->args[index] = value;
+ args->context()->callData->args[index] = value;
}
bool ArgumentsObject::deleteIndexedProperty(Managed *m, uint index)
@@ -182,8 +188,8 @@ PropertyAttributes ArgumentsObject::queryIndexed(const Managed *m, uint index)
if (args->fullyCreated())
return Object::queryIndexed(m, index);
- uint numAccessors = qMin((int)args->context()->d()->function->formalParameterCount(), args->context()->d()->realArgumentCount);
- uint argCount = qMin(args->context()->d()->realArgumentCount, args->context()->d()->callData->argc);
+ uint numAccessors = qMin((int)args->context()->function->formalParameterCount(), args->context()->callData->argc);
+ uint argCount = args->context()->callData->argc;
if (index >= argCount)
return PropertyAttributes();
if (index >= numAccessors)
@@ -195,39 +201,40 @@ DEFINE_OBJECT_VTABLE(ArgumentsGetterFunction);
ReturnedValue ArgumentsGetterFunction::call(Managed *getter, CallData *callData)
{
- ExecutionEngine *v4 = getter->engine();
+ ExecutionEngine *v4 = static_cast<ArgumentsGetterFunction *>(getter)->engine();
Scope scope(v4);
Scoped<ArgumentsGetterFunction> g(scope, static_cast<ArgumentsGetterFunction *>(getter));
Scoped<ArgumentsObject> o(scope, callData->thisObject.as<ArgumentsObject>());
if (!o)
- return v4->currentContext()->throwTypeError();
+ return v4->throwTypeError();
- Q_ASSERT(g->index() < static_cast<unsigned>(o->context()->d()->callData->argc));
- return o->context()->argument(g->index());
+ Q_ASSERT(g->index() < static_cast<unsigned>(o->context()->callData->argc));
+ return o->context()->callData->args[g->index()].asReturnedValue();
}
DEFINE_OBJECT_VTABLE(ArgumentsSetterFunction);
ReturnedValue ArgumentsSetterFunction::call(Managed *setter, CallData *callData)
{
- ExecutionEngine *v4 = setter->engine();
+ ExecutionEngine *v4 = static_cast<ArgumentsSetterFunction *>(setter)->engine();
Scope scope(v4);
Scoped<ArgumentsSetterFunction> s(scope, static_cast<ArgumentsSetterFunction *>(setter));
Scoped<ArgumentsObject> o(scope, callData->thisObject.as<ArgumentsObject>());
if (!o)
- return v4->currentContext()->throwTypeError();
+ return v4->throwTypeError();
- Q_ASSERT(s->index() < static_cast<unsigned>(o->context()->d()->callData->argc));
- o->context()->d()->callData->args[s->index()] = callData->argc ? callData->args[0].asReturnedValue() : Encode::undefined();
+ Q_ASSERT(s->index() < static_cast<unsigned>(o->context()->callData->argc));
+ o->context()->callData->args[s->index()] = callData->argc ? callData->args[0].asReturnedValue() : Encode::undefined();
return Encode::undefined();
}
-void ArgumentsObject::markObjects(Managed *that, ExecutionEngine *e)
+void ArgumentsObject::markObjects(Heap::Base *that, ExecutionEngine *e)
{
- ArgumentsObject *o = static_cast<ArgumentsObject *>(that);
- if (o->context())
- o->context()->mark(e);
- o->mappedArguments().mark(e);
+ ArgumentsObject::Data *o = static_cast<ArgumentsObject::Data *>(that);
+ if (o->context)
+ o->context->mark(e);
+ if (o->mappedArguments)
+ o->mappedArguments->mark(e);
Object::markObjects(that, e);
}
diff --git a/src/qml/jsruntime/qv4argumentsobject_p.h b/src/qml/jsruntime/qv4argumentsobject_p.h
index 786cb36d0a..43cd6d1dee 100644
--- a/src/qml/jsruntime/qv4argumentsobject_p.h
+++ b/src/qml/jsruntime/qv4argumentsobject_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -40,73 +40,82 @@ QT_BEGIN_NAMESPACE
namespace QV4 {
+namespace Heap {
+
+struct ArgumentsGetterFunction : FunctionObject {
+ inline ArgumentsGetterFunction(QV4::ExecutionContext *scope, uint index);
+ uint index;
+};
+
+struct ArgumentsSetterFunction : FunctionObject {
+ inline ArgumentsSetterFunction(QV4::ExecutionContext *scope, uint index);
+ uint index;
+};
+
+struct ArgumentsObject : Object {
+ enum {
+ LengthPropertyIndex = 0,
+ CalleePropertyIndex = 1,
+ CallerPropertyIndex = 3
+ };
+ ArgumentsObject(QV4::CallContext *context);
+ CallContext *context;
+ bool fullyCreated;
+ MemberData *mappedArguments;
+};
+
+}
+
struct ArgumentsGetterFunction: FunctionObject
{
- struct Data : FunctionObject::Data {
- Data(ExecutionContext *scope, uint index)
- : FunctionObject::Data(scope)
- , index(index)
- {
- setVTable(staticVTable());
- }
- uint index;
- };
- V4_OBJECT(FunctionObject)
+ V4_OBJECT2(ArgumentsGetterFunction, FunctionObject)
uint index() const { return d()->index; }
-
static ReturnedValue call(Managed *that, CallData *d);
};
+inline
+Heap::ArgumentsGetterFunction::ArgumentsGetterFunction(QV4::ExecutionContext *scope, uint index)
+ : Heap::FunctionObject(scope)
+ , index(index)
+{
+}
+
struct ArgumentsSetterFunction: FunctionObject
{
- struct Data : FunctionObject::Data {
- Data(ExecutionContext *scope, uint index)
- : FunctionObject::Data(scope)
- , index(index)
- {
- setVTable(staticVTable());
- }
- uint index;
- };
- V4_OBJECT(FunctionObject)
+ V4_OBJECT2(ArgumentsSetterFunction, FunctionObject)
uint index() const { return d()->index; }
-
static ReturnedValue call(Managed *that, CallData *callData);
};
+inline
+Heap::ArgumentsSetterFunction::ArgumentsSetterFunction(QV4::ExecutionContext *scope, uint index)
+ : Heap::FunctionObject(scope)
+ , index(index)
+{
+}
+
struct ArgumentsObject: Object {
- struct Data : Object::Data {
- Data(CallContext *context);
- CallContext *context;
- bool fullyCreated;
- Members mappedArguments;
- };
- V4_OBJECT(Object)
+ V4_OBJECT2(ArgumentsObject, Object)
Q_MANAGED_TYPE(ArgumentsObject)
- CallContext *context() const { return d()->context; }
+ Heap::CallContext *context() const { return d()->context; }
bool fullyCreated() const { return d()->fullyCreated; }
- Members &mappedArguments() { return d()->mappedArguments; }
+ Heap::MemberData *mappedArguments() { return d()->mappedArguments; }
static bool isNonStrictArgumentsObject(Managed *m) {
- return m->internalClass()->vtable->type == Type_ArgumentsObject &&
- !static_cast<ArgumentsObject *>(m)->context()->d()->strictMode;
+ return m->d()->vtable->type == Type_ArgumentsObject &&
+ !static_cast<ArgumentsObject *>(m)->context()->strictMode;
}
- enum {
- LengthPropertyIndex = 0,
- CalleePropertyIndex = 1,
- CallerPropertyIndex = 3
- };
- bool defineOwnProperty(ExecutionContext *ctx, uint index, const Property &desc, PropertyAttributes attrs);
+ bool defineOwnProperty(ExecutionEngine *engine, uint index, const Property *desc, PropertyAttributes attrs);
static ReturnedValue getIndexed(Managed *m, uint index, bool *hasProperty);
- static void putIndexed(Managed *m, uint index, const ValueRef value);
+ static void putIndexed(Managed *m, uint index, const Value &value);
static bool deleteIndexedProperty(Managed *m, uint index);
static PropertyAttributes queryIndexed(const Managed *m, uint index);
- static void markObjects(Managed *that, ExecutionEngine *e);
+ static void markObjects(Heap::Base *that, ExecutionEngine *e);
void fullyCreate();
};
diff --git a/src/qml/jsruntime/qv4arraybuffer.cpp b/src/qml/jsruntime/qv4arraybuffer.cpp
new file mode 100644
index 0000000000..dc65b5d21a
--- /dev/null
+++ b/src/qml/jsruntime/qv4arraybuffer.cpp
@@ -0,0 +1,189 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "qv4arraybuffer_p.h"
+#include "qv4typedarray_p.h"
+#include "qv4dataview_p.h"
+
+using namespace QV4;
+
+DEFINE_OBJECT_VTABLE(ArrayBufferCtor);
+DEFINE_OBJECT_VTABLE(ArrayBuffer);
+
+Heap::ArrayBufferCtor::ArrayBufferCtor(QV4::ExecutionContext *scope)
+ : Heap::FunctionObject(scope, QStringLiteral("ArrayBuffer"))
+{
+}
+
+ReturnedValue ArrayBufferCtor::construct(Managed *m, CallData *callData)
+{
+ ExecutionEngine *v4 = static_cast<Object *>(m)->engine();
+
+ Scope scope(v4);
+ ScopedValue l(scope, callData->argument(0));
+ double dl = l->toInteger();
+ if (v4->hasException)
+ return Encode::undefined();
+ uint len = (uint)qBound(0., dl, (double)UINT_MAX);
+ if (len != dl)
+ return v4->throwRangeError(QLatin1String("ArrayBuffer constructor: invalid length"));
+
+ Scoped<ArrayBuffer> a(scope, v4->memoryManager->alloc<ArrayBuffer>(v4, len));
+ if (scope.engine->hasException)
+ return Encode::undefined();
+ return a.asReturnedValue();
+}
+
+
+ReturnedValue ArrayBufferCtor::call(Managed *that, CallData *callData)
+{
+ return construct(that, callData);
+}
+
+ReturnedValue ArrayBufferCtor::method_isView(CallContext *ctx)
+{
+ QV4::Scope scope(ctx);
+ QV4::Scoped<TypedArray> a(scope, ctx->argument(0));
+ if (!!a)
+ return Encode(true);
+ QV4::Scoped<DataView> v(scope, ctx->argument(0));
+ if (!!v)
+ return Encode(true);
+ return Encode(false);
+}
+
+
+Heap::ArrayBuffer::ArrayBuffer(ExecutionEngine *e, size_t length)
+ : Heap::Object(e->emptyClass, e->arrayBufferPrototype.asObject())
+{
+ data = QTypedArrayData<char>::allocate(length + 1);
+ if (!data) {
+ data = 0;
+ e->throwRangeError(QStringLiteral("ArrayBuffer: out of memory"));
+ return;
+ }
+ data->size = int(length);
+ memset(data->data(), 0, length + 1);
+}
+
+Heap::ArrayBuffer::ArrayBuffer(ExecutionEngine *e, const QByteArray& array)
+ : Heap::Object(e->emptyClass, e->arrayBufferPrototype.asObject())
+ , data(const_cast<QByteArray&>(array).data_ptr())
+{
+ data->ref.ref();
+}
+
+Heap::ArrayBuffer::~ArrayBuffer()
+{
+ if (!data->ref.deref())
+ QTypedArrayData<char>::deallocate(data);
+}
+
+QByteArray ArrayBuffer::asByteArray() const
+{
+ QByteArrayDataPtr ba = { d()->data };
+ ba.ptr->ref.ref();
+ return QByteArray(ba);
+}
+
+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 ArrayBufferPrototype::init(ExecutionEngine *engine, Object *ctor)
+{
+ Scope scope(engine);
+ ScopedObject o(scope);
+ ctor->defineReadonlyProperty(engine->id_length, Primitive::fromInt32(1));
+ ctor->defineReadonlyProperty(engine->id_prototype, (o = this));
+ ctor->defineDefaultProperty(QStringLiteral("isView"), ArrayBufferCtor::method_isView, 1);
+ defineDefaultProperty(engine->id_constructor, (o = ctor));
+ defineAccessorProperty(QStringLiteral("byteLength"), method_get_byteLength, 0);
+ defineDefaultProperty(QStringLiteral("slice"), method_slice, 2);
+}
+
+ReturnedValue ArrayBufferPrototype::method_get_byteLength(CallContext *ctx)
+{
+ Scope scope(ctx);
+ Scoped<ArrayBuffer> v(scope, ctx->thisObject());
+ if (!v)
+ return scope.engine->throwTypeError();
+
+ return Encode(v->d()->data->size);
+}
+
+ReturnedValue ArrayBufferPrototype::method_slice(CallContext *ctx)
+{
+ Scope scope(ctx);
+ Scoped<ArrayBuffer> a(scope, ctx->thisObject());
+ if (!a)
+ return scope.engine->throwTypeError();
+
+ double start = ctx->argc() > 0 ? ctx->args()[0].toInteger() : 0;
+ double end = (ctx->argc() < 2 || ctx->args()[1].isUndefined()) ?
+ a->d()->data->size : ctx->args()[1].toInteger();
+ if (scope.engine->hasException)
+ return 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);
+
+ ScopedFunctionObject constructor(scope, a->get(scope.engine->id_constructor));
+ if (!constructor)
+ return scope.engine->throwTypeError();
+
+ ScopedCallData callData(scope, 1);
+ double newLen = qMax(final - first, 0.);
+ callData->args[0] = QV4::Encode(newLen);
+ QV4::Scoped<ArrayBuffer> newBuffer(scope, constructor->construct(callData));
+ if (!newBuffer || newBuffer->d()->data->size < (int)newLen)
+ return scope.engine->throwTypeError();
+
+ memcpy(newBuffer->d()->data->data(), a->d()->data->data() + (uint)first, newLen);
+
+ return newBuffer.asReturnedValue();
+}
diff --git a/src/qml/jsruntime/qv4arraybuffer_p.h b/src/qml/jsruntime/qv4arraybuffer_p.h
new file mode 100644
index 0000000000..fe3150618d
--- /dev/null
+++ b/src/qml/jsruntime/qv4arraybuffer_p.h
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QV4ARRAYBUFFER_H
+#define QV4ARRAYBUFFER_H
+
+#include "qv4object_p.h"
+#include "qv4functionobject_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace QV4 {
+
+namespace Heap {
+
+struct ArrayBufferCtor : FunctionObject {
+ ArrayBufferCtor(QV4::ExecutionContext *scope);
+};
+
+struct Q_QML_PRIVATE_EXPORT ArrayBuffer : Object {
+ ArrayBuffer(ExecutionEngine *e, size_t length);
+ ArrayBuffer(ExecutionEngine *e, const QByteArray& array);
+ ~ArrayBuffer();
+ QTypedArrayData<char> *data;
+
+ uint byteLength() const { return data->size; }
+};
+
+}
+
+struct ArrayBufferCtor: FunctionObject
+{
+ V4_OBJECT2(ArrayBufferCtor, FunctionObject)
+
+ static ReturnedValue construct(Managed *m, CallData *callData);
+ static ReturnedValue call(Managed *that, CallData *callData);
+
+ static ReturnedValue method_isView(CallContext *ctx);
+
+};
+
+struct Q_QML_PRIVATE_EXPORT ArrayBuffer : Object
+{
+ V4_OBJECT2(ArrayBuffer, Object)
+ V4_NEEDS_DESTROY
+
+ QByteArray asByteArray() const;
+ uint byteLength() const { return d()->byteLength(); }
+ char *data() { detach(); return d()->data ? d()->data->data() : 0; }
+ const char *constData() { detach(); return d()->data ? d()->data->data() : 0; }
+
+private:
+ void detach();
+};
+
+struct ArrayBufferPrototype: Object
+{
+ void init(ExecutionEngine *engine, Object *ctor);
+
+ static ReturnedValue method_get_byteLength(CallContext *ctx);
+ static ReturnedValue method_slice(CallContext *ctx);
+};
+
+
+} // namespace QV4
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/qml/jsruntime/qv4arraydata.cpp b/src/qml/jsruntime/qv4arraydata.cpp
index 0aaf50a43c..afcfa00905 100644
--- a/src/qml/jsruntime/qv4arraydata.cpp
+++ b/src/qml/jsruntime/qv4arraydata.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -34,6 +34,8 @@
#include "qv4object_p.h"
#include "qv4functionobject_p.h"
#include "qv4mm_p.h"
+#include "qv4runtime_p.h"
+#include "qv4argumentsobject_p.h"
using namespace QV4;
@@ -56,14 +58,13 @@ const QV4::ManagedVTable QV4::ArrayData::static_vtbl = {
const ArrayVTable SimpleArrayData::static_vtbl =
{
DEFINE_MANAGED_VTABLE_INT(SimpleArrayData, 0),
- SimpleArrayData::Simple,
+ Heap::ArrayData::Simple,
SimpleArrayData::reallocate,
SimpleArrayData::get,
SimpleArrayData::put,
SimpleArrayData::putArray,
SimpleArrayData::del,
SimpleArrayData::setAttribute,
- SimpleArrayData::attribute,
SimpleArrayData::push_front,
SimpleArrayData::pop_front,
SimpleArrayData::truncate,
@@ -73,26 +74,26 @@ const ArrayVTable SimpleArrayData::static_vtbl =
const ArrayVTable SparseArrayData::static_vtbl =
{
DEFINE_MANAGED_VTABLE_INT(SparseArrayData, 0),
- ArrayData::Sparse,
+ Heap::ArrayData::Sparse,
SparseArrayData::reallocate,
SparseArrayData::get,
SparseArrayData::put,
SparseArrayData::putArray,
SparseArrayData::del,
SparseArrayData::setAttribute,
- SparseArrayData::attribute,
SparseArrayData::push_front,
SparseArrayData::pop_front,
SparseArrayData::truncate,
SparseArrayData::length
};
-Q_STATIC_ASSERT(sizeof(ArrayData::Data) == sizeof(SimpleArrayData::Data));
-Q_STATIC_ASSERT(sizeof(ArrayData::Data) == sizeof(SparseArrayData::Data));
+Q_STATIC_ASSERT(sizeof(Heap::ArrayData) == sizeof(Heap::SimpleArrayData));
+Q_STATIC_ASSERT(sizeof(Heap::ArrayData) == sizeof(Heap::SparseArrayData));
void ArrayData::realloc(Object *o, Type newType, uint requested, bool enforceAttributes)
{
- ArrayData *d = o->arrayData();
+ Scope scope(o->engine());
+ Scoped<ArrayData> d(scope, o->arrayData());
uint alloc = 8;
uint toCopy = 0;
@@ -107,34 +108,34 @@ void ArrayData::realloc(Object *o, Type newType, uint requested, bool enforceAtt
if (alloc < d->alloc())
alloc = d->alloc();
- if (d->type() < Sparse) {
- offset = static_cast<SimpleArrayData *>(d)->d()->offset;
- toCopy = static_cast<SimpleArrayData *>(d)->len();
+ if (d->type() < Heap::ArrayData::Sparse) {
+ offset = d->d()->offset;
+ toCopy = d->d()->len;
} else {
toCopy = d->alloc();
}
if (d->type() > newType)
newType = d->type();
}
- if (enforceAttributes && newType == Simple)
- newType = Complex;
+ if (enforceAttributes && newType == Heap::ArrayData::Simple)
+ newType = Heap::ArrayData::Complex;
while (alloc < requested)
alloc *= 2;
- size_t size = sizeof(ArrayData::Data) + (alloc - 1)*sizeof(Value);
+ size_t size = sizeof(Heap::ArrayData) + (alloc - 1)*sizeof(Value);
if (enforceAttributes)
size += alloc*sizeof(PropertyAttributes);
- ArrayData *newData;
- if (newType < Sparse) {
- SimpleArrayData *n = static_cast<SimpleArrayData *>(o->engine()->memoryManager->allocManaged(size));
- new (n->d()) SimpleArrayData::Data(o->engine());
- n->d()->offset = 0;
- n->len() = d ? static_cast<SimpleArrayData *>(d)->len() : 0;
+ Scoped<ArrayData> newData(scope);
+ if (newType < Heap::ArrayData::Sparse) {
+ Heap::SimpleArrayData *n = scope.engine->memoryManager->allocManaged<SimpleArrayData>(size);
+ new (n) Heap::SimpleArrayData;
+ n->offset = 0;
+ n->len = d ? d->d()->len : 0;
newData = n;
} else {
- SparseArrayData *n = static_cast<SparseArrayData *>(o->engine()->memoryManager->allocManaged(size));
- new (n->d()) SparseArrayData::Data(o->engine());
+ Heap::SparseArrayData *n = scope.engine->memoryManager->allocManaged<SparseArrayData>(size);
+ new (n) Heap::SparseArrayData;
newData = n;
}
newData->setAlloc(alloc);
@@ -145,113 +146,112 @@ void ArrayData::realloc(Object *o, Type newType, uint requested, bool enforceAtt
if (d) {
if (enforceAttributes) {
if (d->attrs())
- memcpy(o->arrayData()->attrs(), d->attrs(), sizeof(PropertyAttributes)*toCopy);
+ memcpy(newData->attrs(), d->attrs(), sizeof(PropertyAttributes)*toCopy);
else
for (uint i = 0; i < toCopy; ++i)
- o->arrayData()->attrs()[i] = Attr_Data;
+ newData->attrs()[i] = Attr_Data;
}
if (toCopy > d->d()->alloc - offset) {
uint copyFromStart = toCopy - (d->d()->alloc - offset);
- memcpy(o->arrayData()->d()->arrayData + toCopy - copyFromStart, d->d()->arrayData, sizeof(Value)*copyFromStart);
+ memcpy(newData->d()->arrayData + toCopy - copyFromStart, d->d()->arrayData, sizeof(Value)*copyFromStart);
toCopy -= copyFromStart;
}
- memcpy(o->arrayData()->d()->arrayData, d->d()->arrayData + offset, sizeof(Value)*toCopy);
+ memcpy(newData->d()->arrayData, d->d()->arrayData + offset, sizeof(Value)*toCopy);
}
- if (newType != Sparse)
+ if (newType != Heap::ArrayData::Sparse)
return;
- SparseArrayData *sparse = static_cast<SparseArrayData *>(o->arrayData());
+ Heap::SparseArrayData *sparse = static_cast<Heap::SparseArrayData *>(newData->d());
uint *lastFree;
- if (d && d->type() == Sparse) {
- SparseArrayData *old = static_cast<SparseArrayData *>(d);
- sparse->setSparse(old->sparse());
- old->setSparse(0);
- sparse->freeList() = old->freeList();
- lastFree = &sparse->freeList();
+ if (d && d->type() == Heap::ArrayData::Sparse) {
+ Heap::SparseArrayData *old = static_cast<Heap::SparseArrayData *>(d->d());
+ sparse->sparse = old->sparse;
+ old->sparse = 0;
+ sparse->freeList = old->freeList;
+ lastFree = &sparse->freeList;
} else {
- sparse->setSparse(new SparseArray);
- lastFree = &sparse->freeList();
+ sparse->sparse = new SparseArray;
+ lastFree = &sparse->freeList;
for (uint i = 0; i < toCopy; ++i) {
- if (!sparse->arrayData()[i].isEmpty()) {
- SparseArrayNode *n = sparse->sparse()->insert(i);
+ if (!sparse->arrayData[i].isEmpty()) {
+ SparseArrayNode *n = sparse->sparse->insert(i);
n->value = i;
} else {
*lastFree = i;
- sparse->arrayData()[i].tag = Value::Empty_Type;
- lastFree = &sparse->arrayData()[i].uint_32;
+ sparse->arrayData[i].tag = Value::Empty_Type;
+ lastFree = &sparse->arrayData[i].uint_32;
}
}
}
- if (toCopy < sparse->alloc()) {
- for (uint i = toCopy; i < sparse->alloc(); ++i) {
+ if (toCopy < sparse->alloc) {
+ for (uint i = toCopy; i < sparse->alloc; ++i) {
*lastFree = i;
- sparse->arrayData()[i].tag = Value::Empty_Type;
- lastFree = &sparse->arrayData()[i].uint_32;
+ sparse->arrayData[i].tag = Value::Empty_Type;
+ lastFree = &sparse->arrayData[i].uint_32;
}
*lastFree = UINT_MAX;
}
// ### Could explicitly free the old data
}
-ArrayData *SimpleArrayData::reallocate(Object *o, uint n, bool enforceAttributes)
+Heap::ArrayData *SimpleArrayData::reallocate(Object *o, uint n, bool enforceAttributes)
{
- realloc(o, Simple, n, enforceAttributes);
+ realloc(o, Heap::ArrayData::Simple, n, enforceAttributes);
return o->arrayData();
}
void ArrayData::ensureAttributes(Object *o)
{
- if (o->arrayData() && o->arrayData()->attrs())
+ if (o->arrayData() && o->arrayData()->attrs)
return;
- ArrayData::realloc(o, Simple, 0, true);
+ ArrayData::realloc(o, Heap::ArrayData::Simple, 0, true);
}
-void SimpleArrayData::markObjects(Managed *d, ExecutionEngine *e)
+void SimpleArrayData::markObjects(Heap::Base *d, ExecutionEngine *e)
{
- SimpleArrayData *dd = static_cast<SimpleArrayData *>(d);
- uint l = dd->len();
- for (uint i = 0; i < l; ++i)
- dd->data(i).mark(e);
+ Heap::SimpleArrayData *dd = static_cast<Heap::SimpleArrayData *>(d);
+ for (uint i = 0; i < dd->len; ++i)
+ dd->arrayData[dd->mappedIndex(i)].mark(e);
}
-ReturnedValue SimpleArrayData::get(const ArrayData *d, uint index)
+ReturnedValue SimpleArrayData::get(const Heap::ArrayData *d, uint index)
{
- const SimpleArrayData *dd = static_cast<const SimpleArrayData *>(d);
- if (index >= dd->len())
+ const Heap::SimpleArrayData *dd = static_cast<const Heap::SimpleArrayData *>(d);
+ if (index >= dd->len)
return Primitive::emptyValue().asReturnedValue();
return dd->data(index).asReturnedValue();
}
-bool SimpleArrayData::put(Object *o, uint index, ValueRef value)
+bool SimpleArrayData::put(Object *o, uint index, const Value &value)
{
- SimpleArrayData *dd = static_cast<SimpleArrayData *>(o->arrayData());
- Q_ASSERT(index >= dd->len() || !dd->attrs() || !dd->attrs()[index].isAccessor());
+ Heap::SimpleArrayData *dd = static_cast<Heap::SimpleArrayData *>(o->d()->arrayData);
+ Q_ASSERT(index >= dd->len || !dd->attrs || !dd->attrs[index].isAccessor());
// ### honour attributes
dd->data(index) = value;
- if (index >= dd->len()) {
- if (dd->attrs())
- dd->attrs()[index] = Attr_Data;
- dd->len() = index + 1;
+ if (index >= dd->len) {
+ if (dd->attrs)
+ dd->attrs[index] = Attr_Data;
+ dd->len = index + 1;
}
return true;
}
bool SimpleArrayData::del(Object *o, uint index)
{
- SimpleArrayData *dd = static_cast<SimpleArrayData *>(o->arrayData());
- if (index >= dd->len())
+ Heap::SimpleArrayData *dd = static_cast<Heap::SimpleArrayData *>(o->d()->arrayData);
+ if (index >= dd->len)
return true;
- if (!dd->attrs() || dd->attrs()[index].isConfigurable()) {
+ if (!dd->attrs || dd->attrs[index].isConfigurable()) {
dd->data(index) = Primitive::emptyValue();
- if (dd->attrs())
- dd->attrs()[index] = Attr_Data;
+ if (dd->attrs)
+ dd->attrs[index] = Attr_Data;
return true;
}
if (dd->data(index).isEmpty())
@@ -261,264 +261,248 @@ bool SimpleArrayData::del(Object *o, uint index)
void SimpleArrayData::setAttribute(Object *o, uint index, PropertyAttributes attrs)
{
- o->arrayData()->attrs()[index] = attrs;
-}
-
-PropertyAttributes SimpleArrayData::attribute(const ArrayData *d, uint index)
-{
- return d->attrs()[index];
+ o->arrayData()->attrs[index] = attrs;
}
-void SimpleArrayData::push_front(Object *o, Value *values, uint n)
+void SimpleArrayData::push_front(Object *o, const Value *values, uint n)
{
- SimpleArrayData *dd = static_cast<SimpleArrayData *>(o->arrayData());
- Q_ASSERT(!dd->attrs());
- if (dd->len() + n > dd->alloc()) {
- realloc(o, Simple, dd->len() + n, false);
- dd = static_cast<SimpleArrayData *>(o->arrayData());
+ Heap::SimpleArrayData *dd = static_cast<Heap::SimpleArrayData *>(o->d()->arrayData);
+ Q_ASSERT(!dd->attrs);
+ if (dd->len + n > dd->alloc) {
+ realloc(o, Heap::ArrayData::Simple, dd->len + n, false);
+ Q_ASSERT(o->d()->arrayData->type == Heap::ArrayData::Simple);
+ dd = static_cast<Heap::SimpleArrayData *>(o->d()->arrayData);
}
- dd->d()->offset = (dd->d()->offset - n) % dd->d()->alloc;
- dd->len() += n;
+ dd->offset = (dd->offset - n) % dd->alloc;
+ dd->len += n;
for (uint i = 0; i < n; ++i)
dd->data(i) = values[i].asReturnedValue();
}
ReturnedValue SimpleArrayData::pop_front(Object *o)
{
- SimpleArrayData *dd = static_cast<SimpleArrayData *>(o->arrayData());
- Q_ASSERT(!dd->attrs());
- if (!dd->len())
+ Heap::SimpleArrayData *dd = static_cast<Heap::SimpleArrayData *>(o->d()->arrayData);
+ Q_ASSERT(!dd->attrs);
+ if (!dd->len)
return Encode::undefined();
ReturnedValue v = dd->data(0).isEmpty() ? Encode::undefined() : dd->data(0).asReturnedValue();
- dd->d()->offset = (dd->d()->offset + 1) % dd->d()->alloc;
- --dd->len();
+ dd->offset = (dd->offset + 1) % dd->alloc;
+ --dd->len;
return v;
}
uint SimpleArrayData::truncate(Object *o, uint newLen)
{
- SimpleArrayData *dd = static_cast<SimpleArrayData *>(o->arrayData());
- if (dd->len() < newLen)
+ Heap::SimpleArrayData *dd = static_cast<Heap::SimpleArrayData *>(o->d()->arrayData);
+ if (dd->len < newLen)
return newLen;
- if (!dd->attrs()) {
- dd->len() = newLen;
+ if (!dd->attrs) {
+ dd->len = newLen;
return newLen;
}
- while (dd->len() > newLen) {
- if (!dd->data(dd->len() - 1).isEmpty() && !dd->attrs()[dd->len() - 1].isConfigurable())
- return dd->len();
- --dd->len();
+ while (dd->len > newLen) {
+ if (!dd->data(dd->len - 1).isEmpty() && !dd->attrs[dd->len - 1].isConfigurable())
+ return dd->len;
+ --dd->len;
}
- return dd->len();
+ return dd->len;
}
-uint SimpleArrayData::length(const ArrayData *d)
+uint SimpleArrayData::length(const Heap::ArrayData *d)
{
- return static_cast<const SimpleArrayData *>(d)->len();
+ return d->len;
}
-bool SimpleArrayData::putArray(Object *o, uint index, Value *values, uint n)
+bool SimpleArrayData::putArray(Object *o, uint index, const Value *values, uint n)
{
- SimpleArrayData *dd = static_cast<SimpleArrayData *>(o->arrayData());
- if (index + n > dd->alloc()) {
+ Heap::SimpleArrayData *dd = static_cast<Heap::SimpleArrayData *>(o->d()->arrayData);
+ if (index + n > dd->alloc) {
reallocate(o, index + n + 1, false);
- dd = static_cast<SimpleArrayData *>(o->arrayData());
+ dd = static_cast<Heap::SimpleArrayData *>(o->d()->arrayData);
}
- for (uint i = dd->len(); i < index; ++i)
+ for (uint i = dd->len; i < index; ++i)
dd->data(i) = Primitive::emptyValue();
for (uint i = 0; i < n; ++i)
dd->data(index + i) = values[i];
- dd->len() = qMax(dd->len(), index + n);
+ dd->len = qMax(dd->len, index + n);
return true;
}
-void SparseArrayData::free(ArrayData *d, uint idx)
+void SparseArrayData::free(Heap::ArrayData *d, uint idx)
{
- Q_ASSERT(d && d->type() == ArrayData::Sparse);
- SparseArrayData *dd = static_cast<SparseArrayData *>(d);
- Value *v = dd->arrayData() + idx;
- if (dd->attrs() && dd->attrs()[idx].isAccessor()) {
+ Q_ASSERT(d && d->type == Heap::ArrayData::Sparse);
+ Value *v = d->arrayData + idx;
+ if (d->attrs && d->attrs[idx].isAccessor()) {
// double slot, free both. Order is important, so we have a double slot for allocation again afterwards.
v[1].tag = Value::Empty_Type;
- v[1].uint_32 = dd->freeList();
+ v[1].uint_32 = d->freeList;
v[0].tag = Value::Empty_Type;
v[0].uint_32 = idx + 1;
} else {
v->tag = Value::Empty_Type;
- v->uint_32 = dd->freeList();
+ v->uint_32 = d->freeList;
}
- dd->freeList() = idx;
- if (dd->attrs())
- dd->attrs()[idx].clear();
+ d->freeList = idx;
+ if (d->attrs)
+ d->attrs[idx].clear();
}
-void SparseArrayData::destroy(Managed *d)
+void SparseArrayData::markObjects(Heap::Base *d, ExecutionEngine *e)
{
- SparseArrayData *dd = static_cast<SparseArrayData *>(d);
- delete dd->sparse();
-}
-
-void SparseArrayData::markObjects(Managed *d, ExecutionEngine *e)
-{
- SparseArrayData *dd = static_cast<SparseArrayData *>(d);
- uint l = dd->alloc();
+ Heap::SparseArrayData *dd = static_cast<Heap::SparseArrayData *>(d);
+ uint l = dd->alloc;
for (uint i = 0; i < l; ++i)
- dd->arrayData()[i].mark(e);
+ dd->arrayData[i].mark(e);
}
-ArrayData *SparseArrayData::reallocate(Object *o, uint n, bool enforceAttributes)
+Heap::ArrayData *SparseArrayData::reallocate(Object *o, uint n, bool enforceAttributes)
{
- realloc(o, Sparse, n, enforceAttributes);
+ realloc(o, Heap::ArrayData::Sparse, n, enforceAttributes);
return o->arrayData();
}
// double slots are required for accessor properties
uint SparseArrayData::allocate(Object *o, bool doubleSlot)
{
- Q_ASSERT(o->arrayData()->type() == ArrayData::Sparse);
- SparseArrayData *dd = static_cast<SparseArrayData *>(o->arrayData());
+ Q_ASSERT(o->d()->arrayData->type == Heap::ArrayData::Sparse);
+ Heap::SparseArrayData *dd = static_cast<Heap::SparseArrayData *>(o->d()->arrayData);
if (doubleSlot) {
- uint *last = &dd->freeList();
+ uint *last = &dd->freeList;
while (1) {
if (*last == UINT_MAX) {
- reallocate(o, o->arrayData()->alloc() + 2, true);
- dd = static_cast<SparseArrayData *>(o->arrayData());
- last = &dd->freeList();
+ reallocate(o, dd->alloc + 2, true);
+ dd = static_cast<Heap::SparseArrayData *>(o->d()->arrayData);
+ last = &dd->freeList;
Q_ASSERT(*last != UINT_MAX);
}
- Q_ASSERT(dd->arrayData()[*last].uint_32 != *last);
- if (dd->arrayData()[*last].uint_32 == (*last + 1)) {
+ Q_ASSERT(dd->arrayData[*last].uint_32 != *last);
+ if (dd->arrayData[*last].uint_32 == (*last + 1)) {
// found two slots in a row
uint idx = *last;
- *last = dd->arrayData()[*last + 1].uint_32;
- o->arrayData()->attrs()[idx] = Attr_Accessor;
+ *last = dd->arrayData[*last + 1].uint_32;
+ dd->attrs[idx] = Attr_Accessor;
return idx;
}
- last = &dd->arrayData()[*last].uint_32;
+ last = &dd->arrayData[*last].uint_32;
}
} else {
- if (dd->freeList() == UINT_MAX) {
- reallocate(o, o->arrayData()->alloc() + 1, false);
- dd = static_cast<SparseArrayData *>(o->arrayData());
+ if (dd->freeList == UINT_MAX) {
+ reallocate(o, dd->alloc + 1, false);
+ dd = static_cast<Heap::SparseArrayData *>(o->d()->arrayData);
}
- uint idx = dd->freeList();
+ uint idx = dd->freeList;
Q_ASSERT(idx != UINT_MAX);
- dd->freeList() = dd->arrayData()[idx].uint_32;
- if (dd->attrs())
- dd->attrs()[idx] = Attr_Data;
+ dd->freeList = dd->arrayData[idx].uint_32;
+ if (dd->attrs)
+ dd->attrs[idx] = Attr_Data;
return idx;
}
}
-ReturnedValue SparseArrayData::get(const ArrayData *d, uint index)
+ReturnedValue SparseArrayData::get(const Heap::ArrayData *d, uint index)
{
- const SparseArrayData *s = static_cast<const SparseArrayData *>(d);
+ const Heap::SparseArrayData *s = static_cast<const Heap::SparseArrayData *>(d);
index = s->mappedIndex(index);
if (index == UINT_MAX)
return Primitive::emptyValue().asReturnedValue();
- return s->arrayData()[index].asReturnedValue();
+ return s->arrayData[index].asReturnedValue();
}
-bool SparseArrayData::put(Object *o, uint index, ValueRef value)
+bool SparseArrayData::put(Object *o, uint index, const Value &value)
{
- if (value->isEmpty())
+ if (value.isEmpty())
return true;
- SparseArrayData *s = static_cast<SparseArrayData *>(o->arrayData());
- SparseArrayNode *n = s->sparse()->insert(index);
- Q_ASSERT(n->value == UINT_MAX || !o->arrayData()->attrs() || !o->arrayData()->attrs()[n->value].isAccessor());
+ Heap::SparseArrayData *s = static_cast<Heap::SparseArrayData *>(o->d()->arrayData);
+ SparseArrayNode *n = s->sparse->insert(index);
+ Q_ASSERT(n->value == UINT_MAX || !s->attrs || !s->attrs[n->value].isAccessor());
if (n->value == UINT_MAX)
n->value = allocate(o);
- s->arrayData()[n->value] = value;
- if (s->attrs())
- s->attrs()[n->value] = Attr_Data;
+ s = static_cast<Heap::SparseArrayData *>(o->d()->arrayData);
+ s->arrayData[n->value] = value;
+ if (s->attrs)
+ s->attrs[n->value] = Attr_Data;
return true;
}
bool SparseArrayData::del(Object *o, uint index)
{
- SparseArrayData *dd = static_cast<SparseArrayData *>(o->arrayData());
+ Heap::SparseArrayData *dd = static_cast<Heap::SparseArrayData *>(o->d()->arrayData);
- SparseArrayNode *n = dd->sparse()->findNode(index);
+ SparseArrayNode *n = dd->sparse->findNode(index);
if (!n)
return true;
uint pidx = n->value;
- Q_ASSERT(!dd->arrayData()[pidx].isEmpty());
+ Q_ASSERT(!dd->arrayData[pidx].isEmpty());
bool isAccessor = false;
- if (dd->attrs()) {
- if (!dd->attrs()[pidx].isConfigurable())
+ if (dd->attrs) {
+ if (!dd->attrs[pidx].isConfigurable())
return false;
- isAccessor = dd->attrs()[pidx].isAccessor();
- dd->attrs()[pidx] = Attr_Data;
+ isAccessor = dd->attrs[pidx].isAccessor();
+ dd->attrs[pidx] = Attr_Data;
}
if (isAccessor) {
// free up both indices
- dd->arrayData()[pidx + 1].tag = Value::Empty_Type;
- dd->arrayData()[pidx + 1].uint_32 = static_cast<SparseArrayData *>(dd)->freeList();
- dd->arrayData()[pidx].tag = Value::Undefined_Type;
- dd->arrayData()[pidx].uint_32 = pidx + 1;
+ dd->arrayData[pidx + 1].tag = Value::Empty_Type;
+ dd->arrayData[pidx + 1].uint_32 = dd->freeList;
+ dd->arrayData[pidx].tag = Value::Undefined_Type;
+ dd->arrayData[pidx].uint_32 = pidx + 1;
} else {
- dd->arrayData()[pidx].tag = Value::Empty_Type;
- dd->arrayData()[pidx].uint_32 = static_cast<SparseArrayData *>(dd)->freeList();
+ dd->arrayData[pidx].tag = Value::Empty_Type;
+ dd->arrayData[pidx].uint_32 = dd->freeList;
}
- dd->freeList() = pidx;
- dd->sparse()->erase(n);
+ dd->freeList = pidx;
+ dd->sparse->erase(n);
return true;
}
void SparseArrayData::setAttribute(Object *o, uint index, PropertyAttributes attrs)
{
- SparseArrayData *d = static_cast<SparseArrayData *>(o->arrayData());
- SparseArrayNode *n = d->sparse()->insert(index);
+ Heap::SparseArrayData *d = static_cast<Heap::SparseArrayData *>(o->d()->arrayData);
+ SparseArrayNode *n = d->sparse->insert(index);
if (n->value == UINT_MAX) {
n->value = allocate(o, attrs.isAccessor());
- d = static_cast<SparseArrayData *>(o->arrayData());
+ d = static_cast<Heap::SparseArrayData *>(o->d()->arrayData);
}
- else if (attrs.isAccessor() != d->attrs()[n->value].isAccessor()) {
+ else if (attrs.isAccessor() != d->attrs[n->value].isAccessor()) {
// need to convert the slot
- free(d, n->value);
+ free(o->arrayData(), n->value);
n->value = allocate(o, attrs.isAccessor());
+ d = static_cast<Heap::SparseArrayData *>(o->d()->arrayData);
}
- o->arrayData()->attrs()[n->value] = attrs;
+ d->attrs[n->value] = attrs;
}
-PropertyAttributes SparseArrayData::attribute(const ArrayData *d, uint index)
+void SparseArrayData::push_front(Object *o, const Value *values, uint n)
{
- SparseArrayNode *n = static_cast<const SparseArrayData *>(d)->sparse()->insert(index);
- if (!n)
- return PropertyAttributes();
- return d->attrs()[n->value];
-}
-
-void SparseArrayData::push_front(Object *o, Value *values, uint n)
-{
- SparseArrayData *d = static_cast<SparseArrayData *>(o->arrayData());
- Q_ASSERT(!o->arrayData()->attrs());
+ Heap::SparseArrayData *d = static_cast<Heap::SparseArrayData *>(o->d()->arrayData);
+ Q_ASSERT(!d->attrs);
for (int i = n - 1; i >= 0; --i) {
uint idx = allocate(o);
- d->arrayData()[idx] = values[i];
- d->sparse()->push_front(idx);
+ d = static_cast<Heap::SparseArrayData *>(o->d()->arrayData);
+ d->arrayData[idx] = values[i];
+ d->sparse->push_front(idx);
}
}
ReturnedValue SparseArrayData::pop_front(Object *o)
{
- SparseArrayData *d = static_cast<SparseArrayData *>(o->arrayData());
- Q_ASSERT(!o->arrayData()->attrs());
- uint idx = d->sparse()->pop_front();
+ Heap::SparseArrayData *d = static_cast<Heap::SparseArrayData *>(o->d()->arrayData);
+ Q_ASSERT(!d->attrs);
+ uint idx = d->sparse->pop_front();
ReturnedValue v;
if (idx != UINT_MAX) {
- v = d->arrayData()[idx].asReturnedValue();
+ v = d->arrayData[idx].asReturnedValue();
free(o->arrayData(), idx);
} else {
v = Encode::undefined();
@@ -528,21 +512,21 @@ ReturnedValue SparseArrayData::pop_front(Object *o)
uint SparseArrayData::truncate(Object *o, uint newLen)
{
- SparseArrayData *d = static_cast<SparseArrayData *>(o->arrayData());
- SparseArrayNode *begin = d->sparse()->lowerBound(newLen);
- if (begin != d->sparse()->end()) {
- SparseArrayNode *it = d->sparse()->end()->previousNode();
+ Heap::SparseArrayData *d = static_cast<Heap::SparseArrayData *>(o->d()->arrayData);
+ SparseArrayNode *begin = d->sparse->lowerBound(newLen);
+ if (begin != d->sparse->end()) {
+ SparseArrayNode *it = d->sparse->end()->previousNode();
while (1) {
- if (d->attrs()) {
- if (!d->attrs()[it->value].isConfigurable()) {
+ if (d->attrs) {
+ if (!d->attrs[it->value].isConfigurable()) {
newLen = it->key() + 1;
break;
}
}
- free(d, it->value);
+ free(o->arrayData(), it->value);
bool brk = (it == begin);
SparseArrayNode *prev = it->previousNode();
- static_cast<SparseArrayData *>(d)->sparse()->erase(it);
+ d->sparse->erase(it);
if (brk)
break;
it = prev;
@@ -551,17 +535,17 @@ uint SparseArrayData::truncate(Object *o, uint newLen)
return newLen;
}
-uint SparseArrayData::length(const ArrayData *d)
+uint SparseArrayData::length(const Heap::ArrayData *d)
{
- const SparseArrayData *dd = static_cast<const SparseArrayData *>(d);
- if (!dd->sparse())
+ const Heap::SparseArrayData *dd = static_cast<const Heap::SparseArrayData *>(d);
+ if (!dd->sparse)
return 0;
- SparseArrayNode *n = dd->sparse()->end();
+ SparseArrayNode *n = dd->sparse->end();
n = n->previousNode();
return n ? n->key() + 1 : 0;
}
-bool SparseArrayData::putArray(Object *o, uint index, Value *values, uint n)
+bool SparseArrayData::putArray(Object *o, uint index, const Value *values, uint n)
{
for (uint i = 0; i < n; ++i)
put(o, index + i, values[i]);
@@ -571,12 +555,13 @@ bool SparseArrayData::putArray(Object *o, uint index, Value *values, uint n)
uint ArrayData::append(Object *obj, ArrayObject *otherObj, uint n)
{
- Q_ASSERT(!obj->arrayData() || !obj->arrayData()->hasAttributes());
+ Q_ASSERT(!obj->d()->arrayData || !obj->d()->arrayData->attrs);
if (!n)
return obj->getLength();
- ArrayData *other = otherObj->arrayData();
+ Scope scope(obj->engine());
+ Scoped<ArrayData> other(scope, otherObj->arrayData());
if (other && other->isSparse())
obj->initSparseArray();
@@ -585,31 +570,34 @@ uint ArrayData::append(Object *obj, ArrayObject *otherObj, uint n)
uint oldSize = obj->getLength();
- if (other && other->isSparse()) {
- SparseArrayData *os = static_cast<SparseArrayData *>(other);
- if (otherObj->hasAccessorProperty() && other->hasAttributes()) {
- Scope scope(obj->engine());
+ if (!other || ArgumentsObject::isNonStrictArgumentsObject(otherObj)) {
+ ScopedValue v(scope);
+ for (uint i = 0; i < n; ++i)
+ obj->arraySet(oldSize + i, (v = otherObj->getIndexed(i)));
+ } else if (other && other->isSparse()) {
+ Heap::SparseArrayData *os = static_cast<Heap::SparseArrayData *>(other->d());
+ if (other->hasAttributes()) {
ScopedValue v(scope);
- for (const SparseArrayNode *it = os->sparse()->begin();
- it != os->sparse()->end(); it = it->nextNode()) {
- v = otherObj->getValue(reinterpret_cast<Property *>(os->arrayData() + it->value), other->attrs()[it->value]);
+ for (const SparseArrayNode *it = os->sparse->begin();
+ it != os->sparse->end(); it = it->nextNode()) {
+ v = otherObj->getValue(reinterpret_cast<Property *>(os->arrayData + it->value), other->d()->attrs[it->value]);
obj->arraySet(oldSize + it->key(), v);
}
} else {
- for (const SparseArrayNode *it = static_cast<const SparseArrayData *>(other)->sparse()->begin();
- it != os->sparse()->end(); it = it->nextNode())
- obj->arraySet(oldSize + it->key(), ValueRef(os->arrayData()[it->value]));
+ for (const SparseArrayNode *it = other->d()->sparse->begin();
+ it != os->sparse->end(); it = it->nextNode())
+ obj->arraySet(oldSize + it->key(), os->arrayData[it->value]);
}
} else {
- SimpleArrayData *os = static_cast<SimpleArrayData *>(other);
+ Heap::SimpleArrayData *os = static_cast<Heap::SimpleArrayData *>(other->d());
uint toCopy = n;
uint chunk = toCopy;
- if (chunk > os->alloc() - os->d()->offset)
- chunk -= os->alloc() - os->d()->offset;
- obj->arrayPut(oldSize, os->arrayData() + os->d()->offset, chunk);
+ if (chunk > os->alloc - os->offset)
+ chunk -= os->alloc - os->offset;
+ obj->arrayPut(oldSize, os->arrayData + os->offset, chunk);
toCopy -= chunk;
if (toCopy)
- obj->arrayPut(oldSize + chunk, os->arrayData(), toCopy);
+ obj->arrayPut(oldSize + chunk, os->arrayData, toCopy);
}
return oldSize + n;
@@ -617,52 +605,51 @@ uint ArrayData::append(Object *obj, ArrayObject *otherObj, uint n)
Property *ArrayData::insert(Object *o, uint index, bool isAccessor)
{
- if (!isAccessor && o->arrayData()->type() != ArrayData::Sparse) {
- SimpleArrayData *d = static_cast<SimpleArrayData *>(o->arrayData());
- if (index < 0x1000 || index < d->len() + (d->len() >> 2)) {
- if (index >= o->arrayData()->alloc()) {
+ if (!isAccessor && o->d()->arrayData->type != Heap::ArrayData::Sparse) {
+ Heap::SimpleArrayData *d = static_cast<Heap::SimpleArrayData *>(o->d()->arrayData);
+ if (index < 0x1000 || index < d->len + (d->len >> 2)) {
+ if (index >= d->alloc) {
o->arrayReserve(index + 1);
- d = static_cast<SimpleArrayData *>(o->arrayData());
+ d = static_cast<Heap::SimpleArrayData *>(o->d()->arrayData);
}
- if (index >= d->len()) {
+ if (index >= d->len) {
// mark possible hole in the array
- for (uint i = d->len(); i < index; ++i)
+ for (uint i = d->len; i < index; ++i)
d->data(i) = Primitive::emptyValue();
- d->len() = index + 1;
+ d->len = index + 1;
}
- return reinterpret_cast<Property *>(d->d()->arrayData + d->mappedIndex(index));
+ return reinterpret_cast<Property *>(d->arrayData + d->mappedIndex(index));
}
}
o->initSparseArray();
- SparseArrayData *s = static_cast<SparseArrayData *>(o->arrayData());
- SparseArrayNode *n = s->sparse()->insert(index);
- if (n->value == UINT_MAX) {
+ Heap::SparseArrayData *s = static_cast<Heap::SparseArrayData *>(o->d()->arrayData);
+ SparseArrayNode *n = s->sparse->insert(index);
+ if (n->value == UINT_MAX)
n->value = SparseArrayData::allocate(o, isAccessor);
- s = static_cast<SparseArrayData *>(o->arrayData());
- }
- return reinterpret_cast<Property *>(s->arrayData() + n->value);
+ s = static_cast<Heap::SparseArrayData *>(o->d()->arrayData);
+ return reinterpret_cast<Property *>(s->arrayData + n->value);
}
class ArrayElementLessThan
{
public:
- inline ArrayElementLessThan(ExecutionContext *context, Object *thisObject, const ValueRef comparefn)
- : m_context(context), thisObject(thisObject), m_comparefn(comparefn) {}
+ inline ArrayElementLessThan(ExecutionEngine *engine, Object *thisObject, const Value &comparefn)
+ : m_engine(engine), thisObject(thisObject), m_comparefn(comparefn) {}
bool operator()(Value v1, Value v2) const;
private:
- ExecutionContext *m_context;
+ ExecutionEngine *m_engine;
Object *thisObject;
- const ValueRef m_comparefn;
+ const Value &m_comparefn;
};
bool ArrayElementLessThan::operator()(Value v1, Value v2) const
{
- Scope scope(m_context);
+ Scope scope(m_engine);
if (v1.isUndefined() || v1.isEmpty())
return false;
@@ -676,12 +663,12 @@ bool ArrayElementLessThan::operator()(Value v1, Value v2) const
callData->thisObject = Primitive::undefinedValue();
callData->args[0] = v1;
callData->args[1] = v2;
- result = Runtime::callValue(m_context, m_comparefn, callData);
+ result = Runtime::callValue(scope.engine, m_comparefn, callData);
return result->toNumber() < 0;
}
- ScopedString p1s(scope, v1.toString(m_context));
- ScopedString p2s(scope, v2.toString(m_context));
+ ScopedString p1s(scope, v1.toString(scope.engine));
+ ScopedString p2s(scope, v2.toString(scope.engine));
return p1s->toQString() < p2s->toQString();
}
@@ -739,33 +726,36 @@ top:
}
-void ArrayData::sort(ExecutionContext *context, Object *thisObject, const ValueRef comparefn, uint len)
+void ArrayData::sort(ExecutionEngine *engine, Object *thisObject, const Value &comparefn, uint len)
{
if (!len)
return;
- if (!thisObject->arrayData() || !thisObject->arrayData()->length())
+ Scope scope(engine);
+ Scoped<ArrayData> arrayData(scope, thisObject->arrayData());
+
+ if (!arrayData || !arrayData->length())
return;
- if (!(comparefn->isUndefined() || comparefn->asObject())) {
- context->throwTypeError();
+ if (!(comparefn.isUndefined() || comparefn.asObject())) {
+ engine->throwTypeError();
return;
}
// The spec says the sorting goes through a series of get,put and delete operations.
// this implies that the attributes don't get sorted around.
- if (thisObject->arrayData()->type() == ArrayData::Sparse) {
+ if (arrayData->type() == Heap::ArrayData::Sparse) {
// since we sort anyway, we can simply iterate over the entries in the sparse
// array and append them one by one to a regular one.
- SparseArrayData *sparse = static_cast<SparseArrayData *>(thisObject->arrayData());
+ Scoped<SparseArrayData> sparse(scope, static_cast<Heap::SparseArrayData *>(arrayData->d()));
if (!sparse->sparse()->nEntries())
return;
thisObject->setArrayData(0);
- ArrayData::realloc(thisObject, ArrayData::Simple, sparse->sparse()->nEntries(), sparse->attrs() ? true : false);
- SimpleArrayData *d = static_cast<SimpleArrayData *>(thisObject->arrayData());
+ ArrayData::realloc(thisObject, Heap::ArrayData::Simple, sparse->sparse()->nEntries(), sparse->attrs() ? true : false);
+ Heap::SimpleArrayData *d = static_cast<Heap::SimpleArrayData *>(thisObject->d()->arrayData);
SparseArrayNode *n = sparse->sparse()->begin();
uint i = 0;
@@ -776,7 +766,7 @@ void ArrayData::sort(ExecutionContext *context, Object *thisObject, const ValueR
PropertyAttributes a = sparse->attrs() ? sparse->attrs()[n->value] : Attr_Data;
d->data(i) = thisObject->getValue(reinterpret_cast<Property *>(sparse->arrayData() + n->value), a);
- d->attrs()[i] = a.isAccessor() ? Attr_Data : a;
+ d->attrs[i] = a.isAccessor() ? Attr_Data : a;
n = n->nextNode();
++i;
@@ -790,7 +780,7 @@ void ArrayData::sort(ExecutionContext *context, Object *thisObject, const ValueR
++i;
}
}
- d->len() = i;
+ d->len = i;
if (len > i)
len = i;
if (n != sparse->sparse()->end()) {
@@ -798,17 +788,16 @@ void ArrayData::sort(ExecutionContext *context, Object *thisObject, const ValueR
thisObject->initSparseArray();
while (n != sparse->sparse()->end()) {
PropertyAttributes a = sparse->attrs() ? sparse->attrs()[n->value] : Attr_Data;
- thisObject->arraySet(n->value, *reinterpret_cast<Property *>(sparse->arrayData() + n->value), a);
+ thisObject->arraySet(n->value, reinterpret_cast<Property *>(sparse->arrayData() + n->value), a);
n = n->nextNode();
}
}
- // ### explicitly delete sparse
} else {
- SimpleArrayData *d = static_cast<SimpleArrayData *>(thisObject->arrayData());
- if (len > d->len())
- len = d->len();
+ Heap::SimpleArrayData *d = static_cast<Heap::SimpleArrayData *>(thisObject->d()->arrayData);
+ if (len > d->len)
+ len = d->len;
// sort empty values to the end
for (uint i = 0; i < len; i++) {
@@ -816,7 +805,7 @@ void ArrayData::sort(ExecutionContext *context, Object *thisObject, const ValueR
while (--len > i)
if (!d->data(len).isEmpty())
break;
- Q_ASSERT(!d->attrs() || !d->attrs()[len].isAccessor());
+ Q_ASSERT(!d->attrs || !d->attrs[len].isAccessor());
d->data(i) = d->data(len);
d->data(len) = Primitive::emptyValue();
}
@@ -827,9 +816,9 @@ void ArrayData::sort(ExecutionContext *context, Object *thisObject, const ValueR
}
- ArrayElementLessThan lessThan(context, thisObject, comparefn);
+ ArrayElementLessThan lessThan(engine, thisObject, comparefn);
- Value *begin = thisObject->arrayData()->d()->arrayData;
+ Value *begin = thisObject->arrayData()->arrayData;
sortHelper(begin, begin + len, *begin, lessThan);
#ifdef CHECK_SPARSE_ARRAYS
diff --git a/src/qml/jsruntime/qv4arraydata_p.h b/src/qml/jsruntime/qv4arraydata_p.h
index b69d200665..915e862bbb 100644
--- a/src/qml/jsruntime/qv4arraydata_p.h
+++ b/src/qml/jsruntime/qv4arraydata_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -42,16 +42,15 @@ QT_BEGIN_NAMESPACE
namespace QV4 {
-#define V4_ARRAYDATA \
+#define V4_ARRAYDATA(DataClass) \
public: \
Q_MANAGED_CHECK \
+ typedef QV4::Heap::DataClass Data; \
static const QV4::ArrayVTable static_vtbl; \
static inline const QV4::ManagedVTable *staticVTable() { return &static_vtbl.managedVTable; } \
- template <typename T> \
- QV4::Returned<T> *asReturned() { return QV4::Returned<T>::create(this); } \
V4_MANAGED_SIZE_TEST \
- const Data *d() const { return &static_cast<const Data &>(Managed::data); } \
- Data *d() { return &static_cast<Data &>(Managed::data); }
+ const Data *d() const { return static_cast<const Data *>(m); } \
+ Data *d() { return static_cast<Data *>(m); }
struct ArrayData;
@@ -60,22 +59,21 @@ struct ArrayVTable
{
ManagedVTable managedVTable;
uint type;
- ArrayData *(*reallocate)(Object *o, uint n, bool enforceAttributes);
- ReturnedValue (*get)(const ArrayData *d, uint index);
- bool (*put)(Object *o, uint index, ValueRef value);
- bool (*putArray)(Object *o, uint index, Value *values, uint n);
+ Heap::ArrayData *(*reallocate)(Object *o, uint n, bool enforceAttributes);
+ ReturnedValue (*get)(const Heap::ArrayData *d, uint index);
+ bool (*put)(Object *o, uint index, const Value &value);
+ bool (*putArray)(Object *o, uint index, const Value *values, uint n);
bool (*del)(Object *o, uint index);
void (*setAttribute)(Object *o, uint index, PropertyAttributes attrs);
- PropertyAttributes (*attribute)(const ArrayData *d, uint index);
- void (*push_front)(Object *o, Value *values, uint n);
+ void (*push_front)(Object *o, const Value *values, uint n);
ReturnedValue (*pop_front)(Object *o);
uint (*truncate)(Object *o, uint newLen);
- uint (*length)(const ArrayData *d);
+ uint (*length)(const Heap::ArrayData *d);
};
+namespace Heap {
-struct Q_QML_EXPORT ArrayData : public Managed
-{
+struct ArrayData : public Base {
enum Type {
Simple = 0,
Complex = 1,
@@ -83,24 +81,89 @@ struct Q_QML_EXPORT ArrayData : public Managed
Custom = 3
};
- struct Data : public Managed::Data {
- Data(InternalClass *ic)
- : Managed::Data(ic)
- {}
- uint alloc;
- Type type;
- PropertyAttributes *attrs;
- union {
- uint len;
- uint freeList;
- };
- union {
- uint offset;
- SparseArray *sparse;
- };
- Value arrayData[1];
+ uint alloc;
+ Type type;
+ PropertyAttributes *attrs;
+ union {
+ uint len;
+ uint freeList;
+ };
+ union {
+ uint offset;
+ SparseArray *sparse;
};
- V4_MANAGED(Managed)
+ Value arrayData[1];
+
+ bool isSparse() const { return type == Sparse; }
+
+ const ArrayVTable *vtable() const { return reinterpret_cast<const ArrayVTable *>(Base::vtable); }
+
+ inline ReturnedValue get(uint i) const {
+ return vtable()->get(this, i);
+ }
+ inline Property *getProperty(uint index);
+ inline PropertyAttributes attributes(uint i) const;
+
+ bool isEmpty(uint i) const {
+ return get(i) == Primitive::emptyValue().asReturnedValue();
+ }
+
+ inline ReturnedValue length() const {
+ return vtable()->length(this);
+ }
+
+};
+
+struct SimpleArrayData : public ArrayData {
+ uint mappedIndex(uint index) const { return (index + offset) % alloc; }
+ Value data(uint index) const { return arrayData[mappedIndex(index)]; }
+ Value &data(uint index) { return arrayData[mappedIndex(index)]; }
+
+ Property *getProperty(uint index) {
+ if (index >= len)
+ return 0;
+ index = mappedIndex(index);
+ if (arrayData[index].isEmpty())
+ return 0;
+ return reinterpret_cast<Property *>(arrayData + index);
+ }
+
+ PropertyAttributes attributes(uint i) const {
+ return attrs ? attrs[i] : Attr_Data;
+ }
+};
+
+struct SparseArrayData : public ArrayData {
+ inline ~SparseArrayData();
+
+ uint mappedIndex(uint index) const {
+ SparseArrayNode *n = sparse->findNode(index);
+ if (!n)
+ return UINT_MAX;
+ return n->value;
+ }
+
+ Property *getProperty(uint index) {
+ SparseArrayNode *n = sparse->findNode(index);
+ if (!n)
+ return 0;
+ return reinterpret_cast<Property *>(arrayData + n->value);
+ }
+
+ PropertyAttributes attributes(uint i) const {
+ if (!attrs)
+ return Attr_Data;
+ uint index = mappedIndex(i);
+ return index < UINT_MAX ? attrs[index] : Attr_Data;
+ }
+};
+
+}
+
+struct Q_QML_EXPORT ArrayData : public Managed
+{
+ typedef Heap::ArrayData::Type Type;
+ V4_MANAGED(ArrayData, Managed)
uint alloc() const { return d()->alloc; }
uint &alloc() { return d()->alloc; }
@@ -112,88 +175,69 @@ struct Q_QML_EXPORT ArrayData : public Managed
const Value *arrayData() const { return &d()->arrayData[0]; }
Value *arrayData() { return &d()->arrayData[0]; }
- const ArrayVTable *vtable() const { return reinterpret_cast<const ArrayVTable *>(internalClass()->vtable); }
- bool isSparse() const { return type() == Sparse; }
+ const ArrayVTable *vtable() const { return d()->vtable(); }
+ bool isSparse() const { return type() == Heap::ArrayData::Sparse; }
uint length() const {
- return vtable()->length(this);
+ return d()->length();
}
bool hasAttributes() const {
return attrs();
}
- PropertyAttributes attributes(int i) const {
- Q_ASSERT(this);
- return attrs() ? vtable()->attribute(this, i) : Attr_Data;
+ PropertyAttributes attributes(uint i) const {
+ return d()->attributes(i);
}
bool isEmpty(uint i) const {
- return (vtable()->get(this, i) == Primitive::emptyValue().asReturnedValue());
+ return d()->isEmpty(i);
}
ReturnedValue get(uint i) const {
- return vtable()->get(this, i);
+ return d()->get(i);
+ }
+ inline Property *getProperty(uint index) {
+ return d()->getProperty(index);
}
- inline Property *getProperty(uint index);
static void ensureAttributes(Object *o);
static void realloc(Object *o, Type newType, uint alloc, bool enforceAttributes);
- static void sort(ExecutionContext *context, Object *thisObject, const ValueRef comparefn, uint dataLen);
+ static void sort(ExecutionEngine *engine, Object *thisObject, const Value &comparefn, uint dataLen);
static uint append(Object *obj, ArrayObject *otherObj, uint n);
static Property *insert(Object *o, uint index, bool isAccessor = false);
};
struct Q_QML_EXPORT SimpleArrayData : public ArrayData
{
+ V4_ARRAYDATA(SimpleArrayData)
- struct Data : public ArrayData::Data {
- Data(ExecutionEngine *engine)
- : ArrayData::Data(engine->simpleArrayDataClass)
- {}
- };
- V4_ARRAYDATA
-
- uint mappedIndex(uint index) const { return (index + d()->offset) % d()->alloc; }
- Value data(uint index) const { return d()->arrayData[mappedIndex(index)]; }
- Value &data(uint index) { return d()->arrayData[mappedIndex(index)]; }
-
- Property *getProperty(uint index) {
- if (index >= len())
- return 0;
- index = mappedIndex(index);
- if (d()->arrayData[index].isEmpty())
- return 0;
- return reinterpret_cast<Property *>(d()->arrayData + index);
- }
+ uint mappedIndex(uint index) const { return d()->mappedIndex(index); }
+ Value data(uint index) const { return d()->data(index); }
+ Value &data(uint index) { return d()->data(index); }
uint &len() { return d()->len; }
uint len() const { return d()->len; }
- static ArrayData *reallocate(Object *o, uint n, bool enforceAttributes);
+ static Heap::ArrayData *reallocate(Object *o, uint n, bool enforceAttributes);
- static void markObjects(Managed *d, ExecutionEngine *e);
+ static void markObjects(Heap::Base *d, ExecutionEngine *e);
- static ReturnedValue get(const ArrayData *d, uint index);
- static bool put(Object *o, uint index, ValueRef value);
- static bool putArray(Object *o, uint index, Value *values, uint n);
+ static ReturnedValue get(const Heap::ArrayData *d, uint index);
+ static bool put(Object *o, uint index, const Value &value);
+ static bool putArray(Object *o, uint index, const Value *values, uint n);
static bool del(Object *o, uint index);
static void setAttribute(Object *o, uint index, PropertyAttributes attrs);
- static PropertyAttributes attribute(const ArrayData *d, uint index);
- static void push_front(Object *o, Value *values, uint n);
+ static void push_front(Object *o, const Value *values, uint n);
static ReturnedValue pop_front(Object *o);
static uint truncate(Object *o, uint newLen);
- static uint length(const ArrayData *d);
+ static uint length(const Heap::ArrayData *d);
};
struct Q_QML_EXPORT SparseArrayData : public ArrayData
{
- struct Data : public ArrayData::Data {
- Data(ExecutionEngine *engine)
- : ArrayData::Data(engine->emptyClass)
- { setVTable(staticVTable()); }
- };
- V4_ARRAYDATA
+ V4_ARRAYDATA(SparseArrayData)
+ V4_NEEDS_DESTROY
uint &freeList() { return d()->freeList; }
uint freeList() const { return d()->freeList; }
@@ -201,48 +245,46 @@ struct Q_QML_EXPORT SparseArrayData : public ArrayData
void setSparse(SparseArray *s) { d()->sparse = s; }
static uint allocate(Object *o, bool doubleSlot = false);
- static void free(ArrayData *d, uint idx);
+ static void free(Heap::ArrayData *d, uint idx);
- Property *getProperty(uint index) {
- SparseArrayNode *n = sparse()->findNode(index);
- if (!n)
- return 0;
- return reinterpret_cast<Property *>(arrayData() + n->value);
- }
-
- uint mappedIndex(uint index) const {
- SparseArrayNode *n = sparse()->findNode(index);
- if (!n)
- return UINT_MAX;
- return n->value;
- }
+ uint mappedIndex(uint index) const { return d()->mappedIndex(index); }
- static void destroy(Managed *d);
- static void markObjects(Managed *d, ExecutionEngine *e);
+ static void markObjects(Heap::Base *d, ExecutionEngine *e);
- static ArrayData *reallocate(Object *o, uint n, bool enforceAttributes);
- static ReturnedValue get(const ArrayData *d, uint index);
- static bool put(Object *o, uint index, ValueRef value);
- static bool putArray(Object *o, uint index, Value *values, uint n);
+ static Heap::ArrayData *reallocate(Object *o, uint n, bool enforceAttributes);
+ static ReturnedValue get(const Heap::ArrayData *d, uint index);
+ static bool put(Object *o, uint index, const Value &value);
+ static bool putArray(Object *o, uint index, const Value *values, uint n);
static bool del(Object *o, uint index);
static void setAttribute(Object *o, uint index, PropertyAttributes attrs);
- static PropertyAttributes attribute(const ArrayData *d, uint index);
- static void push_front(Object *o, Value *values, uint n);
+ static void push_front(Object *o, const Value *values, uint n);
static ReturnedValue pop_front(Object *o);
static uint truncate(Object *o, uint newLen);
- static uint length(const ArrayData *d);
+ static uint length(const Heap::ArrayData *d);
};
+namespace Heap {
+
+inline SparseArrayData::~SparseArrayData()
+{
+ delete sparse;
+}
inline Property *ArrayData::getProperty(uint index)
{
- if (type() != Sparse) {
- SimpleArrayData *that = static_cast<SimpleArrayData *>(this);
- return that->getProperty(index);
- } else {
- SparseArrayData *that = static_cast<SparseArrayData *>(this);
- return that->getProperty(index);
- }
+ if (isSparse())
+ return static_cast<SparseArrayData *>(this)->getProperty(index);
+ return static_cast<SimpleArrayData *>(this)->getProperty(index);
+}
+
+inline PropertyAttributes ArrayData::attributes(uint i) const
+{
+ if (isSparse())
+ return static_cast<const SparseArrayData *>(this)->attributes(i);
+ return static_cast<const SimpleArrayData *>(this)->attributes(i);
+}
+
+
}
}
diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp
index 011279ae07..231eb93dd5 100644
--- a/src/qml/jsruntime/qv4arrayobject.cpp
+++ b/src/qml/jsruntime/qv4arrayobject.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -35,29 +35,30 @@
#include "qv4sparsearray_p.h"
#include "qv4objectproto_p.h"
#include "qv4scopedvalue_p.h"
+#include "qv4argumentsobject_p.h"
+#include "qv4runtime_p.h"
using namespace QV4;
DEFINE_OBJECT_VTABLE(ArrayCtor);
-ArrayCtor::Data::Data(ExecutionContext *scope)
- : FunctionObject::Data(scope, QStringLiteral("Array"))
+Heap::ArrayCtor::ArrayCtor(QV4::ExecutionContext *scope)
+ : Heap::FunctionObject(scope, QStringLiteral("Array"))
{
- setVTable(staticVTable());
}
ReturnedValue ArrayCtor::construct(Managed *m, CallData *callData)
{
- ExecutionEngine *v4 = m->engine();
+ ExecutionEngine *v4 = static_cast<ArrayCtor *>(m)->engine();
Scope scope(v4);
- Scoped<ArrayObject> a(scope, v4->newArrayObject());
+ ScopedArrayObject a(scope, v4->newArrayObject());
uint len;
if (callData->argc == 1 && callData->args[0].isNumber()) {
bool ok;
len = callData->args[0].asArrayLength(&ok);
if (!ok)
- return v4->currentContext()->throwRangeError(callData->args[0]);
+ return v4->throwRangeError(callData->args[0]);
if (len < 0x1000)
a->arrayReserve(len);
@@ -109,21 +110,21 @@ void ArrayPrototype::init(ExecutionEngine *engine, Object *ctor)
ReturnedValue ArrayPrototype::method_isArray(CallContext *ctx)
{
- bool isArray = ctx->d()->callData->argc && ctx->d()->callData->args[0].asArrayObject();
+ bool isArray = ctx->argc() && ctx->args()[0].asArrayObject();
return Encode(isArray);
}
ReturnedValue ArrayPrototype::method_toString(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject o(scope, ctx->d()->callData->thisObject, ScopedObject::Convert);
+ ScopedObject o(scope, ctx->thisObject(), ScopedObject::Convert);
if (ctx->d()->engine->hasException)
return Encode::undefined();
ScopedString s(scope, ctx->d()->engine->newString(QStringLiteral("join")));
- ScopedFunctionObject f(scope, o->get(s.getPointer()));
+ ScopedFunctionObject f(scope, o->get(s));
if (!!f) {
ScopedCallData d(scope, 0);
- d->thisObject = ctx->d()->callData->thisObject;
+ d->thisObject = ctx->thisObject();
return f->call(d);
}
return ObjectPrototype::method_toString(ctx);
@@ -139,12 +140,11 @@ ReturnedValue ArrayPrototype::method_concat(CallContext *ctx)
Scope scope(ctx);
ScopedObject result(scope, ctx->d()->engine->newArrayObject());
- ScopedObject thisObject(scope, ctx->d()->callData->thisObject.toObject(ctx));
+ ScopedObject thisObject(scope, ctx->thisObject().toObject(scope.engine));
if (!thisObject)
return Encode::undefined();
- ScopedArrayObject instance(scope, thisObject);
- if (instance) {
- result->copyArrayData(instance.getPointer());
+ if (thisObject->isArrayObject()) {
+ result->copyArrayData(thisObject);
} else {
result->arraySet(0, thisObject);
}
@@ -152,12 +152,12 @@ ReturnedValue ArrayPrototype::method_concat(CallContext *ctx)
ScopedArrayObject elt(scope);
ScopedObject eltAsObj(scope);
ScopedValue entry(scope);
- for (int i = 0; i < ctx->d()->callData->argc; ++i) {
- eltAsObj = ctx->d()->callData->args[i];
- elt = ctx->d()->callData->args[i];
+ for (int i = 0; i < ctx->argc(); ++i) {
+ eltAsObj = ctx->args()[i];
+ elt = ctx->args()[i];
if (elt) {
uint n = elt->getLength();
- uint newLen = ArrayData::append(result.getPointer(), elt.getPointer(), n);
+ uint newLen = ArrayData::append(result, elt, n);
result->setArrayLengthUnchecked(newLen);
} else if (eltAsObj && eltAsObj->isListType()) {
const uint startIndex = result->getLength();
@@ -166,7 +166,7 @@ ReturnedValue ArrayPrototype::method_concat(CallContext *ctx)
result->putIndexed(startIndex + i, entry);
}
} else {
- result->arraySet(result->getLength(), ValueRef(ctx->d()->callData->args[i]));
+ result->arraySet(result->getLength(), ctx->args()[i]);
}
}
@@ -184,12 +184,12 @@ ReturnedValue ArrayPrototype::method_join(CallContext *ctx)
else
r4 = arg->toQString();
- ScopedObject self(scope, ctx->d()->callData->thisObject);
+ ScopedObject self(scope, ctx->thisObject());
ScopedValue length(scope, self->get(ctx->d()->engine->id_length));
const quint32 r2 = length->isUndefined() ? 0 : length->toUInt32();
if (!r2)
- return ctx->d()->engine->newString(QString())->asReturnedValue();
+ return ctx->d()->engine->newString()->asReturnedValue();
QString R;
@@ -204,28 +204,28 @@ ReturnedValue ArrayPrototype::method_join(CallContext *ctx)
if (scope.hasException())
return Encode::undefined();
if (!e->isNullOrUndefined())
- R += e->toString(ctx)->toQString();
+ R += e->toQString();
}
} else {
//
// crazy!
//
ScopedString name(scope, ctx->d()->engine->newString(QStringLiteral("0")));
- ScopedValue r6(scope, self->get(name.getPointer()));
+ ScopedValue r6(scope, self->get(name));
if (!r6->isNullOrUndefined())
- R = r6->toString(ctx)->toQString();
+ R = r6->toQString();
ScopedValue r12(scope);
for (quint32 k = 1; k < r2; ++k) {
R += r4;
- name = Primitive::fromDouble(k).toString(ctx);
- r12 = self->get(name.getPointer());
+ name = Primitive::fromDouble(k).toString(scope.engine);
+ r12 = self->get(name);
if (scope.hasException())
return Encode::undefined();
if (!r12->isNullOrUndefined())
- R += r12->toString(ctx)->toQString();
+ R += r12->toQString();
}
}
@@ -235,7 +235,7 @@ ReturnedValue ArrayPrototype::method_join(CallContext *ctx)
ReturnedValue ArrayPrototype::method_pop(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
uint len = instance->getLength();
@@ -257,13 +257,13 @@ ReturnedValue ArrayPrototype::method_pop(CallContext *ctx)
instance->setArrayLength(len - 1);
else
instance->put(ctx->d()->engine->id_length, ScopedValue(scope, Primitive::fromDouble(len - 1)));
- return result.asReturnedValue();
+ return result->asReturnedValue();
}
ReturnedValue ArrayPrototype::method_push(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
@@ -272,33 +272,33 @@ ReturnedValue ArrayPrototype::method_push(CallContext *ctx)
uint len = instance->getLength();
- if (len + ctx->d()->callData->argc < len) {
+ if (len + ctx->argc() < len) {
// ughh...
double l = len;
ScopedString s(scope);
- for (int i = 0; i < ctx->d()->callData->argc; ++i) {
- s = Primitive::fromDouble(l + i).toString(ctx);
- instance->put(s.getPointer(), ctx->d()->callData->args[i]);
+ for (int i = 0; i < ctx->argc(); ++i) {
+ s = Primitive::fromDouble(l + i).toString(scope.engine);
+ instance->put(s, ctx->args()[i]);
}
- double newLen = l + ctx->d()->callData->argc;
+ double newLen = l + ctx->argc();
if (!instance->isArrayObject())
instance->put(ctx->d()->engine->id_length, ScopedValue(scope, Primitive::fromDouble(newLen)));
else {
ScopedString str(scope, ctx->d()->engine->newString(QStringLiteral("Array.prototype.push: Overflow")));
- return ctx->throwRangeError(str);
+ return ctx->engine()->throwRangeError(str);
}
return Encode(newLen);
}
- if (!ctx->d()->callData->argc) {
+ if (!ctx->argc())
;
- } else if (!instance->protoHasArray() && instance->arrayData()->length() <= len && instance->arrayType() == ArrayData::Simple) {
- instance->arrayData()->vtable()->putArray(instance.getPointer(), len, ctx->d()->callData->args, ctx->d()->callData->argc);
+ else if (!instance->protoHasArray() && instance->arrayData()->length() <= len && instance->arrayData()->type == Heap::ArrayData::Simple) {
+ instance->arrayData()->vtable()->putArray(instance, len, ctx->args(), ctx->argc());
len = instance->arrayData()->length();
} else {
- for (int i = 0; i < ctx->d()->callData->argc; ++i)
- instance->putIndexed(len + i, ctx->d()->callData->args[i]);
- len += ctx->d()->callData->argc;
+ for (int i = 0; i < ctx->argc(); ++i)
+ instance->putIndexed(len + i, ctx->args()[i]);
+ len += ctx->argc();
}
if (instance->isArrayObject())
instance->setArrayLengthUnchecked(len);
@@ -311,7 +311,7 @@ ReturnedValue ArrayPrototype::method_push(CallContext *ctx)
ReturnedValue ArrayPrototype::method_reverse(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
uint length = instance->getLength();
@@ -343,7 +343,7 @@ ReturnedValue ArrayPrototype::method_reverse(CallContext *ctx)
ReturnedValue ArrayPrototype::method_shift(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
@@ -360,8 +360,8 @@ ReturnedValue ArrayPrototype::method_shift(CallContext *ctx)
ScopedValue result(scope);
- if (!instance->protoHasArray() && !instance->arrayData()->hasAttributes() && instance->arrayData()->length() <= len && instance->arrayData()->type() != ArrayData::Custom) {
- result = instance->arrayData()->vtable()->pop_front(instance.getPointer());
+ if (!instance->protoHasArray() && !instance->arrayData()->attrs && instance->arrayData()->length() <= len && instance->arrayData()->type != Heap::ArrayData::Custom) {
+ result = instance->arrayData()->vtable()->pop_front(instance);
} else {
result = instance->getIndexed(0);
if (scope.hasException())
@@ -389,17 +389,17 @@ ReturnedValue ArrayPrototype::method_shift(CallContext *ctx)
instance->setArrayLengthUnchecked(len - 1);
else
instance->put(ctx->d()->engine->id_length, ScopedValue(scope, Primitive::fromDouble(len - 1)));
- return result.asReturnedValue();
+ return result->asReturnedValue();
}
ReturnedValue ArrayPrototype::method_slice(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject o(scope, ctx->d()->callData->thisObject.toObject(ctx));
+ ScopedObject o(scope, ctx->thisObject().toObject(scope.engine));
if (!o)
return Encode::undefined();
- Scoped<ArrayObject> result(scope, ctx->d()->engine->newArrayObject());
+ ScopedArrayObject result(scope, ctx->d()->engine->newArrayObject());
uint len = o->getLength();
double s = ScopedValue(scope, ctx->argument(0))->toInteger();
uint start;
@@ -410,8 +410,8 @@ ReturnedValue ArrayPrototype::method_slice(CallContext *ctx)
else
start = (uint) s;
uint end = len;
- if (ctx->d()->callData->argc > 1 && !ctx->d()->callData->args[1].isUndefined()) {
- double e = ctx->d()->callData->args[1].toInteger();
+ if (ctx->argc() > 1 && !ctx->args()[1].isUndefined()) {
+ double e = ctx->args()[1].toInteger();
if (e < 0)
end = (uint)qMax(len + e, 0.);
else if (e > len)
@@ -437,26 +437,26 @@ ReturnedValue ArrayPrototype::method_slice(CallContext *ctx)
ReturnedValue ArrayPrototype::method_sort(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Object> instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
uint len = instance->getLength();
ScopedValue comparefn(scope, ctx->argument(0));
- ArrayData::sort(ctx, instance, comparefn, len);
- return ctx->d()->callData->thisObject.asReturnedValue();
+ ArrayData::sort(scope.engine, instance, comparefn, len);
+ return ctx->thisObject().asReturnedValue();
}
ReturnedValue ArrayPrototype::method_splice(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
uint len = instance->getLength();
- Scoped<ArrayObject> newArray(scope, ctx->d()->engine->newArrayObject());
+ ScopedArrayObject newArray(scope, ctx->d()->engine->newArrayObject());
double rs = ScopedValue(scope, ctx->argument(0))->toInteger();
uint start;
@@ -479,7 +479,7 @@ ReturnedValue ArrayPrototype::method_splice(CallContext *ctx)
}
newArray->setArrayLengthUnchecked(deleteCount);
- uint itemCount = ctx->d()->callData->argc < 2 ? 0 : ctx->d()->callData->argc - 2;
+ uint itemCount = ctx->argc() < 2 ? 0 : ctx->argc() - 2;
if (itemCount < deleteCount) {
for (uint k = start; k < len - deleteCount; ++k) {
@@ -517,7 +517,7 @@ ReturnedValue ArrayPrototype::method_splice(CallContext *ctx)
}
for (uint i = 0; i < itemCount; ++i) {
- instance->putIndexed(start + i, ctx->d()->callData->args[i + 2]);
+ instance->putIndexed(start + i, ctx->args()[i + 2]);
if (scope.hasException())
return Encode::undefined();
}
@@ -531,7 +531,7 @@ ReturnedValue ArrayPrototype::method_splice(CallContext *ctx)
ReturnedValue ArrayPrototype::method_unshift(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
@@ -540,23 +540,24 @@ ReturnedValue ArrayPrototype::method_unshift(CallContext *ctx)
uint len = instance->getLength();
- if (!instance->protoHasArray() && !instance->arrayData()->hasAttributes() && instance->arrayData()->length() <= len && instance->arrayData()->type() != ArrayData::Custom) {
- instance->arrayData()->vtable()->push_front(instance.getPointer(), ctx->d()->callData->args, ctx->d()->callData->argc);
+ if (!instance->protoHasArray() && !instance->arrayData()->attrs && instance->arrayData()->length() <= len &&
+ instance->arrayData()->type != Heap::ArrayData::Custom) {
+ instance->arrayData()->vtable()->push_front(instance, ctx->args(), ctx->argc());
} else {
ScopedValue v(scope);
for (uint k = len; k > 0; --k) {
bool exists;
v = instance->getIndexed(k - 1, &exists);
if (exists)
- instance->putIndexed(k + ctx->d()->callData->argc - 1, v);
+ instance->putIndexed(k + ctx->argc() - 1, v);
else
- instance->deleteIndexedProperty(k + ctx->d()->callData->argc - 1);
+ instance->deleteIndexedProperty(k + ctx->argc() - 1);
}
- for (int i = 0; i < ctx->d()->callData->argc; ++i)
- instance->putIndexed(i, ctx->d()->callData->args[i]);
+ for (int i = 0; i < ctx->argc(); ++i)
+ instance->putIndexed(i, ctx->args()[i]);
}
- uint newLen = len + ctx->d()->callData->argc;
+ uint newLen = len + ctx->argc();
if (instance->isArrayObject())
instance->setArrayLengthUnchecked(newLen);
else
@@ -569,18 +570,18 @@ ReturnedValue ArrayPrototype::method_indexOf(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
uint len = instance->getLength();
if (!len)
return Encode(-1);
- ScopedValue searchValue(scope, ctx->d()->callData->argument(0));
+ ScopedValue searchValue(scope, ctx->argument(0));
uint fromIndex = 0;
- if (ctx->d()->callData->argc >= 2) {
- double f = ctx->d()->callData->args[1].toInteger();
+ if (ctx->argc() >= 2) {
+ double f = ctx->args()[1].toInteger();
if (scope.hasException())
return Encode::undefined();
if (f >= len)
@@ -603,7 +604,8 @@ ReturnedValue ArrayPrototype::method_indexOf(CallContext *ctx)
ScopedValue value(scope);
- if (instance->hasAccessorProperty() || (instance->arrayType() >= ArrayData::Sparse) || instance->protoHasArray()) {
+ if (ArgumentsObject::isNonStrictArgumentsObject(instance) ||
+ (instance->arrayType() >= Heap::ArrayData::Sparse) || instance->protoHasArray()) {
// lets be safe and slow
for (uint i = fromIndex; i < len; ++i) {
bool exists;
@@ -616,10 +618,10 @@ ReturnedValue ArrayPrototype::method_indexOf(CallContext *ctx)
} else if (!instance->arrayData()) {
return Encode(-1);
} else {
- Q_ASSERT(instance->arrayType() == ArrayData::Simple || instance->arrayType() == ArrayData::Complex);
- SimpleArrayData *sa = static_cast<SimpleArrayData *>(instance->arrayData());
- if (len > sa->len())
- len = sa->len();
+ Q_ASSERT(instance->arrayType() == Heap::ArrayData::Simple || instance->arrayType() == Heap::ArrayData::Complex);
+ Heap::SimpleArrayData *sa = static_cast<Heap::SimpleArrayData *>(instance->d()->arrayData);
+ if (len > sa->len)
+ len = sa->len;
uint idx = fromIndex;
while (idx < len) {
value = sa->data(idx);
@@ -637,7 +639,7 @@ ReturnedValue ArrayPrototype::method_lastIndexOf(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
uint len = instance->getLength();
@@ -647,13 +649,13 @@ ReturnedValue ArrayPrototype::method_lastIndexOf(CallContext *ctx)
ScopedValue searchValue(scope);
uint fromIndex = len;
- if (ctx->d()->callData->argc >= 1)
+ if (ctx->argc() >= 1)
searchValue = ctx->argument(0);
else
searchValue = Primitive::undefinedValue();
- if (ctx->d()->callData->argc >= 2) {
- double f = ctx->d()->callData->args[1].toInteger();
+ if (ctx->argc() >= 2) {
+ double f = ctx->args()[1].toInteger();
if (scope.hasException())
return Encode::undefined();
if (f > 0)
@@ -682,15 +684,15 @@ ReturnedValue ArrayPrototype::method_lastIndexOf(CallContext *ctx)
ReturnedValue ArrayPrototype::method_every(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Object> instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
uint len = instance->getLength();
- Scoped<FunctionObject> callback(scope, ctx->argument(0));
+ ScopedFunctionObject callback(scope, ctx->argument(0));
if (!callback)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
ScopedCallData callData(scope, 3);
callData->args[2] = instance;
@@ -716,15 +718,15 @@ ReturnedValue ArrayPrototype::method_every(CallContext *ctx)
ReturnedValue ArrayPrototype::method_some(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Object> instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
uint len = instance->getLength();
- Scoped<FunctionObject> callback(scope, ctx->argument(0));
+ ScopedFunctionObject callback(scope, ctx->argument(0));
if (!callback)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
ScopedCallData callData(scope, 3);
callData->thisObject = ctx->argument(1);
@@ -750,15 +752,15 @@ ReturnedValue ArrayPrototype::method_some(CallContext *ctx)
ReturnedValue ArrayPrototype::method_forEach(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Object> instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
uint len = instance->getLength();
- Scoped<FunctionObject> callback(scope, ctx->argument(0));
+ ScopedFunctionObject callback(scope, ctx->argument(0));
if (!callback)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
ScopedCallData callData(scope, 3);
callData->thisObject = ctx->argument(1);
@@ -781,17 +783,17 @@ ReturnedValue ArrayPrototype::method_forEach(CallContext *ctx)
ReturnedValue ArrayPrototype::method_map(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Object> instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
uint len = instance->getLength();
- Scoped<FunctionObject> callback(scope, ctx->argument(0));
+ ScopedFunctionObject callback(scope, ctx->argument(0));
if (!callback)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
- Scoped<ArrayObject> a(scope, ctx->d()->engine->newArrayObject());
+ ScopedArrayObject a(scope, ctx->d()->engine->newArrayObject());
a->arrayReserve(len);
a->setArrayLengthUnchecked(len);
@@ -818,17 +820,17 @@ ReturnedValue ArrayPrototype::method_map(CallContext *ctx)
ReturnedValue ArrayPrototype::method_filter(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Object> instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
uint len = instance->getLength();
- Scoped<FunctionObject> callback(scope, ctx->argument(0));
+ ScopedFunctionObject callback(scope, ctx->argument(0));
if (!callback)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
- Scoped<ArrayObject> a(scope, ctx->d()->engine->newArrayObject());
+ ScopedArrayObject a(scope, ctx->d()->engine->newArrayObject());
a->arrayReserve(len);
ScopedValue selected(scope);
@@ -859,21 +861,21 @@ ReturnedValue ArrayPrototype::method_filter(CallContext *ctx)
ReturnedValue ArrayPrototype::method_reduce(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Object> instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
uint len = instance->getLength();
- Scoped<FunctionObject> callback(scope, ctx->argument(0));
+ ScopedFunctionObject callback(scope, ctx->argument(0));
if (!callback)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
uint k = 0;
ScopedValue acc(scope);
ScopedValue v(scope);
- if (ctx->d()->callData->argc > 1) {
+ if (ctx->argc() > 1) {
acc = ctx->argument(1);
} else {
bool kPresent = false;
@@ -884,7 +886,7 @@ ReturnedValue ArrayPrototype::method_reduce(CallContext *ctx)
++k;
}
if (!kPresent)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
}
ScopedCallData callData(scope, 4);
@@ -903,32 +905,32 @@ ReturnedValue ArrayPrototype::method_reduce(CallContext *ctx)
}
++k;
}
- return acc.asReturnedValue();
+ return acc->asReturnedValue();
}
ReturnedValue ArrayPrototype::method_reduceRight(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Object> instance(scope, ctx->d()->callData->thisObject.toObject(ctx));
+ ScopedObject instance(scope, ctx->thisObject().toObject(scope.engine));
if (!instance)
return Encode::undefined();
uint len = instance->getLength();
- Scoped<FunctionObject> callback(scope, ctx->argument(0));
+ ScopedFunctionObject callback(scope, ctx->argument(0));
if (!callback)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
if (len == 0) {
- if (ctx->d()->callData->argc == 1)
- return ctx->throwTypeError();
+ if (ctx->argc() == 1)
+ return ctx->engine()->throwTypeError();
return ctx->argument(1);
}
uint k = len;
ScopedValue acc(scope);
ScopedValue v(scope);
- if (ctx->d()->callData->argc > 1) {
+ if (ctx->argc() > 1) {
acc = ctx->argument(1);
} else {
bool kPresent = false;
@@ -939,7 +941,7 @@ ReturnedValue ArrayPrototype::method_reduceRight(CallContext *ctx)
--k;
}
if (!kPresent)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
}
ScopedCallData callData(scope, 4);
@@ -957,6 +959,6 @@ ReturnedValue ArrayPrototype::method_reduceRight(CallContext *ctx)
}
--k;
}
- return acc.asReturnedValue();
+ return acc->asReturnedValue();
}
diff --git a/src/qml/jsruntime/qv4arrayobject_p.h b/src/qml/jsruntime/qv4arrayobject_p.h
index 9cd967ddd9..4e67eb2e31 100644
--- a/src/qml/jsruntime/qv4arrayobject_p.h
+++ b/src/qml/jsruntime/qv4arrayobject_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -41,13 +41,17 @@ QT_BEGIN_NAMESPACE
namespace QV4 {
+namespace Heap {
+
+struct ArrayCtor : FunctionObject {
+ ArrayCtor(QV4::ExecutionContext *scope);
+};
+
+}
+
struct ArrayCtor: FunctionObject
{
- struct Data : FunctionObject::Data {
- Data(ExecutionContext *scope);
- };
-
- V4_OBJECT(FunctionObject)
+ V4_OBJECT2(ArrayCtor, FunctionObject)
static ReturnedValue construct(Managed *m, CallData *callData);
static ReturnedValue call(Managed *that, CallData *callData);
diff --git a/src/qml/jsruntime/qv4booleanobject.cpp b/src/qml/jsruntime/qv4booleanobject.cpp
index b58fcbe709..9c293e783b 100644
--- a/src/qml/jsruntime/qv4booleanobject.cpp
+++ b/src/qml/jsruntime/qv4booleanobject.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -38,18 +38,16 @@ using namespace QV4;
DEFINE_OBJECT_VTABLE(BooleanCtor);
DEFINE_OBJECT_VTABLE(BooleanObject);
-BooleanCtor::Data::Data(ExecutionContext *scope)
- : FunctionObject::Data(scope, QStringLiteral("Boolean"))
+Heap::BooleanCtor::BooleanCtor(QV4::ExecutionContext *scope)
+ : Heap::FunctionObject(scope, QStringLiteral("Boolean"))
{
- setVTable(staticVTable());
}
ReturnedValue BooleanCtor::construct(Managed *m, CallData *callData)
{
- Scope scope(m->engine());
+ Scope scope(static_cast<BooleanCtor *>(m)->engine());
bool n = callData->argc ? callData->args[0].toBoolean() : false;
- ScopedValue b(scope, QV4::Primitive::fromBoolean(n));
- return Encode(m->engine()->newBooleanObject(b));
+ return Encode(scope.engine->newBooleanObject(n));
}
ReturnedValue BooleanCtor::call(Managed *, CallData *callData)
@@ -72,14 +70,13 @@ void BooleanPrototype::init(ExecutionEngine *engine, Object *ctor)
ReturnedValue BooleanPrototype::method_toString(CallContext *ctx)
{
bool result;
- if (ctx->d()->callData->thisObject.isBoolean()) {
- result = ctx->d()->callData->thisObject.booleanValue();
+ if (ctx->thisObject().isBoolean()) {
+ result = ctx->thisObject().booleanValue();
} else {
- Scope scope(ctx);
- Scoped<BooleanObject> thisObject(scope, ctx->d()->callData->thisObject);
+ BooleanObject *thisObject = ctx->thisObject().as<BooleanObject>();
if (!thisObject)
- return ctx->throwTypeError();
- result = thisObject->value().booleanValue();
+ return ctx->engine()->throwTypeError();
+ result = thisObject->value();
}
return Encode(ctx->d()->engine->newString(QLatin1String(result ? "true" : "false")));
@@ -87,13 +84,12 @@ ReturnedValue BooleanPrototype::method_toString(CallContext *ctx)
ReturnedValue BooleanPrototype::method_valueOf(CallContext *ctx)
{
- if (ctx->d()->callData->thisObject.isBoolean())
- return ctx->d()->callData->thisObject.asReturnedValue();
+ if (ctx->thisObject().isBoolean())
+ return ctx->thisObject().asReturnedValue();
- Scope scope(ctx);
- Scoped<BooleanObject> thisObject(scope, ctx->d()->callData->thisObject);
+ BooleanObject *thisObject = ctx->thisObject().as<BooleanObject>();
if (!thisObject)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
- return thisObject->value().asReturnedValue();
+ return Encode(thisObject->value());
}
diff --git a/src/qml/jsruntime/qv4booleanobject_p.h b/src/qml/jsruntime/qv4booleanobject_p.h
index 2e96b72b64..903261bdce 100644
--- a/src/qml/jsruntime/qv4booleanobject_p.h
+++ b/src/qml/jsruntime/qv4booleanobject_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -41,13 +41,17 @@ QT_BEGIN_NAMESPACE
namespace QV4 {
+namespace Heap {
+
+struct BooleanCtor : FunctionObject {
+ BooleanCtor(QV4::ExecutionContext *scope);
+};
+
+}
+
struct BooleanCtor: FunctionObject
{
- struct Data : FunctionObject::Data {
- Data(ExecutionContext *scope);
- };
-
- V4_OBJECT(FunctionObject)
+ V4_OBJECT2(BooleanCtor, FunctionObject)
static ReturnedValue construct(Managed *, CallData *callData);
static ReturnedValue call(Managed *that, CallData *callData);
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp
index 5ca47a80b1..9330f10780 100644
--- a/src/qml/jsruntime/qv4context.cpp
+++ b/src/qml/jsruntime/qv4context.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -46,17 +46,17 @@ using namespace QV4;
DEFINE_MANAGED_VTABLE(ExecutionContext);
DEFINE_MANAGED_VTABLE(CallContext);
DEFINE_MANAGED_VTABLE(WithContext);
+DEFINE_MANAGED_VTABLE(CatchContext);
DEFINE_MANAGED_VTABLE(GlobalContext);
-HeapObject *ExecutionContext::newCallContext(FunctionObject *function, CallData *callData)
+Heap::CallContext *ExecutionContext::newCallContext(FunctionObject *function, CallData *callData)
{
Q_ASSERT(function->function());
- CallContext::Data *c = reinterpret_cast<CallContext::Data *>(d()->engine->memoryManager->allocManaged(requiredMemoryForExecutionContect(function, callData->argc)));
- new (c) CallContext::Data(d()->engine, Type_CallContext);
+ Heap::CallContext *c = d()->engine->memoryManager->allocManaged<CallContext>(requiredMemoryForExecutionContect(function, callData->argc));
+ new (c) Heap::CallContext(d()->engine, Heap::ExecutionContext::Type_CallContext);
- c->function = function;
- c->realArgumentCount = callData->argc;
+ c->function = function->d();
c->strictMode = function->strictMode();
c->outer = function->scope();
@@ -76,26 +76,26 @@ HeapObject *ExecutionContext::newCallContext(FunctionObject *function, CallData
::memcpy(c->callData, callData, sizeof(CallData) + (callData->argc - 1) * sizeof(Value));
if (callData->argc < static_cast<int>(compiledFunction->nFormals))
std::fill(c->callData->args + c->callData->argc, c->callData->args + compiledFunction->nFormals, Primitive::undefinedValue());
- c->callData->argc = qMax((uint)callData->argc, compiledFunction->nFormals);
return c;
}
-WithContext *ExecutionContext::newWithContext(Object *with)
+Heap::WithContext *ExecutionContext::newWithContext(Object *with)
{
return d()->engine->memoryManager->alloc<WithContext>(d()->engine, with);
}
-CatchContext *ExecutionContext::newCatchContext(String *exceptionVarName, const ValueRef exceptionValue)
+Heap::CatchContext *ExecutionContext::newCatchContext(String *exceptionVarName, const Value &exceptionValue)
{
return d()->engine->memoryManager->alloc<CatchContext>(d()->engine, exceptionVarName, exceptionValue);
}
-CallContext *ExecutionContext::newQmlContext(FunctionObject *f, Object *qml)
+Heap::CallContext *ExecutionContext::newQmlContext(FunctionObject *f, Object *qml)
{
- CallContext *c = reinterpret_cast<CallContext*>(d()->engine->memoryManager->allocManaged(requiredMemoryForExecutionContect(f, 0)));
- new (c->d()) CallContext::Data(d()->engine, qml, f);
- return c;
+ Scope scope(this);
+ Scoped<CallContext> c(scope, d()->engine->memoryManager->allocManaged<CallContext>(requiredMemoryForExecutionContect(f, 0)));
+ new (c->d()) Heap::CallContext(d()->engine, qml, f);
+ return c->d();
}
@@ -105,14 +105,14 @@ void ExecutionContext::createMutableBinding(String *name, bool deletable)
Scope scope(this);
// find the right context to create the binding on
- ScopedObject activation(scope, d()->engine->globalObject);
- ExecutionContext *ctx = this;
+ ScopedObject activation(scope, d()->engine->globalObject());
+ ScopedContext ctx(scope, this);
while (ctx) {
- if (ctx->d()->type >= Type_CallContext) {
- CallContext *c = static_cast<CallContext *>(ctx);
- if (!c->d()->activation)
- c->d()->activation = d()->engine->newObject()->getPointer();
- activation = c->d()->activation;
+ if (ctx->d()->type >= Heap::ExecutionContext::Type_CallContext) {
+ Heap::CallContext *c = static_cast<Heap::CallContext *>(ctx->d());
+ if (!c->activation)
+ c->activation = scope.engine->newObject();
+ activation = c->activation;
break;
}
ctx = ctx->d()->outer;
@@ -120,56 +120,56 @@ void ExecutionContext::createMutableBinding(String *name, bool deletable)
if (activation->hasProperty(name))
return;
- Property desc(Primitive::undefinedValue());
+ ScopedProperty desc(scope);
PropertyAttributes attrs(Attr_Data);
attrs.setConfigurable(deletable);
- activation->__defineOwnProperty__(this, name, desc, attrs);
+ activation->__defineOwnProperty__(scope.engine, name, desc, attrs);
}
-GlobalContext::Data::Data(ExecutionEngine *eng)
- : ExecutionContext::Data(eng, Type_GlobalContext)
+Heap::GlobalContext::GlobalContext(ExecutionEngine *eng)
+ : Heap::ExecutionContext(eng, Heap::ExecutionContext::Type_GlobalContext)
{
- global = eng->globalObject;
+ global = eng->globalObject()->d();
}
-WithContext::Data::Data(ExecutionEngine *engine, Object *with)
- : ExecutionContext::Data(engine, Type_WithContext)
+Heap::WithContext::WithContext(ExecutionEngine *engine, QV4::Object *with)
+ : Heap::ExecutionContext(engine, Heap::ExecutionContext::Type_WithContext)
{
- callData = parent->d()->callData;
+ callData = parent->callData;
outer = parent;
- lookups = parent->d()->lookups;
- compilationUnit = parent->d()->compilationUnit;
+ lookups = parent->lookups;
+ compilationUnit = parent->compilationUnit;
- withObject = with;
+ withObject = with ? with->d() : 0;
}
-CatchContext::Data::Data(ExecutionEngine *engine, String *exceptionVarName, const ValueRef exceptionValue)
- : ExecutionContext::Data(engine, Type_CatchContext)
+Heap::CatchContext::CatchContext(ExecutionEngine *engine, QV4::String *exceptionVarName, const Value &exceptionValue)
+ : Heap::ExecutionContext(engine, Heap::ExecutionContext::Type_CatchContext)
{
- strictMode = parent->d()->strictMode;
- callData = parent->d()->callData;
+ strictMode = parent->strictMode;
+ callData = parent->callData;
outer = parent;
- lookups = parent->d()->lookups;
- compilationUnit = parent->d()->compilationUnit;
+ lookups = parent->lookups;
+ compilationUnit = parent->compilationUnit;
this->exceptionVarName = exceptionVarName;
this->exceptionValue = exceptionValue;
}
-CallContext::Data::Data(ExecutionEngine *engine, Object *qml, FunctionObject *function)
- : ExecutionContext::Data(engine, Type_QmlContext)
+Heap::CallContext::CallContext(ExecutionEngine *engine, QV4::Object *qml, QV4::FunctionObject *function)
+ : Heap::ExecutionContext(engine, Heap::ExecutionContext::Type_QmlContext)
{
- this->function = function;
+ this->function = function->d();
callData = reinterpret_cast<CallData *>(this + 1);
callData->tag = QV4::Value::_Integer_Type;
callData->argc = 0;
callData->thisObject = Primitive::undefinedValue();
- strictMode = true;
+ strictMode = false;
outer = function->scope();
- activation = qml;
+ activation = qml->d();
if (function->function()) {
compilationUnit = function->function()->compilationUnit;
@@ -181,9 +181,9 @@ CallContext::Data::Data(ExecutionEngine *engine, Object *qml, FunctionObject *fu
std::fill(locals, locals + function->varCount(), Primitive::undefinedValue());
}
-String * const *CallContext::formals() const
+Identifier * const *CallContext::formals() const
{
- return (d()->function && d()->function->function()) ? d()->function->function()->internalClass->nameMap.constData() : 0;
+ return (d()->function && d()->function->function) ? d()->function->function->internalClass->nameMap.constData() : 0;
}
unsigned int CallContext::formalCount() const
@@ -191,9 +191,9 @@ unsigned int CallContext::formalCount() const
return d()->function ? d()->function->formalParameterCount() : 0;
}
-String * const *CallContext::variables() const
+Identifier * const *CallContext::variables() const
{
- return (d()->function && d()->function->function()) ? d()->function->function()->internalClass->nameMap.constData() + d()->function->function()->compiledFunction->nFormals : 0;
+ return (d()->function && d()->function->function) ? d()->function->function->internalClass->nameMap.constData() + d()->function->formalParameterCount() : 0;
}
unsigned int CallContext::variableCount() const
@@ -207,112 +207,114 @@ bool ExecutionContext::deleteProperty(String *name)
{
Scope scope(this);
bool hasWith = false;
- for (ExecutionContext *ctx = this; ctx; ctx = ctx->d()->outer) {
- if (ctx->d()->type == Type_WithContext) {
+ ScopedContext ctx(scope, this);
+ for (; ctx; ctx = ctx->d()->outer) {
+ if (ctx->d()->type == Heap::ExecutionContext::Type_WithContext) {
hasWith = true;
- WithContext *w = static_cast<WithContext *>(ctx);
- if (w->d()->withObject->hasProperty(name))
- return w->d()->withObject->deleteProperty(name);
- } else if (ctx->d()->type == Type_CatchContext) {
- CatchContext *c = static_cast<CatchContext *>(ctx);
- if (c->d()->exceptionVarName->isEqualTo(name))
+ ScopedObject withObject(scope, static_cast<Heap::WithContext *>(ctx->d())->withObject);
+ if (withObject->hasProperty(name))
+ return withObject->deleteProperty(name);
+ } else if (ctx->d()->type == Heap::ExecutionContext::Type_CatchContext) {
+ Heap::CatchContext *c = static_cast<Heap::CatchContext *>(ctx->d());
+ if (c->exceptionVarName->isEqualTo(name))
return false;
- } else if (ctx->d()->type >= Type_CallContext) {
- CallContext *c = static_cast<CallContext *>(ctx);
- FunctionObject *f = c->d()->function;
+ } else if (ctx->d()->type >= Heap::ExecutionContext::Type_CallContext) {
+ Heap::CallContext *c = static_cast<Heap::CallContext *>(ctx->d());
+ ScopedFunctionObject f(scope, c->function);
if (f->needsActivation() || hasWith) {
uint index = f->function()->internalClass->find(name);
if (index < UINT_MAX)
// ### throw in strict mode?
return false;
}
- if (c->d()->activation && c->d()->activation->hasProperty(name))
- return c->d()->activation->deleteProperty(name);
- } else if (ctx->d()->type == Type_GlobalContext) {
- GlobalContext *g = static_cast<GlobalContext *>(ctx);
- if (g->d()->global->hasProperty(name))
- return g->d()->global->deleteProperty(name);
+ ScopedObject activation(scope, c->activation);
+ if (activation && activation->hasProperty(name))
+ return activation->deleteProperty(name);
+ } else if (ctx->d()->type == Heap::ExecutionContext::Type_GlobalContext) {
+ ScopedObject global(scope, static_cast<Heap::GlobalContext *>(ctx->d())->global);
+ if (global->hasProperty(name))
+ return global->deleteProperty(name);
}
}
if (d()->strictMode)
- throwSyntaxError(QStringLiteral("Can't delete property %1").arg(name->toQString()));
+ engine()->throwSyntaxError(QStringLiteral("Can't delete property %1").arg(name->toQString()));
return true;
}
bool CallContext::needsOwnArguments() const
{
- return d()->function->needsActivation() || d()->callData->argc < static_cast<int>(d()->function->formalParameterCount());
-}
-
-void ExecutionContext::markObjects(Managed *m, ExecutionEngine *engine)
-{
- ExecutionContext *ctx = static_cast<ExecutionContext *>(m);
-
- if (ctx->d()->outer)
- ctx->d()->outer->mark(engine);
-
- // ### shouldn't need these 3 lines
- ctx->d()->callData->thisObject.mark(engine);
- for (int arg = 0; arg < ctx->d()->callData->argc; ++arg)
- ctx->d()->callData->args[arg].mark(engine);
-
- if (ctx->d()->type >= Type_CallContext) {
- QV4::CallContext *c = static_cast<CallContext *>(ctx);
- for (unsigned local = 0, lastLocal = c->d()->function->varCount(); local < lastLocal; ++local)
- c->d()->locals[local].mark(engine);
- if (c->d()->activation)
- c->d()->activation->mark(engine);
- c->d()->function->mark(engine);
- } else if (ctx->d()->type == Type_WithContext) {
- WithContext *w = static_cast<WithContext *>(ctx);
- w->d()->withObject->mark(engine);
- } else if (ctx->d()->type == Type_CatchContext) {
- CatchContext *c = static_cast<CatchContext *>(ctx);
- c->d()->exceptionVarName->mark(engine);
- c->d()->exceptionValue.mark(engine);
- } else if (ctx->d()->type == Type_GlobalContext) {
- GlobalContext *g = static_cast<GlobalContext *>(ctx);
- g->d()->global->mark(engine);
+ return d()->function->needsActivation() || argc() < static_cast<int>(d()->function->formalParameterCount());
+}
+
+void ExecutionContext::markObjects(Heap::Base *m, ExecutionEngine *engine)
+{
+ ExecutionContext::Data *ctx = static_cast<ExecutionContext::Data *>(m);
+
+ if (ctx->outer)
+ ctx->outer->mark(engine);
+
+ if (ctx->type >= Heap::ExecutionContext::Type_CallContext) {
+ QV4::Heap::CallContext *c = static_cast<Heap::CallContext *>(ctx);
+ ctx->callData->thisObject.mark(engine);
+ for (int arg = 0; arg < qMax(ctx->callData->argc, (int)c->function->formalParameterCount()); ++arg)
+ ctx->callData->args[arg].mark(engine);
+ for (unsigned local = 0, lastLocal = c->function->varCount(); local < lastLocal; ++local)
+ c->locals[local].mark(engine);
+ if (c->activation)
+ c->activation->mark(engine);
+ c->function->mark(engine);
+ } else if (ctx->type == Heap::ExecutionContext::Type_WithContext) {
+ WithContext::Data *w = static_cast<WithContext::Data *>(ctx);
+ if (w->withObject)
+ w->withObject->mark(engine);
+ } else if (ctx->type == Heap::ExecutionContext::Type_CatchContext) {
+ CatchContext::Data *c = static_cast<CatchContext::Data *>(ctx);
+ c->exceptionVarName->mark(engine);
+ c->exceptionValue.mark(engine);
+ } else if (ctx->type == Heap::ExecutionContext::Type_GlobalContext) {
+ GlobalContext::Data *g = static_cast<GlobalContext::Data *>(ctx);
+ g->global->mark(engine);
}
}
-void ExecutionContext::setProperty(String *name, const ValueRef value)
+void ExecutionContext::setProperty(String *name, const Value &value)
{
Scope scope(this);
- for (ExecutionContext *ctx = this; ctx; ctx = ctx->d()->outer) {
- if (ctx->d()->type == Type_WithContext) {
- ScopedObject w(scope, static_cast<WithContext *>(ctx)->d()->withObject);
+ ScopedContext ctx(scope, this);
+ for (; ctx; ctx = ctx->d()->outer) {
+ if (ctx->d()->type == Heap::ExecutionContext::Type_WithContext) {
+ ScopedObject w(scope, static_cast<Heap::WithContext *>(ctx->d())->withObject);
if (w->hasProperty(name)) {
w->put(name, value);
return;
}
- } else if (ctx->d()->type == Type_CatchContext && static_cast<CatchContext *>(ctx)->d()->exceptionVarName->isEqualTo(name)) {
- static_cast<CatchContext *>(ctx)->d()->exceptionValue = *value;
+ } else if (ctx->d()->type == Heap::ExecutionContext::Type_CatchContext && static_cast<Heap::CatchContext *>(ctx->d())->exceptionVarName->isEqualTo(name)) {
+ static_cast<Heap::CatchContext *>(ctx->d())->exceptionValue = value;
return;
} else {
ScopedObject activation(scope, (Object *)0);
- if (ctx->d()->type >= Type_CallContext) {
- CallContext *c = static_cast<CallContext *>(ctx);
- if (c->d()->function->function()) {
- uint index = c->d()->function->function()->internalClass->find(name);
+ if (ctx->d()->type >= Heap::ExecutionContext::Type_CallContext) {
+ Heap::CallContext *c = static_cast<Heap::CallContext *>(ctx->d());
+ if (c->function->function) {
+ uint index = c->function->function->internalClass->find(name);
if (index < UINT_MAX) {
- if (index < c->d()->function->formalParameterCount()) {
- c->d()->callData->args[c->d()->function->formalParameterCount() - index - 1] = *value;
+ if (index < c->function->formalParameterCount()) {
+ c->callData->args[c->function->formalParameterCount() - index - 1] = value;
} else {
- index -= c->d()->function->formalParameterCount();
- c->d()->locals[index] = *value;
+ index -= c->function->formalParameterCount();
+ c->locals[index] = value;
}
return;
}
}
- activation = c->d()->activation;
- } else if (ctx->d()->type == Type_GlobalContext) {
- activation = static_cast<GlobalContext *>(ctx)->d()->global;
+ activation = c->activation;
+ } else if (ctx->d()->type == Heap::ExecutionContext::Type_GlobalContext) {
+ activation = static_cast<Heap::GlobalContext *>(ctx->d())->global;
}
if (activation) {
- if (ctx->d()->type == Type_QmlContext) {
+ if (ctx->d()->type == Heap::ExecutionContext::Type_QmlContext) {
activation->put(name, value);
return;
} else {
@@ -325,238 +327,163 @@ void ExecutionContext::setProperty(String *name, const ValueRef value)
}
}
}
- if (d()->strictMode || name->equals(d()->engine->id_this.getPointer())) {
+ if (d()->strictMode || name->equals(d()->engine->id_this)) {
ScopedValue n(scope, name->asReturnedValue());
- throwReferenceError(n);
+ engine()->throwReferenceError(n);
return;
}
- d()->engine->globalObject->put(name, value);
+ d()->engine->globalObject()->put(name, value);
}
ReturnedValue ExecutionContext::getProperty(String *name)
{
Scope scope(this);
ScopedValue v(scope);
- name->makeIdentifier();
+ name->makeIdentifier(scope.engine);
- if (name->equals(d()->engine->id_this.getPointer()))
- return d()->callData->thisObject.asReturnedValue();
+ if (name->equals(d()->engine->id_this))
+ return thisObject().asReturnedValue();
bool hasWith = false;
bool hasCatchScope = false;
- for (ExecutionContext *ctx = this; ctx; ctx = ctx->d()->outer) {
- if (ctx->d()->type == Type_WithContext) {
- ScopedObject w(scope, static_cast<WithContext *>(ctx)->d()->withObject);
+ ScopedContext ctx(scope, this);
+ for (; ctx; ctx = ctx->d()->outer) {
+ if (ctx->d()->type == Heap::ExecutionContext::Type_WithContext) {
+ ScopedObject w(scope, static_cast<Heap::WithContext *>(ctx->d())->withObject);
hasWith = true;
bool hasProperty = false;
v = w->get(name, &hasProperty);
if (hasProperty) {
- return v.asReturnedValue();
+ return v->asReturnedValue();
}
continue;
}
- else if (ctx->d()->type == Type_CatchContext) {
+ else if (ctx->d()->type == Heap::ExecutionContext::Type_CatchContext) {
hasCatchScope = true;
- CatchContext *c = static_cast<CatchContext *>(ctx);
- if (c->d()->exceptionVarName->isEqualTo(name))
- return c->d()->exceptionValue.asReturnedValue();
+ Heap::CatchContext *c = static_cast<Heap::CatchContext *>(ctx->d());
+ if (c->exceptionVarName->isEqualTo(name))
+ return c->exceptionValue.asReturnedValue();
}
- else if (ctx->d()->type >= Type_CallContext) {
- QV4::CallContext *c = static_cast<CallContext *>(ctx);
- ScopedFunctionObject f(scope, c->d()->function);
+ else if (ctx->d()->type >= Heap::ExecutionContext::Type_CallContext) {
+ Heap::CallContext *c = static_cast<Heap::CallContext *>(ctx->d());
+ ScopedFunctionObject f(scope, c->function);
if (f->function() && (f->needsActivation() || hasWith || hasCatchScope)) {
uint index = f->function()->internalClass->find(name);
if (index < UINT_MAX) {
- if (index < c->d()->function->formalParameterCount())
- return c->d()->callData->args[c->d()->function->formalParameterCount() - index - 1].asReturnedValue();
- return c->d()->locals[index - c->d()->function->formalParameterCount()].asReturnedValue();
+ if (index < c->function->formalParameterCount())
+ return c->callData->args[c->function->formalParameterCount() - index - 1].asReturnedValue();
+ return c->locals[index - c->function->formalParameterCount()].asReturnedValue();
}
}
- if (c->d()->activation) {
+ ScopedObject activation(scope, c->activation);
+ if (activation) {
bool hasProperty = false;
- v = c->d()->activation->get(name, &hasProperty);
+ v = activation->get(name, &hasProperty);
if (hasProperty)
- return v.asReturnedValue();
+ return v->asReturnedValue();
}
if (f->function() && f->function()->isNamedExpression()
- && name->equals(f->function()->name()))
+ && name->equals(ScopedString(scope, f->function()->name())))
return f.asReturnedValue();
}
- else if (ctx->d()->type == Type_GlobalContext) {
- GlobalContext *g = static_cast<GlobalContext *>(ctx);
+ else if (ctx->d()->type == Heap::ExecutionContext::Type_GlobalContext) {
+ ScopedObject global(scope, static_cast<Heap::GlobalContext *>(ctx->d())->global);
bool hasProperty = false;
- v = g->d()->global->get(name, &hasProperty);
+ v = global->get(name, &hasProperty);
if (hasProperty)
- return v.asReturnedValue();
+ return v->asReturnedValue();
}
}
ScopedValue n(scope, name);
- return throwReferenceError(n);
+ return engine()->throwReferenceError(n);
}
-ReturnedValue ExecutionContext::getPropertyAndBase(String *name, Object *&base)
+ReturnedValue ExecutionContext::getPropertyAndBase(String *name, Heap::Object **base)
{
Scope scope(this);
ScopedValue v(scope);
- base = (Object *)0;
- name->makeIdentifier();
+ *base = (Heap::Object *)0;
+ name->makeIdentifier(scope.engine);
- if (name->equals(d()->engine->id_this.getPointer()))
- return d()->callData->thisObject.asReturnedValue();
+ if (name->equals(d()->engine->id_this))
+ return thisObject().asReturnedValue();
bool hasWith = false;
bool hasCatchScope = false;
- for (ExecutionContext *ctx = this; ctx; ctx = ctx->d()->outer) {
- if (ctx->d()->type == Type_WithContext) {
- Object *w = static_cast<WithContext *>(ctx)->d()->withObject;
+ ScopedContext ctx(scope, this);
+ for (; ctx; ctx = ctx->d()->outer) {
+ if (ctx->d()->type == Heap::ExecutionContext::Type_WithContext) {
+ ScopedObject w(scope, static_cast<Heap::WithContext *>(ctx->d())->withObject);
hasWith = true;
bool hasProperty = false;
v = w->get(name, &hasProperty);
if (hasProperty) {
- base = w;
- return v.asReturnedValue();
+ *base = w->d();
+ return v->asReturnedValue();
}
continue;
}
- else if (ctx->d()->type == Type_CatchContext) {
+ else if (ctx->d()->type == Heap::ExecutionContext::Type_CatchContext) {
hasCatchScope = true;
- CatchContext *c = static_cast<CatchContext *>(ctx);
- if (c->d()->exceptionVarName->isEqualTo(name))
- return c->d()->exceptionValue.asReturnedValue();
+ Heap::CatchContext *c = static_cast<Heap::CatchContext *>(ctx->d());
+ if (c->exceptionVarName->isEqualTo(name))
+ return c->exceptionValue.asReturnedValue();
}
- else if (ctx->d()->type >= Type_CallContext) {
- QV4::CallContext *c = static_cast<CallContext *>(ctx);
- FunctionObject *f = c->d()->function;
+ else if (ctx->d()->type >= Heap::ExecutionContext::Type_CallContext) {
+ Heap::CallContext *c = static_cast<Heap::CallContext *>(ctx->d());
+ ScopedFunctionObject f(scope, c->function);
if (f->function() && (f->needsActivation() || hasWith || hasCatchScope)) {
uint index = f->function()->internalClass->find(name);
if (index < UINT_MAX) {
- if (index < c->d()->function->formalParameterCount())
- return c->d()->callData->args[c->d()->function->formalParameterCount() - index - 1].asReturnedValue();
- return c->d()->locals[index - c->d()->function->formalParameterCount()].asReturnedValue();
+ if (index < f->formalParameterCount())
+ return c->callData->args[f->formalParameterCount() - index - 1].asReturnedValue();
+ return c->locals[index - f->formalParameterCount()].asReturnedValue();
}
}
- if (c->d()->activation) {
+ ScopedObject activation(scope, c->activation);
+ if (activation) {
bool hasProperty = false;
- v = c->d()->activation->get(name, &hasProperty);
+ v = activation->get(name, &hasProperty);
if (hasProperty) {
- if (ctx->d()->type == Type_QmlContext)
- base = c->d()->activation;
- return v.asReturnedValue();
+ if (ctx->d()->type == Heap::ExecutionContext::Type_QmlContext)
+ *base = activation->d();
+ return v->asReturnedValue();
}
}
if (f->function() && f->function()->isNamedExpression()
- && name->equals(f->function()->name()))
- return c->d()->function->asReturnedValue();
+ && name->equals(ScopedString(scope, f->function()->name())))
+ return c->function->asReturnedValue();
}
- else if (ctx->d()->type == Type_GlobalContext) {
- GlobalContext *g = static_cast<GlobalContext *>(ctx);
+ else if (ctx->d()->type == Heap::ExecutionContext::Type_GlobalContext) {
+ ScopedObject global(scope, static_cast<Heap::GlobalContext *>(ctx->d())->global);
bool hasProperty = false;
- v = g->d()->global->get(name, &hasProperty);
+ v = global->get(name, &hasProperty);
if (hasProperty)
- return v.asReturnedValue();
+ return v->asReturnedValue();
}
}
ScopedValue n(scope, name);
- return throwReferenceError(n);
-}
-
-
-ReturnedValue ExecutionContext::throwError(const ValueRef value)
-{
- return d()->engine->throwException(value);
-}
-
-ReturnedValue ExecutionContext::throwError(const QString &message)
-{
- Scope scope(this);
- ScopedValue v(scope, d()->engine->newString(message));
- v = d()->engine->newErrorObject(v);
- return throwError(v);
-}
-
-ReturnedValue ExecutionContext::throwSyntaxError(const QString &message, const QString &fileName, int line, int column)
-{
- Scope scope(this);
- Scoped<Object> error(scope, d()->engine->newSyntaxErrorObject(message, fileName, line, column));
- return throwError(error);
-}
-
-ReturnedValue ExecutionContext::throwSyntaxError(const QString &message)
-{
- Scope scope(this);
- Scoped<Object> error(scope, d()->engine->newSyntaxErrorObject(message));
- return throwError(error);
-}
-
-ReturnedValue ExecutionContext::throwTypeError()
-{
- Scope scope(this);
- Scoped<Object> error(scope, d()->engine->newTypeErrorObject(QStringLiteral("Type error")));
- return throwError(error);
-}
-
-ReturnedValue ExecutionContext::throwTypeError(const QString &message)
-{
- Scope scope(this);
- Scoped<Object> error(scope, d()->engine->newTypeErrorObject(message));
- return throwError(error);
-}
-
-ReturnedValue ExecutionContext::throwUnimplemented(const QString &message)
-{
- Scope scope(this);
- ScopedValue v(scope, d()->engine->newString(QStringLiteral("Unimplemented ") + message));
- v = d()->engine->newErrorObject(v);
- return throwError(v);
-}
-
-ReturnedValue ExecutionContext::catchException(StackTrace *trace)
-{
- return d()->engine->catchException(this, trace);
-}
-
-ReturnedValue ExecutionContext::throwReferenceError(const ValueRef value)
-{
- Scope scope(this);
- Scoped<String> s(scope, value->toString(this));
- QString msg = s->toQString() + QStringLiteral(" is not defined");
- Scoped<Object> error(scope, d()->engine->newReferenceErrorObject(msg));
- return throwError(error);
+ return engine()->throwReferenceError(n);
}
-ReturnedValue ExecutionContext::throwReferenceError(const QString &message, const QString &fileName, int line, int column)
+Heap::FunctionObject *ExecutionContext::getFunctionObject() const
{
- Scope scope(this);
- QString msg = message;
- Scoped<Object> error(scope, d()->engine->newReferenceErrorObject(msg, fileName, line, column));
- return throwError(error);
-}
-
-ReturnedValue ExecutionContext::throwRangeError(const ValueRef value)
-{
- Scope scope(this);
- ScopedString s(scope, value->toString(this));
- QString msg = s->toQString() + QStringLiteral(" out of range");
- ScopedObject error(scope, d()->engine->newRangeErrorObject(msg));
- return throwError(error);
-}
-
-ReturnedValue ExecutionContext::throwRangeError(const QString &message)
-{
- Scope scope(this);
- ScopedObject error(scope, d()->engine->newRangeErrorObject(message));
- return throwError(error);
-}
+ Scope scope(d()->engine);
+ ScopedContext it(scope, this->d());
+ for (; it; it = it->d()->parent) {
+ if (const CallContext *callCtx = it->asCallContext())
+ return callCtx->d()->function;
+ else if (it->asCatchContext() || it->asWithContext())
+ continue; // look in the parent context for a FunctionObject
+ else
+ break;
+ }
-ReturnedValue ExecutionContext::throwURIError(const ValueRef msg)
-{
- Scope scope(this);
- ScopedObject error(scope, d()->engine->newURIErrorObject(msg));
- return throwError(error);
+ return 0;
}
diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h
index 99a982aa7f..8392dd836d 100644
--- a/src/qml/jsruntime/qv4context_p.h
+++ b/src/qml/jsruntime/qv4context_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -34,21 +34,12 @@
#define QMLJS_ENVIRONMENT_H
#include "qv4global_p.h"
-#include "qv4scopedvalue_p.h"
#include "qv4managed_p.h"
-#include "qv4engine_p.h"
QT_BEGIN_NAMESPACE
namespace QV4 {
-struct Object;
-struct ExecutionEngine;
-struct DeclarativeEnvironment;
-struct Lookup;
-struct Function;
-struct ValueRef;
-
namespace CompiledData {
struct CompilationUnit;
struct Function;
@@ -58,12 +49,27 @@ struct CallContext;
struct CatchContext;
struct WithContext;
-struct Q_QML_EXPORT ExecutionContext : public Managed
+struct CallData
{
- enum {
- IsExecutionContext = true
- };
+ // below is to be compatible with Value. Initialize tag to 0
+#if Q_BYTE_ORDER != Q_LITTLE_ENDIAN
+ uint tag;
+#endif
+ int argc;
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+ uint tag;
+#endif
+ inline ReturnedValue argument(int i) const {
+ return i < argc ? args[i].asReturnedValue() : Primitive::undefinedValue().asReturnedValue();
+ }
+ Value thisObject;
+ Value args[1];
+};
+
+namespace Heap {
+
+struct ExecutionContext : Base {
enum ContextType {
Type_GlobalContext = 0x1,
Type_CatchContext = 0x2,
@@ -73,112 +79,109 @@ struct Q_QML_EXPORT ExecutionContext : public Managed
Type_QmlContext = 0x6
};
- struct Data : Managed::Data {
- Data(ExecutionEngine *engine, ContextType t)
- : Managed::Data(engine->executionContextClass)
- , type(t)
- , strictMode(false)
- , engine(engine)
- , parent(engine->currentContext())
- , outer(0)
- , lookups(0)
- , compilationUnit(0)
- , lineNumber(-1)
- {
- engine->current = reinterpret_cast<ExecutionContext *>(this);
- }
- ContextType type;
- bool strictMode;
-
- CallData *callData;
-
- ExecutionEngine *engine;
- ExecutionContext *parent;
- ExecutionContext *outer;
- Lookup *lookups;
- CompiledData::CompilationUnit *compilationUnit;
-
- int lineNumber;
+ inline ExecutionContext(ExecutionEngine *engine, ContextType t);
- };
- V4_MANAGED(Managed)
- Q_MANAGED_TYPE(ExecutionContext)
+ CallData *callData;
- ExecutionContext(ExecutionEngine *engine, ContextType t)
- : Managed(engine->executionContextClass)
+ ExecutionEngine *engine;
+ ExecutionContext *parent;
+ ExecutionContext *outer;
+ Lookup *lookups;
+ CompiledData::CompilationUnit *compilationUnit;
+
+ ContextType type : 8;
+ bool strictMode : 8;
+ int lineNumber;
+};
+
+struct CallContext : ExecutionContext {
+ CallContext(ExecutionEngine *engine, ContextType t = Type_SimpleCallContext)
+ : ExecutionContext(engine, t)
{
- d()->type = t;
- d()->strictMode = false;
- d()->engine = engine;
- d()->parent = engine->currentContext();
- d()->outer = 0;
- d()->lookups = 0;
- d()->compilationUnit = 0;
- d()->lineNumber = -1;
- engine->current = this;
+ function = 0;
+ locals = 0;
+ activation = 0;
}
+ CallContext(ExecutionEngine *engine, QV4::Object *qml, QV4::FunctionObject *function);
+
+ FunctionObject *function;
+ Value *locals;
+ Object *activation;
+};
+
+struct GlobalContext : ExecutionContext {
+ GlobalContext(ExecutionEngine *engine);
+ Object *global;
+};
+
+struct CatchContext : ExecutionContext {
+ CatchContext(ExecutionEngine *engine, QV4::String *exceptionVarName, const Value &exceptionValue);
+ StringValue exceptionVarName;
+ Value exceptionValue;
+};
+
+struct WithContext : ExecutionContext {
+ WithContext(ExecutionEngine *engine, QV4::Object *with);
+ Object *withObject;
+};
+
+
+}
+
+struct Q_QML_EXPORT ExecutionContext : public Managed
+{
+ enum {
+ IsExecutionContext = true
+ };
+
+ V4_MANAGED(ExecutionContext, Managed)
+ Q_MANAGED_TYPE(ExecutionContext)
- HeapObject *newCallContext(FunctionObject *f, CallData *callData);
- WithContext *newWithContext(Object *with);
- CatchContext *newCatchContext(String *exceptionVarName, const ValueRef exceptionValue);
- CallContext *newQmlContext(FunctionObject *f, Object *qml);
+ ExecutionEngine *engine() const { return d()->engine; }
+
+ Heap::CallContext *newCallContext(FunctionObject *f, CallData *callData);
+ Heap::WithContext *newWithContext(Object *with);
+ Heap::CatchContext *newCatchContext(String *exceptionVarName, const Value &exceptionValue);
+ Heap::CallContext *newQmlContext(FunctionObject *f, Object *qml);
void createMutableBinding(String *name, bool deletable);
- ReturnedValue throwError(const QV4::ValueRef value);
- ReturnedValue throwError(const QString &message);
- ReturnedValue throwSyntaxError(const QString &message);
- ReturnedValue throwSyntaxError(const QString &message, const QString &fileName, int lineNumber, int column);
- ReturnedValue throwTypeError();
- ReturnedValue throwTypeError(const QString &message);
- ReturnedValue throwReferenceError(const ValueRef value);
- ReturnedValue throwReferenceError(const QString &value, const QString &fileName, int lineNumber, int column);
- ReturnedValue throwRangeError(const ValueRef value);
- ReturnedValue throwRangeError(const QString &message);
- ReturnedValue throwURIError(const ValueRef msg);
- ReturnedValue throwUnimplemented(const QString &message);
-
- void setProperty(String *name, const ValueRef value);
+ void setProperty(String *name, const Value &value);
ReturnedValue getProperty(String *name);
- ReturnedValue getPropertyAndBase(String *name, Object *&base);
+ ReturnedValue getPropertyAndBase(String *name, Heap::Object **base);
bool deleteProperty(String *name);
- // Can only be called from within catch(...), rethrows if no JS exception.
- ReturnedValue catchException(StackTrace *trace = 0);
-
inline CallContext *asCallContext();
inline const CallContext *asCallContext() const;
inline const CatchContext *asCatchContext() const;
inline const WithContext *asWithContext() const;
- inline FunctionObject *getFunctionObject() const;
+ Heap::FunctionObject *getFunctionObject() const;
+
+ static void markObjects(Heap::Base *m, ExecutionEngine *e);
- static void markObjects(Managed *m, ExecutionEngine *e);
+ const Value &thisObject() const {
+ return d()->callData->thisObject;
+ }
+ int argc() const {
+ return d()->callData->argc;
+ }
+ const Value *args() const {
+ return d()->callData->args;
+ }
+ ReturnedValue argument(int i) const {
+ return d()->callData->argument(i);
+ }
};
struct CallContext : public ExecutionContext
{
- struct Data : ExecutionContext::Data {
- Data(ExecutionEngine *engine, ContextType t = Type_SimpleCallContext)
- : ExecutionContext::Data(engine, t)
- {
- function = 0;
- locals = 0;
- activation = 0;
- }
- Data(ExecutionEngine *engine, Object *qml, QV4::FunctionObject *function);
-
- FunctionObject *function;
- int realArgumentCount;
- Value *locals;
- Object *activation;
- };
- V4_MANAGED(ExecutionContext)
+ V4_MANAGED(CallContext, ExecutionContext)
// formals are in reverse order
- String * const *formals() const;
+ Identifier * const *formals() const;
unsigned int formalCount() const;
- String * const *variables() const;
+ Identifier * const *variables() const;
unsigned int variableCount() const;
inline ReturnedValue argument(int i);
@@ -186,108 +189,43 @@ struct CallContext : public ExecutionContext
};
inline ReturnedValue CallContext::argument(int i) {
- return i < d()->callData->argc ? d()->callData->args[i].asReturnedValue() : Primitive::undefinedValue().asReturnedValue();
+ return i < argc() ? args()[i].asReturnedValue() : Primitive::undefinedValue().asReturnedValue();
}
struct GlobalContext : public ExecutionContext
{
- struct Data : ExecutionContext::Data {
- Data(ExecutionEngine *engine);
- Object *global;
- };
- V4_MANAGED(ExecutionContext)
+ V4_MANAGED(GlobalContext, ExecutionContext)
};
struct CatchContext : public ExecutionContext
{
- struct Data : ExecutionContext::Data {
- Data(ExecutionEngine *engine, String *exceptionVarName, const ValueRef exceptionValue);
- StringValue exceptionVarName;
- Value exceptionValue;
- };
- V4_MANAGED(ExecutionContext)
+ V4_MANAGED(CatchContext, ExecutionContext)
};
struct WithContext : public ExecutionContext
{
- struct Data : ExecutionContext::Data {
- Data(ExecutionEngine *engine, Object *with);
- Object *withObject;
- };
- V4_MANAGED(ExecutionContext)
+ V4_MANAGED(WithContext, ExecutionContext)
};
inline CallContext *ExecutionContext::asCallContext()
{
- return d()->type >= Type_SimpleCallContext ? static_cast<CallContext *>(this) : 0;
+ return d()->type >= Heap::ExecutionContext::Type_SimpleCallContext ? static_cast<CallContext *>(this) : 0;
}
inline const CallContext *ExecutionContext::asCallContext() const
{
- return d()->type >= Type_SimpleCallContext ? static_cast<const CallContext *>(this) : 0;
+ return d()->type >= Heap::ExecutionContext::Type_SimpleCallContext ? static_cast<const CallContext *>(this) : 0;
}
inline const CatchContext *ExecutionContext::asCatchContext() const
{
- return d()->type == Type_CatchContext ? static_cast<const CatchContext *>(this) : 0;
+ return d()->type == Heap::ExecutionContext::Type_CatchContext ? static_cast<const CatchContext *>(this) : 0;
}
inline const WithContext *ExecutionContext::asWithContext() const
{
- return d()->type == Type_WithContext ? static_cast<const WithContext *>(this) : 0;
-}
-
-inline FunctionObject *ExecutionContext::getFunctionObject() const
-{
- for (const ExecutionContext *it = this; it; it = it->d()->parent) {
- if (const CallContext *callCtx = it->asCallContext())
- return callCtx->d()->function;
- else if (it->asCatchContext() || it->asWithContext())
- continue; // look in the parent context for a FunctionObject
- else
- break;
- }
-
- return 0;
-}
-
-inline void ExecutionEngine::pushContext(CallContext *context)
-{
- context->d()->parent = current;
- current = context;
-}
-
-inline ExecutionContext *ExecutionEngine::popContext()
-{
- Q_ASSERT(current->d()->parent);
- current = current->d()->parent;
- return current;
-}
-
-struct ExecutionContextSaver
-{
- ExecutionEngine *engine;
- ExecutionContext *savedContext;
-
- ExecutionContextSaver(ExecutionContext *context)
- : engine(context->d()->engine)
- , savedContext(context)
- {
- }
- ~ExecutionContextSaver()
- {
- engine->current = savedContext;
- }
-};
-
-inline Scope::Scope(ExecutionContext *ctx)
- : engine(ctx->d()->engine)
-#ifndef QT_NO_DEBUG
- , size(0)
-#endif
-{
- mark = engine->jsStackTop;
+ return d()->type == Heap::ExecutionContext::Type_WithContext ? static_cast<const WithContext *>(this) : 0;
}
/* Function *f, int argc */
diff --git a/src/qml/jsruntime/qv4dataview.cpp b/src/qml/jsruntime/qv4dataview.cpp
new file mode 100644
index 0000000000..8a66c2cbfc
--- /dev/null
+++ b/src/qml/jsruntime/qv4dataview.cpp
@@ -0,0 +1,315 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qv4dataview_p.h"
+#include "qv4arraybuffer_p.h"
+
+#include "qendian.h"
+
+using namespace QV4;
+
+DEFINE_OBJECT_VTABLE(DataViewCtor);
+DEFINE_OBJECT_VTABLE(DataView);
+
+Heap::DataViewCtor::DataViewCtor(QV4::ExecutionContext *scope)
+ : Heap::FunctionObject(scope, QStringLiteral("DataView"))
+{
+}
+
+ReturnedValue DataViewCtor::construct(Managed *m, CallData *callData)
+{
+ Scope scope(static_cast<Object *>(m)->engine());
+ Scoped<ArrayBuffer> buffer(scope, callData->argument(0));
+ if (!buffer)
+ return scope.engine->throwTypeError();
+
+ double bo = callData->argc > 1 ? callData->args[1].toNumber() : 0;
+ uint byteOffset = (uint)bo;
+ uint bufferLength = buffer->d()->data->size;
+ double bl = callData->argc < 3 || callData->args[2].isUndefined() ? (bufferLength - bo) : callData->args[2].toNumber();
+ uint byteLength = (uint)bl;
+ if (bo != byteOffset || bl != byteLength || byteOffset + byteLength > bufferLength)
+ return scope.engine->throwRangeError(QStringLiteral("DataView: constructor arguments out of range"));
+
+ Scoped<DataView> a(scope, scope.engine->memoryManager->alloc<DataView>(scope.engine));
+ a->d()->buffer = buffer->d();
+ a->d()->byteLength = byteLength;
+ a->d()->byteOffset = byteOffset;
+ return a.asReturnedValue();
+
+}
+
+ReturnedValue DataViewCtor::call(Managed *that, CallData *callData)
+{
+ return construct(that, callData);
+}
+
+
+Heap::DataView::DataView(ExecutionEngine *e)
+ : Heap::Object(e->emptyClass, e->dataViewPrototype.asObject()),
+ buffer(0),
+ byteLength(0),
+ byteOffset(0)
+{
+}
+
+
+void DataView::markObjects(Heap::Base *that, ExecutionEngine *e)
+{
+ DataView::Data *v = static_cast<DataView::Data *>(that);
+ v->buffer->mark(e);
+}
+
+void DataViewPrototype::init(ExecutionEngine *engine, Object *ctor)
+{
+ Scope scope(engine);
+ ScopedObject o(scope);
+ ctor->defineReadonlyProperty(engine->id_length, Primitive::fromInt32(3));
+ ctor->defineReadonlyProperty(engine->id_prototype, (o = this));
+ defineDefaultProperty(engine->id_constructor, (o = ctor));
+ defineAccessorProperty(QStringLiteral("buffer"), method_get_buffer, 0);
+ defineAccessorProperty(QStringLiteral("byteLength"), method_get_byteLength, 0);
+ defineAccessorProperty(QStringLiteral("byteOffset"), method_get_byteOffset, 0);
+
+ defineDefaultProperty(QStringLiteral("getInt8"), method_getChar<signed char>, 0);
+ defineDefaultProperty(QStringLiteral("getUInt8"), method_getChar<unsigned char>, 0);
+ defineDefaultProperty(QStringLiteral("getInt16"), method_get<short>, 0);
+ defineDefaultProperty(QStringLiteral("getUInt16"), method_get<unsigned short>, 0);
+ defineDefaultProperty(QStringLiteral("getInt32"), method_get<int>, 0);
+ defineDefaultProperty(QStringLiteral("getUInt32"), method_get<unsigned int>, 0);
+ defineDefaultProperty(QStringLiteral("getFloat32"), method_getFloat<float>, 0);
+ defineDefaultProperty(QStringLiteral("getFloat64"), method_getFloat<double>, 0);
+
+ defineDefaultProperty(QStringLiteral("setInt8"), method_setChar<signed char>, 0);
+ defineDefaultProperty(QStringLiteral("setUInt8"), method_setChar<unsigned char>, 0);
+ defineDefaultProperty(QStringLiteral("setInt16"), method_set<short>, 0);
+ defineDefaultProperty(QStringLiteral("setUInt16"), method_set<unsigned short>, 0);
+ defineDefaultProperty(QStringLiteral("setInt32"), method_set<int>, 0);
+ defineDefaultProperty(QStringLiteral("setUInt32"), method_set<unsigned int>, 0);
+ defineDefaultProperty(QStringLiteral("setFloat32"), method_setFloat<float>, 0);
+ defineDefaultProperty(QStringLiteral("setFloat64"), method_setFloat<double>, 0);
+}
+
+ReturnedValue DataViewPrototype::method_get_buffer(CallContext *ctx)
+{
+ Scope scope(ctx);
+ Scoped<DataView> v(scope, ctx->thisObject());
+ if (!v)
+ return scope.engine->throwTypeError();
+
+ return Encode(v->d()->buffer->asReturnedValue());
+}
+
+ReturnedValue DataViewPrototype::method_get_byteLength(CallContext *ctx)
+{
+ Scope scope(ctx);
+ Scoped<DataView> v(scope, ctx->thisObject());
+ if (!v)
+ return scope.engine->throwTypeError();
+
+ return Encode(v->d()->byteLength);
+}
+
+ReturnedValue DataViewPrototype::method_get_byteOffset(CallContext *ctx)
+{
+ Scope scope(ctx);
+ Scoped<DataView> v(scope, ctx->thisObject());
+ if (!v)
+ return scope.engine->throwTypeError();
+
+ return Encode(v->d()->byteOffset);
+}
+
+template <typename T>
+ReturnedValue DataViewPrototype::method_getChar(CallContext *ctx)
+{
+ Scope scope(ctx);
+ Scoped<DataView> v(scope, ctx->thisObject());
+ if (!v || ctx->argc() < 1)
+ return scope.engine->throwTypeError();
+ double l = ctx->args()[0].toNumber();
+ uint idx = (uint)l;
+ if (l != idx || idx + sizeof(T) > v->d()->byteLength)
+ return scope.engine->throwTypeError();
+ idx += v->d()->byteOffset;
+
+ T t = T(v->d()->buffer->data->data()[idx]);
+
+ return Encode((int)t);
+}
+
+template <typename T>
+ReturnedValue DataViewPrototype::method_get(CallContext *ctx)
+{
+ Scope scope(ctx);
+ Scoped<DataView> v(scope, ctx->thisObject());
+ if (!v || ctx->argc() < 1)
+ return scope.engine->throwTypeError();
+ double l = ctx->args()[0].toNumber();
+ uint idx = (uint)l;
+ if (l != idx || idx + sizeof(T) > v->d()->byteLength)
+ return scope.engine->throwTypeError();
+ idx += v->d()->byteOffset;
+
+ bool littleEndian = ctx->argc() < 2 ? false : ctx->args()[1].toBoolean();
+
+ T t = littleEndian
+ ? qFromLittleEndian<T>((uchar *)v->d()->buffer->data->data() + idx)
+ : qFromBigEndian<T>((uchar *)v->d()->buffer->data->data() + idx);
+
+ return Encode(t);
+}
+
+template <typename T>
+ReturnedValue DataViewPrototype::method_getFloat(CallContext *ctx)
+{
+ Scope scope(ctx);
+ Scoped<DataView> v(scope, ctx->thisObject());
+ if (!v || ctx->argc() < 1)
+ return scope.engine->throwTypeError();
+ double l = ctx->args()[0].toNumber();
+ uint idx = (uint)l;
+ if (l != idx || idx + sizeof(T) > v->d()->byteLength)
+ return scope.engine->throwTypeError();
+ idx += v->d()->byteOffset;
+
+ bool littleEndian = ctx->argc() < 2 ? false : ctx->args()[1].toBoolean();
+
+ if (sizeof(T) == 4) {
+ // float
+ union {
+ uint i;
+ float f;
+ } u;
+ u.i = littleEndian
+ ? 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);
+ union {
+ quint64 i;
+ double d;
+ } u;
+ u.i = littleEndian
+ ? qFromLittleEndian<quint64>((uchar *)v->d()->buffer->data->data() + idx)
+ : qFromBigEndian<quint64>((uchar *)v->d()->buffer->data->data() + idx);
+ return Encode(u.d);
+ }
+}
+
+template <typename T>
+ReturnedValue DataViewPrototype::method_setChar(CallContext *ctx)
+{
+ Scope scope(ctx);
+ Scoped<DataView> v(scope, ctx->thisObject());
+ if (!v || ctx->argc() < 1)
+ return scope.engine->throwTypeError();
+ double l = ctx->args()[0].toNumber();
+ uint idx = (uint)l;
+ if (l != idx || idx + sizeof(T) > v->d()->byteLength)
+ return scope.engine->throwTypeError();
+ idx += v->d()->byteOffset;
+
+ int val = ctx->argc() >= 2 ? ctx->args()[1].toInt32() : 0;
+ v->d()->buffer->data->data()[idx] = (char)val;
+
+ return Encode::undefined();
+}
+
+template <typename T>
+ReturnedValue DataViewPrototype::method_set(CallContext *ctx)
+{
+ Scope scope(ctx);
+ Scoped<DataView> v(scope, ctx->thisObject());
+ if (!v || ctx->argc() < 1)
+ return scope.engine->throwTypeError();
+ double l = ctx->args()[0].toNumber();
+ uint idx = (uint)l;
+ if (l != idx || idx + sizeof(T) > v->d()->byteLength)
+ return scope.engine->throwTypeError();
+ idx += v->d()->byteOffset;
+
+ int val = ctx->argc() >= 2 ? ctx->args()[1].toInt32() : 0;
+
+ bool littleEndian = ctx->argc() < 3 ? false : ctx->args()[2].toBoolean();
+
+ if (littleEndian)
+ qToLittleEndian<T>(val, (uchar *)v->d()->buffer->data->data() + idx);
+ else
+ qToBigEndian<T>(val, (uchar *)v->d()->buffer->data->data() + idx);
+
+ return Encode::undefined();
+}
+
+template <typename T>
+ReturnedValue DataViewPrototype::method_setFloat(CallContext *ctx)
+{
+ Scope scope(ctx);
+ Scoped<DataView> v(scope, ctx->thisObject());
+ if (!v || ctx->argc() < 1)
+ return scope.engine->throwTypeError();
+ double l = ctx->args()[0].toNumber();
+ uint idx = (uint)l;
+ if (l != idx || idx + sizeof(T) > v->d()->byteLength)
+ return scope.engine->throwTypeError();
+ idx += v->d()->byteOffset;
+
+ double val = ctx->argc() >= 2 ? ctx->args()[1].toNumber() : qSNaN();
+ bool littleEndian = ctx->argc() < 3 ? false : ctx->args()[2].toBoolean();
+
+ if (sizeof(T) == 4) {
+ // float
+ union {
+ uint i;
+ float f;
+ } u;
+ u.f = val;
+ if (littleEndian)
+ qToLittleEndian(u.i, (uchar *)v->d()->buffer->data->data() + idx);
+ else
+ qToBigEndian(u.i, (uchar *)v->d()->buffer->data->data() + idx);
+ } else {
+ Q_ASSERT(sizeof(T) == 8);
+ union {
+ quint64 i;
+ double d;
+ } u;
+ u.d = val;
+ if (littleEndian)
+ qToLittleEndian(u.i, (uchar *)v->d()->buffer->data->data() + idx);
+ else
+ qToBigEndian(u.i, (uchar *)v->d()->buffer->data->data() + idx);
+ }
+ return Encode::undefined();
+}
diff --git a/src/qml/jsruntime/qv4dataview_p.h b/src/qml/jsruntime/qv4dataview_p.h
new file mode 100644
index 0000000000..3f0c1e9e23
--- /dev/null
+++ b/src/qml/jsruntime/qv4dataview_p.h
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QV4DATAVIEW_H
+#define QV4DATAVIEW_H
+
+#include "qv4object_p.h"
+#include "qv4functionobject_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace QV4 {
+
+namespace Heap {
+
+struct DataViewCtor : FunctionObject {
+ DataViewCtor(QV4::ExecutionContext *scope);
+};
+
+struct DataView : Object {
+ DataView(ExecutionEngine *e);
+ ArrayBuffer *buffer;
+ uint byteLength;
+ uint byteOffset;
+};
+
+}
+
+struct DataViewCtor: FunctionObject
+{
+ V4_OBJECT2(DataViewCtor, FunctionObject)
+
+ static ReturnedValue construct(Managed *m, CallData *callData);
+ static ReturnedValue call(Managed *that, CallData *callData);
+};
+
+struct DataView : Object
+{
+ V4_OBJECT2(DataView, Object)
+
+ static void markObjects(Heap::Base *that, ExecutionEngine *e);
+};
+
+struct DataViewPrototype: Object
+{
+ void init(ExecutionEngine *engine, Object *ctor);
+
+ static ReturnedValue method_get_buffer(CallContext *ctx);
+ static ReturnedValue method_get_byteLength(CallContext *ctx);
+ static ReturnedValue method_get_byteOffset(CallContext *ctx);
+ template <typename T>
+ static ReturnedValue method_getChar(CallContext *ctx);
+ template <typename T>
+ static ReturnedValue method_get(CallContext *ctx);
+ template <typename T>
+ static ReturnedValue method_getFloat(CallContext *ctx);
+ template <typename T>
+ static ReturnedValue method_setChar(CallContext *ctx);
+ template <typename T>
+ static ReturnedValue method_set(CallContext *ctx);
+ template <typename T>
+ static ReturnedValue method_setFloat(CallContext *ctx);
+};
+
+
+} // namespace QV4
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp
index 0aa53c423e..451ef2486d 100644
--- a/src/qml/jsruntime/qv4dateobject.cpp
+++ b/src/qml/jsruntime/qv4dateobject.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -35,14 +35,12 @@
#include "qv4dateobject_p.h"
#include "qv4objectproto_p.h"
#include "qv4scopedvalue_p.h"
-#include <QtCore/qnumeric.h>
-#include <QtCore/qmath.h>
+#include "qv4runtime_p.h"
+
+#include <QtCore/QDebug>
#include <QtCore/QDateTime>
#include <QtCore/QStringList>
-#include <QtCore/QDebug>
-#include <cmath>
-#include <qmath.h>
-#include <qnumeric.h>
+
#include <time.h>
#include <private/qqmljsengine_p.h>
@@ -560,13 +558,7 @@ static inline QString ToString(double t)
{
if (std::isnan(t))
return QStringLiteral("Invalid Date");
- QDateTime dateTime = ToDateTime(t, Qt::LocalTime);
-
- // JavaScript knows a year 0, while QDateTime doesn't. So, in order to show the right date we
- // have to add a year to negative ones here.
- if (dateTime.date().year() < 0)
- dateTime = dateTime.addYears(1);
- QString str = dateTime.toString() + QStringLiteral(" GMT");
+ QString str = ToDateTime(t, Qt::LocalTime).toString() + QStringLiteral(" GMT");
double tzoffset = LocalTZA + DaylightSavingTA(t);
if (tzoffset) {
int hours = static_cast<int>(::fabs(tzoffset) / 1000 / 60 / 60);
@@ -635,10 +627,9 @@ static double getLocalTZA()
DEFINE_OBJECT_VTABLE(DateObject);
-DateObject::Data::Data(ExecutionEngine *engine, const QDateTime &date)
- : Object::Data(engine->dateClass)
+Heap::DateObject::DateObject(QV4::ExecutionEngine *engine, const QDateTime &date)
+ : Heap::Object(engine->emptyClass, engine->datePrototype.asObject())
{
- setVTable(staticVTable());
value.setDouble(date.isValid() ? date.toMSecsSinceEpoch() : qSNaN());
}
@@ -649,21 +640,20 @@ QDateTime DateObject::toQDateTime() const
DEFINE_OBJECT_VTABLE(DateCtor);
-DateCtor::Data::Data(ExecutionContext *scope)
- : FunctionObject::Data(scope, QStringLiteral("Date"))
+Heap::DateCtor::DateCtor(QV4::ExecutionContext *scope)
+ : Heap::FunctionObject(scope, QStringLiteral("Date"))
{
- setVTable(staticVTable());
}
ReturnedValue DateCtor::construct(Managed *m, CallData *callData)
{
+ Scope scope(static_cast<DateCtor *>(m)->engine());
double t = 0;
if (callData->argc == 0)
t = currentTime();
else if (callData->argc == 1) {
- Scope scope(m->engine());
ScopedValue arg(scope, callData->args[0]);
if (DateObject *d = arg->asDateObject())
arg = d->date();
@@ -690,13 +680,13 @@ ReturnedValue DateCtor::construct(Managed *m, CallData *callData)
t = TimeClip(UTC(t));
}
- return Encode(m->engine()->newDateObject(Primitive::fromDouble(t)));
+ return Encode(scope.engine->newDateObject(Primitive::fromDouble(t)));
}
ReturnedValue DateCtor::call(Managed *m, CallData *)
{
double t = currentTime();
- return m->engine()->newString(ToString(t))->asReturnedValue();
+ return static_cast<DateCtor *>(m)->engine()->newString(ToString(t))->asReturnedValue();
}
void DatePrototype::init(ExecutionEngine *engine, Object *ctor)
@@ -762,32 +752,32 @@ void DatePrototype::init(ExecutionEngine *engine, Object *ctor)
double DatePrototype::getThisDate(ExecutionContext *ctx)
{
- if (DateObject *thisObject = ctx->d()->callData->thisObject.asDateObject())
+ if (DateObject *thisObject = ctx->thisObject().asDateObject())
return thisObject->date().asDouble();
else {
- ctx->throwTypeError();
+ ctx->engine()->throwTypeError();
return 0;
}
}
ReturnedValue DatePrototype::method_parse(CallContext *ctx)
{
- if (!ctx->d()->callData->argc)
+ if (!ctx->argc())
return Encode(qSNaN());
- return Encode(ParseString(ctx->d()->callData->args[0].toString(ctx)->toQString()));
+ return Encode(ParseString(ctx->args()[0].toQString()));
}
ReturnedValue DatePrototype::method_UTC(CallContext *ctx)
{
- const int numArgs = ctx->d()->callData->argc;
+ const int numArgs = ctx->argc();
if (numArgs >= 2) {
- double year = ctx->d()->callData->args[0].toNumber();
- double month = ctx->d()->callData->args[1].toNumber();
- double day = numArgs >= 3 ? ctx->d()->callData->args[2].toNumber() : 1;
- double hours = numArgs >= 4 ? ctx->d()->callData->args[3].toNumber() : 0;
- double mins = numArgs >= 5 ? ctx->d()->callData->args[4].toNumber() : 0;
- double secs = numArgs >= 6 ? ctx->d()->callData->args[5].toNumber() : 0;
- double ms = numArgs >= 7 ? ctx->d()->callData->args[6].toNumber() : 0;
+ double year = ctx->args()[0].toNumber();
+ double month = ctx->args()[1].toNumber();
+ double day = numArgs >= 3 ? ctx->args()[2].toNumber() : 1;
+ double hours = numArgs >= 4 ? ctx->args()[3].toNumber() : 0;
+ double mins = numArgs >= 5 ? ctx->args()[4].toNumber() : 0;
+ double secs = numArgs >= 6 ? ctx->args()[5].toNumber() : 0;
+ double ms = numArgs >= 7 ? ctx->args()[6].toNumber() : 0;
if (year >= 0 && year <= 99)
year += 1900;
double t = MakeDate(MakeDay(year, month, day),
@@ -999,11 +989,11 @@ ReturnedValue DatePrototype::method_getTimezoneOffset(CallContext *ctx)
ReturnedValue DatePrototype::method_setTime(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<DateObject> self(scope, ctx->d()->callData->thisObject);
+ Scoped<DateObject> self(scope, ctx->thisObject());
if (!self)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
- double t = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
+ double t = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
self->date().setDouble(TimeClip(t));
return self->date().asReturnedValue();
}
@@ -1011,37 +1001,37 @@ ReturnedValue DatePrototype::method_setTime(CallContext *ctx)
ReturnedValue DatePrototype::method_setMilliseconds(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<DateObject> self(scope, ctx->d()->callData->thisObject);
+ Scoped<DateObject> self(scope, ctx->thisObject());
if (!self)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
double t = LocalTime(self->date().asDouble());
- double ms = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
+ double ms = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
self->date().setDouble(TimeClip(UTC(MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), SecFromTime(t), ms)))));
return self->date().asReturnedValue();
}
ReturnedValue DatePrototype::method_setUTCMilliseconds(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
double t = self->date().asDouble();
- double ms = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
+ double ms = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
self->date().setDouble(TimeClip(MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), SecFromTime(t), ms))));
return self->date().asReturnedValue();
}
ReturnedValue DatePrototype::method_setSeconds(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
double t = LocalTime(self->date().asDouble());
- double sec = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
- double ms = (ctx->d()->callData->argc < 2) ? msFromTime(t) : ctx->d()->callData->args[1].toNumber();
+ double sec = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
+ double ms = (ctx->argc() < 2) ? msFromTime(t) : ctx->args()[1].toNumber();
t = TimeClip(UTC(MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), sec, ms))));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1049,13 +1039,13 @@ ReturnedValue DatePrototype::method_setSeconds(CallContext *ctx)
ReturnedValue DatePrototype::method_setUTCSeconds(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
double t = self->date().asDouble();
- double sec = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
- double ms = (ctx->d()->callData->argc < 2) ? msFromTime(t) : ctx->d()->callData->args[1].toNumber();
+ double sec = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
+ double ms = (ctx->argc() < 2) ? msFromTime(t) : ctx->args()[1].toNumber();
t = TimeClip(MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), sec, ms)));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1063,14 +1053,14 @@ ReturnedValue DatePrototype::method_setUTCSeconds(CallContext *ctx)
ReturnedValue DatePrototype::method_setMinutes(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
double t = LocalTime(self->date().asDouble());
- double min = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
- double sec = (ctx->d()->callData->argc < 2) ? SecFromTime(t) : ctx->d()->callData->args[1].toNumber();
- double ms = (ctx->d()->callData->argc < 3) ? msFromTime(t) : ctx->d()->callData->args[2].toNumber();
+ double min = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
+ double sec = (ctx->argc() < 2) ? SecFromTime(t) : ctx->args()[1].toNumber();
+ double ms = (ctx->argc() < 3) ? msFromTime(t) : ctx->args()[2].toNumber();
t = TimeClip(UTC(MakeDate(Day(t), MakeTime(HourFromTime(t), min, sec, ms))));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1078,14 +1068,14 @@ ReturnedValue DatePrototype::method_setMinutes(CallContext *ctx)
ReturnedValue DatePrototype::method_setUTCMinutes(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
double t = self->date().asDouble();
- double min = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
- double sec = (ctx->d()->callData->argc < 2) ? SecFromTime(t) : ctx->d()->callData->args[1].toNumber();
- double ms = (ctx->d()->callData->argc < 3) ? msFromTime(t) : ctx->d()->callData->args[2].toNumber();
+ double min = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
+ double sec = (ctx->argc() < 2) ? SecFromTime(t) : ctx->args()[1].toNumber();
+ double ms = (ctx->argc() < 3) ? msFromTime(t) : ctx->args()[2].toNumber();
t = TimeClip(MakeDate(Day(t), MakeTime(HourFromTime(t), min, sec, ms)));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1093,15 +1083,15 @@ ReturnedValue DatePrototype::method_setUTCMinutes(CallContext *ctx)
ReturnedValue DatePrototype::method_setHours(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
double t = LocalTime(self->date().asDouble());
- double hour = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
- double min = (ctx->d()->callData->argc < 2) ? MinFromTime(t) : ctx->d()->callData->args[1].toNumber();
- double sec = (ctx->d()->callData->argc < 3) ? SecFromTime(t) : ctx->d()->callData->args[2].toNumber();
- double ms = (ctx->d()->callData->argc < 4) ? msFromTime(t) : ctx->d()->callData->args[3].toNumber();
+ double hour = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
+ double min = (ctx->argc() < 2) ? MinFromTime(t) : ctx->args()[1].toNumber();
+ double sec = (ctx->argc() < 3) ? SecFromTime(t) : ctx->args()[2].toNumber();
+ double ms = (ctx->argc() < 4) ? msFromTime(t) : ctx->args()[3].toNumber();
t = TimeClip(UTC(MakeDate(Day(t), MakeTime(hour, min, sec, ms))));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1109,15 +1099,15 @@ ReturnedValue DatePrototype::method_setHours(CallContext *ctx)
ReturnedValue DatePrototype::method_setUTCHours(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
double t = self->date().asDouble();
- double hour = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
- double min = (ctx->d()->callData->argc < 2) ? MinFromTime(t) : ctx->d()->callData->args[1].toNumber();
- double sec = (ctx->d()->callData->argc < 3) ? SecFromTime(t) : ctx->d()->callData->args[2].toNumber();
- double ms = (ctx->d()->callData->argc < 4) ? msFromTime(t) : ctx->d()->callData->args[3].toNumber();
+ double hour = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
+ double min = (ctx->argc() < 2) ? MinFromTime(t) : ctx->args()[1].toNumber();
+ double sec = (ctx->argc() < 3) ? SecFromTime(t) : ctx->args()[2].toNumber();
+ double ms = (ctx->argc() < 4) ? msFromTime(t) : ctx->args()[3].toNumber();
t = TimeClip(MakeDate(Day(t), MakeTime(hour, min, sec, ms)));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1125,12 +1115,12 @@ ReturnedValue DatePrototype::method_setUTCHours(CallContext *ctx)
ReturnedValue DatePrototype::method_setDate(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
double t = LocalTime(self->date().asDouble());
- double date = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
+ double date = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
t = TimeClip(UTC(MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), date), TimeWithinDay(t))));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1138,12 +1128,12 @@ ReturnedValue DatePrototype::method_setDate(CallContext *ctx)
ReturnedValue DatePrototype::method_setUTCDate(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
double t = self->date().asDouble();
- double date = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
+ double date = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
t = TimeClip(MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), date), TimeWithinDay(t)));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1151,13 +1141,13 @@ ReturnedValue DatePrototype::method_setUTCDate(CallContext *ctx)
ReturnedValue DatePrototype::method_setMonth(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
double t = LocalTime(self->date().asDouble());
- double month = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
- double date = (ctx->d()->callData->argc < 2) ? DateFromTime(t) : ctx->d()->callData->args[1].toNumber();
+ double month = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
+ double date = (ctx->argc() < 2) ? DateFromTime(t) : ctx->args()[1].toNumber();
t = TimeClip(UTC(MakeDate(MakeDay(YearFromTime(t), month, date), TimeWithinDay(t))));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1165,13 +1155,13 @@ ReturnedValue DatePrototype::method_setMonth(CallContext *ctx)
ReturnedValue DatePrototype::method_setUTCMonth(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
double t = self->date().asDouble();
- double month = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
- double date = (ctx->d()->callData->argc < 2) ? DateFromTime(t) : ctx->d()->callData->args[1].toNumber();
+ double month = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
+ double date = (ctx->argc() < 2) ? DateFromTime(t) : ctx->args()[1].toNumber();
t = TimeClip(MakeDate(MakeDay(YearFromTime(t), month, date), TimeWithinDay(t)));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1179,16 +1169,16 @@ ReturnedValue DatePrototype::method_setUTCMonth(CallContext *ctx)
ReturnedValue DatePrototype::method_setYear(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
double t = self->date().asDouble();
if (std::isnan(t))
t = 0;
else
t = LocalTime(t);
- double year = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
+ double year = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
double r;
if (std::isnan(year)) {
r = qSNaN();
@@ -1205,14 +1195,14 @@ ReturnedValue DatePrototype::method_setYear(CallContext *ctx)
ReturnedValue DatePrototype::method_setUTCFullYear(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
double t = self->date().asDouble();
- double year = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
- double month = (ctx->d()->callData->argc < 2) ? MonthFromTime(t) : ctx->d()->callData->args[1].toNumber();
- double date = (ctx->d()->callData->argc < 3) ? DateFromTime(t) : ctx->d()->callData->args[2].toNumber();
+ double year = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
+ double month = (ctx->argc() < 2) ? MonthFromTime(t) : ctx->args()[1].toNumber();
+ double date = (ctx->argc() < 3) ? DateFromTime(t) : ctx->args()[2].toNumber();
t = TimeClip(MakeDate(MakeDay(year, month, date), TimeWithinDay(t)));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1220,16 +1210,16 @@ ReturnedValue DatePrototype::method_setUTCFullYear(CallContext *ctx)
ReturnedValue DatePrototype::method_setFullYear(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
double t = LocalTime(self->date().asDouble());
if (std::isnan(t))
t = 0;
- double year = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
- double month = (ctx->d()->callData->argc < 2) ? MonthFromTime(t) : ctx->d()->callData->args[1].toNumber();
- double date = (ctx->d()->callData->argc < 3) ? DateFromTime(t) : ctx->d()->callData->args[2].toNumber();
+ double year = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
+ double month = (ctx->argc() < 2) ? MonthFromTime(t) : ctx->args()[1].toNumber();
+ double date = (ctx->argc() < 3) ? DateFromTime(t) : ctx->args()[2].toNumber();
t = TimeClip(UTC(MakeDate(MakeDay(year, month, date), TimeWithinDay(t))));
self->date().setDouble(t);
return self->date().asReturnedValue();
@@ -1237,9 +1227,9 @@ ReturnedValue DatePrototype::method_setFullYear(CallContext *ctx)
ReturnedValue DatePrototype::method_toUTCString(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
double t = self->date().asDouble();
return ctx->d()->engine->newString(ToUTCString(t))->asReturnedValue();
@@ -1260,13 +1250,13 @@ static void addZeroPrefixedInt(QString &str, int num, int nDigits)
ReturnedValue DatePrototype::method_toISOString(CallContext *ctx)
{
- DateObject *self = ctx->d()->callData->thisObject.asDateObject();
+ DateObject *self = ctx->thisObject().asDateObject();
if (!self)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
double t = self->date().asDouble();
if (!std::isfinite(t))
- return ctx->throwRangeError(ctx->d()->callData->thisObject);
+ return ctx->engine()->throwRangeError(ctx->thisObject());
QString result;
int year = (int)YearFromTime(t);
@@ -1299,21 +1289,21 @@ ReturnedValue DatePrototype::method_toISOString(CallContext *ctx)
ReturnedValue DatePrototype::method_toJSON(CallContext *ctx)
{
Scope scope(ctx);
- ScopedValue O(scope, RuntimeHelpers::toObject(ctx, ValueRef(&ctx->d()->callData->thisObject)));
+ ScopedValue O(scope, RuntimeHelpers::toObject(scope.engine, ctx->thisObject()));
ScopedValue tv(scope, RuntimeHelpers::toPrimitive(O, NUMBER_HINT));
if (tv->isNumber() && !std::isfinite(tv->toNumber()))
return Encode::null();
ScopedString s(scope, ctx->d()->engine->newString(QStringLiteral("toISOString")));
- ScopedValue v(scope, O->objectValue()->get(s.getPointer()));
+ ScopedValue v(scope, O->objectValue()->get(s));
FunctionObject *toIso = v->asFunctionObject();
if (!toIso)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
- ScopedCallData callData(scope, 0);
- callData->thisObject = ctx->d()->callData->thisObject;
+ ScopedCallData callData(scope);
+ callData->thisObject = ctx->thisObject();
return toIso->call(callData);
}
diff --git a/src/qml/jsruntime/qv4dateobject_p.h b/src/qml/jsruntime/qv4dateobject_p.h
index abab5390a6..dad3689054 100644
--- a/src/qml/jsruntime/qv4dateobject_p.h
+++ b/src/qml/jsruntime/qv4dateobject_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -43,39 +43,45 @@ class QDateTime;
namespace QV4 {
+namespace Heap {
+
+struct DateObject : Object {
+ DateObject(InternalClass *ic, QV4::Object *prototype)
+ : Object(ic, prototype)
+ {
+ value = Encode(qSNaN());
+ }
+
+ DateObject(QV4::ExecutionEngine *engine, const Value &date)
+ : Object(engine->emptyClass, engine->datePrototype.asObject())
+ {
+ value = date;
+ }
+ DateObject(QV4::ExecutionEngine *engine, const QDateTime &date);
+ Value value;
+};
+
+struct DateCtor : FunctionObject {
+ DateCtor(QV4::ExecutionContext *scope);
+};
+
+}
+
struct DateObject: Object {
- struct Data : Object::Data {
- Data(ExecutionEngine *engine, const ValueRef date)
- : Object::Data(engine->dateClass)
- {
- value = date;
- }
- Data(ExecutionEngine *engine, const QDateTime &date);
- Data(InternalClass *ic)
- : Object::Data(ic)
- {
- Q_ASSERT(internalClass->vtable == staticVTable());
- value = Primitive::fromDouble(qSNaN());
- }
- Value value;
- };
- V4_OBJECT(Object)
+ V4_OBJECT2(DateObject, Object)
Q_MANAGED_TYPE(DateObject)
Value date() const { return d()->value; }
Value &date() { return d()->value; }
- void setDate(const ValueRef date) { d()->value = date; }
+ void setDate(const Value &date) { d()->value = date; }
QDateTime toQDateTime() const;
};
struct DateCtor: FunctionObject
{
- struct Data : FunctionObject::Data {
- Data(ExecutionContext *scope);
- };
- V4_OBJECT(FunctionObject)
+ V4_OBJECT2(DateCtor, FunctionObject)
static ReturnedValue construct(Managed *, CallData *callData);
static ReturnedValue call(Managed *that, CallData *);
diff --git a/src/qml/jsruntime/qv4debugging.cpp b/src/qml/jsruntime/qv4debugging.cpp
index 50142ab155..36e7a3558c 100644
--- a/src/qml/jsruntime/qv4debugging.cpp
+++ b/src/qml/jsruntime/qv4debugging.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -38,6 +38,8 @@
#include "qv4instr_moth_p.h"
#include "qv4runtime_p.h"
#include "qv4script_p.h"
+#include "qv4objectiterator_p.h"
+#include "qv4identifier_p.h"
#include <iostream>
#include <algorithm>
@@ -63,7 +65,7 @@ public:
{
Scope scope(engine);
- ExecutionContextSaver saver(engine->currentContext());
+ ExecutionContextSaver saver(scope, engine->currentContext());
if (frameNr > 0) {
Value *savedContexts = scope.alloc(frameNr);
@@ -73,7 +75,7 @@ public:
}
}
- ExecutionContext *ctx = engine->currentContext();
+ ScopedContext ctx(scope, engine->currentContext());
QV4::Script script(ctx, this->script);
script.strictMode = ctx->d()->strictMode;
// In order for property lookups in QML to work, we need to disable fast v4 lookups. That
@@ -84,7 +86,7 @@ public:
if (!scope.engine->hasException)
result = script.run();
if (scope.engine->hasException)
- result = ctx->catchException();
+ result = scope.engine->catchException();
handleResult(result);
}
@@ -164,14 +166,13 @@ public:
Debugger::Debugger(QV4::ExecutionEngine *engine)
: m_engine(engine)
- , m_currentContext(0)
, m_agent(0)
, m_state(Running)
, m_stepping(NotStepping)
, m_pauseRequested(false)
, m_haveBreakPoints(false)
, m_breakOnThrow(false)
- , m_returnedValue(Primitive::undefinedValue())
+ , m_returnedValue(engine, Primitive::undefinedValue())
, m_gatherSources(0)
, m_runningJob(0)
{
@@ -229,9 +230,9 @@ void Debugger::resume(Speed speed)
return;
if (!m_returnedValue.isUndefined())
- m_returnedValue = Encode::undefined();
+ m_returnedValue.set(m_engine, Encode::undefined());
- m_currentContext = m_engine->currentContext();
+ m_currentContext.set(m_engine, m_engine->currentContext());
m_stepping = speed;
m_runningCondition.wakeAll();
}
@@ -261,7 +262,7 @@ Debugger::ExecutionState Debugger::currentExecutionState() const
{
ExecutionState state;
state.fileName = getFunction()->sourceFile();
- state.lineNumber = engine()->currentContext()->d()->lineNumber;
+ state.lineNumber = engine()->currentContext()->lineNumber;
return state;
}
@@ -271,27 +272,37 @@ QVector<StackFrame> Debugger::stackTrace(int frameLimit) const
return m_engine->stackTrace(frameLimit);
}
-static inline CallContext *findContext(ExecutionContext *ctxt, int frame)
+static inline Heap::CallContext *findContext(Heap::ExecutionContext *ctxt, int frame)
{
- while (ctxt) {
- CallContext *cCtxt = ctxt->asCallContext();
+ if (!ctxt)
+ return 0;
+
+ Scope scope(ctxt->engine);
+ ScopedContext ctx(scope, ctxt);
+ while (ctx) {
+ CallContext *cCtxt = ctx->asCallContext();
if (cCtxt && cCtxt->d()->function) {
if (frame < 1)
- return cCtxt;
+ return cCtxt->d();
--frame;
}
- ctxt = ctxt->d()->parent;
+ ctx = ctx->d()->parent;
}
return 0;
}
-static inline CallContext *findScope(ExecutionContext *ctxt, int scope)
+static inline Heap::CallContext *findScope(Heap::ExecutionContext *ctxt, int scope)
{
- for (; scope > 0 && ctxt; --scope)
- ctxt = ctxt->d()->outer;
+ if (!ctxt)
+ return 0;
+
+ Scope s(ctxt->engine);
+ ScopedContext ctx(s, ctxt);
+ for (; scope > 0 && ctx; --scope)
+ ctx = ctx->d()->outer;
- return ctxt ? ctxt->asCallContext() : 0;
+ return (ctx && ctx->d()) ? ctx->asCallContext()->d() : 0;
}
void Debugger::collectArgumentsInContext(Collector *collector, int frameNr, int scopeNr)
@@ -321,17 +332,17 @@ void Debugger::collectArgumentsInContext(Collector *collector, int frameNr, int
if (frameNr < 0)
return;
- CallContext *ctxt = findScope(findContext(engine->currentContext(), frameNr), scopeNr);
+ Scope scope(engine);
+ Scoped<CallContext> ctxt(scope, findScope(findContext(engine->currentContext(), frameNr), scopeNr));
if (!ctxt)
return;
- Scope scope(engine);
ScopedValue v(scope);
int nFormals = ctxt->formalCount();
for (unsigned i = 0, ei = nFormals; i != ei; ++i) {
QString qName;
- if (String *name = ctxt->formals()[nFormals - i - 1])
- qName = name->toQString();
+ if (Identifier *name = ctxt->formals()[nFormals - i - 1])
+ qName = name->string;
v = ctxt->argument(i);
collector->collect(qName, v);
}
@@ -368,16 +379,16 @@ void Debugger::collectLocalsInContext(Collector *collector, int frameNr, int sco
if (frameNr < 0)
return;
- CallContext *ctxt = findScope(findContext(engine->currentContext(), frameNr), scopeNr);
+ Scope scope(engine);
+ Scoped<CallContext> ctxt(scope, findScope(findContext(engine->currentContext(), frameNr), scopeNr));
if (!ctxt)
return;
- Scope scope(engine);
ScopedValue v(scope);
for (unsigned i = 0, ei = ctxt->variableCount(); i != ei; ++i) {
QString qName;
- if (String *name = ctxt->variables()[i])
- qName = name->toQString();
+ if (Identifier *name = ctxt->variables()[i])
+ qName = name->string;
v = ctxt->d()->locals[i];
collector->collect(qName, v);
}
@@ -415,7 +426,8 @@ bool Debugger::collectThisInContext(Debugger::Collector *collector, int frame)
bool myRun()
{
- ExecutionContext *ctxt = findContext(engine->currentContext(), frameNr);
+ Scope scope(engine);
+ ScopedContext ctxt(scope, findContext(engine->currentContext(), frameNr));
while (ctxt) {
if (CallContext *cCtxt = ctxt->asCallContext())
if (cCtxt->d()->activation)
@@ -426,7 +438,6 @@ bool Debugger::collectThisInContext(Debugger::Collector *collector, int frame)
if (!ctxt)
return false;
- Scope scope(engine);
ScopedObject o(scope, ctxt->asCallContext()->d()->activation);
collector->collect(o);
return true;
@@ -473,23 +484,24 @@ void Debugger::collectReturnedValue(Collector *collector) const
return;
Scope scope(m_engine);
- ScopedObject o(scope, m_returnedValue);
+ ScopedObject o(scope, m_returnedValue.valueRef());
collector->collect(o);
}
-QVector<ExecutionContext::ContextType> Debugger::getScopeTypes(int frame) const
+QVector<Heap::ExecutionContext::ContextType> Debugger::getScopeTypes(int frame) const
{
- QVector<ExecutionContext::ContextType> types;
+ QVector<Heap::ExecutionContext::ContextType> types;
if (state() != Paused)
return types;
- CallContext *sctxt = findContext(m_engine->currentContext(), frame);
- if (!sctxt || sctxt->d()->type < ExecutionContext::Type_SimpleCallContext)
+ Scope scope(m_engine);
+ Scoped<CallContext> sctxt(scope, findContext(m_engine->currentContext(), frame));
+ if (!sctxt || sctxt->d()->type < Heap::ExecutionContext::Type_SimpleCallContext)
return types;
- CallContext *ctxt = static_cast<CallContext *>(sctxt);
- for (ExecutionContext *it = ctxt; it; it = it->d()->outer)
+ ScopedContext it(scope, sctxt->d());
+ for (; it; it = it->d()->outer)
types.append(it->d()->type);
return types;
@@ -520,7 +532,7 @@ void Debugger::maybeBreakAtInstruction()
switch (m_stepping) {
case StepOver:
- if (m_currentContext != m_engine->currentContext())
+ if (m_currentContext.asManaged()->d() != m_engine->currentContext())
break;
// fall through
case StepIn:
@@ -536,7 +548,7 @@ void Debugger::maybeBreakAtInstruction()
pauseAndWait(PauseRequest);
} else if (m_haveBreakPoints) {
if (Function *f = getFunction()) {
- const int lineNumber = engine()->currentContext()->d()->lineNumber;
+ const int lineNumber = engine()->currentContext()->lineNumber;
if (reallyHitTheBreakPoint(f->sourceFile(), lineNumber))
pauseAndWait(BreakPoint);
}
@@ -550,7 +562,7 @@ void Debugger::enteringFunction()
QMutexLocker locker(&m_lock);
if (m_stepping == StepIn) {
- m_currentContext = m_engine->currentContext();
+ m_currentContext.set(m_engine, m_engine->currentContext());
}
}
@@ -562,10 +574,10 @@ void Debugger::leavingFunction(const ReturnedValue &retVal)
QMutexLocker locker(&m_lock);
- if (m_stepping != NotStepping && m_currentContext == m_engine->currentContext()) {
- m_currentContext = m_engine->currentContext()->d()->parent;
+ if (m_stepping != NotStepping && m_currentContext.asManaged()->d() == m_engine->currentContext()) {
+ m_currentContext.set(m_engine, m_engine->currentContext()->parent);
m_stepping = StepOver;
- m_returnedValue = retVal;
+ m_returnedValue.set(m_engine, retVal);
}
}
@@ -583,8 +595,10 @@ void Debugger::aboutToThrow()
Function *Debugger::getFunction() const
{
- ExecutionContext *context = m_engine->currentContext();
- if (const FunctionObject *function = context->getFunctionObject())
+ Scope scope(m_engine);
+ ScopedContext context(scope, m_engine->currentContext());
+ ScopedFunctionObject function(scope, context->getFunctionObject());
+ if (function)
return function->function();
else
return context->d()->engine->globalCode;
diff --git a/src/qml/jsruntime/qv4debugging_p.h b/src/qml/jsruntime/qv4debugging_p.h
index 0e115f0de6..e6a9750351 100644
--- a/src/qml/jsruntime/qv4debugging_p.h
+++ b/src/qml/jsruntime/qv4debugging_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -104,7 +104,7 @@ public:
virtual void addNull(const QString &name) = 0;
virtual void addBoolean(const QString &name, bool value) = 0;
virtual void addString(const QString &name, const QString &value) = 0;
- virtual void addObject(const QString &name, ValueRef value) = 0;
+ virtual void addObject(const QString &name, const Value &value) = 0;
virtual void addInteger(const QString &name, int value) = 0;
virtual void addDouble(const QString &name, double value) = 0;
@@ -171,7 +171,7 @@ public:
bool collectThisInContext(Collector *collector, int frame = 0);
void collectThrownValue(Collector *collector);
void collectReturnedValue(Collector *collector) const;
- QVector<ExecutionContext::ContextType> getScopeTypes(int frame = 0) const;
+ QVector<Heap::ExecutionContext::ContextType> getScopeTypes(int frame = 0) const;
void evaluateExpression(int frameNr, const QString &expression, Collector *resultsCollector);
@@ -196,7 +196,7 @@ private:
private:
QV4::ExecutionEngine *m_engine;
- QV4::ExecutionContext *m_currentContext;
+ QV4::PersistentValue m_currentContext;
DebuggerAgent *m_agent;
QMutex m_lock;
QWaitCondition m_runningCondition;
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index 6156e5c3d9..e1282eeca9 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -61,6 +61,18 @@
#include "qv4qobjectwrapper_p.h"
#include "qv4qmlextensions_p.h"
#include "qv4memberdata_p.h"
+#include "qv4arraybuffer_p.h"
+#include "qv4dataview_p.h"
+#include "qv4typedarray_p.h"
+#include <private/qv8engine_p.h>
+#include <private/qjsvalue_p.h>
+#include <private/qqmlcontextwrapper_p.h>
+#include <private/qqmltypewrapper_p.h>
+#include <private/qqmlvaluetypewrapper_p.h>
+#include <private/qqmlvaluetype_p.h>
+#include <private/qqmllistwrapper_p.h>
+#include <private/qqmllist_p.h>
+#include <private/qqmllocale_p.h>
#include <QtCore/QTextStream>
#include <QDateTime>
@@ -79,6 +91,10 @@
#endif
#endif
+#ifdef V4_USE_VALGRIND
+#include <valgrind/memcheck.h>
+#endif
+
QT_BEGIN_NAMESPACE
using namespace QV4;
@@ -87,11 +103,14 @@ static QBasicAtomicInt engineSerial = Q_BASIC_ATOMIC_INITIALIZER(1);
static ReturnedValue throwTypeError(CallContext *ctx)
{
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
}
const int MinimumStackSize = 256; // in kbytes
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_MSVC(4172) // MSVC 2015: warning C4172: returning address of local variable or temporary: dummy
+
quintptr getStackLimit()
{
quintptr stackLimit;
@@ -156,6 +175,7 @@ quintptr getStackLimit()
int dummy;
// this is inexact, as part of the stack is used when being called here,
// but let's simply default to 1MB from where the stack is right now
+ // (Note: triggers warning C4172 as of MSVC 2015, returning address of local variable)
stackLimit = reinterpret_cast<qintptr>(&dummy) - 1024*1024;
#endif
@@ -163,17 +183,27 @@ quintptr getStackLimit()
return stackLimit + MinimumStackSize*1024;
}
+QT_WARNING_POP
+
+QJSEngine *ExecutionEngine::jsEngine() const
+{
+ return v8Engine->publicEngine();
+}
+
+QQmlEngine *ExecutionEngine::qmlEngine() const
+{
+ return v8Engine->engine();
+}
ExecutionEngine::ExecutionEngine(EvalISelFactory *factory)
: current(0)
- , memoryManager(new QV4::MemoryManager)
+ , memoryManager(new QV4::MemoryManager(this))
, executableAllocator(new QV4::ExecutableAllocator)
, regExpAllocator(new QV4::ExecutableAllocator)
, bumperPointerAllocator(new WTF::BumpPointerAllocator)
, jsStack(new WTF::PageAllocation)
, debugger(0)
, profiler(0)
- , globalObject(0)
, globalCode(0)
, v8Engine(0)
, argumentsAccessors(0)
@@ -202,15 +232,19 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory)
}
iselFactory.reset(factory);
- memoryManager->setExecutionEngine(this);
-
// reserve space for the JS stack
// we allow it to grow to 2 times JSStackLimit, as we can overshoot due to garbage collection
// and ScopedValues allocated outside of JIT'ed methods.
- *jsStack = WTF::PageAllocation::allocate(2*JSStackLimit, WTF::OSAllocator::JSVMStackPages, true);
+ *jsStack = WTF::PageAllocation::allocate(2 * JSStackLimit, WTF::OSAllocator::JSVMStackPages,
+ /* writable */ true, /* executable */ false,
+ /* includesGuardPages */ true);
jsStackBase = (Value *)jsStack->base();
jsStackTop = jsStackBase;
+#ifdef V4_USE_VALGRIND
+ VALGRIND_MAKE_MEM_UNDEFINED(jsStackBase, 2*JSStackLimit);
+#endif
+
// set up stack limits
jsStackLimit = jsStackBase + JSStackLimit/sizeof(Value);
cStackLimit = getStackLimit();
@@ -224,10 +258,6 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory)
classPool = new InternalClassPool;
emptyClass = new (classPool) InternalClass(this);
- executionContextClass = InternalClass::create(this, ExecutionContext::staticVTable(), 0);
- constructClass = InternalClass::create(this, Object::staticVTable(), 0);
- stringClass = InternalClass::create(this, String::staticVTable(), 0);
- regExpValueClass = InternalClass::create(this, RegExp::staticVTable(), 0);
id_empty = newIdentifier(QString());
id_undefined = newIdentifier(QStringLiteral("undefined"));
@@ -261,165 +291,168 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory)
id_toString = newIdentifier(QStringLiteral("toString"));
id_destroy = newIdentifier(QStringLiteral("destroy"));
id_valueOf = newIdentifier(QStringLiteral("valueOf"));
+ id_byteLength = newIdentifier(QStringLiteral("byteLength"));
+ id_byteOffset = newIdentifier(QStringLiteral("byteOffset"));
+ id_buffer = newIdentifier(QStringLiteral("buffer"));
+ id_lastIndex = newIdentifier(QStringLiteral("lastIndex"));
- memberDataClass = InternalClass::create(this, MemberData::staticVTable(), 0);
-
- ScopedObject objectPrototype(scope, memoryManager->alloc<ObjectPrototype>(InternalClass::create(this, ObjectPrototype::staticVTable(), 0)));
- objectClass = InternalClass::create(this, Object::staticVTable(), objectPrototype);
- Q_ASSERT(objectClass->vtable == Object::staticVTable());
+ objectPrototype = memoryManager->alloc<ObjectPrototype>(emptyClass, (QV4::Object *)0);
- arrayClass = InternalClass::create(this, ArrayObject::staticVTable(), objectPrototype);
- arrayClass = arrayClass->addMember(id_length, Attr_NotConfigurable|Attr_NotEnumerable);
- ScopedObject arrayPrototype(scope, memoryManager->alloc<ArrayPrototype>(arrayClass));
- arrayClass = arrayClass->changePrototype(arrayPrototype);
+ arrayClass = emptyClass->addMember(id_length, Attr_NotConfigurable|Attr_NotEnumerable);
+ arrayPrototype = memoryManager->alloc<ArrayPrototype>(arrayClass, objectPrototype.asObject());
- simpleArrayDataClass = InternalClass::create(this, SimpleArrayData::staticVTable(), 0);
-
- InternalClass *argsClass = InternalClass::create(this, ArgumentsObject::staticVTable(), objectPrototype);
- argsClass = argsClass->addMember(id_length, Attr_NotEnumerable);
+ InternalClass *argsClass = emptyClass->addMember(id_length, Attr_NotEnumerable);
argumentsObjectClass = argsClass->addMember(id_callee, Attr_Data|Attr_NotEnumerable);
strictArgumentsObjectClass = argsClass->addMember(id_callee, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable);
strictArgumentsObjectClass = strictArgumentsObjectClass->addMember(id_caller, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable);
- Q_ASSERT(argumentsObjectClass->vtable == ArgumentsObject::staticVTable());
- Q_ASSERT(strictArgumentsObjectClass->vtable == ArgumentsObject::staticVTable());
+ m_globalObject = newObject();
+ Q_ASSERT(globalObject()->d()->vtable);
initRootContext();
- ScopedObject stringPrototype(scope, memoryManager->alloc<StringPrototype>(InternalClass::create(this, StringPrototype::staticVTable(), objectPrototype)));
- stringObjectClass = InternalClass::create(this, String::staticVTable(), stringPrototype);
-
- ScopedObject numberPrototype(scope, memoryManager->alloc<NumberPrototype>(InternalClass::create(this, NumberPrototype::staticVTable(), objectPrototype)));
- numberClass = InternalClass::create(this, NumberObject::staticVTable(), numberPrototype);
-
- ScopedObject booleanPrototype(scope, memoryManager->alloc<BooleanPrototype>(InternalClass::create(this, BooleanPrototype::staticVTable(), objectPrototype)));
- booleanClass = InternalClass::create(this, BooleanObject::staticVTable(), booleanPrototype);
+ stringPrototype = memoryManager->alloc<StringPrototype>(emptyClass, objectPrototype.asObject());
+ numberPrototype = memoryManager->alloc<NumberPrototype>(emptyClass, objectPrototype.asObject());
+ booleanPrototype = memoryManager->alloc<BooleanPrototype>(emptyClass, objectPrototype.asObject());
+ datePrototype = memoryManager->alloc<DatePrototype>(emptyClass, objectPrototype.asObject());
- ScopedObject datePrototype(scope, memoryManager->alloc<DatePrototype>(InternalClass::create(this, DatePrototype::staticVTable(), objectPrototype)));
- dateClass = InternalClass::create(this, DateObject::staticVTable(), datePrototype);
-
- InternalClass *functionProtoClass = InternalClass::create(this, FunctionObject::staticVTable(), objectPrototype);
uint index;
- functionProtoClass = functionProtoClass->addMember(id_prototype, Attr_NotEnumerable, &index);
- Q_ASSERT(index == FunctionObject::Index_Prototype);
- ScopedObject functionPrototype(scope, memoryManager->alloc<FunctionPrototype>(functionProtoClass));
- functionClass = InternalClass::create(this, FunctionObject::staticVTable(), functionPrototype);
- functionClass = functionClass->addMember(id_prototype, Attr_NotEnumerable|Attr_NotConfigurable, &index);
- Q_ASSERT(index == FunctionObject::Index_Prototype);
- protoClass = objectClass->addMember(id_constructor, Attr_NotEnumerable, &index);
- Q_ASSERT(index == FunctionObject::Index_ProtoConstructor);
-
- Scoped<RegExpPrototype> regExpPrototype(scope, memoryManager->alloc<RegExpPrototype>(InternalClass::create(this, RegExpPrototype::staticVTable(), objectPrototype)));
- regExpClass = InternalClass::create(this, RegExpObject::staticVTable(), regExpPrototype.getPointer());
+ InternalClass *functionProtoClass = emptyClass->addMember(id_prototype, Attr_NotEnumerable, &index);
+ Q_ASSERT(index == Heap::FunctionObject::Index_Prototype);
+ functionPrototype = memoryManager->alloc<FunctionPrototype>(functionProtoClass, objectPrototype.asObject());
+ functionClass = emptyClass->addMember(id_prototype, Attr_NotEnumerable|Attr_NotConfigurable, &index);
+ Q_ASSERT(index == Heap::FunctionObject::Index_Prototype);
+ simpleScriptFunctionClass = functionClass->addMember(id_name, Attr_ReadOnly, &index);
+ Q_ASSERT(index == Heap::SimpleScriptFunction::Index_Name);
+ simpleScriptFunctionClass = simpleScriptFunctionClass->addMember(id_length, Attr_ReadOnly, &index);
+ Q_ASSERT(index == Heap::SimpleScriptFunction::Index_Length);
+ protoClass = emptyClass->addMember(id_constructor, Attr_NotEnumerable, &index);
+ Q_ASSERT(index == Heap::FunctionObject::Index_ProtoConstructor);
+
+ regExpPrototype = memoryManager->alloc<RegExpPrototype>(this);
regExpExecArrayClass = arrayClass->addMember(id_index, Attr_Data, &index);
Q_ASSERT(index == RegExpObject::Index_ArrayIndex);
regExpExecArrayClass = regExpExecArrayClass->addMember(id_input, Attr_Data, &index);
Q_ASSERT(index == RegExpObject::Index_ArrayInput);
- ScopedObject errorPrototype(scope, memoryManager->alloc<ErrorPrototype>(InternalClass::create(this, ErrorObject::staticVTable(), objectPrototype)));
- errorClass = InternalClass::create(this, ErrorObject::staticVTable(), errorPrototype);
- ScopedObject evalErrorPrototype(scope, memoryManager->alloc<EvalErrorPrototype>(errorClass));
- evalErrorClass = InternalClass::create(this, EvalErrorObject::staticVTable(), evalErrorPrototype);
- ScopedObject rangeErrorPrototype(scope, memoryManager->alloc<RangeErrorPrototype>(errorClass));
- rangeErrorClass = InternalClass::create(this, RangeErrorObject::staticVTable(), rangeErrorPrototype);
- ScopedObject referenceErrorPrototype(scope, memoryManager->alloc<ReferenceErrorPrototype>(errorClass));
- referenceErrorClass = InternalClass::create(this, ReferenceErrorObject::staticVTable(), referenceErrorPrototype);
- ScopedObject syntaxErrorPrototype(scope, memoryManager->alloc<SyntaxErrorPrototype>(errorClass));
- syntaxErrorClass = InternalClass::create(this, SyntaxErrorObject::staticVTable(), syntaxErrorPrototype);
- ScopedObject typeErrorPrototype(scope, memoryManager->alloc<TypeErrorPrototype>(errorClass));
- typeErrorClass = InternalClass::create(this, TypeErrorObject::staticVTable(), typeErrorPrototype);
- ScopedObject uRIErrorPrototype(scope, memoryManager->alloc<URIErrorPrototype>(errorClass));
- uriErrorClass = InternalClass::create(this, URIErrorObject::staticVTable(), uRIErrorPrototype);
-
- ScopedObject variantPrototype(scope, memoryManager->alloc<VariantPrototype>(InternalClass::create(this, VariantPrototype::staticVTable(), objectPrototype)));
- variantClass = InternalClass::create(this, VariantObject::staticVTable(), variantPrototype);
- Q_ASSERT(variantClass->prototype == variantPrototype);
- Q_ASSERT(variantPrototype->internalClass()->prototype == objectPrototype);
-
- sequencePrototype = ScopedValue(scope, memoryManager->alloc<SequencePrototype>(arrayClass));
-
- objectCtor = memoryManager->alloc<ObjectCtor>(rootContext);
- stringCtor = memoryManager->alloc<StringCtor>(rootContext);
- numberCtor = memoryManager->alloc<NumberCtor>(rootContext);
- booleanCtor = memoryManager->alloc<BooleanCtor>(rootContext);
- arrayCtor = memoryManager->alloc<ArrayCtor>(rootContext);
- functionCtor = memoryManager->alloc<FunctionCtor>(rootContext);
- dateCtor = memoryManager->alloc<DateCtor>(rootContext);
- regExpCtor = memoryManager->alloc<RegExpCtor>(rootContext);
- errorCtor = memoryManager->alloc<ErrorCtor>(rootContext);
- evalErrorCtor = memoryManager->alloc<EvalErrorCtor>(rootContext);
- rangeErrorCtor = memoryManager->alloc<RangeErrorCtor>(rootContext);
- referenceErrorCtor = memoryManager->alloc<ReferenceErrorCtor>(rootContext);
- syntaxErrorCtor = memoryManager->alloc<SyntaxErrorCtor>(rootContext);
- typeErrorCtor = memoryManager->alloc<TypeErrorCtor>(rootContext);
- uRIErrorCtor = memoryManager->alloc<URIErrorCtor>(rootContext);
-
- static_cast<ObjectPrototype *>(objectPrototype.getPointer())->init(this, objectCtor.asObject());
- static_cast<StringPrototype *>(stringPrototype.getPointer())->init(this, stringCtor.asObject());
- static_cast<NumberPrototype *>(numberPrototype.getPointer())->init(this, numberCtor.asObject());
- static_cast<BooleanPrototype *>(booleanPrototype.getPointer())->init(this, booleanCtor.asObject());
- static_cast<ArrayPrototype *>(arrayPrototype.getPointer())->init(this, arrayCtor.asObject());
- static_cast<DatePrototype *>(datePrototype.getPointer())->init(this, dateCtor.asObject());
- static_cast<FunctionPrototype *>(functionPrototype.getPointer())->init(this, functionCtor.asObject());
- static_cast<RegExpPrototype *>(regExpPrototype.getPointer())->init(this, regExpCtor.asObject());
- static_cast<ErrorPrototype *>(errorPrototype.getPointer())->init(this, errorCtor.asObject());
- static_cast<EvalErrorPrototype *>(evalErrorPrototype.getPointer())->init(this, evalErrorCtor.asObject());
- static_cast<RangeErrorPrototype *>(rangeErrorPrototype.getPointer())->init(this, rangeErrorCtor.asObject());
- static_cast<ReferenceErrorPrototype *>(referenceErrorPrototype.getPointer())->init(this, referenceErrorCtor.asObject());
- static_cast<SyntaxErrorPrototype *>(syntaxErrorPrototype.getPointer())->init(this, syntaxErrorCtor.asObject());
- static_cast<TypeErrorPrototype *>(typeErrorPrototype.getPointer())->init(this, typeErrorCtor.asObject());
- static_cast<URIErrorPrototype *>(uRIErrorPrototype.getPointer())->init(this, uRIErrorCtor.asObject());
-
- static_cast<VariantPrototype *>(variantPrototype.getPointer())->init();
- static_cast<SequencePrototype *>(sequencePrototype.managed())->init();
+ errorPrototype = memoryManager->alloc<ErrorPrototype>(emptyClass, objectPrototype.asObject());
+ evalErrorPrototype = memoryManager->alloc<EvalErrorPrototype>(emptyClass, errorPrototype.asObject());
+ rangeErrorPrototype = memoryManager->alloc<RangeErrorPrototype>(emptyClass, errorPrototype.asObject());
+ referenceErrorPrototype = memoryManager->alloc<ReferenceErrorPrototype>(emptyClass, errorPrototype.asObject());
+ syntaxErrorPrototype = memoryManager->alloc<SyntaxErrorPrototype>(emptyClass, errorPrototype.asObject());
+ typeErrorPrototype = memoryManager->alloc<TypeErrorPrototype>(emptyClass, errorPrototype.asObject());
+ uRIErrorPrototype = memoryManager->alloc<URIErrorPrototype>(emptyClass, errorPrototype.asObject());
+
+ variantPrototype = memoryManager->alloc<VariantPrototype>(emptyClass, objectPrototype.asObject());
+ Q_ASSERT(variantPrototype.asObject()->prototype() == objectPrototype.asObject()->d());
+
+ sequencePrototype = ScopedValue(scope, memoryManager->alloc<SequencePrototype>(arrayClass, arrayPrototype.asObject()));
+
+ ScopedContext global(scope, rootContext());
+ objectCtor = memoryManager->alloc<ObjectCtor>(global);
+ stringCtor = memoryManager->alloc<StringCtor>(global);
+ numberCtor = memoryManager->alloc<NumberCtor>(global);
+ booleanCtor = memoryManager->alloc<BooleanCtor>(global);
+ arrayCtor = memoryManager->alloc<ArrayCtor>(global);
+ functionCtor = memoryManager->alloc<FunctionCtor>(global);
+ dateCtor = memoryManager->alloc<DateCtor>(global);
+ regExpCtor = memoryManager->alloc<RegExpCtor>(global);
+ errorCtor = memoryManager->alloc<ErrorCtor>(global);
+ evalErrorCtor = memoryManager->alloc<EvalErrorCtor>(global);
+ rangeErrorCtor = memoryManager->alloc<RangeErrorCtor>(global);
+ referenceErrorCtor = memoryManager->alloc<ReferenceErrorCtor>(global);
+ syntaxErrorCtor = memoryManager->alloc<SyntaxErrorCtor>(global);
+ typeErrorCtor = memoryManager->alloc<TypeErrorCtor>(global);
+ uRIErrorCtor = memoryManager->alloc<URIErrorCtor>(global);
+
+ static_cast<ObjectPrototype *>(objectPrototype.asObject())->init(this, objectCtor.asObject());
+ static_cast<StringPrototype *>(stringPrototype.asObject())->init(this, stringCtor.asObject());
+ static_cast<NumberPrototype *>(numberPrototype.asObject())->init(this, numberCtor.asObject());
+ static_cast<BooleanPrototype *>(booleanPrototype.asObject())->init(this, booleanCtor.asObject());
+ static_cast<ArrayPrototype *>(arrayPrototype.asObject())->init(this, arrayCtor.asObject());
+ static_cast<DatePrototype *>(datePrototype.asObject())->init(this, dateCtor.asObject());
+ static_cast<FunctionPrototype *>(functionPrototype.asObject())->init(this, functionCtor.asObject());
+ static_cast<RegExpPrototype *>(regExpPrototype.asObject())->init(this, regExpCtor.asObject());
+ static_cast<ErrorPrototype *>(errorPrototype.asObject())->init(this, errorCtor.asObject());
+ static_cast<EvalErrorPrototype *>(evalErrorPrototype.asObject())->init(this, evalErrorCtor.asObject());
+ static_cast<RangeErrorPrototype *>(rangeErrorPrototype.asObject())->init(this, rangeErrorCtor.asObject());
+ static_cast<ReferenceErrorPrototype *>(referenceErrorPrototype.asObject())->init(this, referenceErrorCtor.asObject());
+ static_cast<SyntaxErrorPrototype *>(syntaxErrorPrototype.asObject())->init(this, syntaxErrorCtor.asObject());
+ static_cast<TypeErrorPrototype *>(typeErrorPrototype.asObject())->init(this, typeErrorCtor.asObject());
+ static_cast<URIErrorPrototype *>(uRIErrorPrototype.asObject())->init(this, uRIErrorCtor.asObject());
+
+ static_cast<VariantPrototype *>(variantPrototype.asObject())->init();
+ sequencePrototype.cast<SequencePrototype>()->init();
+
+
+ // typed arrays
+
+ arrayBufferCtor = memoryManager->alloc<ArrayBufferCtor>(global);
+ arrayBufferPrototype = memoryManager->alloc<ArrayBufferPrototype>(emptyClass, objectPrototype.asObject());
+ static_cast<ArrayBufferPrototype *>(arrayBufferPrototype.asObject())->init(this, arrayBufferCtor.asObject());
+
+ dataViewCtor = memoryManager->alloc<DataViewCtor>(global);
+ dataViewPrototype = memoryManager->alloc<DataViewPrototype>(emptyClass, objectPrototype.asObject());
+ static_cast<DataViewPrototype *>(dataViewPrototype.asObject())->init(this, dataViewCtor.asObject());
+
+ for (int i = 0; i < Heap::TypedArray::NTypes; ++i) {
+ typedArrayCtors[i] = memoryManager->alloc<TypedArrayCtor>(global, Heap::TypedArray::Type(i));
+ typedArrayPrototype[i] = memoryManager->alloc<TypedArrayPrototype>(this, Heap::TypedArray::Type(i));
+ typedArrayPrototype[i].as<TypedArrayPrototype>()->init(this, static_cast<TypedArrayCtor *>(typedArrayCtors[i].asObject()));
+ }
//
// set up the global object
//
- globalObject = newObject()->getPointer();
- rootContext->d()->global = globalObject;
- rootContext->d()->callData->thisObject = globalObject;
- Q_ASSERT(globalObject->internalClass()->vtable);
-
- globalObject->defineDefaultProperty(QStringLiteral("Object"), objectCtor);
- globalObject->defineDefaultProperty(QStringLiteral("String"), stringCtor);
- globalObject->defineDefaultProperty(QStringLiteral("Number"), numberCtor);
- globalObject->defineDefaultProperty(QStringLiteral("Boolean"), booleanCtor);
- globalObject->defineDefaultProperty(QStringLiteral("Array"), arrayCtor);
- globalObject->defineDefaultProperty(QStringLiteral("Function"), functionCtor);
- globalObject->defineDefaultProperty(QStringLiteral("Date"), dateCtor);
- globalObject->defineDefaultProperty(QStringLiteral("RegExp"), regExpCtor);
- globalObject->defineDefaultProperty(QStringLiteral("Error"), errorCtor);
- globalObject->defineDefaultProperty(QStringLiteral("EvalError"), evalErrorCtor);
- globalObject->defineDefaultProperty(QStringLiteral("RangeError"), rangeErrorCtor);
- globalObject->defineDefaultProperty(QStringLiteral("ReferenceError"), referenceErrorCtor);
- globalObject->defineDefaultProperty(QStringLiteral("SyntaxError"), syntaxErrorCtor);
- globalObject->defineDefaultProperty(QStringLiteral("TypeError"), typeErrorCtor);
- globalObject->defineDefaultProperty(QStringLiteral("URIError"), uRIErrorCtor);
+ rootContext()->global = globalObject()->d();
+ rootContext()->callData->thisObject = globalObject();
+ Q_ASSERT(globalObject()->d()->vtable);
+
+ globalObject()->defineDefaultProperty(QStringLiteral("Object"), objectCtor);
+ globalObject()->defineDefaultProperty(QStringLiteral("String"), stringCtor);
+ globalObject()->defineDefaultProperty(QStringLiteral("Number"), numberCtor);
+ globalObject()->defineDefaultProperty(QStringLiteral("Boolean"), booleanCtor);
+ globalObject()->defineDefaultProperty(QStringLiteral("Array"), arrayCtor);
+ globalObject()->defineDefaultProperty(QStringLiteral("Function"), functionCtor);
+ globalObject()->defineDefaultProperty(QStringLiteral("Date"), dateCtor);
+ globalObject()->defineDefaultProperty(QStringLiteral("RegExp"), regExpCtor);
+ globalObject()->defineDefaultProperty(QStringLiteral("Error"), errorCtor);
+ globalObject()->defineDefaultProperty(QStringLiteral("EvalError"), evalErrorCtor);
+ globalObject()->defineDefaultProperty(QStringLiteral("RangeError"), rangeErrorCtor);
+ globalObject()->defineDefaultProperty(QStringLiteral("ReferenceError"), referenceErrorCtor);
+ globalObject()->defineDefaultProperty(QStringLiteral("SyntaxError"), syntaxErrorCtor);
+ globalObject()->defineDefaultProperty(QStringLiteral("TypeError"), typeErrorCtor);
+ globalObject()->defineDefaultProperty(QStringLiteral("URIError"), uRIErrorCtor);
+
+ globalObject()->defineDefaultProperty(QStringLiteral("ArrayBuffer"), arrayBufferCtor);
+ globalObject()->defineDefaultProperty(QStringLiteral("DataView"), dataViewCtor);
+ ScopedString str(scope);
+ for (int i = 0; i < Heap::TypedArray::NTypes; ++i)
+ globalObject()->defineDefaultProperty((str = typedArrayCtors[i].asFunctionObject()->name())->toQString(), typedArrayCtors[i]);
ScopedObject o(scope);
- globalObject->defineDefaultProperty(QStringLiteral("Math"), (o = memoryManager->alloc<MathObject>(QV4::InternalClass::create(this, MathObject::staticVTable(), objectPrototype))));
- globalObject->defineDefaultProperty(QStringLiteral("JSON"), (o = memoryManager->alloc<JsonObject>(QV4::InternalClass::create(this, JsonObject::staticVTable(), objectPrototype))));
-
- globalObject->defineReadonlyProperty(QStringLiteral("undefined"), Primitive::undefinedValue());
- globalObject->defineReadonlyProperty(QStringLiteral("NaN"), Primitive::fromDouble(std::numeric_limits<double>::quiet_NaN()));
- globalObject->defineReadonlyProperty(QStringLiteral("Infinity"), Primitive::fromDouble(Q_INFINITY));
-
-
- evalFunction = Scoped<EvalFunction>(scope, memoryManager->alloc<EvalFunction>(rootContext));
- globalObject->defineDefaultProperty(QStringLiteral("eval"), (o = evalFunction));
-
- globalObject->defineDefaultProperty(QStringLiteral("parseInt"), GlobalFunctions::method_parseInt, 2);
- globalObject->defineDefaultProperty(QStringLiteral("parseFloat"), GlobalFunctions::method_parseFloat, 1);
- globalObject->defineDefaultProperty(QStringLiteral("isNaN"), GlobalFunctions::method_isNaN, 1);
- globalObject->defineDefaultProperty(QStringLiteral("isFinite"), GlobalFunctions::method_isFinite, 1);
- globalObject->defineDefaultProperty(QStringLiteral("decodeURI"), GlobalFunctions::method_decodeURI, 1);
- globalObject->defineDefaultProperty(QStringLiteral("decodeURIComponent"), GlobalFunctions::method_decodeURIComponent, 1);
- globalObject->defineDefaultProperty(QStringLiteral("encodeURI"), GlobalFunctions::method_encodeURI, 1);
- globalObject->defineDefaultProperty(QStringLiteral("encodeURIComponent"), GlobalFunctions::method_encodeURIComponent, 1);
- globalObject->defineDefaultProperty(QStringLiteral("escape"), GlobalFunctions::method_escape, 1);
- globalObject->defineDefaultProperty(QStringLiteral("unescape"), GlobalFunctions::method_unescape, 1);
-
- Scoped<String> name(scope, newString(QStringLiteral("thrower")));
- thrower = ScopedFunctionObject(scope, BuiltinFunction::create(rootContext, name.getPointer(), throwTypeError)).getPointer();
+ globalObject()->defineDefaultProperty(QStringLiteral("Math"), (o = memoryManager->alloc<MathObject>(this)));
+ globalObject()->defineDefaultProperty(QStringLiteral("JSON"), (o = memoryManager->alloc<JsonObject>(this)));
+
+ globalObject()->defineReadonlyProperty(QStringLiteral("undefined"), Primitive::undefinedValue());
+ globalObject()->defineReadonlyProperty(QStringLiteral("NaN"), Primitive::fromDouble(std::numeric_limits<double>::quiet_NaN()));
+ globalObject()->defineReadonlyProperty(QStringLiteral("Infinity"), Primitive::fromDouble(Q_INFINITY));
+
+
+ evalFunction = memoryManager->alloc<EvalFunction>(global);
+ globalObject()->defineDefaultProperty(QStringLiteral("eval"), (o = evalFunction));
+
+ globalObject()->defineDefaultProperty(QStringLiteral("parseInt"), GlobalFunctions::method_parseInt, 2);
+ globalObject()->defineDefaultProperty(QStringLiteral("parseFloat"), GlobalFunctions::method_parseFloat, 1);
+ globalObject()->defineDefaultProperty(QStringLiteral("isNaN"), GlobalFunctions::method_isNaN, 1);
+ globalObject()->defineDefaultProperty(QStringLiteral("isFinite"), GlobalFunctions::method_isFinite, 1);
+ globalObject()->defineDefaultProperty(QStringLiteral("decodeURI"), GlobalFunctions::method_decodeURI, 1);
+ globalObject()->defineDefaultProperty(QStringLiteral("decodeURIComponent"), GlobalFunctions::method_decodeURIComponent, 1);
+ globalObject()->defineDefaultProperty(QStringLiteral("encodeURI"), GlobalFunctions::method_encodeURI, 1);
+ globalObject()->defineDefaultProperty(QStringLiteral("encodeURIComponent"), GlobalFunctions::method_encodeURIComponent, 1);
+ globalObject()->defineDefaultProperty(QStringLiteral("escape"), GlobalFunctions::method_escape, 1);
+ globalObject()->defineDefaultProperty(QStringLiteral("unescape"), GlobalFunctions::method_unescape, 1);
+
+ ScopedString name(scope, newString(QStringLiteral("thrower")));
+ thrower = BuiltinFunction::create(global, name, ::throwTypeError);
}
ExecutionEngine::~ExecutionEngine()
@@ -465,15 +498,16 @@ void ExecutionEngine::enableProfiler()
void ExecutionEngine::initRootContext()
{
- GlobalContext *r = static_cast<GlobalContext*>(memoryManager->allocManaged(sizeof(GlobalContext::Data) + sizeof(CallData)));
+ Scope scope(this);
+ Scoped<GlobalContext> r(scope, memoryManager->allocManaged<GlobalContext>(sizeof(GlobalContext::Data) + sizeof(CallData)));
new (r->d()) GlobalContext::Data(this);
r->d()->callData = reinterpret_cast<CallData *>(r->d() + 1);
r->d()->callData->tag = QV4::Value::_Integer_Type;
r->d()->callData->argc = 0;
- r->d()->callData->thisObject = globalObject;
+ r->d()->callData->thisObject = globalObject();
r->d()->callData->args[0] = Encode::undefined();
- rootContext = r;
+ m_rootContext = r->d();
}
InternalClass *ExecutionEngine::newClass(const InternalClass &other)
@@ -481,63 +515,64 @@ InternalClass *ExecutionEngine::newClass(const InternalClass &other)
return new (classPool) InternalClass(other);
}
-ExecutionContext *ExecutionEngine::pushGlobalContext()
+Heap::ExecutionContext *ExecutionEngine::pushGlobalContext()
{
- GlobalContext *g = memoryManager->alloc<GlobalContext>(this);
- g->d()->callData = rootContext->d()->callData;
+ Scope scope(this);
+ Scoped<GlobalContext> g(scope, memoryManager->alloc<GlobalContext>(this));
+ g->d()->callData = rootContext()->callData;
- Q_ASSERT(currentContext() == g);
- return g;
+ Q_ASSERT(currentContext() == g->d());
+ return g->d();
}
-Returned<Object> *ExecutionEngine::newObject()
+Heap::Object *ExecutionEngine::newObject()
{
Scope scope(this);
ScopedObject object(scope, memoryManager->alloc<Object>(this));
- return object->asReturned<Object>();
+ return object->d();
}
-Returned<Object> *ExecutionEngine::newObject(InternalClass *internalClass)
+Heap::Object *ExecutionEngine::newObject(InternalClass *internalClass, QV4::Object *prototype)
{
Scope scope(this);
- ScopedObject object(scope, memoryManager->alloc<Object>(internalClass));
- return object->asReturned<Object>();
+ ScopedObject object(scope, memoryManager->alloc<Object>(internalClass, prototype));
+ return object->d();
}
-Returned<String> *ExecutionEngine::newString(const QString &s)
+Heap::String *ExecutionEngine::newString(const QString &s)
{
Scope scope(this);
- return ScopedString(scope, memoryManager->alloc<String>(this, s))->asReturned<String>();
+ return ScopedString(scope, memoryManager->allocWithStringData<String>(s.length() * sizeof(QChar), s))->d();
}
-String *ExecutionEngine::newIdentifier(const QString &text)
+Heap::String *ExecutionEngine::newIdentifier(const QString &text)
{
return identifierTable->insertString(text);
}
-Returned<Object> *ExecutionEngine::newStringObject(const ValueRef value)
+Heap::Object *ExecutionEngine::newStringObject(const Value &value)
{
Scope scope(this);
Scoped<StringObject> object(scope, memoryManager->alloc<StringObject>(this, value));
- return object->asReturned<Object>();
+ return object->d();
}
-Returned<Object> *ExecutionEngine::newNumberObject(const ValueRef value)
+Heap::Object *ExecutionEngine::newNumberObject(double value)
{
Scope scope(this);
Scoped<NumberObject> object(scope, memoryManager->alloc<NumberObject>(this, value));
- return object->asReturned<Object>();
+ return object->d();
}
-Returned<Object> *ExecutionEngine::newBooleanObject(const ValueRef value)
+Heap::Object *ExecutionEngine::newBooleanObject(bool b)
{
Scope scope(this);
- ScopedObject object(scope, memoryManager->alloc<BooleanObject>(this, value));
- return object->asReturned<Object>();
+ ScopedObject object(scope, memoryManager->alloc<BooleanObject>(this, b));
+ return object->d();
}
-Returned<ArrayObject> *ExecutionEngine::newArrayObject(int count)
+Heap::ArrayObject *ExecutionEngine::newArrayObject(int count)
{
Scope scope(this);
ScopedArrayObject object(scope, memoryManager->alloc<ArrayObject>(this));
@@ -547,39 +582,46 @@ Returned<ArrayObject> *ExecutionEngine::newArrayObject(int count)
object->arrayReserve(count);
object->setArrayLengthUnchecked(count);
}
- return object->asReturned<ArrayObject>();
+ return object->d();
}
-Returned<ArrayObject> *ExecutionEngine::newArrayObject(const QStringList &list)
+Heap::ArrayObject *ExecutionEngine::newArrayObject(const QStringList &list)
{
Scope scope(this);
ScopedArrayObject object(scope, memoryManager->alloc<ArrayObject>(this, list));
- return object->asReturned<ArrayObject>();
+ return object->d();
}
-Returned<ArrayObject> *ExecutionEngine::newArrayObject(InternalClass *ic)
+Heap::ArrayObject *ExecutionEngine::newArrayObject(InternalClass *ic, Object *prototype)
{
Scope scope(this);
- ScopedArrayObject object(scope, memoryManager->alloc<ArrayObject>(ic));
- return object->asReturned<ArrayObject>();
+ ScopedArrayObject object(scope, memoryManager->alloc<ArrayObject>(ic, prototype));
+ return object->d();
+}
+
+Heap::ArrayBuffer *ExecutionEngine::newArrayBuffer(const QByteArray &array)
+{
+ Scope scope(this);
+ Scoped<ArrayBuffer> object(scope, memoryManager->alloc<ArrayBuffer>(this, array));
+ return object->d();
}
-Returned<DateObject> *ExecutionEngine::newDateObject(const ValueRef value)
+Heap::DateObject *ExecutionEngine::newDateObject(const Value &value)
{
Scope scope(this);
Scoped<DateObject> object(scope, memoryManager->alloc<DateObject>(this, value));
- return object->asReturned<DateObject>();
+ return object->d();
}
-Returned<DateObject> *ExecutionEngine::newDateObject(const QDateTime &dt)
+Heap::DateObject *ExecutionEngine::newDateObject(const QDateTime &dt)
{
Scope scope(this);
Scoped<DateObject> object(scope, memoryManager->alloc<DateObject>(this, dt));
- return object->asReturned<DateObject>();
+ return object->d();
}
-Returned<RegExpObject> *ExecutionEngine::newRegExpObject(const QString &pattern, int flags)
+Heap::RegExpObject *ExecutionEngine::newRegExpObject(const QString &pattern, int flags)
{
bool global = (flags & IR::RegExp::RegExp_Global);
bool ignoreCase = false;
@@ -594,122 +636,125 @@ Returned<RegExpObject> *ExecutionEngine::newRegExpObject(const QString &pattern,
return newRegExpObject(re, global);
}
-Returned<RegExpObject> *ExecutionEngine::newRegExpObject(RegExp *re, bool global)
+Heap::RegExpObject *ExecutionEngine::newRegExpObject(RegExp *re, bool global)
{
Scope scope(this);
Scoped<RegExpObject> object(scope, memoryManager->alloc<RegExpObject>(this, re, global));
- return object->asReturned<RegExpObject>();
+ return object->d();
}
-Returned<RegExpObject> *ExecutionEngine::newRegExpObject(const QRegExp &re)
+Heap::RegExpObject *ExecutionEngine::newRegExpObject(const QRegExp &re)
{
Scope scope(this);
Scoped<RegExpObject> object(scope, memoryManager->alloc<RegExpObject>(this, re));
- return object->asReturned<RegExpObject>();
+ return object->d();
}
-Returned<Object> *ExecutionEngine::newErrorObject(const ValueRef value)
+Heap::Object *ExecutionEngine::newErrorObject(const Value &value)
{
Scope scope(this);
- ScopedObject object(scope, memoryManager->alloc<ErrorObject>(errorClass, value));
- return object->asReturned<Object>();
+ ScopedObject object(scope, memoryManager->alloc<ErrorObject>(emptyClass, errorPrototype.asObject(), value));
+ return object->d();
}
-Returned<Object> *ExecutionEngine::newSyntaxErrorObject(const QString &message)
+Heap::Object *ExecutionEngine::newSyntaxErrorObject(const QString &message)
{
Scope scope(this);
ScopedString s(scope, newString(message));
ScopedObject error(scope, memoryManager->alloc<SyntaxErrorObject>(this, s));
- return error->asReturned<Object>();
+ return error->d();
}
-Returned<Object> *ExecutionEngine::newSyntaxErrorObject(const QString &message, const QString &fileName, int line, int column)
+Heap::Object *ExecutionEngine::newSyntaxErrorObject(const QString &message, const QString &fileName, int line, int column)
{
Scope scope(this);
ScopedObject error(scope, memoryManager->alloc<SyntaxErrorObject>(this, message, fileName, line, column));
- return error->asReturned<Object>();
+ return error->d();
}
-Returned<Object> *ExecutionEngine::newReferenceErrorObject(const QString &message)
+Heap::Object *ExecutionEngine::newReferenceErrorObject(const QString &message)
{
Scope scope(this);
ScopedObject o(scope, memoryManager->alloc<ReferenceErrorObject>(this, message));
- return o->asReturned<Object>();
+ return o->d();
}
-Returned<Object> *ExecutionEngine::newReferenceErrorObject(const QString &message, const QString &fileName, int lineNumber, int columnNumber)
+Heap::Object *ExecutionEngine::newReferenceErrorObject(const QString &message, const QString &fileName, int lineNumber, int columnNumber)
{
Scope scope(this);
ScopedObject o(scope, memoryManager->alloc<ReferenceErrorObject>(this, message, fileName, lineNumber, columnNumber));
- return o->asReturned<Object>();
+ return o->d();
}
-Returned<Object> *ExecutionEngine::newTypeErrorObject(const QString &message)
+Heap::Object *ExecutionEngine::newTypeErrorObject(const QString &message)
{
Scope scope(this);
ScopedObject o(scope, memoryManager->alloc<TypeErrorObject>(this, message));
- return o->asReturned<Object>();
+ return o->d();
}
-Returned<Object> *ExecutionEngine::newRangeErrorObject(const QString &message)
+Heap::Object *ExecutionEngine::newRangeErrorObject(const QString &message)
{
Scope scope(this);
ScopedObject o(scope, memoryManager->alloc<RangeErrorObject>(this, message));
- return o->asReturned<Object>();
+ return o->d();
}
-Returned<Object> *ExecutionEngine::newURIErrorObject(const ValueRef message)
+Heap::Object *ExecutionEngine::newURIErrorObject(const Value &message)
{
Scope scope(this);
ScopedObject o(scope, memoryManager->alloc<URIErrorObject>(this, message));
- return o->asReturned<Object>();
+ return o->d();
}
-Returned<Object> *ExecutionEngine::newVariantObject(const QVariant &v)
+Heap::Object *ExecutionEngine::newVariantObject(const QVariant &v)
{
Scope scope(this);
ScopedObject o(scope, memoryManager->alloc<VariantObject>(this, v));
- return o->asReturned<Object>();
+ return o->d();
}
-Returned<Object> *ExecutionEngine::newForEachIteratorObject(ExecutionContext *ctx, Object *o)
+Heap::Object *ExecutionEngine::newForEachIteratorObject(Object *o)
{
Scope scope(this);
- ScopedObject obj(scope, memoryManager->alloc<ForEachIteratorObject>(ctx, o));
- return obj->asReturned<Object>();
+ ScopedObject obj(scope, memoryManager->alloc<ForEachIteratorObject>(this, o));
+ return obj->d();
}
-Returned<Object> *ExecutionEngine::qmlContextObject() const
+Heap::Object *ExecutionEngine::qmlContextObject() const
{
- ExecutionContext *ctx = currentContext();
+ Heap::ExecutionContext *ctx = currentContext();
- if (ctx->d()->type == QV4::ExecutionContext::Type_SimpleCallContext && !ctx->d()->outer)
- ctx = ctx->d()->parent;
+ if (ctx->type == Heap::ExecutionContext::Type_SimpleCallContext && !ctx->outer)
+ ctx = ctx->parent;
- if (!ctx->d()->outer)
+ if (!ctx->outer)
return 0;
- while (ctx->d()->outer && ctx->d()->outer->d()->type != ExecutionContext::Type_GlobalContext)
- ctx = ctx->d()->outer;
+ while (ctx->outer && ctx->outer->type != Heap::ExecutionContext::Type_GlobalContext)
+ ctx = ctx->outer;
Q_ASSERT(ctx);
- if (ctx->d()->type != ExecutionContext::Type_QmlContext)
+ if (ctx->type != Heap::ExecutionContext::Type_QmlContext)
return 0;
- return static_cast<CallContext *>(ctx)->d()->activation->asReturned<Object>();
+ Q_ASSERT(static_cast<Heap::CallContext *>(ctx)->activation);
+ return static_cast<Heap::CallContext *>(ctx)->activation;
}
QVector<StackFrame> ExecutionEngine::stackTrace(int frameLimit) const
{
- Scope scope(this->currentContext());
+ Scope scope(const_cast<ExecutionEngine *>(this));
ScopedString name(scope);
QVector<StackFrame> stack;
- QV4::ExecutionContext *c = currentContext();
+ ScopedContext c(scope, currentContext());
+ ScopedFunctionObject function(scope);
while (c && frameLimit) {
- if (FunctionObject *function = c->getFunctionObject()) {
+ function = c->getFunctionObject();
+ if (function) {
StackFrame frame;
if (const Function *f = function->function())
frame.source = f->sourceFile();
@@ -732,7 +777,7 @@ QVector<StackFrame> ExecutionEngine::stackTrace(int frameLimit) const
StackFrame frame;
frame.source = globalCode->sourceFile();
frame.function = globalCode->name()->toQString();
- frame.line = rootContext->d()->lineNumber;
+ frame.line = rootContext()->lineNumber;
frame.column = -1;
stack.append(frame);
@@ -793,12 +838,13 @@ QUrl ExecutionEngine::resolvedUrl(const QString &file)
return src;
QUrl base;
- QV4::ExecutionContext *c = currentContext();
+ Scope scope(this);
+ ScopedContext c(scope, currentContext());
while (c) {
CallContext *callCtx = c->asCallContext();
if (callCtx && callCtx->d()->function) {
- if (callCtx->d()->function->function())
- base.setUrl(callCtx->d()->function->function()->sourceFile());
+ if (callCtx->d()->function->function)
+ base.setUrl(callCtx->d()->function->function->sourceFile());
break;
}
c = c->d()->parent;
@@ -831,9 +877,10 @@ void ExecutionEngine::requireArgumentsAccessors(int n)
memcpy(argumentsAccessors, oldAccessors, oldSize*sizeof(Property));
delete [] oldAccessors;
}
+ ScopedContext global(scope, scope.engine->rootContext());
for (int i = oldSize; i < nArgumentsAccessors; ++i) {
- argumentsAccessors[i].value = ScopedValue(scope, memoryManager->alloc<ArgumentsGetterFunction>(rootContext, i));
- argumentsAccessors[i].set = ScopedValue(scope, memoryManager->alloc<ArgumentsSetterFunction>(rootContext, i));
+ argumentsAccessors[i].value = ScopedValue(scope, memoryManager->alloc<ArgumentsGetterFunction>(global, i));
+ argumentsAccessors[i].set = ScopedValue(scope, memoryManager->alloc<ArgumentsSetterFunction>(global, i));
}
}
}
@@ -842,24 +889,24 @@ void ExecutionEngine::markObjects()
{
identifierTable->mark(this);
- globalObject->mark(this);
+ globalObject()->mark(this);
for (int i = 0; i < nArgumentsAccessors; ++i) {
const Property &pd = argumentsAccessors[i];
- if (FunctionObject *getter = pd.getter())
+ if (Heap::FunctionObject *getter = pd.getter())
getter->mark(this);
- if (FunctionObject *setter = pd.setter())
+ if (Heap::FunctionObject *setter = pd.setter())
setter->mark(this);
}
- ExecutionContext *c = currentContext();
+ Heap::ExecutionContext *c = currentContext();
while (c) {
Q_ASSERT(c->inUse());
- if (!c->markBit()) {
- c->d()->markBit = 1;
- c->markObjects(c, this);
+ if (!c->isMarked()) {
+ c->setMarkBit();
+ c->gcGetVtable()->markObjects(c, this);
}
- c = c->d()->parent;
+ c = c->parent;
}
id_empty->mark(this);
@@ -894,6 +941,10 @@ void ExecutionEngine::markObjects()
id_toString->mark(this);
id_destroy->mark(this);
id_valueOf->mark(this);
+ id_byteLength->mark(this);
+ id_byteOffset->mark(this);
+ id_buffer->mark(this);
+ id_lastIndex->mark(this);
objectCtor.mark(this);
stringCtor.mark(this);
@@ -910,8 +961,34 @@ void ExecutionEngine::markObjects()
syntaxErrorCtor.mark(this);
typeErrorCtor.mark(this);
uRIErrorCtor.mark(this);
+ arrayBufferCtor.mark(this);
+ dataViewCtor.mark(this);
+ for (int i = 0; i < Heap::TypedArray::NTypes; ++i)
+ typedArrayCtors[i].mark(this);
+
+ objectPrototype.mark(this);
+ arrayPrototype.mark(this);
+ stringPrototype.mark(this);
+ numberPrototype.mark(this);
+ booleanPrototype.mark(this);
+ datePrototype.mark(this);
+ functionPrototype.mark(this);
+ regExpPrototype.mark(this);
+ errorPrototype.mark(this);
+ evalErrorPrototype.mark(this);
+ rangeErrorPrototype.mark(this);
+ referenceErrorPrototype.mark(this);
+ syntaxErrorPrototype.mark(this);
+ typeErrorPrototype.mark(this);
+ uRIErrorPrototype.mark(this);
+ variantPrototype.mark(this);
sequencePrototype.mark(this);
+ arrayBufferPrototype.mark(this);
+ dataViewPrototype.mark(this);
+ for (int i = 0; i < Heap::TypedArray::NTypes; ++i)
+ typedArrayPrototype[i].mark(this);
+
exceptionValue.mark(this);
thrower->mark(this);
@@ -933,7 +1010,7 @@ QmlExtensions *ExecutionEngine::qmlExtensions()
return m_qmlExtensions;
}
-ReturnedValue ExecutionEngine::throwException(const ValueRef value)
+ReturnedValue ExecutionEngine::throwError(const Value &value)
{
// we can get in here with an exception already set, as the runtime
// doesn't check after every operation that can throw.
@@ -957,11 +1034,9 @@ ReturnedValue ExecutionEngine::throwException(const ValueRef value)
return Encode::undefined();
}
-ReturnedValue ExecutionEngine::catchException(ExecutionContext *catchingContext, StackTrace *trace)
+ReturnedValue ExecutionEngine::catchException(StackTrace *trace)
{
Q_ASSERT(hasException);
- Q_UNUSED(catchingContext);
- Q_ASSERT(currentContext() == catchingContext);
if (trace)
*trace = exceptionStackTrace;
exceptionStackTrace.clear();
@@ -971,11 +1046,97 @@ ReturnedValue ExecutionEngine::catchException(ExecutionContext *catchingContext,
return res;
}
-QQmlError ExecutionEngine::catchExceptionAsQmlError(ExecutionContext *context)
+ReturnedValue ExecutionEngine::throwError(const QString &message)
+{
+ Scope scope(this);
+ ScopedValue v(scope, newString(message));
+ v = newErrorObject(v);
+ return throwError(v);
+}
+
+ReturnedValue ExecutionEngine::throwSyntaxError(const QString &message, const QString &fileName, int line, int column)
+{
+ Scope scope(this);
+ ScopedObject error(scope, newSyntaxErrorObject(message, fileName, line, column));
+ return throwError(error);
+}
+
+ReturnedValue ExecutionEngine::throwSyntaxError(const QString &message)
+{
+ Scope scope(this);
+ ScopedObject error(scope, newSyntaxErrorObject(message));
+ return throwError(error);
+}
+
+
+ReturnedValue ExecutionEngine::throwTypeError()
+{
+ Scope scope(this);
+ ScopedObject error(scope, newTypeErrorObject(QStringLiteral("Type error")));
+ return throwError(error);
+}
+
+ReturnedValue ExecutionEngine::throwTypeError(const QString &message)
+{
+ Scope scope(this);
+ ScopedObject error(scope, newTypeErrorObject(message));
+ return throwError(error);
+}
+
+ReturnedValue ExecutionEngine::throwReferenceError(const Value &value)
+{
+ Scope scope(this);
+ ScopedString s(scope, value.toString(this));
+ QString msg = s->toQString() + QStringLiteral(" is not defined");
+ ScopedObject error(scope, newReferenceErrorObject(msg));
+ return throwError(error);
+}
+
+ReturnedValue ExecutionEngine::throwReferenceError(const QString &message, const QString &fileName, int line, int column)
+{
+ Scope scope(this);
+ QString msg = message;
+ ScopedObject error(scope, newReferenceErrorObject(msg, fileName, line, column));
+ return throwError(error);
+}
+
+ReturnedValue ExecutionEngine::throwRangeError(const QString &message)
+{
+ Scope scope(this);
+ ScopedObject error(scope, newRangeErrorObject(message));
+ return throwError(error);
+}
+
+ReturnedValue ExecutionEngine::throwRangeError(const Value &value)
+{
+ Scope scope(this);
+ ScopedString s(scope, value.toString(this));
+ QString msg = s->toQString() + QStringLiteral(" out of range");
+ ScopedObject error(scope, newRangeErrorObject(msg));
+ return throwError(error);
+}
+
+ReturnedValue ExecutionEngine::throwURIError(const Value &msg)
+{
+ Scope scope(this);
+ ScopedObject error(scope, newURIErrorObject(msg));
+ return throwError(error);
+}
+
+ReturnedValue ExecutionEngine::throwUnimplemented(const QString &message)
+{
+ Scope scope(this);
+ ScopedValue v(scope, newString(QStringLiteral("Unimplemented ") + message));
+ v = newErrorObject(v);
+ return throwError(v);
+}
+
+
+QQmlError ExecutionEngine::catchExceptionAsQmlError()
{
QV4::StackTrace trace;
- QV4::Scope scope(context);
- QV4::ScopedValue exception(scope, context->catchException(&trace));
+ QV4::Scope scope(this);
+ QV4::ScopedValue exception(scope, catchException(&trace));
QQmlError error;
if (!trace.isEmpty()) {
QV4::StackFrame frame = trace.first();
@@ -985,8 +1146,8 @@ QQmlError ExecutionEngine::catchExceptionAsQmlError(ExecutionContext *context)
}
QV4::Scoped<QV4::ErrorObject> errorObj(scope, exception);
if (!!errorObj && errorObj->asSyntaxError()) {
- QV4::ScopedString m(scope, errorObj->engine()->newString(QStringLiteral("message")));
- QV4::ScopedValue v(scope, errorObj->get(m.getPointer()));
+ QV4::ScopedString m(scope, newString(QStringLiteral("message")));
+ QV4::ScopedValue v(scope, errorObj->get(m));
error.setDescription(v->toQStringNoThrow());
} else
error.setDescription(exception->toQStringNoThrow());
@@ -1008,4 +1169,708 @@ bool ExecutionEngine::recheckCStackLimits()
return (reinterpret_cast<quintptr>(&dummy) >= cStackLimit);
}
+
+// Variant conversion code
+
+typedef QSet<QV4::Heap::Object *> V4ObjectSet;
+static QVariant toVariant(QV4::ExecutionEngine *e, const QV4::Value &value, int typeHint, bool createJSValueForObjects, V4ObjectSet *visitedObjects);
+static QObject *qtObjectFromJS(QV4::ExecutionEngine *engine, const QV4::Value &value);
+static QVariant objectToVariant(QV4::ExecutionEngine *e, QV4::Object *o, V4ObjectSet *visitedObjects = 0);
+static bool convertToNativeQObject(QV4::ExecutionEngine *e, const QV4::Value &value,
+ const QByteArray &targetType,
+ void **result);
+static QV4::ReturnedValue variantListToJS(QV4::ExecutionEngine *v4, const QVariantList &lst);
+static QV4::ReturnedValue variantMapToJS(QV4::ExecutionEngine *v4, const QVariantMap &vmap);
+static QV4::ReturnedValue variantToJS(QV4::ExecutionEngine *v4, const QVariant &value)
+{
+ return v4->metaTypeToJS(value.userType(), value.constData());
+}
+
+
+QVariant ExecutionEngine::toVariant(const Value &value, int typeHint, bool createJSValueForObjects)
+{
+ return ::toVariant(this, value, typeHint, createJSValueForObjects, 0);
+}
+
+
+static QVariant toVariant(QV4::ExecutionEngine *e, const QV4::Value &value, int typeHint, bool createJSValueForObjects, V4ObjectSet *visitedObjects)
+{
+ Q_ASSERT (!value.isEmpty());
+ QV4::Scope scope(e);
+
+ if (QV4::VariantObject *v = value.as<QV4::VariantObject>())
+ return v->d()->data;
+
+ if (typeHint == QVariant::Bool)
+ return QVariant(value.toBoolean());
+
+ if (typeHint == QMetaType::QJsonValue)
+ return QVariant::fromValue(QV4::JsonObject::toJsonValue(value));
+
+ if (typeHint == qMetaTypeId<QJSValue>())
+ return QVariant::fromValue(QJSValue(e, value.asReturnedValue()));
+
+ if (value.asObject()) {
+ QV4::ScopedObject object(scope, value);
+ if (typeHint == QMetaType::QJsonObject
+ && !value.asArrayObject() && !value.asFunctionObject()) {
+ return QVariant::fromValue(QV4::JsonObject::toJsonObject(object));
+ } else if (QV4::QObjectWrapper *wrapper = object->as<QV4::QObjectWrapper>()) {
+ return qVariantFromValue<QObject *>(wrapper->object());
+ } else if (object->as<QV4::QmlContextWrapper>()) {
+ return QVariant();
+ } else if (QV4::QmlTypeWrapper *w = object->as<QV4::QmlTypeWrapper>()) {
+ return w->toVariant();
+ } else if (QV4::QQmlValueTypeWrapper *v = object->as<QV4::QQmlValueTypeWrapper>()) {
+ return v->toVariant();
+ } else if (QV4::QmlListWrapper *l = object->as<QV4::QmlListWrapper>()) {
+ return l->toVariant();
+ } else if (object->isListType())
+ return QV4::SequencePrototype::toVariant(object);
+ }
+
+ if (value.asArrayObject()) {
+ QV4::ScopedArrayObject a(scope, value);
+ if (typeHint == qMetaTypeId<QList<QObject *> >()) {
+ QList<QObject *> list;
+ uint length = a->getLength();
+ QV4::Scoped<QV4::QObjectWrapper> qobjectWrapper(scope);
+ for (uint ii = 0; ii < length; ++ii) {
+ qobjectWrapper = a->getIndexed(ii);
+ if (!!qobjectWrapper) {
+ list << qobjectWrapper->object();
+ } else {
+ list << 0;
+ }
+ }
+
+ return qVariantFromValue<QList<QObject*> >(list);
+ } else if (typeHint == QMetaType::QJsonArray) {
+ return QVariant::fromValue(QV4::JsonObject::toJsonArray(a));
+ }
+
+ bool succeeded = false;
+ QVariant retn = QV4::SequencePrototype::toVariant(value, typeHint, &succeeded);
+ if (succeeded)
+ return retn;
+ }
+
+ if (value.isUndefined())
+ return QVariant();
+ if (value.isNull())
+ return QVariant(QMetaType::VoidStar, (void *)0);
+ if (value.isBoolean())
+ return value.booleanValue();
+ if (value.isInteger())
+ return value.integerValue();
+ if (value.isNumber())
+ return value.asDouble();
+ if (value.isString())
+ return value.stringValue()->toQString();
+ if (QV4::QQmlLocaleData *ld = value.as<QV4::QQmlLocaleData>())
+ return ld->d()->locale;
+ if (QV4::DateObject *d = value.asDateObject())
+ return d->toQDateTime();
+ if (QV4::ArrayBuffer *d = value.as<ArrayBuffer>())
+ return d->asByteArray();
+ // NOTE: since we convert QTime to JS Date, round trip will change the variant type (to QDateTime)!
+
+ QV4::ScopedObject o(scope, value);
+ Q_ASSERT(o);
+
+ if (QV4::RegExpObject *re = o->as<QV4::RegExpObject>())
+ return re->toQRegExp();
+
+ if (createJSValueForObjects)
+ return QVariant::fromValue(QJSValue(scope.engine, o->asReturnedValue()));
+
+ return objectToVariant(e, o, visitedObjects);
+}
+
+static QVariant objectToVariant(QV4::ExecutionEngine *e, QV4::Object *o, V4ObjectSet *visitedObjects)
+{
+ Q_ASSERT(o);
+
+ V4ObjectSet recursionGuardSet;
+ if (!visitedObjects) {
+ visitedObjects = &recursionGuardSet;
+ } else if (visitedObjects->contains(o->d())) {
+ // Avoid recursion.
+ // For compatibility with QVariant{List,Map} conversion, we return an
+ // empty object (and no error is thrown).
+ if (o->asArrayObject())
+ return QVariantList();
+ return QVariantMap();
+ }
+ visitedObjects->insert(o->d());
+
+ QVariant result;
+
+ if (o->asArrayObject()) {
+ QV4::Scope scope(e);
+ QV4::ScopedArrayObject a(scope, o->asReturnedValue());
+ QV4::ScopedValue v(scope);
+ QVariantList list;
+
+ int length = a->getLength();
+ for (int ii = 0; ii < length; ++ii) {
+ v = a->getIndexed(ii);
+ list << ::toVariant(e, v, -1, /*createJSValueForObjects*/false, visitedObjects);
+ }
+
+ result = list;
+ } else if (!o->asFunctionObject()) {
+ QVariantMap map;
+ QV4::Scope scope(e);
+ QV4::ObjectIterator it(scope, o, QV4::ObjectIterator::EnumerableOnly);
+ QV4::ScopedValue name(scope);
+ QV4::ScopedValue val(scope);
+ while (1) {
+ name = it.nextPropertyNameAsString(val);
+ if (name->isNull())
+ break;
+
+ QString key = name->toQStringNoThrow();
+ map.insert(key, ::toVariant(e, val, /*type hint*/-1, /*createJSValueForObjects*/false, visitedObjects));
+ }
+
+ result = map;
+ }
+
+ visitedObjects->remove(o->d());
+ return result;
+}
+
+static QV4::ReturnedValue arrayFromVariantList(QV4::ExecutionEngine *e, const QVariantList &list)
+{
+ QV4::Scope scope(e);
+ QV4::ScopedArrayObject a(scope, e->newArrayObject());
+ int len = list.count();
+ a->arrayReserve(len);
+ QV4::ScopedValue v(scope);
+ for (int ii = 0; ii < len; ++ii)
+ a->arrayPut(ii, (v = scope.engine->fromVariant(list.at(ii))));
+
+ a->setArrayLengthUnchecked(len);
+ return a.asReturnedValue();
+}
+
+static QV4::ReturnedValue objectFromVariantMap(QV4::ExecutionEngine *e, const QVariantMap &map)
+{
+ QV4::Scope scope(e);
+ QV4::ScopedObject o(scope, e->newObject());
+ QV4::ScopedString s(scope);
+ QV4::ScopedValue v(scope);
+ for (QVariantMap::const_iterator iter = map.begin(), cend = map.end(); iter != cend; ++iter) {
+ s = e->newString(iter.key());
+ uint idx = s->asArrayIndex();
+ if (idx > 16 && (!o->arrayData() || idx > o->arrayData()->length() * 2))
+ o->initSparseArray();
+ o->put(s, (v = e->fromVariant(iter.value())));
+ }
+ return o.asReturnedValue();
+}
+
+Q_CORE_EXPORT QString qt_regexp_toCanonical(const QString &, QRegExp::PatternSyntax);
+
+QV4::ReturnedValue QV4::ExecutionEngine::fromVariant(const QVariant &variant)
+{
+ int type = variant.userType();
+ const void *ptr = variant.constData();
+
+ if (type < QMetaType::User) {
+ switch (QMetaType::Type(type)) {
+ case QMetaType::UnknownType:
+ case QMetaType::Void:
+ return QV4::Encode::undefined();
+ case QMetaType::VoidStar:
+ return QV4::Encode::null();
+ case QMetaType::Bool:
+ return QV4::Encode(*reinterpret_cast<const bool*>(ptr));
+ case QMetaType::Int:
+ return QV4::Encode(*reinterpret_cast<const int*>(ptr));
+ case QMetaType::UInt:
+ return QV4::Encode(*reinterpret_cast<const uint*>(ptr));
+ case QMetaType::LongLong:
+ return QV4::Encode((double)*reinterpret_cast<const qlonglong*>(ptr));
+ case QMetaType::ULongLong:
+ return QV4::Encode((double)*reinterpret_cast<const qulonglong*>(ptr));
+ case QMetaType::Double:
+ return QV4::Encode(*reinterpret_cast<const double*>(ptr));
+ case QMetaType::QString:
+ return newString(*reinterpret_cast<const QString*>(ptr))->asReturnedValue();
+ case QMetaType::Float:
+ return QV4::Encode(*reinterpret_cast<const float*>(ptr));
+ case QMetaType::Short:
+ return QV4::Encode((int)*reinterpret_cast<const short*>(ptr));
+ case QMetaType::UShort:
+ return QV4::Encode((int)*reinterpret_cast<const unsigned short*>(ptr));
+ case QMetaType::Char:
+ return newString(QChar::fromLatin1(*reinterpret_cast<const char *>(ptr)))->asReturnedValue();
+ case QMetaType::UChar:
+ return newString(QChar::fromLatin1(*reinterpret_cast<const unsigned char *>(ptr)))->asReturnedValue();
+ case QMetaType::QChar:
+ return newString(*reinterpret_cast<const QChar *>(ptr))->asReturnedValue();
+ case QMetaType::QDateTime:
+ return QV4::Encode(newDateObject(*reinterpret_cast<const QDateTime *>(ptr)));
+ case QMetaType::QDate:
+ return QV4::Encode(newDateObject(QDateTime(*reinterpret_cast<const QDate *>(ptr))));
+ case QMetaType::QTime:
+ return QV4::Encode(newDateObject(QDateTime(QDate(1970,1,1), *reinterpret_cast<const QTime *>(ptr))));
+ case QMetaType::QRegExp:
+ return QV4::Encode(newRegExpObject(*reinterpret_cast<const QRegExp *>(ptr)));
+ case QMetaType::QObjectStar:
+ return QV4::QObjectWrapper::wrap(this, *reinterpret_cast<QObject* const *>(ptr));
+ case QMetaType::QStringList:
+ {
+ bool succeeded = false;
+ QV4::Scope scope(this);
+ QV4::ScopedValue retn(scope, QV4::SequencePrototype::fromVariant(this, variant, &succeeded));
+ if (succeeded)
+ return retn->asReturnedValue();
+ return QV4::Encode(newArrayObject(*reinterpret_cast<const QStringList *>(ptr)));
+ }
+ case QMetaType::QVariantList:
+ return arrayFromVariantList(this, *reinterpret_cast<const QVariantList *>(ptr));
+ case QMetaType::QVariantMap:
+ return objectFromVariantMap(this, *reinterpret_cast<const QVariantMap *>(ptr));
+ case QMetaType::QJsonValue:
+ return QV4::JsonObject::fromJsonValue(this, *reinterpret_cast<const QJsonValue *>(ptr));
+ case QMetaType::QJsonObject:
+ return QV4::JsonObject::fromJsonObject(this, *reinterpret_cast<const QJsonObject *>(ptr));
+ case QMetaType::QJsonArray:
+ return QV4::JsonObject::fromJsonArray(this, *reinterpret_cast<const QJsonArray *>(ptr));
+ case QMetaType::QLocale:
+ return QQmlLocale::wrap(this, *reinterpret_cast<const QLocale*>(ptr));
+ default:
+ break;
+ }
+
+ if (const QMetaObject *vtmo = QQmlValueTypeFactory::metaObjectForMetaType(type))
+ return QV4::QQmlValueTypeWrapper::create(this, variant, vtmo, type);
+ } else {
+ QV4::Scope scope(this);
+ if (type == qMetaTypeId<QQmlListReference>()) {
+ typedef QQmlListReferencePrivate QDLRP;
+ QDLRP *p = QDLRP::get((QQmlListReference*)const_cast<void *>(ptr));
+ if (p->object) {
+ return QV4::QmlListWrapper::create(scope.engine, p->property, p->propertyType);
+ } else {
+ return QV4::Encode::null();
+ }
+ } else if (type == qMetaTypeId<QJSValue>()) {
+ const QJSValue *value = reinterpret_cast<const QJSValue *>(ptr);
+ return QJSValuePrivate::convertedToValue(this, *value);
+ } else if (type == qMetaTypeId<QList<QObject *> >()) {
+ // XXX Can this be made more by using Array as a prototype and implementing
+ // directly against QList<QObject*>?
+ const QList<QObject *> &list = *(const QList<QObject *>*)ptr;
+ QV4::ScopedArrayObject a(scope, newArrayObject());
+ a->arrayReserve(list.count());
+ QV4::ScopedValue v(scope);
+ for (int ii = 0; ii < list.count(); ++ii)
+ a->arrayPut(ii, (v = QV4::QObjectWrapper::wrap(this, list.at(ii))));
+ a->setArrayLengthUnchecked(list.count());
+ return a.asReturnedValue();
+ } else if (QMetaType::typeFlags(type) & QMetaType::PointerToQObject) {
+ return QV4::QObjectWrapper::wrap(this, *reinterpret_cast<QObject* const *>(ptr));
+ }
+
+ bool objOk;
+ QObject *obj = QQmlMetaType::toQObject(variant, &objOk);
+ if (objOk)
+ return QV4::QObjectWrapper::wrap(this, obj);
+
+ bool succeeded = false;
+ QV4::ScopedValue retn(scope, QV4::SequencePrototype::fromVariant(this, variant, &succeeded));
+ if (succeeded)
+ return retn->asReturnedValue();
+
+ if (const QMetaObject *vtmo = QQmlValueTypeFactory::metaObjectForMetaType(type))
+ return QV4::QQmlValueTypeWrapper::create(this, variant, vtmo, type);
+ }
+
+ // XXX TODO: To be compatible, we still need to handle:
+ // + QObjectList
+ // + QList<int>
+
+ return QV4::Encode(newVariantObject(variant));
+}
+
+QVariantMap ExecutionEngine::variantMapFromJS(Object *o)
+{
+ return objectToVariant(this, o).toMap();
+}
+
+
+// Converts a QVariantList to JS.
+// The result is a new Array object with length equal to the length
+// of the QVariantList, and the elements being the QVariantList's
+// elements converted to JS, recursively.
+static QV4::ReturnedValue variantListToJS(QV4::ExecutionEngine *v4, const QVariantList &lst)
+{
+ QV4::Scope scope(v4);
+ QV4::ScopedArrayObject a(scope, v4->newArrayObject());
+ a->arrayReserve(lst.size());
+ QV4::ScopedValue v(scope);
+ for (int i = 0; i < lst.size(); i++)
+ a->arrayPut(i, (v = variantToJS(v4, lst.at(i))));
+ a->setArrayLengthUnchecked(lst.size());
+ return a.asReturnedValue();
+}
+
+// Converts a QVariantMap to JS.
+// The result is a new Object object with property names being
+// the keys of the QVariantMap, and values being the values of
+// the QVariantMap converted to JS, recursively.
+static QV4::ReturnedValue variantMapToJS(QV4::ExecutionEngine *v4, const QVariantMap &vmap)
+{
+ QV4::Scope scope(v4);
+ QV4::ScopedObject o(scope, v4->newObject());
+ QV4::ScopedString s(scope);
+ QV4::ScopedValue v(scope);
+ for (QVariantMap::const_iterator it = vmap.constBegin(), cend = vmap.constEnd(); it != cend; ++it) {
+ s = v4->newIdentifier(it.key());
+ v = variantToJS(v4, it.value());
+ uint idx = s->asArrayIndex();
+ if (idx < UINT_MAX)
+ o->arraySet(idx, v);
+ else
+ o->insertMember(s, v);
+ }
+ return o.asReturnedValue();
+}
+
+// Converts the meta-type defined by the given type and data to JS.
+// Returns the value if conversion succeeded, an empty handle otherwise.
+QV4::ReturnedValue ExecutionEngine::metaTypeToJS(int type, const void *data)
+{
+ Q_ASSERT(data != 0);
+
+ // check if it's one of the types we know
+ switch (QMetaType::Type(type)) {
+ case QMetaType::UnknownType:
+ case QMetaType::Void:
+ return QV4::Encode::undefined();
+ case QMetaType::VoidStar:
+ return QV4::Encode::null();
+ case QMetaType::Bool:
+ return QV4::Encode(*reinterpret_cast<const bool*>(data));
+ case QMetaType::Int:
+ return QV4::Encode(*reinterpret_cast<const int*>(data));
+ case QMetaType::UInt:
+ return QV4::Encode(*reinterpret_cast<const uint*>(data));
+ case QMetaType::LongLong:
+ return QV4::Encode(double(*reinterpret_cast<const qlonglong*>(data)));
+ case QMetaType::ULongLong:
+#if defined(Q_OS_WIN) && defined(_MSC_FULL_VER) && _MSC_FULL_VER <= 12008804
+#pragma message("** NOTE: You need the Visual Studio Processor Pack to compile support for 64bit unsigned integers.")
+ return QV4::Encode(double((qlonglong)*reinterpret_cast<const qulonglong*>(data)));
+#elif defined(Q_CC_MSVC) && !defined(Q_CC_MSVC_NET)
+ return QV4::Encode(double((qlonglong)*reinterpret_cast<const qulonglong*>(data)));
+#else
+ return QV4::Encode(double(*reinterpret_cast<const qulonglong*>(data)));
+#endif
+ case QMetaType::Double:
+ return QV4::Encode(*reinterpret_cast<const double*>(data));
+ case QMetaType::QString:
+ return newString(*reinterpret_cast<const QString*>(data))->asReturnedValue();
+ case QMetaType::Float:
+ return QV4::Encode(*reinterpret_cast<const float*>(data));
+ case QMetaType::Short:
+ return QV4::Encode((int)*reinterpret_cast<const short*>(data));
+ case QMetaType::UShort:
+ return QV4::Encode((int)*reinterpret_cast<const unsigned short*>(data));
+ case QMetaType::Char:
+ return QV4::Encode((int)*reinterpret_cast<const char*>(data));
+ case QMetaType::UChar:
+ return QV4::Encode((int)*reinterpret_cast<const unsigned char*>(data));
+ case QMetaType::QChar:
+ return QV4::Encode((int)(*reinterpret_cast<const QChar*>(data)).unicode());
+ case QMetaType::QStringList:
+ return QV4::Encode(newArrayObject(*reinterpret_cast<const QStringList *>(data)));
+ case QMetaType::QVariantList:
+ return variantListToJS(this, *reinterpret_cast<const QVariantList *>(data));
+ case QMetaType::QVariantMap:
+ return variantMapToJS(this, *reinterpret_cast<const QVariantMap *>(data));
+ case QMetaType::QDateTime:
+ return QV4::Encode(newDateObject(*reinterpret_cast<const QDateTime *>(data)));
+ case QMetaType::QDate:
+ return QV4::Encode(newDateObject(QDateTime(*reinterpret_cast<const QDate *>(data))));
+ case QMetaType::QRegExp:
+ return QV4::Encode(newRegExpObject(*reinterpret_cast<const QRegExp *>(data)));
+ case QMetaType::QObjectStar:
+ return QV4::QObjectWrapper::wrap(this, *reinterpret_cast<QObject* const *>(data));
+ case QMetaType::QVariant:
+ return variantToJS(this, *reinterpret_cast<const QVariant*>(data));
+ case QMetaType::QJsonValue:
+ return QV4::JsonObject::fromJsonValue(this, *reinterpret_cast<const QJsonValue *>(data));
+ case QMetaType::QJsonObject:
+ return QV4::JsonObject::fromJsonObject(this, *reinterpret_cast<const QJsonObject *>(data));
+ case QMetaType::QJsonArray:
+ return QV4::JsonObject::fromJsonArray(this, *reinterpret_cast<const QJsonArray *>(data));
+ default:
+ if (type == qMetaTypeId<QJSValue>()) {
+ return QJSValuePrivate::convertedToValue(this, *reinterpret_cast<const QJSValue*>(data));
+ } else {
+ QByteArray typeName = QMetaType::typeName(type);
+ if (typeName.endsWith('*') && !*reinterpret_cast<void* const *>(data)) {
+ return QV4::Encode::null();
+ }
+ QMetaType mt(type);
+ if (mt.flags() & QMetaType::IsGadget) {
+ Q_ASSERT(mt.metaObject());
+ return QV4::QQmlValueTypeWrapper::create(this, QVariant(type, data), mt.metaObject(), type);
+ }
+ // Fall back to wrapping in a QVariant.
+ return QV4::Encode(newVariantObject(QVariant(type, data)));
+ }
+ }
+ Q_UNREACHABLE();
+ return 0;
+}
+
+void ExecutionEngine::assertObjectBelongsToEngine(const Value &v)
+{
+ Q_UNUSED(v);
+ Q_ASSERT(!v.isObject() || v.objectValue()->engine() == this);
+ Q_UNUSED(v);
+}
+
+// Converts a JS value to a meta-type.
+// data must point to a place that can store a value of the given type.
+// Returns true if conversion succeeded, false otherwise.
+bool ExecutionEngine::metaTypeFromJS(const QV4::Value &value, int type, void *data)
+{
+ QV4::Scope scope(this);
+
+ // check if it's one of the types we know
+ switch (QMetaType::Type(type)) {
+ case QMetaType::Bool:
+ *reinterpret_cast<bool*>(data) = value.toBoolean();
+ return true;
+ case QMetaType::Int:
+ *reinterpret_cast<int*>(data) = value.toInt32();
+ return true;
+ case QMetaType::UInt:
+ *reinterpret_cast<uint*>(data) = value.toUInt32();
+ return true;
+ case QMetaType::LongLong:
+ *reinterpret_cast<qlonglong*>(data) = qlonglong(value.toInteger());
+ return true;
+ case QMetaType::ULongLong:
+ *reinterpret_cast<qulonglong*>(data) = qulonglong(value.toInteger());
+ return true;
+ case QMetaType::Double:
+ *reinterpret_cast<double*>(data) = value.toNumber();
+ return true;
+ case QMetaType::QString:
+ if (value.isUndefined() || value.isNull())
+ *reinterpret_cast<QString*>(data) = QString();
+ else
+ *reinterpret_cast<QString*>(data) = value.toQString();
+ return true;
+ case QMetaType::Float:
+ *reinterpret_cast<float*>(data) = value.toNumber();
+ return true;
+ case QMetaType::Short:
+ *reinterpret_cast<short*>(data) = short(value.toInt32());
+ return true;
+ case QMetaType::UShort:
+ *reinterpret_cast<unsigned short*>(data) = value.toUInt16();
+ return true;
+ case QMetaType::Char:
+ *reinterpret_cast<char*>(data) = char(value.toInt32());
+ return true;
+ case QMetaType::UChar:
+ *reinterpret_cast<unsigned char*>(data) = (unsigned char)(value.toInt32());
+ return true;
+ case QMetaType::QChar:
+ if (value.isString()) {
+ QString str = value.stringValue()->toQString();
+ *reinterpret_cast<QChar*>(data) = str.isEmpty() ? QChar() : str.at(0);
+ } else {
+ *reinterpret_cast<QChar*>(data) = QChar(ushort(value.toUInt16()));
+ }
+ return true;
+ case QMetaType::QDateTime:
+ if (QV4::DateObject *d = value.asDateObject()) {
+ *reinterpret_cast<QDateTime *>(data) = d->toQDateTime();
+ return true;
+ } break;
+ case QMetaType::QDate:
+ if (QV4::DateObject *d = value.asDateObject()) {
+ *reinterpret_cast<QDate *>(data) = d->toQDateTime().date();
+ return true;
+ } break;
+ case QMetaType::QRegExp:
+ if (QV4::RegExpObject *r = value.as<QV4::RegExpObject>()) {
+ *reinterpret_cast<QRegExp *>(data) = r->toQRegExp();
+ return true;
+ } break;
+ case QMetaType::QObjectStar: {
+ QV4::QObjectWrapper *qobjectWrapper = value.as<QV4::QObjectWrapper>();
+ if (qobjectWrapper || value.isNull()) {
+ *reinterpret_cast<QObject* *>(data) = qtObjectFromJS(scope.engine, value);
+ return true;
+ } break;
+ }
+ case QMetaType::QStringList: {
+ QV4::ScopedArrayObject a(scope, value);
+ if (a) {
+ *reinterpret_cast<QStringList *>(data) = a->toQStringList();
+ return true;
+ }
+ break;
+ }
+ case QMetaType::QVariantList: {
+ QV4::ScopedArrayObject a(scope, value);
+ if (a) {
+ *reinterpret_cast<QVariantList *>(data) = scope.engine->toVariant(a, /*typeHint*/-1, /*createJSValueForObjects*/false).toList();
+ return true;
+ }
+ break;
+ }
+ case QMetaType::QVariantMap: {
+ QV4::ScopedObject o(scope, value);
+ if (o) {
+ *reinterpret_cast<QVariantMap *>(data) = variantMapFromJS(o);
+ return true;
+ }
+ break;
+ }
+ case QMetaType::QVariant:
+ *reinterpret_cast<QVariant*>(data) = scope.engine->toVariant(value, /*typeHint*/-1, /*createJSValueForObjects*/false);
+ return true;
+ case QMetaType::QJsonValue:
+ *reinterpret_cast<QJsonValue *>(data) = QV4::JsonObject::toJsonValue(value);
+ return true;
+ case QMetaType::QJsonObject: {
+ QV4::ScopedObject o(scope, value);
+ *reinterpret_cast<QJsonObject *>(data) = QV4::JsonObject::toJsonObject(o);
+ return true;
+ }
+ case QMetaType::QJsonArray: {
+ QV4::ScopedArrayObject a(scope, value);
+ if (a) {
+ *reinterpret_cast<QJsonArray *>(data) = QV4::JsonObject::toJsonArray(a);
+ return true;
+ }
+ break;
+ }
+ default:
+ ;
+ }
+
+ {
+ QV4::Scoped<QV4::QQmlValueTypeWrapper> vtw(scope, value);
+ if (vtw && vtw->typeId() == type) {
+ return vtw->toGadget(data);
+ }
+ }
+
+#if 0
+ if (isQtVariant(value)) {
+ const QVariant &var = variantValue(value);
+ // ### Enable once constructInPlace() is in qt master.
+ if (var.userType() == type) {
+ QMetaType::constructInPlace(type, data, var.constData());
+ return true;
+ }
+ if (var.canConvert(type)) {
+ QVariant vv = var;
+ vv.convert(type);
+ Q_ASSERT(vv.userType() == type);
+ QMetaType::constructInPlace(type, data, vv.constData());
+ return true;
+ }
+
+ }
+#endif
+
+ // Try to use magic; for compatibility with qscriptvalue_cast.
+
+ QByteArray name = QMetaType::typeName(type);
+ if (convertToNativeQObject(this, value, name, reinterpret_cast<void* *>(data)))
+ return true;
+ if (value.as<QV4::VariantObject>() && name.endsWith('*')) {
+ int valueType = QMetaType::type(name.left(name.size()-1));
+ QVariant &var = value.as<QV4::VariantObject>()->d()->data;
+ if (valueType == var.userType()) {
+ // We have T t, T* is requested, so return &t.
+ *reinterpret_cast<void* *>(data) = var.data();
+ return true;
+ } else if (value.isObject()) {
+ // Look in the prototype chain.
+ QV4::ScopedObject proto(scope, value.objectValue()->prototype());
+ while (proto) {
+ bool canCast = false;
+ if (QV4::VariantObject *vo = proto->as<QV4::VariantObject>()) {
+ const QVariant &v = vo->d()->data;
+ canCast = (type == v.userType()) || (valueType && (valueType == v.userType()));
+ }
+ else if (proto->as<QV4::QObjectWrapper>()) {
+ QByteArray className = name.left(name.size()-1);
+ QV4::ScopedObject p(scope, proto.getPointer());
+ if (QObject *qobject = qtObjectFromJS(scope.engine, p))
+ canCast = qobject->qt_metacast(className) != 0;
+ }
+ if (canCast) {
+ QByteArray varTypeName = QMetaType::typeName(var.userType());
+ if (varTypeName.endsWith('*'))
+ *reinterpret_cast<void* *>(data) = *reinterpret_cast<void* *>(var.data());
+ else
+ *reinterpret_cast<void* *>(data) = var.data();
+ return true;
+ }
+ proto = proto->prototype();
+ }
+ }
+ } else if (value.isNull() && name.endsWith('*')) {
+ *reinterpret_cast<void* *>(data) = 0;
+ return true;
+ } else if (type == qMetaTypeId<QJSValue>()) {
+ *reinterpret_cast<QJSValue*>(data) = QJSValue(this, value.asReturnedValue());
+ return true;
+ }
+
+ return false;
+}
+
+static bool convertToNativeQObject(QV4::ExecutionEngine *e, const Value &value, const QByteArray &targetType, void **result)
+{
+ if (!targetType.endsWith('*'))
+ return false;
+ if (QObject *qobject = qtObjectFromJS(e, value)) {
+ int start = targetType.startsWith("const ") ? 6 : 0;
+ QByteArray className = targetType.mid(start, targetType.size()-start-1);
+ if (void *instance = qobject->qt_metacast(className)) {
+ *result = instance;
+ return true;
+ }
+ }
+ return false;
+}
+
+static QObject *qtObjectFromJS(QV4::ExecutionEngine *engine, const Value &value)
+{
+ if (!value.isObject())
+ return 0;
+
+ QV4::Scope scope(engine);
+ QV4::Scoped<QV4::VariantObject> v(scope, value);
+
+ if (v) {
+ QVariant variant = v->d()->data;
+ int type = variant.userType();
+ if (type == QMetaType::QObjectStar)
+ return *reinterpret_cast<QObject* const *>(variant.constData());
+ }
+ QV4::Scoped<QV4::QObjectWrapper> wrapper(scope, value);
+ if (!wrapper)
+ return 0;
+ return wrapper->object();
+}
+
+
QT_END_NAMESPACE
diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h
index a4a40c2f41..c0c88abaa5 100644
--- a/src/qml/jsruntime/qv4engine_p.h
+++ b/src/qml/jsruntime/qv4engine_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -35,8 +35,8 @@
#include "qv4global_p.h"
#include "private/qv4isel_p.h"
-#include "qv4util_p.h"
-#include "qv4property_p.h"
+#include "qv4managed_p.h"
+#include "qv4context_p.h"
#include <private/qintrusivelist_p.h>
namespace WTF {
@@ -48,6 +48,8 @@ QT_BEGIN_NAMESPACE
class QV8Engine;
class QQmlError;
+class QJSEngine;
+class QQmlEngine;
namespace QV4 {
namespace Debugging {
@@ -59,61 +61,11 @@ class Profiler;
namespace CompiledData {
struct CompilationUnit;
}
-}
-
-namespace QV4 {
-
-struct Function;
-struct Object;
-struct BooleanObject;
-struct NumberObject;
-struct StringObject;
-struct ArrayObject;
-struct DateObject;
-struct FunctionObject;
-struct BoundFunction;
-struct RegExpObject;
-struct ErrorObject;
-struct SyntaxErrorObject;
-struct ArgumentsObject;
-struct ExecutionContext;
-struct ExecutionEngine;
-struct Members;
-class MemoryManager;
-class ExecutableAllocator;
-
-struct ObjectPrototype;
-struct StringPrototype;
-struct NumberPrototype;
-struct BooleanPrototype;
-struct ArrayPrototype;
-struct FunctionPrototype;
-struct DatePrototype;
-struct RegExpPrototype;
-struct ErrorPrototype;
-struct EvalErrorPrototype;
-struct RangeErrorPrototype;
-struct ReferenceErrorPrototype;
-struct SyntaxErrorPrototype;
-struct TypeErrorPrototype;
-struct URIErrorPrototype;
-struct VariantPrototype;
-struct SequencePrototype;
-struct EvalFunction;
-struct IdentifierTable;
-struct InternalClass;
-struct InternalClassPool;
-class MultiplyWrappedQObjectMap;
-struct RegExp;
-class RegExpCache;
-struct QmlExtensions;
-struct Exception;
-struct ExecutionContextSaver;
#define CHECK_STACK_LIMITS(v4) \
if ((v4->jsStackTop <= v4->jsStackLimit) && (reinterpret_cast<quintptr>(&v4) >= v4->cStackLimit || v4->recheckCStackLimits())) {} \
else \
- return v4->currentContext()->throwRangeError(QStringLiteral("Maximum call stack size exceeded."))
+ return v4->throwRangeError(QStringLiteral("Maximum call stack size exceeded."))
struct Q_QML_EXPORT ExecutionEngine
@@ -121,13 +73,15 @@ struct Q_QML_EXPORT ExecutionEngine
private:
friend struct ExecutionContextSaver;
friend struct ExecutionContext;
- ExecutionContext *current;
+ friend struct Heap::ExecutionContext;
public:
- ExecutionContext *currentContext() const { return current; }
+ Heap::ExecutionContext *current;
+ Heap::ExecutionContext *currentContext() const { return current; }
Value *jsStackTop;
quint32 hasException;
- GlobalContext *rootContext;
+ Heap::GlobalContext *m_rootContext;
+ Heap::GlobalContext *rootContext() const { return m_rootContext; }
MemoryManager *memoryManager;
ExecutableAllocator *executableAllocator;
@@ -144,22 +98,13 @@ public:
WTF::PageAllocation *jsStack;
Value *jsStackBase;
- Value *stackPush(uint nValues) {
- Value *ptr = jsStackTop;
- jsStackTop = ptr + nValues;
- return ptr;
- }
- void stackPop(uint nValues) {
- jsStackTop -= nValues;
- }
-
- void pushForGC(Managed *m) {
- *jsStackTop = Value::fromManaged(m);
+ void pushForGC(Heap::Base *m) {
+ *jsStackTop = m;
++jsStackTop;
}
- Managed *popForGC() {
+ Heap::Base *popForGC() {
--jsStackTop;
- return jsStackTop->managed();
+ return jsStackTop->heapObject();
}
IdentifierTable *identifierTable;
@@ -167,10 +112,13 @@ public:
QV4::Debugging::Debugger *debugger;
QV4::Profiling::Profiler *profiler;
- Object *globalObject;
+ Value m_globalObject;
+ Object *globalObject() { return reinterpret_cast<Object *>(&m_globalObject); }
Function *globalCode;
+ QJSEngine *jsEngine() const;
+ QQmlEngine *qmlEngine() const;
QV8Engine *v8Engine;
Value objectCtor;
@@ -188,44 +136,49 @@ public:
Value syntaxErrorCtor;
Value typeErrorCtor;
Value uRIErrorCtor;
+ Value arrayBufferCtor;
+ Value dataViewCtor;
+ enum { NTypedArrayTypes = 9 }; // avoid header dependency
+ Value typedArrayCtors[NTypedArrayTypes];
+
+ Value objectPrototype;
+ Value arrayPrototype;
+ Value stringPrototype;
+ Value numberPrototype;
+ Value booleanPrototype;
+ Value datePrototype;
+ Value functionPrototype;
+ Value regExpPrototype;
+ Value errorPrototype;
+ Value evalErrorPrototype;
+ Value rangeErrorPrototype;
+ Value referenceErrorPrototype;
+ Value syntaxErrorPrototype;
+ Value typeErrorPrototype;
+ Value uRIErrorPrototype;
+ Value variantPrototype;
Value sequencePrototype;
+ Value arrayBufferPrototype;
+ Value dataViewPrototype;
+ Value typedArrayPrototype[NTypedArrayTypes]; // TypedArray::NValues, avoid including the header here
+
InternalClassPool *classPool;
InternalClass *emptyClass;
- InternalClass *executionContextClass;
- InternalClass *constructClass;
- InternalClass *stringClass;
- InternalClass *objectClass;
InternalClass *arrayClass;
- InternalClass *simpleArrayDataClass;
- InternalClass *stringObjectClass;
- InternalClass *booleanClass;
- InternalClass *numberClass;
- InternalClass *dateClass;
InternalClass *functionClass;
+ InternalClass *simpleScriptFunctionClass;
InternalClass *protoClass;
- InternalClass *regExpClass;
InternalClass *regExpExecArrayClass;
- InternalClass *regExpValueClass;
-
- InternalClass *errorClass;
- InternalClass *evalErrorClass;
- InternalClass *rangeErrorClass;
- InternalClass *referenceErrorClass;
- InternalClass *syntaxErrorClass;
- InternalClass *typeErrorClass;
- InternalClass *uriErrorClass;
+
InternalClass *argumentsObjectClass;
InternalClass *strictArgumentsObjectClass;
- InternalClass *variantClass;
- InternalClass *memberDataClass;
-
- EvalFunction *evalFunction;
- FunctionObject *thrower;
+ Heap::EvalFunction *evalFunction;
+ Heap::FunctionObject *thrower;
Property *argumentsAccessors;
int nArgumentsAccessors;
@@ -262,6 +215,10 @@ public:
StringValue id_toString;
StringValue id_destroy;
StringValue id_valueOf;
+ StringValue id_byteLength;
+ StringValue id_byteOffset;
+ StringValue id_buffer;
+ StringValue id_lastIndex;
QSet<CompiledData::CompilationUnit*> compilationUnits;
@@ -294,45 +251,47 @@ public:
void enableDebugger();
void enableProfiler();
- ExecutionContext *pushGlobalContext();
+ Heap::ExecutionContext *pushGlobalContext();
void pushContext(CallContext *context);
- ExecutionContext *popContext();
+ Heap::ExecutionContext *popContext();
+
+ Heap::Object *newObject();
+ Heap::Object *newObject(InternalClass *internalClass, Object *prototype);
- Returned<Object> *newObject();
- Returned<Object> *newObject(InternalClass *internalClass);
+ Heap::String *newString(const QString &s = QString());
+ Heap::String *newIdentifier(const QString &text);
- Returned<String> *newString(const QString &s);
- String *newIdentifier(const QString &text);
+ Heap::Object *newStringObject(const Value &value);
+ Heap::Object *newNumberObject(double value);
+ Heap::Object *newBooleanObject(bool b);
- Returned<Object> *newStringObject(const ValueRef value);
- Returned<Object> *newNumberObject(const ValueRef value);
- Returned<Object> *newBooleanObject(const ValueRef value);
+ Heap::ArrayObject *newArrayObject(int count = 0);
+ Heap::ArrayObject *newArrayObject(const QStringList &list);
+ Heap::ArrayObject *newArrayObject(InternalClass *ic, Object *prototype);
- Returned<ArrayObject> *newArrayObject(int count = 0);
- Returned<ArrayObject> *newArrayObject(const QStringList &list);
- Returned<ArrayObject> *newArrayObject(InternalClass *ic);
+ Heap::ArrayBuffer *newArrayBuffer(const QByteArray &array);
- Returned<DateObject> *newDateObject(const ValueRef value);
- Returned<DateObject> *newDateObject(const QDateTime &dt);
+ Heap::DateObject *newDateObject(const Value &value);
+ Heap::DateObject *newDateObject(const QDateTime &dt);
- Returned<RegExpObject> *newRegExpObject(const QString &pattern, int flags);
- Returned<RegExpObject> *newRegExpObject(RegExp *re, bool global);
- Returned<RegExpObject> *newRegExpObject(const QRegExp &re);
+ Heap::RegExpObject *newRegExpObject(const QString &pattern, int flags);
+ Heap::RegExpObject *newRegExpObject(RegExp *re, bool global);
+ Heap::RegExpObject *newRegExpObject(const QRegExp &re);
- Returned<Object> *newErrorObject(const ValueRef value);
- Returned<Object> *newSyntaxErrorObject(const QString &message, const QString &fileName, int line, int column);
- Returned<Object> *newSyntaxErrorObject(const QString &message);
- Returned<Object> *newReferenceErrorObject(const QString &message);
- Returned<Object> *newReferenceErrorObject(const QString &message, const QString &fileName, int lineNumber, int columnNumber);
- Returned<Object> *newTypeErrorObject(const QString &message);
- Returned<Object> *newRangeErrorObject(const QString &message);
- Returned<Object> *newURIErrorObject(const ValueRef message);
+ Heap::Object *newErrorObject(const Value &value);
+ Heap::Object *newSyntaxErrorObject(const QString &message, const QString &fileName, int line, int column);
+ Heap::Object *newSyntaxErrorObject(const QString &message);
+ Heap::Object *newReferenceErrorObject(const QString &message);
+ Heap::Object *newReferenceErrorObject(const QString &message, const QString &fileName, int lineNumber, int columnNumber);
+ Heap::Object *newTypeErrorObject(const QString &message);
+ Heap::Object *newRangeErrorObject(const QString &message);
+ Heap::Object *newURIErrorObject(const Value &message);
- Returned<Object> *newVariantObject(const QVariant &v);
+ Heap::Object *newVariantObject(const QVariant &v);
- Returned<Object> *newForEachIteratorObject(ExecutionContext *ctx, Object *o);
+ Heap::Object *newForEachIteratorObject(Object *o);
- Returned<Object> *qmlContextObject() const;
+ Heap::Object *qmlContextObject() const;
StackTrace stackTrace(int frameLimit = -1) const;
StackFrame currentStackFrame() const;
@@ -354,23 +313,91 @@ public:
Value exceptionValue;
StackTrace exceptionStackTrace;
- ReturnedValue throwException(const ValueRef value);
- ReturnedValue catchException(ExecutionContext *catchingContext, StackTrace *trace);
+ ReturnedValue throwError(const Value &value);
+ ReturnedValue catchException(StackTrace *trace = 0);
+
+ ReturnedValue throwError(const QString &message);
+ ReturnedValue throwSyntaxError(const QString &message);
+ ReturnedValue throwSyntaxError(const QString &message, const QString &fileName, int lineNumber, int column);
+ ReturnedValue throwTypeError();
+ ReturnedValue throwTypeError(const QString &message);
+ ReturnedValue throwReferenceError(const Value &value);
+ ReturnedValue throwReferenceError(const QString &value, const QString &fileName, int lineNumber, int column);
+ ReturnedValue throwRangeError(const Value &value);
+ ReturnedValue throwRangeError(const QString &message);
+ ReturnedValue throwURIError(const Value &msg);
+ ReturnedValue throwUnimplemented(const QString &message);
// Use only inside catch(...) -- will re-throw if no JS exception
- static QQmlError catchExceptionAsQmlError(QV4::ExecutionContext *context);
+ QQmlError catchExceptionAsQmlError();
+
+ // variant conversions
+ QVariant toVariant(const QV4::Value &value, int typeHint, bool createJSValueForObjects = true);
+ QV4::ReturnedValue fromVariant(const QVariant &);
+
+ QVariantMap variantMapFromJS(QV4::Object *o);
+
+ bool metaTypeFromJS(const Value &value, int type, void *data);
+ QV4::ReturnedValue metaTypeToJS(int type, const void *data);
+
+ void assertObjectBelongsToEngine(const Value &v);
private:
QmlExtensions *m_qmlExtensions;
};
+inline void ExecutionEngine::pushContext(CallContext *context)
+{
+ Q_ASSERT(current && context && context->d());
+ context->d()->parent = current;
+ current = context->d();
+}
+
+inline Heap::ExecutionContext *ExecutionEngine::popContext()
+{
+ Q_ASSERT(current->parent);
+ current = current->parent;
+ Q_ASSERT(current);
+ return current;
+}
+
+inline
+Heap::ExecutionContext::ExecutionContext(ExecutionEngine *engine, ContextType t)
+ : engine(engine)
+ , parent(engine->currentContext())
+ , outer(0)
+ , lookups(0)
+ , compilationUnit(0)
+ , type(t)
+ , strictMode(false)
+ , lineNumber(-1)
+{
+ engine->current = this;
+}
+
+
+// ### Remove me
inline
void Managed::mark(QV4::ExecutionEngine *engine)
{
Q_ASSERT(inUse());
if (markBit())
return;
- d()->markBit = 1;
+#ifndef QT_NO_DEBUG
+ engine->assertObjectBelongsToEngine(*this);
+#endif
+ d()->setMarkBit();
+ engine->pushForGC(d());
+}
+
+
+inline
+void Heap::Base::mark(QV4::ExecutionEngine *engine)
+{
+ Q_ASSERT(inUse());
+ if (isMarked())
+ return;
+ setMarkBit();
engine->pushForGC(this);
}
diff --git a/src/qml/jsruntime/qv4errorobject.cpp b/src/qml/jsruntime/qv4errorobject.cpp
index d87083275d..9034dee6a0 100644
--- a/src/qml/jsruntime/qv4errorobject.cpp
+++ b/src/qml/jsruntime/qv4errorobject.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -34,14 +34,9 @@
#include "qv4errorobject_p.h"
#include "qv4mm_p.h"
-#include <QtCore/qnumeric.h>
-#include <QtCore/qmath.h>
#include <QtCore/QDateTime>
#include <QtCore/QStringList>
#include <QtCore/QDebug>
-#include <cmath>
-#include <qmath.h>
-#include <qnumeric.h>
#include <private/qqmljsengine_p.h>
#include <private/qqmljslexer_p.h>
@@ -63,27 +58,28 @@
using namespace QV4;
-ErrorObject::Data::Data(InternalClass *ic)
- : Object::Data(ic)
+Heap::ErrorObject::ErrorObject(InternalClass *ic, QV4::Object *prototype)
+ : Heap::Object(ic, prototype)
+ , stack(Q_NULLPTR)
{
Scope scope(ic->engine);
- Scoped<ErrorObject> e(scope, this);
+ Scoped<QV4::ErrorObject> e(scope, this);
ScopedString s(scope, scope.engine->newString(QStringLiteral("Error")));
e->defineDefaultProperty(QStringLiteral("name"), s);
}
-ErrorObject::Data::Data(InternalClass *ic, const ValueRef message, ErrorType t)
- : Object::Data(ic)
+Heap::ErrorObject::ErrorObject(InternalClass *ic, QV4::Object *prototype, const Value &message, ErrorType t)
+ : Heap::Object(ic, prototype)
{
- subtype = t;
+ errorType = t;
Scope scope(ic->engine);
- Scoped<ErrorObject> e(scope, this);
+ Scoped<QV4::ErrorObject> e(scope, this);
- e->defineAccessorProperty(QStringLiteral("stack"), ErrorObject::method_get_stack, 0);
+ e->defineAccessorProperty(QStringLiteral("stack"), QV4::ErrorObject::method_get_stack, 0);
- if (!message->isUndefined())
+ if (!message.isUndefined())
e->defineDefaultProperty(QStringLiteral("message"), message);
ScopedString s(scope);
e->defineDefaultProperty(QStringLiteral("name"), (s = scope.engine->newString(e->className())));
@@ -95,16 +91,16 @@ ErrorObject::Data::Data(InternalClass *ic, const ValueRef message, ErrorType t)
}
}
-ErrorObject::Data::Data(InternalClass *ic, const QString &message, ErrorObject::ErrorType t)
- : Object::Data(ic)
+Heap::ErrorObject::ErrorObject(InternalClass *ic, QV4::Object *prototype, const QString &message, ErrorObject::ErrorType t)
+ : Heap::Object(ic, prototype)
{
- subtype = t;
+ errorType = t;
Scope scope(ic->engine);
- Scoped<ErrorObject> e(scope, this);
+ Scoped<QV4::ErrorObject> e(scope, this);
ScopedString s(scope);
- e->defineAccessorProperty(QStringLiteral("stack"), ErrorObject::method_get_stack, 0);
+ e->defineAccessorProperty(QStringLiteral("stack"), QV4::ErrorObject::method_get_stack, 0);
ScopedValue v(scope, scope.engine->newString(message));
e->defineDefaultProperty(QStringLiteral("message"), v);
@@ -117,16 +113,16 @@ ErrorObject::Data::Data(InternalClass *ic, const QString &message, ErrorObject::
}
}
-ErrorObject::Data::Data(InternalClass *ic, const QString &message, const QString &fileName, int line, int column, ErrorObject::ErrorType t)
- : Object::Data(ic)
+Heap::ErrorObject::ErrorObject(InternalClass *ic, QV4::Object *prototype, const QString &message, const QString &fileName, int line, int column, ErrorObject::ErrorType t)
+ : Heap::Object(ic, prototype)
{
- subtype = t;
+ errorType = t;
Scope scope(ic->engine);
- Scoped<ErrorObject> e(scope, this);
+ Scoped<QV4::ErrorObject> e(scope, this);
ScopedString s(scope);
- e->defineAccessorProperty(QStringLiteral("stack"), ErrorObject::method_get_stack, 0);
+ e->defineAccessorProperty(QStringLiteral("stack"), QV4::ErrorObject::method_get_stack, 0);
e->defineDefaultProperty(QStringLiteral("name"), (s = scope.engine->newString(e->className())));
e->d()->stackTrace = scope.engine->stackTrace();
@@ -148,9 +144,9 @@ ErrorObject::Data::Data(InternalClass *ic, const QString &message, const QString
ReturnedValue ErrorObject::method_get_stack(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<ErrorObject> This(scope, ctx->d()->callData->thisObject);
+ Scoped<ErrorObject> This(scope, ctx->thisObject());
if (!This)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
if (!This->d()->stack) {
QString trace;
for (int i = 0; i < This->d()->stackTrace.count(); ++i) {
@@ -165,16 +161,16 @@ ReturnedValue ErrorObject::method_get_stack(CallContext *ctx)
trace += QString::number(frame.line);
}
}
- This->d()->stack = ctx->d()->engine->newString(trace)->getPointer();
+ This->d()->stack = ctx->d()->engine->newString(trace);
}
return This->d()->stack->asReturnedValue();
}
-void ErrorObject::markObjects(Managed *that, ExecutionEngine *e)
+void ErrorObject::markObjects(Heap::Base *that, ExecutionEngine *e)
{
- ErrorObject *This = that->asErrorObject();
- if (This->d()->stack)
- This->d()->stack->mark(e);
+ ErrorObject::Data *This = static_cast<ErrorObject::Data *>(that);
+ if (This->stack)
+ This->stack->mark(e);
Object::markObjects(that, e);
}
@@ -182,58 +178,58 @@ DEFINE_OBJECT_VTABLE(ErrorObject);
DEFINE_OBJECT_VTABLE(SyntaxErrorObject);
-SyntaxErrorObject::Data::Data(ExecutionEngine *engine, const ValueRef msg)
- : ErrorObject::Data(engine->syntaxErrorClass, msg, SyntaxError)
+Heap::SyntaxErrorObject::SyntaxErrorObject(ExecutionEngine *engine, const Value &msg)
+ : Heap::ErrorObject(engine->emptyClass, engine->syntaxErrorPrototype.asObject(), msg, SyntaxError)
{
}
-SyntaxErrorObject::Data::Data(ExecutionEngine *engine, const QString &msg, const QString &fileName, int lineNumber, int columnNumber)
- : ErrorObject::Data(engine->syntaxErrorClass, msg, fileName, lineNumber, columnNumber, SyntaxError)
+Heap::SyntaxErrorObject::SyntaxErrorObject(ExecutionEngine *engine, const QString &msg, const QString &fileName, int lineNumber, int columnNumber)
+ : Heap::ErrorObject(engine->emptyClass, engine->syntaxErrorPrototype.asObject(), msg, fileName, lineNumber, columnNumber, SyntaxError)
{
}
-EvalErrorObject::Data::Data(ExecutionEngine *engine, const ValueRef message)
- : ErrorObject::Data(engine->evalErrorClass, message, EvalError)
+Heap::EvalErrorObject::EvalErrorObject(ExecutionEngine *engine, const Value &message)
+ : Heap::ErrorObject(engine->emptyClass, engine->evalErrorPrototype.asObject(), message, EvalError)
{
}
-RangeErrorObject::Data::Data(ExecutionEngine *engine, const ValueRef message)
- : ErrorObject::Data(engine->rangeErrorClass, message, RangeError)
+Heap::RangeErrorObject::RangeErrorObject(ExecutionEngine *engine, const Value &message)
+ : Heap::ErrorObject(engine->emptyClass, engine->rangeErrorPrototype.asObject(), message, RangeError)
{
}
-RangeErrorObject::Data::Data(ExecutionEngine *engine, const QString &message)
- : ErrorObject::Data(engine->rangeErrorClass, message, RangeError)
+Heap::RangeErrorObject::RangeErrorObject(ExecutionEngine *engine, const QString &message)
+ : Heap::ErrorObject(engine->emptyClass, engine->rangeErrorPrototype.asObject(), message, RangeError)
{
}
-ReferenceErrorObject::Data::Data(ExecutionEngine *engine, const ValueRef message)
- : ErrorObject::Data(engine->referenceErrorClass, message, ReferenceError)
+Heap::ReferenceErrorObject::ReferenceErrorObject(ExecutionEngine *engine, const Value &message)
+ : Heap::ErrorObject(engine->emptyClass, engine->referenceErrorPrototype.asObject(), message, ReferenceError)
{
}
-ReferenceErrorObject::Data::Data(ExecutionEngine *engine, const QString &message)
- : ErrorObject::Data(engine->referenceErrorClass, message, ReferenceError)
+Heap::ReferenceErrorObject::ReferenceErrorObject(ExecutionEngine *engine, const QString &message)
+ : Heap::ErrorObject(engine->emptyClass, engine->referenceErrorPrototype.asObject(), message, ReferenceError)
{
}
-ReferenceErrorObject::Data::Data(ExecutionEngine *engine, const QString &msg, const QString &fileName, int lineNumber, int columnNumber)
- : ErrorObject::Data(engine->referenceErrorClass, msg, fileName, lineNumber, columnNumber, ReferenceError)
+Heap::ReferenceErrorObject::ReferenceErrorObject(ExecutionEngine *engine, const QString &msg, const QString &fileName, int lineNumber, int columnNumber)
+ : Heap::ErrorObject(engine->emptyClass, engine->referenceErrorPrototype.asObject(), msg, fileName, lineNumber, columnNumber, ReferenceError)
{
}
-TypeErrorObject::Data::Data(ExecutionEngine *engine, const ValueRef message)
- : ErrorObject::Data(engine->typeErrorClass, message, TypeError)
+Heap::TypeErrorObject::TypeErrorObject(ExecutionEngine *engine, const Value &message)
+ : Heap::ErrorObject(engine->emptyClass, engine->typeErrorPrototype.asObject(), message, TypeError)
{
}
-TypeErrorObject::Data::Data(ExecutionEngine *engine, const QString &message)
- : ErrorObject::Data(engine->typeErrorClass, message, TypeError)
+Heap::TypeErrorObject::TypeErrorObject(ExecutionEngine *engine, const QString &message)
+ : Heap::ErrorObject(engine->emptyClass, engine->typeErrorPrototype.asObject(), message, TypeError)
{
}
-URIErrorObject::Data::Data(ExecutionEngine *engine, const ValueRef message)
- : ErrorObject::Data(engine->uriErrorClass, message, URIError)
+Heap::URIErrorObject::URIErrorObject(ExecutionEngine *engine, const Value &message)
+ : Heap::ErrorObject(engine->emptyClass, engine->uRIErrorPrototype.asObject(), message, URIError)
{
}
@@ -245,23 +241,21 @@ DEFINE_OBJECT_VTABLE(SyntaxErrorCtor);
DEFINE_OBJECT_VTABLE(TypeErrorCtor);
DEFINE_OBJECT_VTABLE(URIErrorCtor);
-ErrorCtor::Data::Data(ExecutionContext *scope)
- : FunctionObject::Data(scope, QStringLiteral("Error"))
+Heap::ErrorCtor::ErrorCtor(QV4::ExecutionContext *scope)
+ : Heap::FunctionObject(scope, QStringLiteral("Error"))
{
- setVTable(staticVTable());
}
-ErrorCtor::Data::Data(ExecutionContext *scope, const QString &name)
- : FunctionObject::Data(scope, name)
+Heap::ErrorCtor::ErrorCtor(QV4::ExecutionContext *scope, const QString &name)
+ : Heap::FunctionObject(scope, name)
{
- setVTable(staticVTable());
}
ReturnedValue ErrorCtor::construct(Managed *m, CallData *callData)
{
- Scope scope(m->engine());
+ Scope scope(static_cast<ErrorCtor *>(m)->engine());
ScopedValue v(scope, callData->argument(0));
- return Encode(m->engine()->newErrorObject(v));
+ return Encode(scope.engine->newErrorObject(v));
}
ReturnedValue ErrorCtor::call(Managed *that, CallData *callData)
@@ -269,82 +263,76 @@ ReturnedValue ErrorCtor::call(Managed *that, CallData *callData)
return static_cast<Object *>(that)->construct(callData);
}
-EvalErrorCtor::Data::Data(ExecutionContext *scope)
- : ErrorCtor::Data(scope, QStringLiteral("EvalError"))
+Heap::EvalErrorCtor::EvalErrorCtor(QV4::ExecutionContext *scope)
+ : Heap::ErrorCtor(scope, QStringLiteral("EvalError"))
{
- setVTable(staticVTable());
}
ReturnedValue EvalErrorCtor::construct(Managed *m, CallData *callData)
{
- Scope scope(m->engine());
+ Scope scope(static_cast<EvalErrorCtor *>(m)->engine());
ScopedValue v(scope, callData->argument(0));
- return (m->engine()->memoryManager->alloc<EvalErrorObject>(m->engine(), v))->asReturnedValue();
+ return (scope.engine->memoryManager->alloc<EvalErrorObject>(scope.engine, v))->asReturnedValue();
}
-RangeErrorCtor::Data::Data(ExecutionContext *scope)
- : ErrorCtor::Data(scope, QStringLiteral("RangeError"))
+Heap::RangeErrorCtor::RangeErrorCtor(QV4::ExecutionContext *scope)
+ : Heap::ErrorCtor(scope, QStringLiteral("RangeError"))
{
- setVTable(staticVTable());
}
ReturnedValue RangeErrorCtor::construct(Managed *m, CallData *callData)
{
- Scope scope(m->engine());
+ Scope scope(static_cast<RangeErrorCtor *>(m)->engine());
ScopedValue v(scope, callData->argument(0));
- return (m->engine()->memoryManager->alloc<RangeErrorObject>(scope.engine, v))->asReturnedValue();
+ return (scope.engine->memoryManager->alloc<RangeErrorObject>(scope.engine, v))->asReturnedValue();
}
-ReferenceErrorCtor::Data::Data(ExecutionContext *scope)
- : ErrorCtor::Data(scope, QStringLiteral("ReferenceError"))
+Heap::ReferenceErrorCtor::ReferenceErrorCtor(QV4::ExecutionContext *scope)
+ : Heap::ErrorCtor(scope, QStringLiteral("ReferenceError"))
{
- setVTable(staticVTable());
}
ReturnedValue ReferenceErrorCtor::construct(Managed *m, CallData *callData)
{
- Scope scope(m->engine());
+ Scope scope(static_cast<ReferenceErrorCtor *>(m)->engine());
ScopedValue v(scope, callData->argument(0));
- return (m->engine()->memoryManager->alloc<ReferenceErrorObject>(scope.engine, v))->asReturnedValue();
+ return (scope.engine->memoryManager->alloc<ReferenceErrorObject>(scope.engine, v))->asReturnedValue();
}
-SyntaxErrorCtor::Data::Data(ExecutionContext *scope)
- : ErrorCtor::Data(scope, QStringLiteral("SyntaxError"))
+Heap::SyntaxErrorCtor::SyntaxErrorCtor(QV4::ExecutionContext *scope)
+ : Heap::ErrorCtor(scope, QStringLiteral("SyntaxError"))
{
- setVTable(staticVTable());
}
ReturnedValue SyntaxErrorCtor::construct(Managed *m, CallData *callData)
{
- Scope scope(m->engine());
+ Scope scope(static_cast<SyntaxErrorCtor *>(m)->engine());
ScopedValue v(scope, callData->argument(0));
- return (m->engine()->memoryManager->alloc<SyntaxErrorObject>(scope.engine, v))->asReturnedValue();
+ return (scope.engine->memoryManager->alloc<SyntaxErrorObject>(scope.engine, v))->asReturnedValue();
}
-TypeErrorCtor::Data::Data(ExecutionContext *scope)
- : ErrorCtor::Data(scope, QStringLiteral("TypeError"))
+Heap::TypeErrorCtor::TypeErrorCtor(QV4::ExecutionContext *scope)
+ : Heap::ErrorCtor(scope, QStringLiteral("TypeError"))
{
- setVTable(staticVTable());
}
ReturnedValue TypeErrorCtor::construct(Managed *m, CallData *callData)
{
- Scope scope(m->engine());
+ Scope scope(static_cast<TypeErrorCtor *>(m)->engine());
ScopedValue v(scope, callData->argument(0));
- return (m->engine()->memoryManager->alloc<TypeErrorObject>(scope.engine, v))->asReturnedValue();
+ return (scope.engine->memoryManager->alloc<TypeErrorObject>(scope.engine, v))->asReturnedValue();
}
-URIErrorCtor::Data::Data(ExecutionContext *scope)
- : ErrorCtor::Data(scope, QStringLiteral("URIError"))
+Heap::URIErrorCtor::URIErrorCtor(QV4::ExecutionContext *scope)
+ : Heap::ErrorCtor(scope, QStringLiteral("URIError"))
{
- setVTable(staticVTable());
}
ReturnedValue URIErrorCtor::construct(Managed *m, CallData *callData)
{
- Scope scope(m->engine());
+ Scope scope(static_cast<URIErrorCtor *>(m)->engine());
ScopedValue v(scope, callData->argument(0));
- return (m->engine()->memoryManager->alloc<URIErrorObject>(scope.engine, v))->asReturnedValue();
+ return (scope.engine->memoryManager->alloc<URIErrorObject>(scope.engine, v))->asReturnedValue();
}
void ErrorPrototype::init(ExecutionEngine *engine, Object *ctor, Object *obj)
@@ -356,16 +344,16 @@ void ErrorPrototype::init(ExecutionEngine *engine, Object *ctor, Object *obj)
ctor->defineReadonlyProperty(engine->id_length, Primitive::fromInt32(1));
obj->defineDefaultProperty(QStringLiteral("constructor"), (o = ctor));
obj->defineDefaultProperty(engine->id_toString, method_toString, 0);
- obj->defineDefaultProperty(QStringLiteral("message"), (s = engine->newString(QString())));
+ obj->defineDefaultProperty(QStringLiteral("message"), (s = engine->newString()));
}
ReturnedValue ErrorPrototype::method_toString(CallContext *ctx)
{
Scope scope(ctx);
- Object *o = ctx->d()->callData->thisObject.asObject();
+ Object *o = ctx->thisObject().asObject();
if (!o)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
ScopedValue name(scope, o->get(ctx->d()->engine->id_name));
QString qname;
@@ -375,7 +363,7 @@ ReturnedValue ErrorPrototype::method_toString(CallContext *ctx)
qname = name->toQString();
ScopedString s(scope, ctx->d()->engine->newString(QString::fromLatin1("message")));
- ScopedValue message(scope, o->get(s.getPointer()));
+ ScopedValue message(scope, o->get(s));
QString qmessage;
if (!message->isUndefined())
qmessage = message->toQString();
diff --git a/src/qml/jsruntime/qv4errorobject_p.h b/src/qml/jsruntime/qv4errorobject_p.h
index 47442ad985..071f5b8c9a 100644
--- a/src/qml/jsruntime/qv4errorobject_p.h
+++ b/src/qml/jsruntime/qv4errorobject_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -42,11 +42,9 @@ namespace QV4 {
struct SyntaxErrorObject;
-struct ErrorObject: Object {
- enum {
- IsErrorObject = true
- };
+namespace Heap {
+struct ErrorObject : Object {
enum ErrorType {
Error,
EvalError,
@@ -56,22 +54,90 @@ struct ErrorObject: Object {
TypeError,
URIError
};
- struct Data : Object::Data {
- Data(InternalClass *ic);
- Data(InternalClass *ic, const ValueRef message, ErrorType t = Error);
- Data(InternalClass *ic, const QString &message, ErrorType t = Error);
- Data(InternalClass *ic, const QString &message, const QString &fileName, int line, int column, ErrorType t = Error);
- StackTrace stackTrace;
- String *stack;
+
+ ErrorObject(InternalClass *ic, QV4::Object *prototype);
+ ErrorObject(InternalClass *ic, QV4::Object *prototype, const Value &message, ErrorType t = Error);
+ ErrorObject(InternalClass *ic, QV4::Object *prototype, const QString &message, ErrorType t = Error);
+ ErrorObject(InternalClass *ic, QV4::Object *prototype, const QString &message, const QString &fileName, int line, int column, ErrorType t = Error);
+
+ ErrorType errorType;
+ StackTrace stackTrace;
+ String *stack;
+};
+
+struct EvalErrorObject : ErrorObject {
+ EvalErrorObject(ExecutionEngine *engine, const Value &message);
+};
+
+struct RangeErrorObject : ErrorObject {
+ RangeErrorObject(ExecutionEngine *engine, const Value &message);
+ RangeErrorObject(ExecutionEngine *engine, const QString &msg);
+};
+
+struct ReferenceErrorObject : ErrorObject {
+ ReferenceErrorObject(ExecutionEngine *engine, const Value &message);
+ ReferenceErrorObject(ExecutionEngine *engine, const QString &msg);
+ ReferenceErrorObject(ExecutionEngine *engine, const QString &msg, const QString &fileName, int lineNumber, int columnNumber);
+};
+
+struct SyntaxErrorObject : ErrorObject {
+ SyntaxErrorObject(ExecutionEngine *engine, const Value &message);
+ SyntaxErrorObject(ExecutionEngine *engine, const QString &msg, const QString &fileName, int lineNumber, int columnNumber);
+};
+
+struct TypeErrorObject : ErrorObject {
+ TypeErrorObject(ExecutionEngine *engine, const Value &message);
+ TypeErrorObject(ExecutionEngine *engine, const QString &msg);
+};
+
+struct URIErrorObject : ErrorObject {
+ URIErrorObject(ExecutionEngine *engine, const Value &message);
+};
+
+struct ErrorCtor : Heap::FunctionObject {
+ ErrorCtor(QV4::ExecutionContext *scope);
+ ErrorCtor(QV4::ExecutionContext *scope, const QString &name);
+};
+
+struct EvalErrorCtor : ErrorCtor {
+ EvalErrorCtor(QV4::ExecutionContext *scope);
+};
+
+struct RangeErrorCtor : ErrorCtor {
+ RangeErrorCtor(QV4::ExecutionContext *scope);
+};
+
+struct ReferenceErrorCtor : ErrorCtor {
+ ReferenceErrorCtor(QV4::ExecutionContext *scope);
+};
+
+struct SyntaxErrorCtor : ErrorCtor {
+ SyntaxErrorCtor(QV4::ExecutionContext *scope);
+};
+
+struct TypeErrorCtor : ErrorCtor {
+ TypeErrorCtor(QV4::ExecutionContext *scope);
+};
+
+struct URIErrorCtor : ErrorCtor {
+ URIErrorCtor(QV4::ExecutionContext *scope);
+};
+
+}
+
+struct ErrorObject: Object {
+ enum {
+ IsErrorObject = true
};
- V4_OBJECT(Object)
+
+ V4_OBJECT2(ErrorObject, Object)
Q_MANAGED_TYPE(ErrorObject)
+ V4_NEEDS_DESTROY
SyntaxErrorObject *asSyntaxError();
static ReturnedValue method_get_stack(CallContext *ctx);
- static void markObjects(Managed *that, ExecutionEngine *e);
- static void destroy(Managed *that) { static_cast<ErrorObject *>(that)->d()->~Data(); }
+ static void markObjects(Heap::Base *that, ExecutionEngine *e);
};
template<>
@@ -80,55 +146,42 @@ inline ErrorObject *value_cast(const Value &v) {
}
struct EvalErrorObject: ErrorObject {
- struct Data : ErrorObject::Data {
- Data(ExecutionEngine *engine, const ValueRef message);
- };
+ typedef Heap::EvalErrorObject Data;
+ const Data *d() const { return static_cast<const Data *>(ErrorObject::d()); }
+ Data *d() { return static_cast<Data *>(ErrorObject::d()); }
};
struct RangeErrorObject: ErrorObject {
- struct Data : ErrorObject::Data {
- Data(ExecutionEngine *engine, const ValueRef message);
- Data(ExecutionEngine *engine, const QString &msg);
- };
+ typedef Heap::RangeErrorObject Data;
+ const Data *d() const { return static_cast<const Data *>(ErrorObject::d()); }
+ Data *d() { return static_cast<Data *>(ErrorObject::d()); }
};
struct ReferenceErrorObject: ErrorObject {
- struct Data : ErrorObject::Data {
- Data(ExecutionEngine *engine, const ValueRef message);
- Data(ExecutionEngine *engine, const QString &msg);
- Data(ExecutionEngine *engine, const QString &msg, const QString &fileName, int lineNumber, int columnNumber);
- };
+ typedef Heap::ReferenceErrorObject Data;
+ const Data *d() const { return static_cast<const Data *>(ErrorObject::d()); }
+ Data *d() { return static_cast<Data *>(ErrorObject::d()); }
};
struct SyntaxErrorObject: ErrorObject {
- struct Data : ErrorObject::Data {
- Data(ExecutionEngine *engine, const ValueRef message);
- Data(ExecutionEngine *engine, const QString &msg, const QString &fileName, int lineNumber, int columnNumber);
- };
- V4_OBJECT(ErrorObject)
+ V4_OBJECT2(SyntaxErrorObject, ErrorObject)
};
struct TypeErrorObject: ErrorObject {
- struct Data : ErrorObject::Data {
- Data(ExecutionEngine *engine, const ValueRef message);
- Data(ExecutionEngine *engine, const QString &msg);
- };
+ typedef Heap::TypeErrorObject Data;
+ const Data *d() const { return static_cast<const Data *>(ErrorObject::d()); }
+ Data *d() { return static_cast<Data *>(ErrorObject::d()); }
};
struct URIErrorObject: ErrorObject {
- struct Data : ErrorObject::Data {
- Data(ExecutionEngine *engine, const ValueRef message);
- };
+ typedef Heap::URIErrorObject Data;
+ const Data *d() const { return static_cast<const Data *>(ErrorObject::d()); }
+ Data *d() { return static_cast<Data *>(ErrorObject::d()); }
};
struct ErrorCtor: FunctionObject
{
- struct Data : FunctionObject::Data {
- Data(ExecutionContext *scope);
- Data(ExecutionContext *scope, const QString &name);
- };
-
- V4_OBJECT(FunctionObject)
+ V4_OBJECT2(ErrorCtor, FunctionObject)
static ReturnedValue construct(Managed *, CallData *callData);
static ReturnedValue call(Managed *that, CallData *callData);
@@ -136,60 +189,42 @@ struct ErrorCtor: FunctionObject
struct EvalErrorCtor: ErrorCtor
{
- struct Data : ErrorCtor::Data {
- Data(ExecutionContext *scope);
- };
- V4_OBJECT(ErrorCtor)
+ V4_OBJECT2(EvalErrorCtor, ErrorCtor)
static ReturnedValue construct(Managed *m, CallData *callData);
};
struct RangeErrorCtor: ErrorCtor
{
- struct Data : ErrorCtor::Data {
- Data(ExecutionContext *scope);
- };
- V4_OBJECT(ErrorCtor)
+ V4_OBJECT2(RangeErrorCtor, ErrorCtor)
static ReturnedValue construct(Managed *m, CallData *callData);
};
struct ReferenceErrorCtor: ErrorCtor
{
- struct Data : ErrorCtor::Data {
- Data(ExecutionContext *scope);
- };
- V4_OBJECT(ErrorCtor)
+ V4_OBJECT2(ReferenceErrorCtor, ErrorCtor)
static ReturnedValue construct(Managed *m, CallData *callData);
};
struct SyntaxErrorCtor: ErrorCtor
{
- struct Data : ErrorCtor::Data {
- Data(ExecutionContext *scope);
- };
- V4_OBJECT(ErrorCtor)
+ V4_OBJECT2(SyntaxErrorCtor, ErrorCtor)
static ReturnedValue construct(Managed *m, CallData *callData);
};
struct TypeErrorCtor: ErrorCtor
{
- struct Data : ErrorCtor::Data {
- Data(ExecutionContext *scope);
- };
- V4_OBJECT(ErrorCtor)
+ V4_OBJECT2(TypeErrorCtor, ErrorCtor)
static ReturnedValue construct(Managed *m, CallData *callData);
};
struct URIErrorCtor: ErrorCtor
{
- struct Data : ErrorCtor::Data {
- Data(ExecutionContext *scope);
- };
- V4_OBJECT(ErrorCtor)
+ V4_OBJECT2(URIErrorCtor, ErrorCtor)
static ReturnedValue construct(Managed *m, CallData *callData);
};
@@ -236,7 +271,7 @@ struct URIErrorPrototype : ErrorObject
inline SyntaxErrorObject *ErrorObject::asSyntaxError()
{
- return subtype() == SyntaxError ? static_cast<SyntaxErrorObject *>(this) : 0;
+ return d()->errorType == QV4::Heap::ErrorObject::SyntaxError ? static_cast<SyntaxErrorObject *>(this) : 0;
}
}
diff --git a/src/qml/jsruntime/qv4executableallocator.cpp b/src/qml/jsruntime/qv4executableallocator.cpp
index ac923d7913..9fd887a272 100644
--- a/src/qml/jsruntime/qv4executableallocator.cpp
+++ b/src/qml/jsruntime/qv4executableallocator.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/jsruntime/qv4executableallocator_p.h b/src/qml/jsruntime/qv4executableallocator_p.h
index b70fb04a90..0d07e3c1bd 100644
--- a/src/qml/jsruntime/qv4executableallocator_p.h
+++ b/src/qml/jsruntime/qv4executableallocator_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/jsruntime/qv4function.cpp b/src/qml/jsruntime/qv4function.cpp
index c7fe2128ce..be63b31e1e 100644
--- a/src/qml/jsruntime/qv4function.cpp
+++ b/src/qml/jsruntime/qv4function.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE
using namespace QV4;
Function::Function(ExecutionEngine *engine, CompiledData::CompilationUnit *unit, const CompiledData::Function *function,
- ReturnedValue (*codePtr)(ExecutionContext *, const uchar *))
+ ReturnedValue (*codePtr)(ExecutionEngine *, const uchar *))
: compiledFunction(function)
, compilationUnit(unit)
, code(codePtr)
@@ -56,9 +56,9 @@ Function::Function(ExecutionEngine *engine, CompiledData::CompilationUnit *unit,
const quint32 *formalsIndices = compiledFunction->formalsTable();
// iterate backwards, so we get the right ordering for duplicate names
Scope scope(engine);
- ScopedString s(scope);
+ ScopedString arg(scope);
for (int i = static_cast<int>(compiledFunction->nFormals - 1); i >= 0; --i) {
- String *arg = compilationUnit->runtimeStrings[formalsIndices[i]].asString();
+ arg = compilationUnit->runtimeStrings[formalsIndices[i]];
while (1) {
InternalClass *newClass = internalClass->addMember(arg, Attr_NotConfigurable);
if (newClass != internalClass) {
@@ -66,15 +66,14 @@ Function::Function(ExecutionEngine *engine, CompiledData::CompilationUnit *unit,
break;
}
// duplicate arguments, need some trick to store them
- arg = (s = engine->memoryManager->alloc<String>(engine, arg, engine->newString(QString(0xfffe))->getPointer())).getPointer();
+ MemoryManager *mm = engine->memoryManager;
+ arg = mm->alloc<String>(mm, arg->d(), engine->newString(QString(0xfffe)));
}
}
const quint32 *localsIndices = compiledFunction->localsTable();
- for (quint32 i = 0; i < compiledFunction->nLocals; ++i) {
- String *local = compilationUnit->runtimeStrings[localsIndices[i]].asString();
- internalClass = internalClass->addMember(local, Attr_NotConfigurable);
- }
+ for (quint32 i = 0; i < compiledFunction->nLocals; ++i)
+ internalClass = internalClass->addMember(compilationUnit->runtimeStrings[localsIndices[i]]->identifier, Attr_NotConfigurable);
}
Function::~Function()
diff --git a/src/qml/jsruntime/qv4function_p.h b/src/qml/jsruntime/qv4function_p.h
index 465489b83f..10a03bca94 100644
--- a/src/qml/jsruntime/qv4function_p.h
+++ b/src/qml/jsruntime/qv4function_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -34,60 +34,28 @@
#define QV4FUNCTION_H
#include "qv4global_p.h"
-
-#include <QtCore/QVector>
-#include <QtCore/QByteArray>
-#include <QtCore/qurl.h>
-
-#include "qv4value_p.h"
#include <private/qv4compileddata_p.h>
-#include <private/qv4engine_p.h>
QT_BEGIN_NAMESPACE
namespace QV4 {
-struct String;
-struct Function;
-struct Object;
-struct FunctionObject;
-struct ExecutionContext;
-struct ExecutionEngine;
-class MemoryManager;
-
-struct ObjectPrototype;
-struct StringPrototype;
-struct NumberPrototype;
-struct BooleanPrototype;
-struct ArrayPrototype;
-struct FunctionPrototype;
-struct DatePrototype;
-struct ErrorPrototype;
-struct EvalErrorPrototype;
-struct RangeErrorPrototype;
-struct ReferenceErrorPrototype;
-struct SyntaxErrorPrototype;
-struct TypeErrorPrototype;
-struct URIErrorPrototype;
-struct InternalClass;
-struct Lookup;
-
struct Q_QML_EXPORT Function {
const CompiledData::Function *compiledFunction;
CompiledData::CompilationUnit *compilationUnit;
- ReturnedValue (*code)(ExecutionContext *, const uchar *);
+ ReturnedValue (*code)(ExecutionEngine *, const uchar *);
const uchar *codeData;
// first nArguments names in internalClass are the actual arguments
InternalClass *internalClass;
Function(ExecutionEngine *engine, CompiledData::CompilationUnit *unit, const CompiledData::Function *function,
- ReturnedValue (*codePtr)(ExecutionContext *, const uchar *));
+ ReturnedValue (*codePtr)(ExecutionEngine *, const uchar *));
~Function();
- inline String *name() {
- return compilationUnit->runtimeStrings[compiledFunction->nameIndex].getPointer();
+ inline Heap::String *name() {
+ return compilationUnit->runtimeStrings[compiledFunction->nameIndex];
}
inline QString sourceFile() const { return compilationUnit->fileName(); }
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index f3ad8ef892..0a12d013ac 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -48,15 +48,11 @@
#include <private/qqmljsast_p.h>
#include <private/qqmlcontextwrapper_p.h>
#include <private/qqmlengine_p.h>
-#include <qv4jsir_p.h>
#include <qv4codegen_p.h>
#include "private/qlocale_tools_p.h"
+#include "private/qqmlbuiltinfunctions_p.h"
-#include <QtCore/qmath.h>
#include <QtCore/QDebug>
-#include <cassert>
-#include <typeinfo>
-#include <iostream>
#include <algorithm>
#include "qv4alloca_p.h"
#include "qv4profiling_p.h"
@@ -66,46 +62,84 @@ using namespace QV4;
DEFINE_OBJECT_VTABLE(FunctionObject);
-FunctionObject::Data::Data(ExecutionContext *scope, String *name, bool createProto)
- : Object::Data(scope->d()->engine->functionClass)
- , scope(scope)
+Heap::FunctionObject::FunctionObject(QV4::ExecutionContext *scope, QV4::String *name, bool createProto)
+ : Heap::Object(scope->d()->engine->functionClass, scope->d()->engine->functionPrototype.asObject())
+ , scope(scope->d())
+ , function(Q_NULLPTR)
{
- Scope s(scope);
+ Scope s(scope->engine());
ScopedFunctionObject f(s, this);
f->init(name, createProto);
}
+Heap::FunctionObject::FunctionObject(QV4::ExecutionContext *scope, Function *function, bool createProto)
+ : Heap::Object(scope->d()->engine->functionClass, scope->d()->engine->functionPrototype.asObject())
+ , scope(scope->d())
+ , function(Q_NULLPTR)
+{
+ Scope s(scope->engine());
+ ScopedString name(s, function->name());
+ ScopedFunctionObject f(s, this);
+ f->init(name, createProto);
+}
-FunctionObject::Data::Data(ExecutionContext *scope, const QString &name, bool createProto)
- : Object::Data(scope->d()->engine->functionClass)
- , scope(scope)
+Heap::FunctionObject::FunctionObject(QV4::ExecutionContext *scope, const QString &name, bool createProto)
+ : Heap::Object(scope->d()->engine->functionClass, scope->d()->engine->functionPrototype.asObject())
+ , scope(scope->d())
+ , function(Q_NULLPTR)
{
- Scope s(scope);
+ Scope s(scope->engine());
ScopedFunctionObject f(s, this);
ScopedString n(s, s.engine->newString(name));
- f->init(n.getPointer(), createProto);
+ f->init(n, createProto);
}
-FunctionObject::Data::Data(ExecutionContext *scope, const ReturnedValue name)
- : Object::Data(scope->d()->engine->functionClass)
+Heap::FunctionObject::FunctionObject(ExecutionContext *scope, const QString &name, bool createProto)
+ : Heap::Object(scope->engine->functionClass, scope->engine->functionPrototype.asObject())
, scope(scope)
+ , function(Q_NULLPTR)
+{
+ Scope s(scope->engine);
+ ScopedFunctionObject f(s, this);
+ ScopedString n(s, s.engine->newString(name));
+ f->init(n, createProto);
+}
+
+Heap::FunctionObject::FunctionObject(QV4::ExecutionContext *scope, const ReturnedValue name)
+ : Heap::Object(scope->d()->engine->functionClass, scope->d()->engine->functionPrototype.asObject())
+ , scope(scope->d())
+ , function(Q_NULLPTR)
{
Scope s(scope);
ScopedFunctionObject f(s, this);
ScopedString n(s, name);
- f->init(n.getPointer(), false);
+ f->init(n, false);
}
-FunctionObject::Data::Data(InternalClass *ic)
- : Object::Data(ic)
- , scope(ic->engine->rootContext)
+Heap::FunctionObject::FunctionObject(ExecutionContext *scope, const ReturnedValue name)
+ : Heap::Object(scope->engine->functionClass, scope->engine->functionPrototype.asObject())
+ , scope(scope)
+ , function(Q_NULLPTR)
{
- memberData.ensureIndex(ic->engine, Index_Prototype);
- memberData[Index_Prototype] = Encode::undefined();
+ Scope s(scope->engine);
+ ScopedFunctionObject f(s, this);
+ ScopedString n(s, name);
+ f->init(n, false);
}
+Heap::FunctionObject::FunctionObject(InternalClass *ic, QV4::Object *prototype)
+ : Heap::Object(ic, prototype)
+ , scope(ic->engine->rootContext())
+ , function(Q_NULLPTR)
+{
+ Scope scope(ic->engine);
+ ScopedObject o(scope, this);
+ o->ensureMemberIndex(ic->engine, Index_Prototype);
+ memberData->data[Index_Prototype] = Encode::undefined();
+}
-FunctionObject::Data::~Data()
+
+Heap::FunctionObject::~FunctionObject()
{
if (function)
function->compilationUnit->release();
@@ -116,16 +150,14 @@ void FunctionObject::init(String *n, bool createProto)
Scope s(internalClass()->engine);
ScopedValue protectThis(s, this);
- d()->needsActivation = true;
- d()->strictMode = false;
-
- memberData().ensureIndex(s.engine, Index_Prototype);
+ ensureMemberIndex(s.engine, Heap::FunctionObject::Index_Prototype);
if (createProto) {
- Scoped<Object> proto(s, scope()->d()->engine->newObject(scope()->d()->engine->protoClass));
- proto->memberData()[Index_ProtoConstructor] = this->asReturnedValue();
- memberData()[Index_Prototype] = proto.asReturnedValue();
+ ScopedObject proto(s, scope()->engine->newObject(s.engine->protoClass, s.engine->objectPrototype.asObject()));
+ proto->ensureMemberIndex(s.engine, Heap::FunctionObject::Index_ProtoConstructor);
+ proto->memberData()->data[Heap::FunctionObject::Index_ProtoConstructor] = this->asReturnedValue();
+ memberData()->data[Heap::FunctionObject::Index_Prototype] = proto.asReturnedValue();
} else {
- memberData()[Index_Prototype] = Encode::undefined();
+ memberData()->data[Heap::FunctionObject::Index_Prototype] = Encode::undefined();
}
ScopedValue v(s, n);
@@ -134,20 +166,20 @@ void FunctionObject::init(String *n, bool createProto)
ReturnedValue FunctionObject::name()
{
- return get(scope()->d()->engine->id_name);
+ return get(scope()->engine->id_name);
}
ReturnedValue FunctionObject::newInstance()
{
Scope scope(internalClass()->engine);
- ScopedCallData callData(scope, 0);
+ ScopedCallData callData(scope);
return construct(callData);
}
ReturnedValue FunctionObject::construct(Managed *that, CallData *)
{
- that->internalClass()->engine->currentContext()->throwTypeError();
+ static_cast<FunctionObject *>(that)->internalClass()->engine->throwTypeError();
return Encode::undefined();
}
@@ -156,16 +188,16 @@ ReturnedValue FunctionObject::call(Managed *, CallData *)
return Encode::undefined();
}
-void FunctionObject::markObjects(Managed *that, ExecutionEngine *e)
+void FunctionObject::markObjects(Heap::Base *that, ExecutionEngine *e)
{
- FunctionObject *o = static_cast<FunctionObject *>(that);
- if (o->scope())
- o->scope()->mark(e);
+ Heap::FunctionObject *o = static_cast<Heap::FunctionObject *>(that);
+ if (o->scope)
+ o->scope->mark(e);
Object::markObjects(that, e);
}
-FunctionObject *FunctionObject::createScriptFunction(ExecutionContext *scope, Function *function, bool createProto)
+Heap::FunctionObject *FunctionObject::createScriptFunction(ExecutionContext *scope, Function *function, bool createProto)
{
if (function->needsActivation() ||
function->compiledFunction->flags & CompiledData::Function::HasCatchOrWith ||
@@ -175,29 +207,50 @@ FunctionObject *FunctionObject::createScriptFunction(ExecutionContext *scope, Fu
return scope->d()->engine->memoryManager->alloc<SimpleScriptFunction>(scope, function, createProto);
}
+bool FunctionObject::isBinding() const
+{
+ return d()->vtable == QQmlBindingFunction::staticVTable();
+}
+
+bool FunctionObject::isBoundFunction() const
+{
+ return d()->vtable == BoundFunction::staticVTable();
+}
+
+QQmlSourceLocation FunctionObject::sourceLocation() const
+{
+ if (isBinding()) {
+ Q_ASSERT(as<const QV4::QQmlBindingFunction>());
+ return static_cast<QV4::Heap::QQmlBindingFunction *>(d())->bindingLocation;
+ }
+ QV4::Function *function = d()->function;
+ Q_ASSERT(function);
+
+ return QQmlSourceLocation(function->sourceFile(), function->compiledFunction->location.line, function->compiledFunction->location.column);
+}
+
DEFINE_OBJECT_VTABLE(FunctionCtor);
-FunctionCtor::Data::Data(ExecutionContext *scope)
- : FunctionObject::Data(scope, QStringLiteral("Function"))
+Heap::FunctionCtor::FunctionCtor(QV4::ExecutionContext *scope)
+ : Heap::FunctionObject(scope, QStringLiteral("Function"))
{
- setVTable(staticVTable());
}
// 15.3.2
ReturnedValue FunctionCtor::construct(Managed *that, CallData *callData)
{
- FunctionCtor *f = static_cast<FunctionCtor *>(that);
- ExecutionEngine *v4 = f->internalClass()->engine;
- ExecutionContext *ctx = v4->currentContext();
+ Scope scope(static_cast<Object *>(that)->engine());
+ Scoped<FunctionCtor> f(scope, static_cast<FunctionCtor *>(that));
+ ScopedContext ctx(scope, scope.engine->currentContext());
QString arguments;
QString body;
if (callData->argc > 0) {
for (int i = 0; i < callData->argc - 1; ++i) {
if (i)
arguments += QLatin1String(", ");
- arguments += callData->args[i].toString(ctx)->toQString();
+ arguments += callData->args[i].toQString();
}
- body = callData->args[callData->argc - 1].toString(ctx)->toQString();
+ body = callData->args[callData->argc - 1].toQString();
}
if (ctx->d()->engine->hasException)
return Encode::undefined();
@@ -212,24 +265,25 @@ ReturnedValue FunctionCtor::construct(Managed *that, CallData *callData)
const bool parsed = parser.parseExpression();
if (!parsed)
- return v4->currentContext()->throwSyntaxError(QLatin1String("Parse error"));
+ return scope.engine->throwSyntaxError(QLatin1String("Parse error"));
using namespace QQmlJS::AST;
FunctionExpression *fe = QQmlJS::AST::cast<FunctionExpression *>(parser.rootNode());
if (!fe)
- return v4->currentContext()->throwSyntaxError(QLatin1String("Parse error"));
+ return scope.engine->throwSyntaxError(QLatin1String("Parse error"));
- IR::Module module(v4->debugger != 0);
+ IR::Module module(scope.engine->debugger != 0);
- QQmlJS::RuntimeCodegen cg(v4->currentContext(), f->strictMode());
+ QQmlJS::RuntimeCodegen cg(scope.engine, f->strictMode());
cg.generateFromFunctionExpression(QString(), function, fe, &module);
- QV4::Compiler::JSUnitGenerator jsGenerator(&module);
- QScopedPointer<EvalInstructionSelection> isel(v4->iselFactory->create(QQmlEnginePrivate::get(v4), v4->executableAllocator, &module, &jsGenerator));
- QQmlRefPointer<QV4::CompiledData::CompilationUnit> compilationUnit = isel->compile();
- QV4::Function *vmf = compilationUnit->linkToEngine(v4);
+ Compiler::JSUnitGenerator jsGenerator(&module);
+ QScopedPointer<EvalInstructionSelection> isel(scope.engine->iselFactory->create(QQmlEnginePrivate::get(scope.engine), scope.engine->executableAllocator, &module, &jsGenerator));
+ QQmlRefPointer<CompiledData::CompilationUnit> compilationUnit = isel->compile();
+ Function *vmf = compilationUnit->linkToEngine(scope.engine);
- return FunctionObject::createScriptFunction(v4->rootContext, vmf)->asReturnedValue();
+ ScopedContext global(scope, scope.engine->rootContext());
+ return FunctionObject::createScriptFunction(global, vmf)->asReturnedValue();
}
// 15.3.1: This is equivalent to new Function(...)
@@ -240,8 +294,8 @@ ReturnedValue FunctionCtor::call(Managed *that, CallData *callData)
DEFINE_OBJECT_VTABLE(FunctionPrototype);
-FunctionPrototype::Data::Data(InternalClass *ic)
- : FunctionObject::Data(ic)
+Heap::FunctionPrototype::FunctionPrototype(InternalClass *ic, QV4::Object *prototype)
+ : Heap::FunctionObject(ic, prototype)
{
}
@@ -264,9 +318,9 @@ void FunctionPrototype::init(ExecutionEngine *engine, Object *ctor)
ReturnedValue FunctionPrototype::method_toString(CallContext *ctx)
{
- FunctionObject *fun = ctx->d()->callData->thisObject.asFunctionObject();
+ FunctionObject *fun = ctx->thisObject().asFunctionObject();
if (!fun)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
return ctx->d()->engine->newString(QStringLiteral("function() { [code] }"))->asReturnedValue();
}
@@ -274,9 +328,9 @@ ReturnedValue FunctionPrototype::method_toString(CallContext *ctx)
ReturnedValue FunctionPrototype::method_apply(CallContext *ctx)
{
Scope scope(ctx);
- FunctionObject *o = ctx->d()->callData->thisObject.asFunctionObject();
+ ScopedFunctionObject o(scope, ctx->thisObject().asFunctionObject());
if (!o)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
ScopedValue arg(scope, ctx->argument(1));
@@ -286,7 +340,7 @@ ReturnedValue FunctionPrototype::method_apply(CallContext *ctx)
if (!arr) {
len = 0;
if (!arg->isNullOrUndefined())
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
} else {
len = arr->getLength();
}
@@ -294,15 +348,15 @@ ReturnedValue FunctionPrototype::method_apply(CallContext *ctx)
ScopedCallData callData(scope, len);
if (len) {
- if (arr->arrayType() != ArrayData::Simple || arr->protoHasArray() || arr->hasAccessorProperty()) {
+ if (arr->arrayType() != Heap::ArrayData::Simple || arr->protoHasArray()) {
for (quint32 i = 0; i < len; ++i)
callData->args[i] = arr->getIndexed(i);
} else {
- uint alen = arr->arrayData() ? arr->arrayData()->length() : 0;
+ uint alen = arr->arrayData() ? arr->arrayData()->len : 0;
if (alen > len)
alen = len;
for (uint i = 0; i < alen; ++i)
- callData->args[i] = static_cast<SimpleArrayData *>(arr->arrayData())->data(i);
+ callData->args[i] = static_cast<Heap::SimpleArrayData *>(arr->arrayData())->data(i);
for (quint32 i = alen; i < len; ++i)
callData->args[i] = Primitive::undefinedValue();
}
@@ -316,14 +370,14 @@ ReturnedValue FunctionPrototype::method_call(CallContext *ctx)
{
Scope scope(ctx);
- FunctionObject *o = ctx->d()->callData->thisObject.asFunctionObject();
+ ScopedFunctionObject o(scope, ctx->thisObject().asFunctionObject());
if (!o)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
- ScopedCallData callData(scope, ctx->d()->callData->argc ? ctx->d()->callData->argc - 1 : 0);
- if (ctx->d()->callData->argc) {
- for (int i = 1; i < ctx->d()->callData->argc; ++i)
- callData->args[i - 1] = ctx->d()->callData->args[i];
+ ScopedCallData callData(scope, ctx->argc() ? ctx->argc() - 1 : 0);
+ if (ctx->argc()) {
+ for (int i = 1; i < ctx->argc(); ++i)
+ callData->args[i - 1] = ctx->args()[i];
}
callData->thisObject = ctx->argument(0);
return o->call(callData);
@@ -332,34 +386,32 @@ ReturnedValue FunctionPrototype::method_call(CallContext *ctx)
ReturnedValue FunctionPrototype::method_bind(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<FunctionObject> target(scope, ctx->d()->callData->thisObject);
+ ScopedFunctionObject target(scope, ctx->thisObject());
if (!target)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
ScopedValue boundThis(scope, ctx->argument(0));
- Members boundArgs;
- boundArgs.reset();
- if (ctx->d()->callData->argc > 1) {
- boundArgs.ensureIndex(scope.engine, ctx->d()->callData->argc - 1);
- boundArgs.d()->d()->size = ctx->d()->callData->argc - 1;
- memcpy(boundArgs.data(), ctx->d()->callData->args + 1, (ctx->d()->callData->argc - 1)*sizeof(Value));
+ Scoped<MemberData> boundArgs(scope, (Heap::MemberData *)0);
+ if (ctx->argc() > 1) {
+ boundArgs = MemberData::reallocate(scope.engine, 0, ctx->argc() - 1);
+ boundArgs->d()->size = ctx->argc() - 1;
+ memcpy(boundArgs->data(), ctx->args() + 1, (ctx->argc() - 1)*sizeof(Value));
}
- ScopedValue protectBoundArgs(scope, boundArgs.d());
- return BoundFunction::create(ctx->d()->engine->rootContext, target, boundThis, boundArgs)->asReturnedValue();
+ ScopedContext global(scope, scope.engine->rootContext());
+ return BoundFunction::create(global, target, boundThis, boundArgs)->asReturnedValue();
}
DEFINE_OBJECT_VTABLE(ScriptFunction);
-ScriptFunction::Data::Data(ExecutionContext *scope, Function *function)
- : SimpleScriptFunction::Data(scope, function, true)
+Heap::ScriptFunction::ScriptFunction(QV4::ExecutionContext *scope, Function *function)
+ : Heap::SimpleScriptFunction(scope, function, true)
{
- setVTable(staticVTable());
}
ReturnedValue ScriptFunction::construct(Managed *that, CallData *callData)
{
- ExecutionEngine *v4 = that->engine();
+ ExecutionEngine *v4 = static_cast<Object *>(that)->engine();
if (v4->hasException)
return Encode::undefined();
CHECK_STACK_LIMITS(v4);
@@ -367,15 +419,16 @@ ReturnedValue ScriptFunction::construct(Managed *that, CallData *callData)
Scope scope(v4);
Scoped<ScriptFunction> f(scope, static_cast<ScriptFunction *>(that));
- InternalClass *ic = f->internalClassForConstructor();
- ScopedObject obj(scope, v4->newObject(ic));
+ InternalClass *ic = scope.engine->emptyClass;
+ ScopedObject proto(scope, f->protoForConstructor());
+ ScopedObject obj(scope, v4->newObject(ic, proto));
- ExecutionContext *context = v4->currentContext();
+ ScopedContext context(scope, v4->currentContext());
callData->thisObject = obj.asReturnedValue();
- ExecutionContext *ctx = reinterpret_cast<ExecutionContext *>(context->newCallContext(f.getPointer(), callData));
+ Scoped<CallContext> ctx(scope, context->newCallContext(f, callData));
- ExecutionContextSaver ctxSaver(context);
- ScopedValue result(scope, Q_V4_PROFILE(v4, ctx, f->function()));
+ ExecutionContextSaver ctxSaver(scope, context);
+ ScopedValue result(scope, Q_V4_PROFILE(v4, f->function()));
if (f->function()->compiledFunction->hasQmlDependencies())
QmlContextWrapper::registerQmlDependencies(v4, f->function()->compiledFunction);
@@ -384,58 +437,61 @@ ReturnedValue ScriptFunction::construct(Managed *that, CallData *callData)
return Encode::undefined();
if (result->isObject())
- return result.asReturnedValue();
+ return result->asReturnedValue();
return obj.asReturnedValue();
}
ReturnedValue ScriptFunction::call(Managed *that, CallData *callData)
{
- ScriptFunction *f = static_cast<ScriptFunction *>(that);
- ExecutionEngine *v4 = f->engine();
+ ExecutionEngine *v4 = static_cast<Object *>(that)->engine();
if (v4->hasException)
return Encode::undefined();
CHECK_STACK_LIMITS(v4);
- ExecutionContext *context = v4->currentContext();
- Scope scope(context);
+ Scope scope(v4);
+ Scoped<ScriptFunction> f(scope, static_cast<ScriptFunction *>(that));
+ ScopedContext context(scope, v4->currentContext());
- CallContext *ctx = reinterpret_cast<CallContext *>(context->newCallContext(f, callData));
+ Scoped<CallContext> ctx(scope, context->newCallContext(f, callData));
- ExecutionContextSaver ctxSaver(context);
- ScopedValue result(scope, Q_V4_PROFILE(v4, ctx, f->function()));
+ ExecutionContextSaver ctxSaver(scope, context);
+ ScopedValue result(scope, Q_V4_PROFILE(v4, f->function()));
if (f->function()->compiledFunction->hasQmlDependencies())
QmlContextWrapper::registerQmlDependencies(ctx->d()->engine, f->function()->compiledFunction);
- return result.asReturnedValue();
+ return result->asReturnedValue();
}
DEFINE_OBJECT_VTABLE(SimpleScriptFunction);
-SimpleScriptFunction::Data::Data(ExecutionContext *scope, Function *function, bool createProto)
- : FunctionObject::Data(scope, function->name(), createProto)
+Heap::SimpleScriptFunction::SimpleScriptFunction(QV4::ExecutionContext *scope, Function *function, bool createProto)
+ : Heap::FunctionObject(function->compilationUnit->engine->simpleScriptFunctionClass, function->compilationUnit->engine->functionPrototype.asObject())
{
- setVTable(staticVTable());
+ this->scope = scope->d();
this->function = function;
function->compilationUnit->addref();
Q_ASSERT(function);
Q_ASSERT(function->code);
- needsActivation = function->needsActivation();
- strictMode = function->isStrict();
-
- // global function
- if (!scope)
- return;
-
Scope s(scope);
ScopedFunctionObject f(s, this);
- f->defineReadonlyProperty(scope->d()->engine->id_length, Primitive::fromInt32(f->formalParameterCount()));
+ if (createProto) {
+ ScopedString name(s, function->name());
+ f->init(name, createProto);
+ f->defineReadonlyProperty(scope->d()->engine->id_length, Primitive::fromInt32(f->formalParameterCount()));
+ } else {
+ f->ensureMemberIndex(s.engine, Index_Length);
+ memberData->data[Index_Name] = function->name();
+ memberData->data[Index_Length] = Primitive::fromInt32(f->formalParameterCount());
+ }
if (scope->d()->strictMode) {
- Property pd(s.engine->thrower, s.engine->thrower);
+ ScopedProperty pd(s);
+ pd->value = s.engine->thrower;
+ pd->set = s.engine->thrower;
f->insertMember(scope->d()->engine->id_caller, pd, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable);
f->insertMember(scope->d()->engine->id_arguments, pd, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable);
}
@@ -443,7 +499,7 @@ SimpleScriptFunction::Data::Data(ExecutionContext *scope, Function *function, bo
ReturnedValue SimpleScriptFunction::construct(Managed *that, CallData *callData)
{
- ExecutionEngine *v4 = that->engine();
+ ExecutionEngine *v4 = static_cast<Object *>(that)->engine();
if (v4->hasException)
return Encode::undefined();
CHECK_STACK_LIMITS(v4);
@@ -451,27 +507,26 @@ ReturnedValue SimpleScriptFunction::construct(Managed *that, CallData *callData)
Scope scope(v4);
Scoped<SimpleScriptFunction> f(scope, static_cast<SimpleScriptFunction *>(that));
- InternalClass *ic = f->internalClassForConstructor();
- callData->thisObject = v4->newObject(ic);
+ InternalClass *ic = scope.engine->emptyClass;
+ ScopedObject proto(scope, f->protoForConstructor());
+ callData->thisObject = v4->newObject(ic, proto);
- ExecutionContext *context = v4->currentContext();
- ExecutionContextSaver ctxSaver(context);
+ ExecutionContextSaver ctxSaver(scope, v4->currentContext());
CallContext::Data ctx(v4);
+ ctx.vtable = CallContext::staticVTable();
ctx.strictMode = f->strictMode();
ctx.callData = callData;
- ctx.function = f.getPointer();
+ ctx.function = f->d();
ctx.compilationUnit = f->function()->compilationUnit;
ctx.lookups = ctx.compilationUnit->runtimeLookups;
ctx.outer = f->scope();
- ctx.locals = v4->stackPush(f->varCount());
- while (callData->argc < (int)f->formalParameterCount()) {
- callData->args[callData->argc] = Encode::undefined();
- ++callData->argc;
- }
- Q_ASSERT(v4->currentContext()->d() == &ctx);
+ ctx.locals = scope.alloc(f->varCount());
+ for (int i = callData->argc; i < (int)f->formalParameterCount(); ++i)
+ callData->args[i] = Encode::undefined();
+ Q_ASSERT(v4->currentContext() == &ctx);
- Scoped<Object> result(scope, Q_V4_PROFILE(v4, reinterpret_cast<CallContext *>(&ctx), f->function()));
+ ScopedObject result(scope, Q_V4_PROFILE(v4, f->function()));
if (f->function()->compiledFunction->hasQmlDependencies())
QmlContextWrapper::registerQmlDependencies(v4, f->function()->compiledFunction);
@@ -483,67 +538,59 @@ ReturnedValue SimpleScriptFunction::construct(Managed *that, CallData *callData)
ReturnedValue SimpleScriptFunction::call(Managed *that, CallData *callData)
{
- ExecutionEngine *v4 = that->internalClass()->engine;
+ ExecutionEngine *v4 = static_cast<SimpleScriptFunction *>(that)->internalClass()->engine;
if (v4->hasException)
return Encode::undefined();
CHECK_STACK_LIMITS(v4);
- SimpleScriptFunction *f = static_cast<SimpleScriptFunction *>(that);
-
Scope scope(v4);
- ExecutionContext *context = v4->currentContext();
- ExecutionContextSaver ctxSaver(context);
+ Scoped<SimpleScriptFunction> f(scope, static_cast<SimpleScriptFunction *>(that));
+
+ ExecutionContextSaver ctxSaver(scope, v4->currentContext());
CallContext::Data ctx(v4);
+ ctx.vtable = CallContext::staticVTable();
ctx.strictMode = f->strictMode();
ctx.callData = callData;
- ctx.function = f;
+ ctx.function = f->d();
ctx.compilationUnit = f->function()->compilationUnit;
ctx.lookups = ctx.compilationUnit->runtimeLookups;
ctx.outer = f->scope();
- ctx.locals = v4->stackPush(f->varCount());
- while (callData->argc < (int)f->formalParameterCount()) {
- callData->args[callData->argc] = Encode::undefined();
- ++callData->argc;
- }
- Q_ASSERT(v4->currentContext()->d() == &ctx);
+ ctx.locals = scope.alloc(f->varCount());
+ for (int i = callData->argc; i < (int)f->formalParameterCount(); ++i)
+ callData->args[i] = Encode::undefined();
+ Q_ASSERT(v4->currentContext() == &ctx);
- ScopedValue result(scope, Q_V4_PROFILE(v4, reinterpret_cast<CallContext *>(&ctx), f->function()));
+ ScopedValue result(scope, Q_V4_PROFILE(v4, f->function()));
if (f->function()->compiledFunction->hasQmlDependencies())
QmlContextWrapper::registerQmlDependencies(v4, f->function()->compiledFunction);
- return result.asReturnedValue();
+ return result->asReturnedValue();
}
-InternalClass *SimpleScriptFunction::internalClassForConstructor()
+Heap::Object *SimpleScriptFunction::protoForConstructor()
{
- ReturnedValue proto = protoProperty();
- InternalClass *classForConstructor;
- Scope scope(internalClass()->engine);
- ScopedObject p(scope, proto);
+ Scope scope(engine());
+ ScopedObject p(scope, protoProperty());
if (p)
- classForConstructor = internalClass()->engine->constructClass->changePrototype(p.getPointer());
- else
- classForConstructor = scope.engine->objectClass;
-
- return classForConstructor;
+ return p->d();
+ return scope.engine->objectPrototype.asObject()->d();
}
DEFINE_OBJECT_VTABLE(BuiltinFunction);
-BuiltinFunction::Data::Data(ExecutionContext *scope, String *name, ReturnedValue (*code)(CallContext *))
- : FunctionObject::Data(scope, name)
+Heap::BuiltinFunction::BuiltinFunction(QV4::ExecutionContext *scope, QV4::String *name, ReturnedValue (*code)(QV4::CallContext *))
+ : Heap::FunctionObject(scope, name)
, code(code)
{
- setVTable(staticVTable());
}
ReturnedValue BuiltinFunction::construct(Managed *f, CallData *)
{
- return f->internalClass()->engine->currentContext()->throwTypeError();
+ return static_cast<BuiltinFunction *>(f)->internalClass()->engine->throwTypeError();
}
ReturnedValue BuiltinFunction::call(Managed *that, CallData *callData)
@@ -554,15 +601,17 @@ ReturnedValue BuiltinFunction::call(Managed *that, CallData *callData)
return Encode::undefined();
CHECK_STACK_LIMITS(v4);
- ExecutionContext *context = v4->currentContext();
- ExecutionContextSaver ctxSaver(context);
+ Scope scope(v4);
+ ExecutionContextSaver ctxSaver(scope, v4->currentContext());
CallContext::Data ctx(v4);
- ctx.strictMode = f->scope()->d()->strictMode; // ### needed? scope or parent context?
+ ctx.vtable = CallContext::staticVTable();
+ ctx.strictMode = f->scope()->strictMode; // ### needed? scope or parent context?
ctx.callData = callData;
- Q_ASSERT(v4->currentContext()->d() == &ctx);
+ Q_ASSERT(v4->currentContext() == &ctx);
+ Scoped<CallContext> sctx(scope, &ctx);
- return f->d()->code(reinterpret_cast<CallContext *>(&ctx));
+ return f->d()->code(sctx);
}
ReturnedValue IndexedBuiltinFunction::call(Managed *that, CallData *callData)
@@ -573,43 +622,45 @@ ReturnedValue IndexedBuiltinFunction::call(Managed *that, CallData *callData)
return Encode::undefined();
CHECK_STACK_LIMITS(v4);
- ExecutionContext *context = v4->currentContext();
- ExecutionContextSaver ctxSaver(context);
+ Scope scope(v4);
+ ExecutionContextSaver ctxSaver(scope, v4->currentContext());
CallContext::Data ctx(v4);
- ctx.strictMode = f->scope()->d()->strictMode; // ### needed? scope or parent context?
+ ctx.vtable = CallContext::staticVTable();
+ ctx.strictMode = f->scope()->strictMode; // ### needed? scope or parent context?
ctx.callData = callData;
- Q_ASSERT(v4->currentContext()->d() == &ctx);
+ Q_ASSERT(v4->currentContext() == &ctx);
+ Scoped<CallContext> sctx(scope, &ctx);
- return f->d()->code(reinterpret_cast<CallContext *>(&ctx), f->d()->index);
+ return f->d()->code(sctx, f->d()->index);
}
DEFINE_OBJECT_VTABLE(IndexedBuiltinFunction);
DEFINE_OBJECT_VTABLE(BoundFunction);
-BoundFunction::Data::Data(ExecutionContext *scope, FunctionObject *target, const ValueRef boundThis, const Members &boundArgs)
- : FunctionObject::Data(scope, QStringLiteral("__bound function__"))
- , target(target)
- , boundArgs(boundArgs)
+Heap::BoundFunction::BoundFunction(QV4::ExecutionContext *scope, QV4::FunctionObject *target,
+ const Value &boundThis, QV4::MemberData *boundArgs)
+ : Heap::FunctionObject(scope, QStringLiteral("__bound function__"))
+ , target(target->d())
+ , boundArgs(boundArgs ? boundArgs->d() : 0)
{
this->boundThis = boundThis;
- setVTable(staticVTable());
- subtype = FunctionObject::BoundFunction;
Scope s(scope);
ScopedObject f(s, this);
ScopedValue l(s, target->get(s.engine->id_length));
int len = l->toUInt32();
- len -= boundArgs.size();
+ if (boundArgs)
+ len -= boundArgs->size();
if (len < 0)
len = 0;
f->defineReadonlyProperty(s.engine->id_length, Primitive::fromInt32(len));
- ExecutionEngine *v4 = s.engine;
-
- Property pd(v4->thrower, v4->thrower);
+ ScopedProperty pd(s);
+ pd->value = s.engine->thrower;
+ pd->set = s.engine->thrower;
f->insertMember(s.engine->id_arguments, pd, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable);
f->insertMember(s.engine->id_caller, pd, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable);
}
@@ -617,35 +668,48 @@ BoundFunction::Data::Data(ExecutionContext *scope, FunctionObject *target, const
ReturnedValue BoundFunction::call(Managed *that, CallData *dd)
{
BoundFunction *f = static_cast<BoundFunction *>(that);
- Scope scope(f->scope()->d()->engine);
+ Scope scope(f->engine());
if (scope.hasException())
return Encode::undefined();
- ScopedCallData callData(scope, f->boundArgs().size() + dd->argc);
+ Scoped<MemberData> boundArgs(scope, f->boundArgs());
+ ScopedCallData callData(scope, (boundArgs ? boundArgs->size() : 0) + dd->argc);
callData->thisObject = f->boundThis();
- memcpy(callData->args, f->boundArgs().data(), f->boundArgs().size()*sizeof(Value));
- memcpy(callData->args + f->boundArgs().size(), dd->args, dd->argc*sizeof(Value));
- return f->target()->call(callData);
+ Value *argp = callData->args;
+ if (boundArgs) {
+ memcpy(argp, boundArgs->data(), boundArgs->size()*sizeof(Value));
+ argp += boundArgs->size();
+ }
+ memcpy(argp, dd->args, dd->argc*sizeof(Value));
+ ScopedFunctionObject t(scope, f->target());
+ return t->call(callData);
}
ReturnedValue BoundFunction::construct(Managed *that, CallData *dd)
{
BoundFunction *f = static_cast<BoundFunction *>(that);
- Scope scope(f->scope()->d()->engine);
+ Scope scope(f->engine());
if (scope.hasException())
return Encode::undefined();
- ScopedCallData callData(scope, f->boundArgs().size() + dd->argc);
- memcpy(callData->args, f->boundArgs().data(), f->boundArgs().size()*sizeof(Value));
- memcpy(callData->args + f->boundArgs().size(), dd->args, dd->argc*sizeof(Value));
- return f->target()->construct(callData);
+ Scoped<MemberData> boundArgs(scope, f->boundArgs());
+ ScopedCallData callData(scope, (boundArgs ? boundArgs->size() : 0) + dd->argc);
+ Value *argp = callData->args;
+ if (boundArgs) {
+ memcpy(argp, boundArgs->data(), boundArgs->size()*sizeof(Value));
+ argp += boundArgs->size();
+ }
+ memcpy(argp, dd->args, dd->argc*sizeof(Value));
+ ScopedFunctionObject t(scope, f->target());
+ return t->construct(callData);
}
-void BoundFunction::markObjects(Managed *that, ExecutionEngine *e)
+void BoundFunction::markObjects(Heap::Base *that, ExecutionEngine *e)
{
- BoundFunction *o = static_cast<BoundFunction *>(that);
- o->target()->mark(e);
- o->boundThis().mark(e);
- o->boundArgs().mark(e);
+ BoundFunction::Data *o = static_cast<BoundFunction::Data *>(that);
+ o->target->mark(e);
+ o->boundThis.mark(e);
+ if (o->boundArgs)
+ o->boundArgs->mark(e);
FunctionObject::markObjects(that, e);
}
diff --git a/src/qml/jsruntime/qv4functionobject_p.h b/src/qml/jsruntime/qv4functionobject_p.h
index adedb9fb7d..252ff40a1a 100644
--- a/src/qml/jsruntime/qv4functionobject_p.h
+++ b/src/qml/jsruntime/qv4functionobject_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -33,94 +33,96 @@
#ifndef QV4FUNCTIONOBJECT_H
#define QV4FUNCTIONOBJECT_H
-#include "qv4global_p.h"
-#include "qv4runtime_p.h"
-#include "qv4engine_p.h"
-#include "qv4context_p.h"
#include "qv4object_p.h"
-#include "qv4string_p.h"
-#include "qv4managed_p.h"
-#include "qv4property_p.h"
#include "qv4function_p.h"
-#include "qv4objectiterator_p.h"
+#include "qv4context_p.h"
#include "qv4mm_p.h"
-#include <QtCore/QString>
-#include <QtCore/QHash>
-#include <QtCore/QScopedPointer>
-#include <cstdio>
-#include <cassert>
-
QT_BEGIN_NAMESPACE
+struct QQmlSourceLocation;
+
namespace QV4 {
-struct Function;
-struct Object;
-struct BooleanObject;
-struct NumberObject;
-struct StringObject;
-struct ArrayObject;
-struct DateObject;
-struct FunctionObject;
-struct ErrorObject;
-struct ArgumentsObject;
-struct ExecutionContext;
-struct ExecutionEngine;
-class MemoryManager;
-
-struct ObjectPrototype;
-struct StringPrototype;
-struct NumberPrototype;
-struct BooleanPrototype;
-struct ArrayPrototype;
-struct FunctionPrototype;
-struct DatePrototype;
-struct ErrorPrototype;
-struct EvalErrorPrototype;
-struct RangeErrorPrototype;
-struct ReferenceErrorPrototype;
-struct SyntaxErrorPrototype;
-struct TypeErrorPrototype;
-struct URIErrorPrototype;
-struct InternalClass;
-struct Lookup;
+namespace Heap {
-struct Q_QML_EXPORT FunctionObject: Object {
- struct Q_QML_PRIVATE_EXPORT Data : Object::Data {
- Data(ExecutionContext *scope, String *name, bool createProto = false);
- Data(ExecutionContext *scope, const QString &name = QString(), bool createProto = false);
- Data(ExecutionContext *scope, const ReturnedValue name);
- Data(InternalClass *ic);
- ~Data();
-
- ExecutionContext *scope;
- Function *function;
- };
- V4_OBJECT(Object)
- Q_MANAGED_TYPE(FunctionObject)
+struct Q_QML_PRIVATE_EXPORT FunctionObject : Object {
enum {
- IsFunctionObject = true
- };
- // Used with Managed::subType
- enum FunctionType {
- RegularFunction = 0,
- WrappedQtMethod = 1,
- BoundFunction
+ Index_Prototype = 0,
+ Index_ProtoConstructor = 0
};
+ FunctionObject(QV4::ExecutionContext *scope, QV4::String *name, bool createProto = false);
+ FunctionObject(QV4::ExecutionContext *scope, QV4::Function *function, bool createProto = false);
+ FunctionObject(QV4::ExecutionContext *scope, const QString &name = QString(), bool createProto = false);
+ FunctionObject(ExecutionContext *scope, const QString &name = QString(), bool createProto = false);
+ FunctionObject(QV4::ExecutionContext *scope, const ReturnedValue name);
+ FunctionObject(ExecutionContext *scope, const ReturnedValue name);
+ FunctionObject(InternalClass *ic, QV4::Object *prototype);
+ ~FunctionObject();
+
+ unsigned int formalParameterCount() { return function ? function->compiledFunction->nFormals : 0; }
+ unsigned int varCount() { return function ? function->compiledFunction->nLocals : 0; }
+ bool needsActivation() const { return function ? function->needsActivation() : false; }
+
+ ExecutionContext *scope;
+ Function *function;
+};
+
+struct FunctionCtor : FunctionObject {
+ FunctionCtor(QV4::ExecutionContext *scope);
+};
+
+struct FunctionPrototype : FunctionObject {
+ FunctionPrototype(InternalClass *ic, QV4::Object *prototype);
+};
+
+struct Q_QML_EXPORT BuiltinFunction : FunctionObject {
+ BuiltinFunction(QV4::ExecutionContext *scope, QV4::String *name, ReturnedValue (*code)(QV4::CallContext *));
+ ReturnedValue (*code)(QV4::CallContext *);
+};
+
+struct IndexedBuiltinFunction : FunctionObject {
+ inline IndexedBuiltinFunction(QV4::ExecutionContext *scope, uint index, ReturnedValue (*code)(QV4::CallContext *ctx, uint index));
+ ReturnedValue (*code)(QV4::CallContext *, uint index);
+ uint index;
+};
+
+struct SimpleScriptFunction : FunctionObject {
enum {
- Index_Prototype = 0,
- Index_ProtoConstructor = 0
+ Index_Name = FunctionObject::Index_Prototype + 1,
+ Index_Length
};
+ SimpleScriptFunction(QV4::ExecutionContext *scope, Function *function, bool createProto);
+};
+struct ScriptFunction : SimpleScriptFunction {
+ ScriptFunction(QV4::ExecutionContext *scope, Function *function);
+};
+
+struct BoundFunction : FunctionObject {
+ BoundFunction(QV4::ExecutionContext *scope, QV4::FunctionObject *target, const Value &boundThis, QV4::MemberData *boundArgs);
+ FunctionObject *target;
+ Value boundThis;
+ MemberData *boundArgs;
+};
+
+}
+
+struct Q_QML_EXPORT FunctionObject: Object {
+ enum {
+ IsFunctionObject = true
+ };
+ V4_OBJECT2(FunctionObject, Object)
+ Q_MANAGED_TYPE(FunctionObject)
+ V4_NEEDS_DESTROY
- ExecutionContext *scope() { return d()->scope; }
- Function *function() const { return d()->function; }
+ Heap::ExecutionContext *scope() { return d()->scope; }
+ Function *function() { return d()->function; }
ReturnedValue name();
- unsigned int formalParameterCount() { return function() ? function()->compiledFunction->nFormals : 0; }
- unsigned int varCount() { return function() ? function()->compiledFunction->nLocals : 0; }
+ unsigned int formalParameterCount() { return d()->formalParameterCount(); }
+ unsigned int varCount() { return d()->varCount(); }
void init(String *name, bool createProto);
@@ -130,23 +132,23 @@ struct Q_QML_EXPORT FunctionObject: Object {
using Object::call;
static ReturnedValue construct(Managed *that, CallData *);
static ReturnedValue call(Managed *that, CallData *d);
- static void destroy(Managed *m) {
- static_cast<FunctionObject *>(m)->d()->~Data();
- }
static FunctionObject *cast(const Value &v) {
return v.asFunctionObject();
}
- static FunctionObject *createScriptFunction(ExecutionContext *scope, Function *function, bool createProto = true);
+ static Heap::FunctionObject *createScriptFunction(ExecutionContext *scope, Function *function, bool createProto = true);
- ReturnedValue protoProperty() { return memberData()[Index_Prototype].asReturnedValue(); }
+ ReturnedValue protoProperty() { return memberData()->data[Heap::FunctionObject::Index_Prototype].asReturnedValue(); }
- bool needsActivation() const { return d()->needsActivation; }
- bool strictMode() const { return d()->strictMode; }
- bool bindingKeyFlag() const { return d()->bindingKeyFlag; }
+ bool needsActivation() const { return d()->needsActivation(); }
+ bool strictMode() const { return d()->function ? d()->function->isStrict() : false; }
+ bool isBinding() const;
+ bool isBoundFunction() const;
- static void markObjects(Managed *that, ExecutionEngine *e);
+ QQmlSourceLocation sourceLocation() const;
+
+ static void markObjects(Heap::Base *that, ExecutionEngine *e);
};
template<>
@@ -156,11 +158,7 @@ inline FunctionObject *value_cast(const Value &v) {
struct FunctionCtor: FunctionObject
{
- struct Data : FunctionObject::Data {
- Data(ExecutionContext *scope);
- };
-
- V4_OBJECT(FunctionObject)
+ V4_OBJECT2(FunctionCtor, FunctionObject)
static ReturnedValue construct(Managed *that, CallData *callData);
static ReturnedValue call(Managed *that, CallData *callData);
@@ -168,10 +166,7 @@ struct FunctionCtor: FunctionObject
struct FunctionPrototype: FunctionObject
{
- struct Data : FunctionObject::Data {
- Data(InternalClass *ic);
- };
- V4_OBJECT(FunctionObject)
+ V4_OBJECT2(FunctionPrototype, FunctionObject)
void init(ExecutionEngine *engine, Object *ctor);
@@ -182,13 +177,9 @@ struct FunctionPrototype: FunctionObject
};
struct Q_QML_EXPORT BuiltinFunction: FunctionObject {
- struct Q_QML_EXPORT Data : FunctionObject::Data {
- Data(ExecutionContext *scope, String *name, ReturnedValue (*code)(CallContext *));
- ReturnedValue (*code)(CallContext *);
- };
- V4_OBJECT(FunctionObject)
+ V4_OBJECT2(BuiltinFunction, FunctionObject)
- static BuiltinFunction *create(ExecutionContext *scope, String *name, ReturnedValue (*code)(CallContext *))
+ static Heap::BuiltinFunction *create(ExecutionContext *scope, String *name, ReturnedValue (*code)(CallContext *))
{
return scope->engine()->memoryManager->alloc<BuiltinFunction>(scope, name, code);
}
@@ -199,45 +190,36 @@ struct Q_QML_EXPORT BuiltinFunction: FunctionObject {
struct IndexedBuiltinFunction: FunctionObject
{
- struct Data : FunctionObject::Data {
- Data(ExecutionContext *scope, uint index, ReturnedValue (*code)(CallContext *ctx, uint index))
- : FunctionObject::Data(scope),
- code(code)
- , index(index)
- {
- setVTable(staticVTable());
- }
- ReturnedValue (*code)(CallContext *, uint index);
- uint index;
- };
- V4_OBJECT(FunctionObject)
+ V4_OBJECT2(IndexedBuiltinFunction, FunctionObject)
static ReturnedValue construct(Managed *m, CallData *)
{
- return m->engine()->currentContext()->throwTypeError();
+ return static_cast<IndexedBuiltinFunction *>(m)->engine()->throwTypeError();
}
static ReturnedValue call(Managed *that, CallData *callData);
};
+Heap::IndexedBuiltinFunction::IndexedBuiltinFunction(QV4::ExecutionContext *scope, uint index,
+ ReturnedValue (*code)(QV4::CallContext *ctx, uint index))
+ : Heap::FunctionObject(scope),
+ code(code)
+ , index(index)
+{
+}
+
struct SimpleScriptFunction: FunctionObject {
- struct Data : FunctionObject::Data {
- Data(ExecutionContext *scope, Function *function, bool createProto);
- };
- V4_OBJECT(FunctionObject)
+ V4_OBJECT2(SimpleScriptFunction, FunctionObject)
static ReturnedValue construct(Managed *, CallData *callData);
static ReturnedValue call(Managed *that, CallData *callData);
- InternalClass *internalClassForConstructor();
+ Heap::Object *protoForConstructor();
};
struct ScriptFunction: SimpleScriptFunction {
- struct Data : SimpleScriptFunction::Data {
- Data(ExecutionContext *scope, Function *function);
- };
- V4_OBJECT(FunctionObject)
+ V4_OBJECT2(ScriptFunction, FunctionObject)
static ReturnedValue construct(Managed *, CallData *callData);
static ReturnedValue call(Managed *that, CallData *callData);
@@ -245,27 +227,21 @@ struct ScriptFunction: SimpleScriptFunction {
struct BoundFunction: FunctionObject {
- struct Data : FunctionObject::Data {
- Data(ExecutionContext *scope, FunctionObject *target, const ValueRef boundThis, const Members &boundArgs);
- FunctionObject *target;
- Value boundThis;
- Members boundArgs;
- };
- V4_OBJECT(FunctionObject)
+ V4_OBJECT2(BoundFunction, FunctionObject)
- static BoundFunction *create(ExecutionContext *scope, FunctionObject *target, const ValueRef boundThis, const QV4::Members &boundArgs)
+ static Heap::BoundFunction *create(ExecutionContext *scope, FunctionObject *target, const Value &boundThis, QV4::MemberData *boundArgs)
{
return scope->engine()->memoryManager->alloc<BoundFunction>(scope, target, boundThis, boundArgs);
}
- FunctionObject *target() { return d()->target; }
+ Heap::FunctionObject *target() { return d()->target; }
Value boundThis() const { return d()->boundThis; }
- Members boundArgs() const { return d()->boundArgs; }
+ Heap::MemberData *boundArgs() const { return d()->boundArgs; }
static ReturnedValue construct(Managed *, CallData *d);
static ReturnedValue call(Managed *that, CallData *dd);
- static void markObjects(Managed *that, ExecutionEngine *e);
+ static void markObjects(Heap::Base *that, ExecutionEngine *e);
};
}
diff --git a/src/qml/jsruntime/qv4global_p.h b/src/qml/jsruntime/qv4global_p.h
index 1208f0f5ee..4b08194b60 100644
--- a/src/qml/jsruntime/qv4global_p.h
+++ b/src/qml/jsruntime/qv4global_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -34,10 +34,19 @@
#ifndef QV4GLOBAL_H
#define QV4GLOBAL_H
+#if defined(QT_BUILD_QMLDEVTOOLS_LIB) || defined(QT_QMLDEVTOOLS_LIB)
+#define V4_BOOTSTRAP
+#endif
+
#include <QtCore/qglobal.h>
#include <QString>
+
+#ifdef V4_BOOTSTRAP
+#include <private/qtqmldevtoolsglobal_p.h>
+#else
#include <qtqmlglobal.h>
#include <private/qtqmlglobal_p.h>
+#endif
#if defined(Q_CC_MSVC)
#include <float.h>
@@ -59,10 +68,6 @@ inline double trunc(double d) { return d > 0 ? floor(d) : ceil(d); }
#define qOffsetOf(s, m) ((size_t)((((char *)&(((s *)64)->m)) - 64)))
-#if defined(QT_BUILD_QMLDEVTOOLS_LIB) || defined(QT_QMLDEVTOOLS_LIB)
-#define V4_BOOTSTRAP
-#endif
-
// Decide whether to enable or disable the JIT
// White list architectures
@@ -116,6 +121,39 @@ QT_BEGIN_NAMESPACE
namespace QV4 {
+namespace Heap {
+ struct Base;
+ struct MemberData;
+ struct ArrayData;
+
+ struct String;
+ struct Object;
+ struct ObjectPrototype;
+
+ struct ExecutionContext;
+ struct GlobalContext;
+ struct CallContext;
+ struct ScriptFunction;
+
+ struct BooleanObject;
+ struct NumberObject;
+ struct StringObject;
+ struct ArrayObject;
+ struct DateObject;
+ struct FunctionObject;
+ struct ErrorObject;
+ struct ArgumentsObject;
+ struct QObjectWrapper;
+ struct RegExpObject;
+ struct RegExp;
+ struct EvalFunction;
+
+ struct ArrayBuffer;
+ struct DataView;
+ struct TypedArray;
+
+}
+
class MemoryManager;
struct String;
struct Object;
@@ -128,6 +166,9 @@ struct ScriptFunction;
struct InternalClass;
struct Property;
struct Value;
+struct Lookup;
+struct ArrayData;
+struct ManagedVTable;
struct BooleanObject;
struct NumberObject;
@@ -138,9 +179,15 @@ struct FunctionObject;
struct ErrorObject;
struct ArgumentsObject;
struct Managed;
-struct Lookup;
struct ExecutionEngine;
struct QObjectWrapper;
+struct RegExpObject;
+struct RegExp;
+struct EvalFunction;
+
+struct ArrayBuffer;
+struct DataView;
+struct TypedArray;
// ReturnedValue is used to return values from runtime methods
// the type has to be a primitive type (no struct or union), so that the compiler
@@ -148,22 +195,23 @@ struct QObjectWrapper;
// It will be returned in rax on x64, [eax,edx] on x86 and [r0,r1] on arm
typedef quint64 ReturnedValue;
struct CallData;
+struct Scope;
struct ScopedValue;
-struct ValueRef;
template<typename T> struct Scoped;
typedef Scoped<String> ScopedString;
typedef Scoped<Object> ScopedObject;
typedef Scoped<ArrayObject> ScopedArrayObject;
typedef Scoped<FunctionObject> ScopedFunctionObject;
-template<typename T> struct Returned;
-typedef Returned<String> ReturnedString;
-typedef Returned<Object> ReturnedObject;
-typedef Returned<FunctionObject> ReturnedFunctionObject;
+typedef Scoped<ExecutionContext> ScopedContext;
-struct PersistentValuePrivate;
+struct PersistentValueStorage;
class PersistentValue;
class WeakValue;
+struct IdentifierTable;
+class RegExpCache;
+class MultiplyWrappedQObjectMap;
+struct QmlExtensions;
namespace Global {
enum {
diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp
index 77bc9f579c..8e33cec57f 100644
--- a/src/qml/jsruntime/qv4globalobject.cpp
+++ b/src/qml/jsruntime/qv4globalobject.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -338,10 +338,9 @@ static QString decode(const QString &input, DecodeMode decodeMode, bool *ok)
DEFINE_OBJECT_VTABLE(EvalFunction);
-EvalFunction::Data::Data(ExecutionContext *scope)
- : FunctionObject::Data(scope, scope->d()->engine->id_eval)
+Heap::EvalFunction::EvalFunction(QV4::ExecutionContext *scope)
+ : Heap::FunctionObject(scope, scope->d()->engine->id_eval)
{
- setVTable(staticVTable());
Scope s(scope);
ScopedFunctionObject f(s, this);
f->defineReadonlyProperty(s.engine->id_length, Primitive::fromInt32(1));
@@ -353,11 +352,12 @@ ReturnedValue EvalFunction::evalCall(CallData *callData, bool directCall)
return Encode::undefined();
ExecutionEngine *v4 = engine();
- ExecutionContext *parentContext = v4->currentContext();
- ExecutionContextSaver ctxSaver(parentContext);
+ Scope scope(v4);
- ExecutionContext *ctx = parentContext;
- Scope scope(ctx);
+ ScopedContext parentContext(scope, v4->currentContext());
+ ExecutionContextSaver ctxSaver(scope, parentContext);
+
+ ScopedContext ctx(scope, parentContext.getPointer());
if (!directCall) {
// the context for eval should be the global scope, so we fake a root
@@ -382,24 +382,20 @@ ReturnedValue EvalFunction::evalCall(CallData *callData, bool directCall)
if (!function)
return Encode::undefined();
- d()->strictMode = function->isStrict() || (ctx->d()->strictMode);
-
- d()->needsActivation = function->needsActivation();
-
- if (strictMode()) {
+ if (function->isStrict() || (ctx->d()->strictMode)) {
ScopedFunctionObject e(scope, FunctionObject::createScriptFunction(ctx, function));
ScopedCallData callData(scope, 0);
- callData->thisObject = ctx->d()->callData->thisObject;
+ callData->thisObject = ctx->thisObject();
return e->call(callData);
}
- ContextStateSaver stateSaver(ctx);
+ ContextStateSaver stateSaver(scope, ctx);
// set the correct strict mode flag on the context
- ctx->d()->strictMode = strictMode();
+ ctx->d()->strictMode = false;
ctx->d()->compilationUnit = function->compilationUnit;
- return function->code(ctx, function->codeData);
+ return function->code(ctx->engine(), function->codeData);
}
@@ -430,13 +426,12 @@ static inline int toInt(const QChar &qc, int R)
ReturnedValue GlobalFunctions::method_parseInt(CallContext *ctx)
{
Scope scope(ctx);
- ScopedValue string(scope, ctx->argument(0));
+ ScopedValue inputString(scope, ctx->argument(0));
ScopedValue radix(scope, ctx->argument(1));
int R = radix->isUndefined() ? 0 : radix->toInt32();
// [15.1.2.2] step by step:
- String *inputString = string->toString(ctx); // 1
- QString trimmed = inputString->toQString().trimmed(); // 2
+ QString trimmed = inputString->toQString().trimmed(); // 1 + 2
if (ctx->d()->engine->hasException)
return Encode::undefined();
@@ -516,7 +511,7 @@ ReturnedValue GlobalFunctions::method_parseFloat(CallContext *ctx)
Scope scope(ctx);
// [15.1.2.3] step by step:
- Scoped<String> inputString(scope, ctx->argument(0), Scoped<String>::Convert);
+ ScopedString inputString(scope, ctx->argument(0), ScopedString::Convert);
if (scope.engine->hasException)
return Encode::undefined();
@@ -542,44 +537,44 @@ ReturnedValue GlobalFunctions::method_parseFloat(CallContext *ctx)
/// isNaN [15.1.2.4]
ReturnedValue GlobalFunctions::method_isNaN(CallContext *ctx)
{
- if (!ctx->d()->callData->argc)
+ if (!ctx->argc())
// undefined gets converted to NaN
return Encode(true);
- if (ctx->d()->callData->args[0].integerCompatible())
+ if (ctx->args()[0].integerCompatible())
return Encode(false);
- double d = ctx->d()->callData->args[0].toNumber();
+ double d = ctx->args()[0].toNumber();
return Encode((bool)std::isnan(d));
}
/// isFinite [15.1.2.5]
ReturnedValue GlobalFunctions::method_isFinite(CallContext *ctx)
{
- if (!ctx->d()->callData->argc)
+ if (!ctx->argc())
// undefined gets converted to NaN
return Encode(false);
- if (ctx->d()->callData->args[0].integerCompatible())
+ if (ctx->args()[0].integerCompatible())
return Encode(true);
- double d = ctx->d()->callData->args[0].toNumber();
+ double d = ctx->args()[0].toNumber();
return Encode((bool)std::isfinite(d));
}
/// decodeURI [15.1.3.1]
ReturnedValue GlobalFunctions::method_decodeURI(CallContext *context)
{
- if (context->d()->callData->argc == 0)
+ if (context->argc() == 0)
return Encode::undefined();
- QString uriString = context->d()->callData->args[0].toString(context)->toQString();
+ QString uriString = context->args()[0].toQString();
bool ok;
QString out = decode(uriString, DecodeNonReserved, &ok);
if (!ok) {
Scope scope(context);
ScopedString s(scope, context->d()->engine->newString(QStringLiteral("malformed URI sequence")));
- return context->throwURIError(s);
+ return context->engine()->throwURIError(s);
}
return context->d()->engine->newString(out)->asReturnedValue();
@@ -588,16 +583,16 @@ ReturnedValue GlobalFunctions::method_decodeURI(CallContext *context)
/// decodeURIComponent [15.1.3.2]
ReturnedValue GlobalFunctions::method_decodeURIComponent(CallContext *context)
{
- if (context->d()->callData->argc == 0)
+ if (context->argc() == 0)
return Encode::undefined();
- QString uriString = context->d()->callData->args[0].toString(context)->toQString();
+ QString uriString = context->args()[0].toQString();
bool ok;
QString out = decode(uriString, DecodeAll, &ok);
if (!ok) {
Scope scope(context);
ScopedString s(scope, context->d()->engine->newString(QStringLiteral("malformed URI sequence")));
- return context->throwURIError(s);
+ return context->engine()->throwURIError(s);
}
return context->d()->engine->newString(out)->asReturnedValue();
@@ -606,16 +601,16 @@ ReturnedValue GlobalFunctions::method_decodeURIComponent(CallContext *context)
/// encodeURI [15.1.3.3]
ReturnedValue GlobalFunctions::method_encodeURI(CallContext *context)
{
- if (context->d()->callData->argc == 0)
+ if (context->argc() == 0)
return Encode::undefined();
- QString uriString = context->d()->callData->args[0].toString(context)->toQString();
+ QString uriString = context->args()[0].toQString();
bool ok;
QString out = encode(uriString, uriUnescapedReserved, &ok);
if (!ok) {
Scope scope(context);
ScopedString s(scope, context->d()->engine->newString(QStringLiteral("malformed URI sequence")));
- return context->throwURIError(s);
+ return context->engine()->throwURIError(s);
}
return context->d()->engine->newString(out)->asReturnedValue();
@@ -624,16 +619,16 @@ ReturnedValue GlobalFunctions::method_encodeURI(CallContext *context)
/// encodeURIComponent [15.1.3.4]
ReturnedValue GlobalFunctions::method_encodeURIComponent(CallContext *context)
{
- if (context->d()->callData->argc == 0)
+ if (context->argc() == 0)
return Encode::undefined();
- QString uriString = context->d()->callData->args[0].toString(context)->toQString();
+ QString uriString = context->args()[0].toQString();
bool ok;
QString out = encode(uriString, uriUnescaped, &ok);
if (!ok) {
Scope scope(context);
ScopedString s(scope, context->d()->engine->newString(QStringLiteral("malformed URI sequence")));
- return context->throwURIError(s);
+ return context->engine()->throwURIError(s);
}
return context->d()->engine->newString(out)->asReturnedValue();
@@ -641,18 +636,18 @@ ReturnedValue GlobalFunctions::method_encodeURIComponent(CallContext *context)
ReturnedValue GlobalFunctions::method_escape(CallContext *context)
{
- if (!context->d()->callData->argc)
+ if (!context->argc())
return context->d()->engine->newString(QStringLiteral("undefined"))->asReturnedValue();
- QString str = context->d()->callData->args[0].toString(context)->toQString();
+ QString str = context->args()[0].toQString();
return context->d()->engine->newString(escape(str))->asReturnedValue();
}
ReturnedValue GlobalFunctions::method_unescape(CallContext *context)
{
- if (!context->d()->callData->argc)
+ if (!context->argc())
return context->d()->engine->newString(QStringLiteral("undefined"))->asReturnedValue();
- QString str = context->d()->callData->args[0].toString(context)->toQString();
+ QString str = context->args()[0].toQString();
return context->d()->engine->newString(unescape(str))->asReturnedValue();
}
diff --git a/src/qml/jsruntime/qv4globalobject_p.h b/src/qml/jsruntime/qv4globalobject_p.h
index 352519ceaf..74de233b47 100644
--- a/src/qml/jsruntime/qv4globalobject_p.h
+++ b/src/qml/jsruntime/qv4globalobject_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -40,13 +40,17 @@ QT_BEGIN_NAMESPACE
namespace QV4 {
+namespace Heap {
+
+struct EvalFunction : FunctionObject {
+ EvalFunction(QV4::ExecutionContext *scope);
+};
+
+}
+
struct Q_QML_EXPORT EvalFunction : FunctionObject
{
- struct Data : FunctionObject::Data {
- Data(ExecutionContext *scope);
- };
-
- V4_OBJECT(FunctionObject)
+ V4_OBJECT2(EvalFunction, FunctionObject)
ReturnedValue evalCall(CallData *callData, bool directCall);
diff --git a/src/qml/jsruntime/qv4identifier.cpp b/src/qml/jsruntime/qv4identifier.cpp
index d7e0e25ddf..b2785b672e 100644
--- a/src/qml/jsruntime/qv4identifier.cpp
+++ b/src/qml/jsruntime/qv4identifier.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -152,7 +152,7 @@ const Identifier *IdentifierHashBase::toIdentifier(const QString &str) const
return d->identifierTable->identifier(str);
}
-const Identifier *IdentifierHashBase::toIdentifier(String *str) const
+const Identifier *IdentifierHashBase::toIdentifier(Heap::String *str) const
{
Q_ASSERT(d);
return d->identifierTable->identifier(str);
diff --git a/src/qml/jsruntime/qv4identifier_p.h b/src/qml/jsruntime/qv4identifier_p.h
index afed5c646f..7937391ff7 100644
--- a/src/qml/jsruntime/qv4identifier_p.h
+++ b/src/qml/jsruntime/qv4identifier_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -39,6 +39,10 @@ QT_BEGIN_NAMESPACE
namespace QV4 {
+namespace Heap {
+ struct String;
+}
+
struct String;
struct IdentifierTable;
struct ExecutionEngine;
@@ -102,7 +106,7 @@ protected:
const IdentifierHashEntry *lookup(const QString &str) const;
const IdentifierHashEntry *lookup(String *str) const;
const Identifier *toIdentifier(const QString &str) const;
- const Identifier *toIdentifier(String *str) const;
+ const Identifier *toIdentifier(Heap::String *str) const;
};
diff --git a/src/qml/jsruntime/qv4identifiertable.cpp b/src/qml/jsruntime/qv4identifiertable.cpp
index d7ed7a8db0..138d76bf4a 100644
--- a/src/qml/jsruntime/qv4identifiertable.cpp
+++ b/src/qml/jsruntime/qv4identifiertable.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -53,41 +53,41 @@ IdentifierTable::IdentifierTable(ExecutionEngine *engine)
, numBits(8)
{
alloc = primeForNumBits(numBits);
- entries = (String **)malloc(alloc*sizeof(String *));
- memset(entries, 0, alloc*sizeof(String *));
+ entries = (Heap::String **)malloc(alloc*sizeof(Heap::String *));
+ memset(entries, 0, alloc*sizeof(Heap::String *));
}
IdentifierTable::~IdentifierTable()
{
for (int i = 0; i < alloc; ++i)
if (entries[i])
- delete entries[i]->d()->identifier;
+ delete entries[i]->identifier;
free(entries);
}
-void IdentifierTable::addEntry(String *str)
+void IdentifierTable::addEntry(Heap::String *str)
{
uint hash = str->hashValue();
- if (str->subtype() == String::StringType_ArrayIndex)
+ if (str->subtype == Heap::String::StringType_ArrayIndex)
return;
- str->d()->identifier = new Identifier;
- str->d()->identifier->string = str->toQString();
- str->d()->identifier->hashValue = hash;
+ str->identifier = new Identifier;
+ str->identifier->string = str->toQString();
+ str->identifier->hashValue = hash;
bool grow = (alloc <= size*2);
if (grow) {
++numBits;
int newAlloc = primeForNumBits(numBits);
- String **newEntries = (String **)malloc(newAlloc*sizeof(String *));
- memset(newEntries, 0, newAlloc*sizeof(String *));
+ Heap::String **newEntries = (Heap::String **)malloc(newAlloc*sizeof(Heap::String *));
+ memset(newEntries, 0, newAlloc*sizeof(Heap::String *));
for (int i = 0; i < alloc; ++i) {
- String *e = entries[i];
+ Heap::String *e = entries[i];
if (!e)
continue;
- uint idx = e->d()->stringHash % newAlloc;
+ uint idx = e->stringHash % newAlloc;
while (newEntries[idx]) {
++idx;
idx %= newAlloc;
@@ -110,48 +110,48 @@ void IdentifierTable::addEntry(String *str)
-String *IdentifierTable::insertString(const QString &s)
+Heap::String *IdentifierTable::insertString(const QString &s)
{
uint hash = String::createHashValue(s.constData(), s.length());
uint idx = hash % alloc;
- while (String *e = entries[idx]) {
- if (e->d()->stringHash == hash && e->toQString() == s)
+ while (Heap::String *e = entries[idx]) {
+ if (e->stringHash == hash && e->toQString() == s)
return e;
++idx;
idx %= alloc;
}
- String *str = engine->newString(s)->getPointer();
+ Heap::String *str = engine->newString(s);
addEntry(str);
return str;
}
-Identifier *IdentifierTable::identifierImpl(const String *str)
+Identifier *IdentifierTable::identifierImpl(const Heap::String *str)
{
- if (str->d()->identifier)
- return str->d()->identifier;
+ if (str->identifier)
+ return str->identifier;
uint hash = str->hashValue();
- if (str->subtype() == String::StringType_ArrayIndex)
+ if (str->subtype == Heap::String::StringType_ArrayIndex)
return 0;
uint idx = hash % alloc;
- while (String *e = entries[idx]) {
- if (e->d()->stringHash == hash && e->isEqualTo(str)) {
- str->d()->identifier = e->d()->identifier;
- return e->d()->identifier;
+ while (Heap::String *e = entries[idx]) {
+ if (e->stringHash == hash && e->isEqualTo(str)) {
+ str->identifier = e->identifier;
+ return e->identifier;
}
++idx;
idx %= alloc;
}
- addEntry(const_cast<QV4::String *>(str));
- return str->d()->identifier;
+ addEntry(const_cast<QV4::Heap::String *>(str));
+ return str->identifier;
}
Identifier *IdentifierTable::identifier(const QString &s)
{
- return insertString(s)->d()->identifier;
+ return insertString(s)->identifier;
}
Identifier *IdentifierTable::identifier(const char *s, int len)
@@ -162,16 +162,16 @@ Identifier *IdentifierTable::identifier(const char *s, int len)
QLatin1String latin(s, len);
uint idx = hash % alloc;
- while (String *e = entries[idx]) {
- if (e->d()->stringHash == hash && e->toQString() == latin)
- return e->d()->identifier;
+ while (Heap::String *e = entries[idx]) {
+ if (e->stringHash == hash && e->toQString() == latin)
+ return e->identifier;
++idx;
idx %= alloc;
}
- String *str = engine->newString(QString::fromLatin1(s, len))->getPointer();
+ Heap::String *str = engine->newString(QString::fromLatin1(s, len));
addEntry(str);
- return str->d()->identifier;
+ return str->identifier;
}
}
diff --git a/src/qml/jsruntime/qv4identifiertable_p.h b/src/qml/jsruntime/qv4identifiertable_p.h
index 6ae2ec06d6..ff374225f4 100644
--- a/src/qml/jsruntime/qv4identifiertable_p.h
+++ b/src/qml/jsruntime/qv4identifiertable_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -49,36 +49,39 @@ struct IdentifierTable
int alloc;
int size;
int numBits;
- String **entries;
+ Heap::String **entries;
- void addEntry(String *str);
+ void addEntry(Heap::String *str);
public:
IdentifierTable(ExecutionEngine *engine);
~IdentifierTable();
- String *insertString(const QString &s);
+ Heap::String *insertString(const QString &s);
- Identifier *identifier(const String *str) {
- if (str->d()->identifier)
- return str->d()->identifier;
+ Identifier *identifier(const Heap::String *str) {
+ if (str->identifier)
+ return str->identifier;
return identifierImpl(str);
}
+ Identifier *identifier(const QV4::String *str) {
+ return identifier(str->d());
+ }
Identifier *identifier(const QString &s);
Identifier *identifier(const char *s, int len);
- Identifier *identifierImpl(const String *str);
+ Identifier *identifierImpl(const Heap::String *str);
void mark(ExecutionEngine *e) {
for (int i = 0; i < alloc; ++i) {
- String *entry = entries[i];
- if (!entry || entry->markBit())
+ Heap::String *entry = entries[i];
+ if (!entry || entry->isMarked())
continue;
- entry->d()->markBit = 1;
- Q_ASSERT(entry->internalClass()->vtable->markObjects);
- entry->internalClass()->vtable->markObjects(entry, e);
+ entry->setMarkBit();
+ Q_ASSERT(entry->gcGetVtable()->markObjects);
+ entry->gcGetVtable()->markObjects(entry, e);
}
}
};
diff --git a/src/qml/jsruntime/qv4include.cpp b/src/qml/jsruntime/qv4include.cpp
index 9d6a4ab10a..e4bd460966 100644
--- a/src/qml/jsruntime/qv4include.cpp
+++ b/src/qml/jsruntime/qv4include.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -49,17 +49,17 @@
QT_BEGIN_NAMESPACE
-QV4Include::QV4Include(const QUrl &url, QV8Engine *engine, QQmlContextData *context,
- const QV4::ValueRef qmlglobal, const QV4::ValueRef callback)
- : v4(QV8Engine::getV4(engine)), m_network(0), m_reply(0), m_url(url), m_redirectCount(0), m_context(context)
+QV4Include::QV4Include(const QUrl &url, QV4::ExecutionEngine *engine, QQmlContextData *context,
+ const QV4::Value &qmlglobal, const QV4::Value &callback)
+ : v4(engine), m_network(0), m_reply(0), m_url(url), m_redirectCount(0), m_context(context)
{
- m_qmlglobal = qmlglobal;
- if (callback->asFunctionObject())
- m_callbackFunction = callback;
+ m_qmlglobal.set(engine, qmlglobal);
+ if (callback.asFunctionObject())
+ m_callbackFunction.set(engine, callback);
- m_resultObject = resultValue(v4);
+ m_resultObject.set(v4, resultValue(v4));
- m_network = engine->networkAccessManager();
+ m_network = engine->v8Engine->networkAccessManager();
QNetworkRequest request;
request.setUrl(url);
@@ -81,32 +81,31 @@ QV4::ReturnedValue QV4Include::resultValue(QV4::ExecutionEngine *v4, Status stat
QV4::ScopedObject o(scope, v4->newObject());
QV4::ScopedString s(scope);
QV4::ScopedValue v(scope);
- o->put((s = v4->newString(QStringLiteral("OK"))).getPointer(), (v = QV4::Primitive::fromInt32(Ok)));
- o->put((s = v4->newString(QStringLiteral("LOADING"))).getPointer(), (v = QV4::Primitive::fromInt32(Loading)));
- o->put((s = v4->newString(QStringLiteral("NETWORK_ERROR"))).getPointer(), (v = QV4::Primitive::fromInt32(NetworkError)));
- o->put((s = v4->newString(QStringLiteral("EXCEPTION"))).getPointer(), (v = QV4::Primitive::fromInt32(Exception)));
- o->put((s = v4->newString(QStringLiteral("status"))).getPointer(), (v = QV4::Primitive::fromInt32(status)));
+ o->put((s = v4->newString(QStringLiteral("OK"))), (v = QV4::Primitive::fromInt32(Ok)));
+ o->put((s = v4->newString(QStringLiteral("LOADING"))), (v = QV4::Primitive::fromInt32(Loading)));
+ o->put((s = v4->newString(QStringLiteral("NETWORK_ERROR"))), (v = QV4::Primitive::fromInt32(NetworkError)));
+ o->put((s = v4->newString(QStringLiteral("EXCEPTION"))), (v = QV4::Primitive::fromInt32(Exception)));
+ o->put((s = v4->newString(QStringLiteral("status"))), (v = QV4::Primitive::fromInt32(status)));
return o.asReturnedValue();
}
-void QV4Include::callback(const QV4::ValueRef callback, const QV4::ValueRef status)
+void QV4Include::callback(const QV4::Value &callback, const QV4::Value &status)
{
- QV4::ExecutionEngine *v4 = callback->engine();
- if (!v4)
+ if (!callback.isObject())
return;
+ QV4::ExecutionEngine *v4 = callback.asObject()->engine();
QV4::Scope scope(v4);
QV4::ScopedFunctionObject f(scope, callback);
if (!f)
return;
- QV4::ExecutionContext *ctx = v4->currentContext();
QV4::ScopedCallData callData(scope, 1);
- callData->thisObject = v4->globalObject->asReturnedValue();
+ callData->thisObject = v4->globalObject()->asReturnedValue();
callData->args[0] = status;
f->call(callData);
if (scope.hasException())
- ctx->catchException();
+ scope.engine->catchException();
}
QV4::ReturnedValue QV4Include::result()
@@ -136,6 +135,7 @@ void QV4Include::finished()
QV4::Scope scope(v4);
QV4::ScopedObject resultObj(scope, m_resultObject.value());
+ QV4::ScopedString status(scope, v4->newString(QStringLiteral("status")));
if (m_reply->error() == QNetworkReply::NoError) {
QByteArray data = m_reply->readAll();
@@ -145,20 +145,19 @@ void QV4Include::finished()
QV4::ScopedObject qmlglobal(scope, m_qmlglobal.value());
QV4::Script script(v4, qmlglobal, code, m_url.toString());
- QV4::ExecutionContext *ctx = v4->currentContext();
- QV4::ScopedString status(scope, v4->newString(QStringLiteral("status")));
script.parse();
if (!scope.engine->hasException)
script.run();
if (scope.engine->hasException) {
- QV4::ScopedValue ex(scope, ctx->catchException());
- resultObj->put(status.getPointer(), QV4::ScopedValue(scope, QV4::Primitive::fromInt32(Exception)));
- resultObj->put(v4->newString(QStringLiteral("exception"))->getPointer(), ex);
+ QV4::ScopedValue ex(scope, scope.engine->catchException());
+ resultObj->put(status, QV4::ScopedValue(scope, QV4::Primitive::fromInt32(Exception)));
+ QV4::ScopedString exception(scope, v4->newString(QStringLiteral("exception")));
+ resultObj->put(exception, ex);
} else {
- resultObj->put(status.getPointer(), QV4::ScopedValue(scope, QV4::Primitive::fromInt32(Ok)));
+ resultObj->put(status, QV4::ScopedValue(scope, QV4::Primitive::fromInt32(Ok)));
}
} else {
- resultObj->put(v4->newString(QStringLiteral("status"))->getPointer(), QV4::ScopedValue(scope, QV4::Primitive::fromInt32(NetworkError)));
+ resultObj->put(status, QV4::ScopedValue(scope, QV4::Primitive::fromInt32(NetworkError)));
}
QV4::ScopedValue cb(scope, m_callbackFunction.value());
@@ -173,21 +172,20 @@ void QV4Include::finished()
*/
QV4::ReturnedValue QV4Include::method_include(QV4::CallContext *ctx)
{
- if (!ctx->d()->callData->argc)
+ if (!ctx->argc())
return QV4::Encode::undefined();
QV4::Scope scope(ctx->engine());
- QV8Engine *engine = scope.engine->v8Engine;
QQmlContextData *context = QV4::QmlContextWrapper::callingContext(scope.engine);
if (!context || !context->isJSContext)
V4THROW_ERROR("Qt.include(): Can only be called from JavaScript files");
- QUrl url(scope.engine->resolvedUrl(ctx->d()->callData->args[0].toQStringNoThrow()));
+ QUrl url(scope.engine->resolvedUrl(ctx->args()[0].toQStringNoThrow()));
QV4::ScopedValue callbackFunction(scope, QV4::Primitive::undefinedValue());
- if (ctx->d()->callData->argc >= 2 && ctx->d()->callData->args[1].asFunctionObject())
- callbackFunction = ctx->d()->callData->args[1];
+ if (ctx->argc() >= 2 && ctx->args()[1].asFunctionObject())
+ callbackFunction = ctx->args()[1];
QString localFile = QQmlFile::urlToLocalFileOrQrc(url);
@@ -195,7 +193,7 @@ QV4::ReturnedValue QV4Include::method_include(QV4::CallContext *ctx)
QV4::ScopedObject qmlcontextobject(scope, scope.engine->qmlContextObject());
if (localFile.isEmpty()) {
- QV4Include *i = new QV4Include(url, engine, context,
+ QV4Include *i = new QV4Include(url, scope.engine, context,
qmlcontextobject,
callbackFunction);
result = i->result();
@@ -219,14 +217,14 @@ QV4::ReturnedValue QV4Include::method_include(QV4::CallContext *ctx)
}
if (!script.isNull()) {
- QV4::ExecutionContext *ctx = scope.engine->currentContext();
script->parse();
if (!scope.engine->hasException)
script->run();
if (scope.engine->hasException) {
- QV4::ScopedValue ex(scope, ctx->catchException());
+ QV4::ScopedValue ex(scope, scope.engine->catchException());
result = resultValue(scope.engine, Exception);
- result->asObject()->put(scope.engine->newString(QStringLiteral("exception"))->getPointer(), ex);
+ QV4::ScopedString exception(scope, scope.engine->newString(QStringLiteral("exception")));
+ result->asObject()->put(exception, ex);
} else {
result = resultValue(scope.engine, Ok);
}
@@ -237,7 +235,7 @@ QV4::ReturnedValue QV4Include::method_include(QV4::CallContext *ctx)
callback(callbackFunction, result);
}
- return result.asReturnedValue();
+ return result->asReturnedValue();
}
QT_END_NAMESPACE
diff --git a/src/qml/jsruntime/qv4include_p.h b/src/qml/jsruntime/qv4include_p.h
index 71c09bc314..5dc94e8555 100644
--- a/src/qml/jsruntime/qv4include_p.h
+++ b/src/qml/jsruntime/qv4include_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -76,14 +76,14 @@ private Q_SLOTS:
void finished();
private:
- QV4Include(const QUrl &url, QV8Engine *engine, QQmlContextData *context,
- const QV4::ValueRef qmlglobal, const QV4::ValueRef callback);
+ QV4Include(const QUrl &url, QV4::ExecutionEngine *engine, QQmlContextData *context,
+ const QV4::Value &qmlglobal, const QV4::Value &callback);
~QV4Include();
QV4::ReturnedValue result();
static QV4::ReturnedValue resultValue(QV4::ExecutionEngine *v4, Status status = Loading);
- static void callback(const QV4::ValueRef callback, const QV4::ValueRef status);
+ static void callback(const QV4::Value &callback, const QV4::Value &status);
QV4::ExecutionEngine *v4;
QNetworkAccessManager *m_network;
diff --git a/src/qml/jsruntime/qv4internalclass.cpp b/src/qml/jsruntime/qv4internalclass.cpp
index bb22e30ac1..a90e8e3689 100644
--- a/src/qml/jsruntime/qv4internalclass.cpp
+++ b/src/qml/jsruntime/qv4internalclass.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -40,14 +40,6 @@
QT_BEGIN_NAMESPACE
-uint QV4::qHash(const QV4::InternalClassTransition &t, uint)
-{
- if (t.flags == QV4::InternalClassTransition::ProtoChange)
- // INT_MAX is prime, so this should give a decent distribution of keys
- return (uint)((quintptr)t.prototype * INT_MAX);
- return t.id->hashValue ^ t.flags;
-}
-
using namespace QV4;
static const uchar prime_deltas[] = {
@@ -120,11 +112,10 @@ uint PropertyHash::lookup(const Identifier *identifier) const
InternalClass::InternalClass(ExecutionEngine *engine)
: engine(engine)
- , prototype(0)
- , vtable(&QV4::Managed::static_vtbl)
, m_sealed(0)
, m_frozen(0)
, size(0)
+ , extensible(true)
{
}
@@ -132,39 +123,49 @@ InternalClass::InternalClass(ExecutionEngine *engine)
InternalClass::InternalClass(const QV4::InternalClass &other)
: QQmlJS::Managed()
, engine(other.engine)
- , prototype(other.prototype)
- , vtable(other.vtable)
, propertyTable(other.propertyTable)
, nameMap(other.nameMap)
, propertyData(other.propertyData)
- , transitions()
, m_sealed(0)
, m_frozen(0)
, size(other.size)
+ , extensible(other.extensible)
{
+ Q_ASSERT(extensible);
}
void InternalClass::changeMember(Object *object, String *string, PropertyAttributes data, uint *index)
{
uint idx;
- InternalClass *newClass = object->internalClass()->changeMember(string, data, &idx);
+ InternalClass *newClass = object->internalClass()->changeMember(string->identifier(), data, &idx);
if (index)
*index = idx;
if (newClass->size > object->internalClass()->size) {
Q_ASSERT(newClass->size == object->internalClass()->size + 1);
- memmove(object->memberData().data() + idx + 2, object->memberData().data() + idx + 1, (object->internalClass()->size - idx - 1)*sizeof(Value));
+ memmove(object->memberData()->data + idx + 2, object->memberData()->data + idx + 1, (object->internalClass()->size - idx - 1)*sizeof(Value));
} else if (newClass->size < object->internalClass()->size) {
Q_ASSERT(newClass->size == object->internalClass()->size - 1);
- memmove(object->memberData().data() + idx + 1, object->memberData().data() + idx + 2, (object->internalClass()->size - idx - 2)*sizeof(Value));
+ memmove(object->memberData()->data + idx + 1, object->memberData()->data + idx + 2, (object->internalClass()->size - idx - 2)*sizeof(Value));
}
object->setInternalClass(newClass);
}
-InternalClass *InternalClass::changeMember(String *string, PropertyAttributes data, uint *index)
+InternalClassTransition &InternalClass::lookupOrInsertTransition(const InternalClassTransition &t)
+{
+ std::vector<Transition>::iterator it = std::lower_bound(transitions.begin(), transitions.end(), t);
+ if (it != transitions.end() && *it == t) {
+ return *it;
+ } else {
+ it = transitions.insert(it, t);
+ return *it;
+ }
+}
+
+InternalClass *InternalClass::changeMember(Identifier *identifier, PropertyAttributes data, uint *index)
{
data.resolve();
- uint idx = find(string);
+ uint idx = find(identifier);
Q_ASSERT(idx != UINT_MAX);
if (index)
@@ -173,14 +174,13 @@ InternalClass *InternalClass::changeMember(String *string, PropertyAttributes da
if (data == propertyData.at(idx))
return this;
- Transition t = { { string->d()->identifier }, (int)data.flags() };
- QHash<Transition, InternalClass *>::const_iterator tit = transitions.constFind(t);
- if (tit != transitions.constEnd())
- return tit.value();
+ Transition temp = { identifier, 0, (int)data.flags() };
+ Transition &t = lookupOrInsertTransition(temp);
+ if (t.lookup)
+ return t.lookup;
// create a new class and add it to the tree
- InternalClass *newClass = engine->emptyClass->changeVTable(vtable);
- newClass = newClass->changePrototype(prototype);
+ InternalClass *newClass = engine->emptyClass;
for (uint i = 0; i < size; ++i) {
if (i == idx) {
newClass = newClass->addMember(nameMap.at(i), data);
@@ -189,77 +189,26 @@ InternalClass *InternalClass::changeMember(String *string, PropertyAttributes da
}
}
- transitions.insert(t, newClass);
- return newClass;
-}
-
-InternalClass *InternalClass::create(ExecutionEngine *engine, const ManagedVTable *vtable, Object *proto)
-{
- InternalClass *c = engine->emptyClass->changeVTable(vtable);
- if (!proto)
- return c;
- return c->changePrototype(proto);
-}
-
-InternalClass *InternalClass::changePrototype(Object *proto)
-{
- if (prototype == proto)
- return this;
-
- Transition t;
- t.prototype = proto;
- t.flags = Transition::ProtoChange;
-
- QHash<Transition, InternalClass *>::const_iterator tit = transitions.constFind(t);
- if (tit != transitions.constEnd())
- return tit.value();
-
- // create a new class and add it to the tree
- InternalClass *newClass;
- if (!size) {
- newClass = engine->newClass(*this);
- newClass->prototype = proto;
- } else {
- newClass = engine->emptyClass->changeVTable(vtable);
- newClass = newClass->changePrototype(proto);
- for (uint i = 0; i < size; ++i) {
- if (!propertyData.at(i).isEmpty())
- newClass = newClass->addMember(nameMap.at(i), propertyData.at(i));
- }
- }
-
- transitions.insert(t, newClass);
+ t.lookup = newClass;
+ Q_ASSERT(t.lookup);
return newClass;
}
-InternalClass *InternalClass::changeVTable(const ManagedVTable *vt)
+InternalClass *InternalClass::nonExtensible()
{
- if (vtable == vt)
+ if (!extensible)
return this;
- Transition t;
- t.vtable = vt;
- t.flags = Transition::VTableChange;
-
- QHash<Transition, InternalClass *>::const_iterator tit = transitions.constFind(t);
- if (tit != transitions.constEnd())
- return tit.value();
+ Transition temp = { Q_NULLPTR, Q_NULLPTR, Transition::NotExtensible};
+ Transition &t = lookupOrInsertTransition(temp);
+ if (t.lookup)
+ return t.lookup;
- // create a new class and add it to the tree
- InternalClass *newClass;
- if (this == engine->emptyClass) {
- newClass = engine->newClass(*this);
- newClass->vtable = vt;
- } else {
- newClass = engine->emptyClass->changeVTable(vt);
- newClass = newClass->changePrototype(prototype);
- for (uint i = 0; i < size; ++i) {
- if (!propertyData.at(i).isEmpty())
- newClass = newClass->addMember(nameMap.at(i), propertyData.at(i));
- }
- }
+ InternalClass *newClass = engine->newClass(*this);
+ newClass->extensible = false;
- transitions.insert(t, newClass);
+ t.lookup = newClass;
+ Q_ASSERT(t.lookup);
return newClass;
}
@@ -273,45 +222,46 @@ void InternalClass::addMember(Object *object, String *string, PropertyAttributes
}
uint idx;
- InternalClass *newClass = object->internalClass()->addMemberImpl(string, data, &idx);
+ InternalClass *newClass = object->internalClass()->addMemberImpl(string->identifier(), data, &idx);
if (index)
*index = idx;
object->setInternalClass(newClass);
}
-
InternalClass *InternalClass::addMember(String *string, PropertyAttributes data, uint *index)
{
- data.resolve();
engine->identifierTable->identifier(string);
+ return addMember(string->identifier(), data, index);
+}
- if (propertyTable.lookup(string->d()->identifier) < size)
- return changeMember(string, data, index);
+InternalClass *InternalClass::addMember(Identifier *identifier, PropertyAttributes data, uint *index)
+{
+ data.resolve();
+
+ if (propertyTable.lookup(identifier) < size)
+ return changeMember(identifier, data, index);
- return addMemberImpl(string, data, index);
+ return addMemberImpl(identifier, data, index);
}
-InternalClass *InternalClass::addMemberImpl(String *string, PropertyAttributes data, uint *index)
+InternalClass *InternalClass::addMemberImpl(Identifier *identifier, PropertyAttributes data, uint *index)
{
- Transition t = { { string->d()->identifier }, (int)data.flags() };
- QHash<Transition, InternalClass *>::const_iterator tit = transitions.constFind(t);
+ Transition temp = { identifier, 0, (int)data.flags() };
+ Transition &t = lookupOrInsertTransition(temp);
if (index)
*index = size;
- if (tit != transitions.constEnd())
- return tit.value();
+
+ if (t.lookup)
+ return t.lookup;
// create a new class and add it to the tree
InternalClass *newClass = engine->newClass(*this);
- PropertyHash::Entry e = { string->d()->identifier, newClass->size };
+ PropertyHash::Entry e = { identifier, newClass->size };
newClass->propertyTable.addEntry(e, newClass->size);
- // The incoming string can come from anywhere, so make sure to
- // store a string in the nameMap that's guaranteed to get
- // marked properly during GC.
- String *name = engine->newIdentifier(string->toQString());
- newClass->nameMap.add(newClass->size, name);
+ newClass->nameMap.add(newClass->size, identifier);
newClass->propertyData.add(newClass->size, data);
++newClass->size;
if (data.isAccessor()) {
@@ -322,7 +272,8 @@ InternalClass *InternalClass::addMemberImpl(String *string, PropertyAttributes d
++newClass->size;
}
- transitions.insert(t, newClass);
+ t.lookup = newClass;
+ Q_ASSERT(t.lookup);
return newClass;
}
@@ -332,15 +283,14 @@ void InternalClass::removeMember(Object *object, Identifier *id)
uint propIdx = oldClass->propertyTable.lookup(id);
Q_ASSERT(propIdx < oldClass->size);
- Transition t = { { id } , -1 };
- QHash<Transition, InternalClass *>::const_iterator tit = object->internalClass()->transitions.constFind(t);
+ Transition temp = { id, 0, -1 };
+ Transition &t = object->internalClass()->lookupOrInsertTransition(temp);
- if (tit != object->internalClass()->transitions.constEnd()) {
- object->setInternalClass(tit.value());
+ if (t.lookup) {
+ object->setInternalClass(t.lookup);
} else {
// create a new class and add it to the tree
- InternalClass *newClass = oldClass->engine->emptyClass->changeVTable(oldClass->vtable);
- newClass = newClass->changePrototype(oldClass->prototype);
+ InternalClass *newClass = oldClass->engine->emptyClass;
for (uint i = 0; i < oldClass->size; ++i) {
if (i == propIdx)
continue;
@@ -351,9 +301,10 @@ void InternalClass::removeMember(Object *object, Identifier *id)
}
// remove the entry in memberdata
- memmove(object->memberData().data() + propIdx, object->memberData().data() + propIdx + 1, (object->internalClass()->size - propIdx)*sizeof(Value));
+ memmove(object->memberData()->data + propIdx, object->memberData()->data + propIdx + 1, (object->internalClass()->size - propIdx)*sizeof(Value));
- oldClass->transitions.insert(t, object->internalClass());
+ t.lookup = object->internalClass();
+ Q_ASSERT(t.lookup);
}
uint InternalClass::find(const String *string)
@@ -368,14 +319,21 @@ uint InternalClass::find(const String *string)
return UINT_MAX;
}
+uint InternalClass::find(const Identifier *id)
+{
+ uint index = propertyTable.lookup(id);
+ if (index < size)
+ return index;
+
+ return UINT_MAX;
+}
+
InternalClass *InternalClass::sealed()
{
if (m_sealed)
return m_sealed;
m_sealed = engine->emptyClass;
- m_sealed = m_sealed->changeVTable(vtable);
- m_sealed = m_sealed->changePrototype(prototype);
for (uint i = 0; i < size; ++i) {
PropertyAttributes attrs = propertyData.at(i);
if (attrs.isEmpty())
@@ -383,6 +341,7 @@ InternalClass *InternalClass::sealed()
attrs.setConfigurable(false);
m_sealed = m_sealed->addMember(nameMap.at(i), attrs);
}
+ m_sealed = m_sealed->nonExtensible();
m_sealed->m_sealed = m_sealed;
return m_sealed;
@@ -394,8 +353,6 @@ InternalClass *InternalClass::frozen()
return m_frozen;
m_frozen = engine->emptyClass;
- m_frozen = m_frozen->changeVTable(vtable);
- m_frozen = m_frozen->changePrototype(prototype);
for (uint i = 0; i < size; ++i) {
PropertyAttributes attrs = propertyData.at(i);
if (attrs.isEmpty())
@@ -404,6 +361,7 @@ InternalClass *InternalClass::frozen()
attrs.setConfigurable(false);
m_frozen = m_frozen->addMember(nameMap.at(i), attrs);
}
+ m_frozen = m_frozen->nonExtensible();
m_frozen->m_frozen = m_frozen;
m_frozen->m_sealed = m_frozen;
@@ -421,35 +379,25 @@ void InternalClass::destroy()
continue;
next->engine = 0;
next->propertyTable.~PropertyHash();
- next->nameMap.~SharedInternalClassData<String *>();
+ next->nameMap.~SharedInternalClassData<Identifier *>();
next->propertyData.~SharedInternalClassData<PropertyAttributes>();
if (next->m_sealed)
destroyStack.append(next->m_sealed);
if (next->m_frozen)
destroyStack.append(next->m_frozen);
- destroyStack.append(next->transitions.values());
- next->transitions.clear();
- }
-}
-struct InternalClassPoolVisitor
-{
- ExecutionEngine *engine;
- void operator()(InternalClass *klass)
- {
- // all prototype changes are done on the empty class
- Q_ASSERT(!klass->prototype || klass != engine->emptyClass);
-
- if (klass->prototype)
- klass->prototype->mark(engine);
+ for (size_t i = 0; i < next->transitions.size(); ++i) {
+ Q_ASSERT(next->transitions.at(i).lookup);
+ destroyStack.append(next->transitions.at(i).lookup);
+ }
+
+ next->transitions.~vector<Transition>();
}
-};
+}
void InternalClassPool::markObjects(ExecutionEngine *engine)
{
- InternalClassPoolVisitor v;
- v.engine = engine;
- visitManagedPool<InternalClass, InternalClassPoolVisitor>(v);
+ Q_UNUSED(engine);
}
QT_END_NAMESPACE
diff --git a/src/qml/jsruntime/qv4internalclass_p.h b/src/qml/jsruntime/qv4internalclass_p.h
index 06feea1d5a..3289058cb7 100644
--- a/src/qml/jsruntime/qv4internalclass_p.h
+++ b/src/qml/jsruntime/qv4internalclass_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -33,9 +33,9 @@
#ifndef QV4INTERNALCLASS_H
#define QV4INTERNALCLASS_H
-#include <QHash>
-#include <QVector>
#include "qv4global_p.h"
+
+#include <QHash>
#include <private/qqmljsmemorypool_p.h>
QT_BEGIN_NAMESPACE
@@ -189,49 +189,47 @@ private:
struct InternalClassTransition
{
- union {
- Identifier *id;
- Object *prototype;
- const ManagedVTable *vtable;
- };
+ Identifier *id;
+ InternalClass *lookup;
int flags;
enum {
// range 0-0xff is reserved for attribute changes
- ProtoChange = 0x100,
- VTableChange = 0x200
+ NotExtensible = 0x100
};
bool operator==(const InternalClassTransition &other) const
{ return id == other.id && flags == other.flags; }
+
+ bool operator<(const InternalClassTransition &other) const
+ { return id < other.id; }
};
-uint qHash(const QV4::InternalClassTransition &t, uint = 0);
struct InternalClass : public QQmlJS::Managed {
ExecutionEngine *engine;
- Object *prototype;
- const ManagedVTable *vtable;
PropertyHash propertyTable; // id to valueIndex
- SharedInternalClassData<String *> nameMap;
+ SharedInternalClassData<Identifier *> nameMap;
SharedInternalClassData<PropertyAttributes> propertyData;
typedef InternalClassTransition Transition;
- QHash<Transition, InternalClass *> transitions; // id to next class, positive means add, negative delete
+ std::vector<Transition> transitions;
+ InternalClassTransition &lookupOrInsertTransition(const InternalClassTransition &t);
InternalClass *m_sealed;
InternalClass *m_frozen;
uint size;
+ bool extensible;
- static InternalClass *create(ExecutionEngine *engine, const ManagedVTable *vtable, Object *proto);
- InternalClass *changePrototype(Object *proto);
- InternalClass *changeVTable(const ManagedVTable *vt);
+ InternalClass *nonExtensible();
static void addMember(Object *object, String *string, PropertyAttributes data, uint *index);
InternalClass *addMember(String *string, PropertyAttributes data, uint *index = 0);
- InternalClass *changeMember(String *string, PropertyAttributes data, uint *index = 0);
+ InternalClass *addMember(Identifier *identifier, PropertyAttributes data, uint *index = 0);
+ InternalClass *changeMember(Identifier *identifier, PropertyAttributes data, uint *index = 0);
static void changeMember(Object *object, String *string, PropertyAttributes data, uint *index = 0);
static void removeMember(Object *object, Identifier *id);
uint find(const String *s);
+ uint find(const Identifier *id);
InternalClass *sealed();
InternalClass *frozen();
@@ -239,7 +237,7 @@ struct InternalClass : public QQmlJS::Managed {
void destroy();
private:
- InternalClass *addMemberImpl(String *string, PropertyAttributes data, uint *index);
+ InternalClass *addMemberImpl(Identifier *identifier, PropertyAttributes data, uint *index);
friend struct ExecutionEngine;
InternalClass(ExecutionEngine *engine);
InternalClass(const InternalClass &other);
diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp
index 268559dec8..e7905974df 100644
--- a/src/qml/jsruntime/qv4jsonobject.cpp
+++ b/src/qml/jsruntime/qv4jsonobject.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -37,6 +37,8 @@
#include <qv4booleanobject_p.h>
#include <qv4objectiterator_p.h>
#include <qv4scopedvalue_p.h>
+#include <qv4runtime_p.h>
+
#include <qjsondocument.h>
#include <qstack.h>
#include <qstringlist.h>
@@ -63,7 +65,7 @@ DEFINE_OBJECT_VTABLE(JsonObject);
class JsonParser
{
public:
- JsonParser(ExecutionContext *context, const QChar *json, int length);
+ JsonParser(ExecutionEngine *engine, const QChar *json, int length);
ReturnedValue parse(QJsonParseError *error);
@@ -75,10 +77,10 @@ private:
ReturnedValue parseArray();
bool parseMember(Object *o);
bool parseString(QString *string);
- bool parseValue(ValueRef val);
- bool parseNumber(ValueRef val);
+ bool parseValue(Value *val);
+ bool parseNumber(Value *val);
- ExecutionContext *context;
+ ExecutionEngine *engine;
const QChar *head;
const QChar *json;
const QChar *end;
@@ -90,8 +92,8 @@ private:
static const int nestingLimit = 1024;
-JsonParser::JsonParser(ExecutionContext *context, const QChar *json, int length)
- : context(context), head(json), json(json), nestingLevel(0), lastError(QJsonParseError::NoError)
+JsonParser::JsonParser(ExecutionEngine *engine, const QChar *json, int length)
+ : engine(engine), head(json), json(json), nestingLevel(0), lastError(QJsonParseError::NoError)
{
end = json + length;
}
@@ -187,7 +189,7 @@ ReturnedValue JsonParser::parse(QJsonParseError *error)
eatSpace();
- Scope scope(context);
+ Scope scope(engine);
ScopedValue v(scope);
if (!parseValue(v)) {
#ifdef PARSER_DEBUG
@@ -211,7 +213,7 @@ ReturnedValue JsonParser::parse(QJsonParseError *error)
END;
error->offset = 0;
error->error = QJsonParseError::NoError;
- return v.asReturnedValue();
+ return v->asReturnedValue();
}
/*
@@ -227,9 +229,9 @@ ReturnedValue JsonParser::parseObject()
}
BEGIN << "parseObject pos=" << json;
- Scope scope(context);
+ Scope scope(engine);
- ScopedObject o(scope, context->d()->engine->newObject());
+ ScopedObject o(scope, engine->newObject());
QChar token = nextToken();
while (token == Quote) {
@@ -263,7 +265,7 @@ ReturnedValue JsonParser::parseObject()
bool JsonParser::parseMember(Object *o)
{
BEGIN << "parseMember";
- Scope scope(context);
+ Scope scope(engine);
QString key;
if (!parseString(&key))
@@ -277,12 +279,12 @@ bool JsonParser::parseMember(Object *o)
if (!parseValue(val))
return false;
- ScopedString s(scope, context->d()->engine->newIdentifier(key));
+ ScopedString s(scope, engine->newIdentifier(key));
uint idx = s->asArrayIndex();
if (idx < UINT_MAX) {
o->putIndexed(idx, val);
} else {
- o->insertMember(s.getPointer(), val);
+ o->insertMember(s, val);
}
END;
@@ -294,9 +296,9 @@ bool JsonParser::parseMember(Object *o)
*/
ReturnedValue JsonParser::parseArray()
{
- Scope scope(context);
+ Scope scope(engine);
BEGIN << "parseArray";
- Scoped<ArrayObject> array(scope, context->d()->engine->newArrayObject());
+ ScopedArrayObject array(scope, engine->newArrayObject());
if (++nestingLevel > nestingLimit) {
lastError = QJsonParseError::DeepNesting;
@@ -342,7 +344,7 @@ value = false / null / true / object / array / number / string
*/
-bool JsonParser::parseValue(ValueRef val)
+bool JsonParser::parseValue(Value *val)
{
BEGIN << "parse Value" << *json;
@@ -399,7 +401,7 @@ bool JsonParser::parseValue(ValueRef val)
return false;
DEBUG << "value: string";
END;
- val = context->d()->engine->newString(value);
+ *val = Value::fromHeapObject(engine->newString(value));
return true;
}
case BeginArray: {
@@ -450,7 +452,7 @@ bool JsonParser::parseValue(ValueRef val)
*/
-bool JsonParser::parseNumber(ValueRef val)
+bool JsonParser::parseNumber(Value *val)
{
BEGIN << "parseNumber" << *json;
@@ -639,19 +641,21 @@ struct Stringify
{
ExecutionContext *ctx;
FunctionObject *replacerFunction;
- QVector<String *> propertyList;
+ // ### GC
+ QVector<Heap::String *> propertyList;
QString gap;
QString indent;
- QStack<Object *> stack;
+ // ### GC
+ QStack<Heap::Object *> stack;
Stringify(ExecutionContext *ctx) : ctx(ctx), replacerFunction(0) {}
- QString Str(const QString &key, ValueRef v);
+ QString Str(const QString &key, const Value &v);
QString JA(ArrayObject *a);
QString JO(Object *o);
- QString makeMember(const QString &key, ValueRef v);
+ QString makeMember(const QString &key, const Value &v);
};
static QString quote(const QString &str)
@@ -695,15 +699,15 @@ static QString quote(const QString &str)
return product;
}
-QString Stringify::Str(const QString &key, ValueRef v)
+QString Stringify::Str(const QString &key, const Value &v)
{
Scope scope(ctx);
- ScopedValue value(scope, *v);
+ ScopedValue value(scope, v);
ScopedObject o(scope, value);
if (o) {
ScopedString s(scope, ctx->d()->engine->newString(QStringLiteral("toJSON")));
- Scoped<FunctionObject> toJSON(scope, o->get(s.getPointer()));
+ ScopedFunctionObject toJSON(scope, o->get(s));
if (!!toJSON) {
ScopedCallData callData(scope, 1);
callData->thisObject = value;
@@ -714,7 +718,7 @@ QString Stringify::Str(const QString &key, ValueRef v)
if (replacerFunction) {
ScopedObject holder(scope, ctx->d()->engine->newObject());
- holder->put(ctx, QString(), value);
+ holder->put(scope.engine, QString(), value);
ScopedCallData callData(scope, 2);
callData->args[0] = ctx->d()->engine->newString(key);
callData->args[1] = value;
@@ -722,14 +726,14 @@ QString Stringify::Str(const QString &key, ValueRef v)
value = replacerFunction->call(callData);
}
- o = value.asReturnedValue();
+ o = value->asReturnedValue();
if (o) {
if (NumberObject *n = o->asNumberObject())
- value = n->value();
+ value = Encode(n->value());
else if (StringObject *so = o->asStringObject())
value = so->d()->value;
else if (BooleanObject *b =o->asBooleanObject())
- value = b->value();
+ value = Encode(b->value());
}
if (value->isNull())
@@ -741,15 +745,14 @@ QString Stringify::Str(const QString &key, ValueRef v)
if (value->isNumber()) {
double d = value->toNumber();
- return std::isfinite(d) ? value->toString(ctx)->toQString() : QStringLiteral("null");
+ return std::isfinite(d) ? value->toQString() : QStringLiteral("null");
}
- o = value.asReturnedValue();
+ o = value->asReturnedValue();
if (o) {
if (!o->asFunctionObject()) {
if (o->asArrayObject()) {
- ScopedArrayObject a(scope, o);
- return JA(a);
+ return JA(static_cast<ArrayObject *>(o.getPointer()));
} else {
return JO(o);
}
@@ -759,7 +762,7 @@ QString Stringify::Str(const QString &key, ValueRef v)
return QString();
}
-QString Stringify::makeMember(const QString &key, ValueRef v)
+QString Stringify::makeMember(const QString &key, const Value &v)
{
QString strP = Str(key, v);
if (!strP.isEmpty()) {
@@ -774,15 +777,15 @@ QString Stringify::makeMember(const QString &key, ValueRef v)
QString Stringify::JO(Object *o)
{
- if (stack.contains(o)) {
- ctx->throwTypeError();
+ if (stack.contains(o->d())) {
+ ctx->engine()->throwTypeError();
return QString();
}
Scope scope(ctx);
QString result;
- stack.push(o);
+ stack.push(o->d());
QString stepback = indent;
indent += gap;
@@ -806,7 +809,7 @@ QString Stringify::JO(Object *o)
for (int i = 0; i < propertyList.size(); ++i) {
bool exists;
s = propertyList.at(i);
- ScopedValue v(scope, o->get(s.getPointer(), &exists));
+ ScopedValue v(scope, o->get(s, &exists));
if (!exists)
continue;
QString member = makeMember(s->toQString(), v);
@@ -831,15 +834,15 @@ QString Stringify::JO(Object *o)
QString Stringify::JA(ArrayObject *a)
{
- if (stack.contains(a)) {
- ctx->throwTypeError();
+ if (stack.contains(a->d())) {
+ ctx->engine()->throwTypeError();
return QString();
}
Scope scope(a->engine());
QString result;
- stack.push(a);
+ stack.push(a->d());
QString stepback = indent;
indent += gap;
@@ -875,14 +878,14 @@ QString Stringify::JA(ArrayObject *a)
}
-JsonObject::Data::Data(InternalClass *ic)
- : Object::Data(ic)
+Heap::JsonObject::JsonObject(ExecutionEngine *e)
+ : Heap::Object(e->emptyClass, e->objectPrototype.asObject())
{
- Scope scope(ic->engine);
+ Scope scope(e);
ScopedObject o(scope, this);
- o->defineDefaultProperty(QStringLiteral("parse"), method_parse, 2);
- o->defineDefaultProperty(QStringLiteral("stringify"), method_stringify, 3);
+ o->defineDefaultProperty(QStringLiteral("parse"), QV4::JsonObject::method_parse, 2);
+ o->defineDefaultProperty(QStringLiteral("stringify"), QV4::JsonObject::method_stringify, 3);
}
@@ -890,18 +893,18 @@ ReturnedValue JsonObject::method_parse(CallContext *ctx)
{
Scope scope(ctx);
ScopedValue v(scope, ctx->argument(0));
- QString jtext = v->toString(ctx)->toQString();
+ QString jtext = v->toQString();
DEBUG << "parsing source = " << jtext;
- JsonParser parser(ctx, jtext.constData(), jtext.length());
+ JsonParser parser(scope.engine, jtext.constData(), jtext.length());
QJsonParseError error;
ScopedValue result(scope, parser.parse(&error));
if (error.error != QJsonParseError::NoError) {
DEBUG << "parse error" << error.errorString();
- return ctx->throwSyntaxError(QStringLiteral("JSON.parse: Parse error"));
+ return ctx->engine()->throwSyntaxError(QStringLiteral("JSON.parse: Parse error"));
}
- return result.asReturnedValue();
+ return result->asReturnedValue();
}
ReturnedValue JsonObject::method_stringify(CallContext *ctx)
@@ -910,7 +913,7 @@ ReturnedValue JsonObject::method_stringify(CallContext *ctx)
Stringify stringify(ctx);
- Scoped<Object> o(scope, ctx->argument(1));
+ ScopedObject o(scope, ctx->argument(1));
if (o) {
stringify.replacerFunction = o->asFunctionObject();
if (o->isArrayObject()) {
@@ -919,11 +922,11 @@ ReturnedValue JsonObject::method_stringify(CallContext *ctx)
for (uint i = 0; i < arrayLen; ++i) {
v = o->getIndexed(i);
if (v->asNumberObject() || v->asStringObject() || v->isNumber())
- v = RuntimeHelpers::toString(ctx, v);
+ v = RuntimeHelpers::toString(scope.engine, v);
if (v->isString()) {
String *s = v->stringValue();
- if (!stringify.propertyList.contains(s))
- stringify.propertyList.append(s);
+ if (!stringify.propertyList.contains(s->d()))
+ stringify.propertyList.append(s->d());
}
}
}
@@ -931,7 +934,7 @@ ReturnedValue JsonObject::method_stringify(CallContext *ctx)
ScopedValue s(scope, ctx->argument(2));
if (NumberObject *n = s->asNumberObject())
- s = n->value();
+ s = Encode(n->value());
else if (StringObject *so = s->asStringObject())
s = so->d()->value;
@@ -954,7 +957,7 @@ ReturnedValue JsonObject::method_stringify(CallContext *ctx)
ReturnedValue JsonObject::fromJsonValue(ExecutionEngine *engine, const QJsonValue &value)
{
if (value.isString())
- return engine->currentContext()->d()->engine->newString(value.toString())->asReturnedValue();
+ return engine->currentContext()->engine->newString(value.toString())->asReturnedValue();
else if (value.isDouble())
return Encode(value.toDouble());
else if (value.isBool())
@@ -969,38 +972,39 @@ ReturnedValue JsonObject::fromJsonValue(ExecutionEngine *engine, const QJsonValu
return Encode::undefined();
}
-QJsonValue JsonObject::toJsonValue(const ValueRef value,
- V4ObjectSet &visitedObjects)
+QJsonValue JsonObject::toJsonValue(const Value &value, V4ObjectSet &visitedObjects)
{
- if (value->isNumber())
- return QJsonValue(value->toNumber());
- else if (value->isBoolean())
- return QJsonValue((bool)value->booleanValue());
- else if (value->isNull())
+ if (value.isNumber())
+ return QJsonValue(value.toNumber());
+ else if (value.isBoolean())
+ return QJsonValue((bool)value.booleanValue());
+ else if (value.isNull())
return QJsonValue(QJsonValue::Null);
- else if (value->isUndefined())
+ else if (value.isUndefined())
return QJsonValue(QJsonValue::Undefined);
+ else if (value.isString())
+ return QJsonValue(value.toQString());
- Q_ASSERT(value->engine());
- Scope scope(value->engine());
+ Q_ASSERT(value.isObject());
+ Scope scope(value.asObject()->engine());
ScopedArrayObject a(scope, value);
if (a)
return toJsonArray(a, visitedObjects);
ScopedObject o(scope, value);
if (o)
return toJsonObject(o, visitedObjects);
- return QJsonValue(value->toQString());
+ return QJsonValue(value.toQString());
}
QV4::ReturnedValue JsonObject::fromJsonObject(ExecutionEngine *engine, const QJsonObject &object)
{
Scope scope(engine);
- Scoped<Object> o(scope, engine->newObject());
+ ScopedObject o(scope, engine->newObject());
ScopedString s(scope);
ScopedValue v(scope);
- for (QJsonObject::const_iterator it = object.begin(); it != object.end(); ++it) {
+ for (QJsonObject::const_iterator it = object.begin(), cend = object.end(); it != cend; ++it) {
v = fromJsonValue(engine, it.value());
- o->put((s = engine->newString(it.key())).getPointer(), v);
+ o->put((s = engine->newString(it.key())), v);
}
return o.asReturnedValue();
}
@@ -1013,14 +1017,14 @@ QJsonObject JsonObject::toJsonObject(Object *o, V4ObjectSet &visitedObjects)
Scope scope(o->engine());
- if (visitedObjects.contains(o)) {
+ if (visitedObjects.contains(o->d())) {
// Avoid recursion.
// For compatibility with QVariant{List,Map} conversion, we return an
// empty object (and no error is thrown).
return result;
}
- visitedObjects.insert(o);
+ visitedObjects.insert(o->d());
ObjectIterator it(scope, o, ObjectIterator::EnumerableOnly);
ScopedValue name(scope);
@@ -1035,7 +1039,7 @@ QJsonObject JsonObject::toJsonObject(Object *o, V4ObjectSet &visitedObjects)
result.insert(key, toJsonValue(val, visitedObjects));
}
- visitedObjects.remove(o);
+ visitedObjects.remove(o->d());
return result;
}
@@ -1044,7 +1048,7 @@ QV4::ReturnedValue JsonObject::fromJsonArray(ExecutionEngine *engine, const QJso
{
Scope scope(engine);
int size = array.size();
- Scoped<ArrayObject> a(scope, engine->newArrayObject());
+ ScopedArrayObject a(scope, engine->newArrayObject());
a->arrayReserve(size);
ScopedValue v(scope);
for (int i = 0; i < size; i++)
@@ -1061,14 +1065,14 @@ QJsonArray JsonObject::toJsonArray(ArrayObject *a, V4ObjectSet &visitedObjects)
Scope scope(a->engine());
- if (visitedObjects.contains(a)) {
+ if (visitedObjects.contains(a->d())) {
// Avoid recursion.
// For compatibility with QVariant{List,Map} conversion, we return an
// empty array (and no error is thrown).
return result;
}
- visitedObjects.insert(a);
+ visitedObjects.insert(a->d());
ScopedValue v(scope);
quint32 length = a->getLength();
@@ -1079,7 +1083,7 @@ QJsonArray JsonObject::toJsonArray(ArrayObject *a, V4ObjectSet &visitedObjects)
result.append(toJsonValue(v, visitedObjects));
}
- visitedObjects.remove(a);
+ visitedObjects.remove(a->d());
return result;
}
diff --git a/src/qml/jsruntime/qv4jsonobject_p.h b/src/qml/jsruntime/qv4jsonobject_p.h
index 6b9840156d..81a783ee92 100644
--- a/src/qml/jsruntime/qv4jsonobject_p.h
+++ b/src/qml/jsruntime/qv4jsonobject_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -42,14 +42,20 @@ QT_BEGIN_NAMESPACE
namespace QV4 {
+namespace Heap {
+
+struct JsonObject : Object {
+ JsonObject(ExecutionEngine *e);
+};
+
+}
+
struct JsonObject : Object {
- struct Data : Object::Data {
- Data(InternalClass *ic);
- };
Q_MANAGED_TYPE(JsonObject)
- V4_OBJECT(Object)
+ V4_OBJECT2(JsonObject, Object)
private:
- typedef QSet<QV4::Object *> V4ObjectSet;
+ // ### GC
+ typedef QSet<QV4::Heap::Base *> V4ObjectSet;
public:
static ReturnedValue method_parse(CallContext *ctx);
@@ -59,7 +65,7 @@ public:
static ReturnedValue fromJsonObject(ExecutionEngine *engine, const QJsonObject &object);
static ReturnedValue fromJsonArray(ExecutionEngine *engine, const QJsonArray &array);
- static inline QJsonValue toJsonValue(const QV4::ValueRef value)
+ static inline QJsonValue toJsonValue(const QV4::Value &value)
{ V4ObjectSet visitedObjects; return toJsonValue(value, visitedObjects); }
static inline QJsonObject toJsonObject(QV4::Object *o)
{ V4ObjectSet visitedObjects; return toJsonObject(o, visitedObjects); }
@@ -67,7 +73,7 @@ public:
{ V4ObjectSet visitedObjects; return toJsonArray(a, visitedObjects); }
private:
- static QJsonValue toJsonValue(const QV4::ValueRef value, V4ObjectSet &visitedObjects);
+ static QJsonValue toJsonValue(const QV4::Value &value, V4ObjectSet &visitedObjects);
static QJsonObject toJsonObject(Object *o, V4ObjectSet &visitedObjects);
static QJsonArray toJsonArray(ArrayObject *a, V4ObjectSet &visitedObjects);
diff --git a/src/qml/jsruntime/qv4lookup.cpp b/src/qml/jsruntime/qv4lookup.cpp
index 254666eca2..82b20337cb 100644
--- a/src/qml/jsruntime/qv4lookup.cpp
+++ b/src/qml/jsruntime/qv4lookup.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -39,87 +39,91 @@ QT_BEGIN_NAMESPACE
using namespace QV4;
-ReturnedValue Lookup::lookup(ValueRef thisObject, Object *obj, PropertyAttributes *attrs)
+ReturnedValue Lookup::lookup(const Value &thisObject, Object *o, PropertyAttributes *attrs)
{
+ ExecutionEngine *engine = o->engine();
+ Identifier *name = engine->currentContext()->compilationUnit->runtimeStrings[nameIndex]->identifier;
int i = 0;
+ Heap::Object *obj = o->d();
while (i < Size && obj) {
- classList[i] = obj->internalClass();
+ classList[i] = obj->internalClass;
- index = obj->internalClass()->find(name);
+ index = obj->internalClass->find(name);
if (index != UINT_MAX) {
level = i;
- *attrs = obj->internalClass()->propertyData.at(index);
- return !attrs->isAccessor() ? obj->memberData()[index].asReturnedValue() : obj->getValue(thisObject, obj->propertyAt(index), *attrs);
+ *attrs = obj->internalClass->propertyData.at(index);
+ return !attrs->isAccessor() ? obj->memberData->data[index].asReturnedValue() : Object::getValue(thisObject, obj->propertyAt(index), *attrs);
}
- obj = obj->prototype();
+ obj = obj->prototype;
++i;
}
level = Size;
while (obj) {
- index = obj->internalClass()->find(name);
+ index = obj->internalClass->find(name);
if (index != UINT_MAX) {
- *attrs = obj->internalClass()->propertyData.at(index);
- return !attrs->isAccessor() ? obj->memberData()[index].asReturnedValue() : obj->getValue(thisObject, obj->propertyAt(index), *attrs);
+ *attrs = obj->internalClass->propertyData.at(index);
+ return !attrs->isAccessor() ? obj->memberData->data[index].asReturnedValue() : Object::getValue(thisObject, obj->propertyAt(index), *attrs);
}
- obj = obj->prototype();
+ obj = obj->prototype;
}
return Primitive::emptyValue().asReturnedValue();
}
-ReturnedValue Lookup::lookup(Object *obj, PropertyAttributes *attrs)
+ReturnedValue Lookup::lookup(Object *thisObject, PropertyAttributes *attrs)
{
- Object *thisObject = obj;
+ Heap::Object *obj = thisObject->d();
+ ExecutionEngine *engine = thisObject->engine();
+ Identifier *name = engine->currentContext()->compilationUnit->runtimeStrings[nameIndex]->identifier;
int i = 0;
while (i < Size && obj) {
- classList[i] = obj->internalClass();
+ classList[i] = obj->internalClass;
- index = obj->internalClass()->find(name);
+ index = obj->internalClass->find(name);
if (index != UINT_MAX) {
level = i;
- *attrs = obj->internalClass()->propertyData.at(index);
- return !attrs->isAccessor() ? obj->memberData()[index].asReturnedValue() : thisObject->getValue(obj->propertyAt(index), *attrs);
+ *attrs = obj->internalClass->propertyData.at(index);
+ return !attrs->isAccessor() ? obj->memberData->data[index].asReturnedValue() : thisObject->getValue(obj->propertyAt(index), *attrs);
}
- obj = obj->prototype();
+ obj = obj->prototype;
++i;
}
level = Size;
while (obj) {
- index = obj->internalClass()->find(name);
+ index = obj->internalClass->find(name);
if (index != UINT_MAX) {
- *attrs = obj->internalClass()->propertyData.at(index);
- return !attrs->isAccessor() ? obj->memberData()[index].asReturnedValue() : thisObject->getValue(obj->propertyAt(index), *attrs);
+ *attrs = obj->internalClass->propertyData.at(index);
+ return !attrs->isAccessor() ? obj->memberData->data[index].asReturnedValue() : thisObject->getValue(obj->propertyAt(index), *attrs);
}
- obj = obj->prototype();
+ obj = obj->prototype;
}
return Primitive::emptyValue().asReturnedValue();
}
-ReturnedValue Lookup::indexedGetterGeneric(Lookup *l, const ValueRef object, const ValueRef index)
+ReturnedValue Lookup::indexedGetterGeneric(Lookup *l, const Value &object, const Value &index)
{
- if (object->isObject() && index->asArrayIndex() < UINT_MAX) {
+ if (object.isObject() && index.asArrayIndex() < UINT_MAX) {
l->indexedGetter = indexedGetterObjectInt;
return indexedGetterObjectInt(l, object, index);
}
return indexedGetterFallback(l, object, index);
}
-ReturnedValue Lookup::indexedGetterFallback(Lookup *l, const ValueRef object, const ValueRef index)
+ReturnedValue Lookup::indexedGetterFallback(Lookup *l, const Value &object, const Value &index)
{
Q_UNUSED(l);
- ExecutionContext *ctx = l->engine->currentContext();
- Scope scope(ctx);
- uint idx = index->asArrayIndex();
+ Scope scope(l->engine);
+ uint idx = index.asArrayIndex();
- Scoped<Object> o(scope, object);
+ ScopedObject o(scope, object);
if (!o) {
if (idx < UINT_MAX) {
- if (String *str = object->asString()) {
+ if (String *str = object.asString()) {
if (idx >= (uint)str->toQString().length()) {
return Encode::undefined();
}
@@ -128,19 +132,19 @@ ReturnedValue Lookup::indexedGetterFallback(Lookup *l, const ValueRef object, co
}
}
- if (object->isNullOrUndefined()) {
- QString message = QStringLiteral("Cannot read property '%1' of %2").arg(index->toQStringNoThrow()).arg(object->toQStringNoThrow());
- return ctx->throwTypeError(message);
+ if (object.isNullOrUndefined()) {
+ QString message = QStringLiteral("Cannot read property '%1' of %2").arg(index.toQStringNoThrow()).arg(object.toQStringNoThrow());
+ return l->engine->throwTypeError(message);
}
- o = RuntimeHelpers::convertToObject(ctx, object);
+ o = RuntimeHelpers::convertToObject(scope.engine, object);
if (!o) // type error
return Encode::undefined();
}
if (idx < UINT_MAX) {
- if (o->arrayData() && !o->arrayData()->hasAttributes()) {
- ScopedValue v(scope, o->arrayData()->get(idx));
+ if (o->d()->arrayData && !o->d()->arrayData->attrs) {
+ ScopedValue v(scope, Scoped<ArrayData>(scope, o->arrayData())->get(idx));
if (!v->isEmpty())
return v->asReturnedValue();
}
@@ -148,24 +152,24 @@ ReturnedValue Lookup::indexedGetterFallback(Lookup *l, const ValueRef object, co
return o->getIndexed(idx);
}
- ScopedString name(scope, index->toString(ctx));
+ ScopedString name(scope, index.toString(scope.engine));
if (scope.hasException())
return Encode::undefined();
- return o->get(name.getPointer());
+ return o->get(name);
}
-ReturnedValue Lookup::indexedGetterObjectInt(Lookup *l, const ValueRef object, const ValueRef index)
+ReturnedValue Lookup::indexedGetterObjectInt(Lookup *l, const Value &object, const Value &index)
{
- uint idx = index->asArrayIndex();
- if (idx == UINT_MAX || !object->isObject())
+ uint idx = index.asArrayIndex();
+ if (idx == UINT_MAX || !object.isObject())
return indexedGetterGeneric(l, object, index);
- Object *o = object->objectValue();
- if (o->arrayData() && o->arrayData()->type() == ArrayData::Simple) {
- SimpleArrayData *s = static_cast<SimpleArrayData *>(o->arrayData());
- if (idx < s->len())
+ Object *o = object.objectValue();
+ if (o->d()->arrayData && o->d()->arrayData->type == Heap::ArrayData::Simple) {
+ Heap::SimpleArrayData *s = static_cast<Heap::SimpleArrayData *>(o->d()->arrayData);
+ if (idx < s->len)
if (!s->data(idx).isEmpty())
return s->data(idx).asReturnedValue();
}
@@ -173,11 +177,11 @@ ReturnedValue Lookup::indexedGetterObjectInt(Lookup *l, const ValueRef object, c
return indexedGetterFallback(l, object, index);
}
-void Lookup::indexedSetterGeneric(Lookup *l, const ValueRef object, const ValueRef index, const ValueRef v)
+void Lookup::indexedSetterGeneric(Lookup *l, const Value &object, const Value &index, const Value &v)
{
- if (object->isObject()) {
- Object *o = object->objectValue();
- if (o->arrayData() && o->arrayData()->type() == ArrayData::Simple && index->asArrayIndex() < UINT_MAX) {
+ if (object.isObject()) {
+ Object *o = object.objectValue();
+ if (o->d()->arrayData && o->d()->arrayData->type == Heap::ArrayData::Simple && index.asArrayIndex() < UINT_MAX) {
l->indexedSetter = indexedSetterObjectInt;
indexedSetterObjectInt(l, object, index, v);
return;
@@ -186,19 +190,18 @@ void Lookup::indexedSetterGeneric(Lookup *l, const ValueRef object, const ValueR
indexedSetterFallback(l, object, index, v);
}
-void Lookup::indexedSetterFallback(Lookup *l, const ValueRef object, const ValueRef index, const ValueRef value)
+void Lookup::indexedSetterFallback(Lookup *l, const Value &object, const Value &index, const Value &value)
{
- ExecutionContext *ctx = l->engine->currentContext();
- Scope scope(ctx);
- ScopedObject o(scope, object->toObject(ctx));
+ Scope scope(l->engine);
+ ScopedObject o(scope, object.toObject(scope.engine));
if (scope.engine->hasException)
return;
- uint idx = index->asArrayIndex();
+ uint idx = index.asArrayIndex();
if (idx < UINT_MAX) {
- if (o->arrayData() && o->arrayData()->type() == ArrayData::Simple) {
- SimpleArrayData *s = static_cast<SimpleArrayData *>(o->arrayData());
- if (idx < s->len() && !s->data(idx).isEmpty()) {
+ if (o->d()->arrayData && o->d()->arrayData->type == Heap::ArrayData::Simple) {
+ Heap::SimpleArrayData *s = static_cast<Heap::SimpleArrayData *>(o->d()->arrayData);
+ if (idx < s->len) {
s->data(idx) = value;
return;
}
@@ -207,22 +210,22 @@ void Lookup::indexedSetterFallback(Lookup *l, const ValueRef object, const Value
return;
}
- ScopedString name(scope, index->toString(ctx));
- o->put(name.getPointer(), value);
+ ScopedString name(scope, index.toString(scope.engine));
+ o->put(name, value);
}
-void Lookup::indexedSetterObjectInt(Lookup *l, const ValueRef object, const ValueRef index, const ValueRef v)
+void Lookup::indexedSetterObjectInt(Lookup *l, const Value &object, const Value &index, const Value &v)
{
- uint idx = index->asArrayIndex();
- if (idx == UINT_MAX || !object->isObject()) {
+ uint idx = index.asArrayIndex();
+ if (idx == UINT_MAX || !object.isObject()) {
indexedSetterGeneric(l, object, index, v);
return;
}
- Object *o = object->objectValue();
- if (o->arrayData() && o->arrayData()->type() == ArrayData::Simple) {
- SimpleArrayData *s = static_cast<SimpleArrayData *>(o->arrayData());
- if (idx < s->len() && !s->data(idx).isEmpty()) {
+ Object *o = object.objectValue();
+ if (o->d()->arrayData && o->d()->arrayData->type == Heap::ArrayData::Simple) {
+ Heap::SimpleArrayData *s = static_cast<Heap::SimpleArrayData *>(o->d()->arrayData);
+ if (idx < s->len) {
s->data(idx) = v;
return;
}
@@ -230,38 +233,40 @@ void Lookup::indexedSetterObjectInt(Lookup *l, const ValueRef object, const Valu
indexedSetterFallback(l, object, index, v);
}
-ReturnedValue Lookup::getterGeneric(QV4::Lookup *l, const ValueRef object)
+ReturnedValue Lookup::getterGeneric(Lookup *l, ExecutionEngine *engine, const Value &object)
{
- if (Object *o = object->asObject())
+ if (Object *o = object.asObject())
return o->getLookup(l);
- ExecutionEngine *engine = l->name->engine();
Object *proto;
- switch (object->type()) {
+ switch (object.type()) {
case Value::Undefined_Type:
case Value::Null_Type:
- return engine->currentContext()->throwTypeError();
+ return engine->throwTypeError();
case Value::Boolean_Type:
- proto = engine->booleanClass->prototype;
+ proto = engine->booleanPrototype.asObject();
break;
- case Value::Managed_Type:
- Q_ASSERT(object->isString());
- proto = engine->stringObjectClass->prototype;
- if (l->name->equals(engine->id_length.getPointer())) {
+ case Value::Managed_Type: {
+ Q_ASSERT(object.isString());
+ proto = engine->stringPrototype.asObject();
+ Scope scope(engine);
+ ScopedString name(scope, engine->currentContext()->compilationUnit->runtimeStrings[l->nameIndex]);
+ if (name->equals(engine->id_length)) {
// special case, as the property is on the object itself
l->getter = stringLengthGetter;
- return stringLengthGetter(l, object);
+ return stringLengthGetter(l, engine, object);
}
break;
+ }
case Value::Integer_Type:
default: // Number
- proto = engine->numberClass->prototype;
+ proto = engine->numberPrototype.asObject();
}
PropertyAttributes attrs;
ReturnedValue v = l->lookup(object, proto, &attrs);
if (v != Primitive::emptyValue().asReturnedValue()) {
- l->type = object->type();
+ l->type = object.type();
l->proto = proto;
if (attrs.isData()) {
if (l->level == 0)
@@ -281,12 +286,12 @@ ReturnedValue Lookup::getterGeneric(QV4::Lookup *l, const ValueRef object)
return Encode::undefined();
}
-ReturnedValue Lookup::getterTwoClasses(Lookup *l, const ValueRef object)
+ReturnedValue Lookup::getterTwoClasses(Lookup *l, ExecutionEngine *engine, const Value &object)
{
Lookup l1 = *l;
if (l1.getter == Lookup::getter0 || l1.getter == Lookup::getter1) {
- if (Object *o = object->asObject()) {
+ if (Object *o = object.asObject()) {
ReturnedValue v = o->getLookup(l);
Lookup l2 = *l;
@@ -314,267 +319,267 @@ ReturnedValue Lookup::getterTwoClasses(Lookup *l, const ValueRef object)
}
l->getter = getterFallback;
- return getterFallback(l, object);
+ return getterFallback(l, engine, object);
}
-ReturnedValue Lookup::getterFallback(Lookup *l, const ValueRef object)
+ReturnedValue Lookup::getterFallback(Lookup *l, ExecutionEngine *engine, const Value &object)
{
- QV4::Scope scope(l->name->engine());
- QV4::ScopedObject o(scope, object->toObject(scope.engine->currentContext()));
+ QV4::Scope scope(engine);
+ QV4::ScopedObject o(scope, object.toObject(scope.engine));
if (!o)
return Encode::undefined();
- QV4::ScopedString s(scope, l->name);
- return o->get(s.getPointer());
+ ScopedString name(scope, engine->currentContext()->compilationUnit->runtimeStrings[l->nameIndex]);
+ return o->get(name);
}
-ReturnedValue Lookup::getter0(Lookup *l, const ValueRef object)
+ReturnedValue Lookup::getter0(Lookup *l, ExecutionEngine *engine, const Value &object)
{
- if (object->isManaged()) {
+ if (object.isManaged()) {
// we can safely cast to a QV4::Object here. If object is actually a string,
// the internal class won't match
- Object *o = object->objectValue();
+ Object *o = object.objectValue();
if (l->classList[0] == o->internalClass())
- return o->memberData()[l->index].asReturnedValue();
+ return o->memberData()->data[l->index].asReturnedValue();
}
- return getterTwoClasses(l, object);
+ return getterTwoClasses(l, engine, object);
}
-ReturnedValue Lookup::getter1(Lookup *l, const ValueRef object)
+ReturnedValue Lookup::getter1(Lookup *l, ExecutionEngine *engine, const Value &object)
{
- if (object->isManaged()) {
+ if (object.isManaged()) {
// we can safely cast to a QV4::Object here. If object is actually a string,
// the internal class won't match
- Object *o = object->objectValue();
+ Object *o = object.objectValue();
if (l->classList[0] == o->internalClass() &&
- l->classList[1] == o->prototype()->internalClass())
- return o->prototype()->memberData()[l->index].asReturnedValue();
+ l->classList[1] == o->prototype()->internalClass)
+ return o->prototype()->memberData->data[l->index].asReturnedValue();
}
- return getterTwoClasses(l, object);
+ return getterTwoClasses(l, engine, object);
}
-ReturnedValue Lookup::getter2(Lookup *l, const ValueRef object)
+ReturnedValue Lookup::getter2(Lookup *l, ExecutionEngine *engine, const Value &object)
{
- if (object->isManaged()) {
+ if (object.isManaged()) {
// we can safely cast to a QV4::Object here. If object is actually a string,
// the internal class won't match
- Object *o = object->objectValue();
+ Object *o = object.objectValue();
if (l->classList[0] == o->internalClass()) {
- o = o->prototype();
- if (l->classList[1] == o->internalClass()) {
- o = o->prototype();
- if (l->classList[2] == o->internalClass())
- return o->memberData()[l->index].asReturnedValue();
+ Heap::Object *p = o->prototype();
+ if (l->classList[1] == p->internalClass) {
+ p = p->prototype;
+ if (l->classList[2] == p->internalClass)
+ return p->memberData->data[l->index].asReturnedValue();
}
}
}
l->getter = getterFallback;
- return getterFallback(l, object);
+ return getterFallback(l, engine, object);
}
-ReturnedValue Lookup::getter0getter0(Lookup *l, const ValueRef object)
+ReturnedValue Lookup::getter0getter0(Lookup *l, ExecutionEngine *engine, const Value &object)
{
- if (object->isManaged()) {
+ if (object.isManaged()) {
// we can safely cast to a QV4::Object here. If object is actually a string,
// the internal class won't match
- Object *o = object->objectValue();
+ Object *o = object.objectValue();
if (l->classList[0] == o->internalClass())
- return o->memberData()[l->index].asReturnedValue();
+ return o->memberData()->data[l->index].asReturnedValue();
if (l->classList[2] == o->internalClass())
- return o->memberData()[l->index2].asReturnedValue();
+ return o->memberData()->data[l->index2].asReturnedValue();
}
l->getter = getterFallback;
- return getterFallback(l, object);
+ return getterFallback(l, engine, object);
}
-ReturnedValue Lookup::getter0getter1(Lookup *l, const ValueRef object)
+ReturnedValue Lookup::getter0getter1(Lookup *l, ExecutionEngine *engine, const Value &object)
{
- if (object->isManaged()) {
+ if (object.isManaged()) {
// we can safely cast to a QV4::Object here. If object is actually a string,
// the internal class won't match
- Object *o = object->objectValue();
+ Object *o = object.objectValue();
if (l->classList[0] == o->internalClass())
- return o->memberData()[l->index].asReturnedValue();
+ return o->memberData()->data[l->index].asReturnedValue();
if (l->classList[2] == o->internalClass() &&
- l->classList[3] == o->prototype()->internalClass())
- return o->prototype()->memberData()[l->index2].asReturnedValue();
+ l->classList[3] == o->prototype()->internalClass)
+ return o->prototype()->memberData->data[l->index2].asReturnedValue();
}
l->getter = getterFallback;
- return getterFallback(l, object);
+ return getterFallback(l, engine, object);
}
-ReturnedValue Lookup::getter1getter1(Lookup *l, const ValueRef object)
+ReturnedValue Lookup::getter1getter1(Lookup *l, ExecutionEngine *engine, const Value &object)
{
- if (object->isManaged()) {
+ if (object.isManaged()) {
// we can safely cast to a QV4::Object here. If object is actually a string,
// the internal class won't match
- Object *o = object->objectValue();
+ Object *o = object.objectValue();
if (l->classList[0] == o->internalClass() &&
- l->classList[1] == o->prototype()->internalClass())
- return o->prototype()->memberData()[l->index].asReturnedValue();
+ l->classList[1] == o->prototype()->internalClass)
+ return o->prototype()->memberData->data[l->index].asReturnedValue();
if (l->classList[2] == o->internalClass() &&
- l->classList[3] == o->prototype()->internalClass())
- return o->prototype()->memberData()[l->index2].asReturnedValue();
- return getterFallback(l, object);
+ l->classList[3] == o->prototype()->internalClass)
+ return o->prototype()->memberData->data[l->index2].asReturnedValue();
+ return getterFallback(l, engine, object);
}
l->getter = getterFallback;
- return getterFallback(l, object);
+ return getterFallback(l, engine, object);
}
-ReturnedValue Lookup::getterAccessor0(Lookup *l, const ValueRef object)
+ReturnedValue Lookup::getterAccessor0(Lookup *l, ExecutionEngine *engine, const Value &object)
{
- if (object->isManaged()) {
+ if (object.isManaged()) {
// we can safely cast to a QV4::Object here. If object is actually a string,
// the internal class won't match
- Object *o = object->objectValue();
+ Object *o = object.objectValue();
if (l->classList[0] == o->internalClass()) {
Scope scope(o->engine());
- FunctionObject *getter = o->propertyAt(l->index)->getter();
+ ScopedFunctionObject getter(scope, o->propertyAt(l->index)->getter());
if (!getter)
return Encode::undefined();
ScopedCallData callData(scope, 0);
- callData->thisObject = *object;
+ callData->thisObject = object;
return getter->call(callData);
}
}
l->getter = getterFallback;
- return getterFallback(l, object);
+ return getterFallback(l, engine, object);
}
-ReturnedValue Lookup::getterAccessor1(Lookup *l, const ValueRef object)
+ReturnedValue Lookup::getterAccessor1(Lookup *l, ExecutionEngine *engine, const Value &object)
{
- if (object->isManaged()) {
+ if (object.isManaged()) {
// we can safely cast to a QV4::Object here. If object is actually a string,
// the internal class won't match
- Object *o = object->objectValue();
- if (l->classList[0] == o->internalClass() &&
- l->classList[1] == o->prototype()->internalClass()) {
- Scope scope(o->engine());
- FunctionObject *getter = o->prototype()->propertyAt(l->index)->getter();
+ Heap::Object *o = object.objectValue()->d();
+ if (l->classList[0] == o->internalClass &&
+ l->classList[1] == o->prototype->internalClass) {
+ Scope scope(o->internalClass->engine);
+ ScopedFunctionObject getter(scope, o->prototype->propertyAt(l->index)->getter());
if (!getter)
return Encode::undefined();
ScopedCallData callData(scope, 0);
- callData->thisObject = *object;
+ callData->thisObject = object;
return getter->call(callData);
}
}
l->getter = getterFallback;
- return getterFallback(l, object);
+ return getterFallback(l, engine, object);
}
-ReturnedValue Lookup::getterAccessor2(Lookup *l, const ValueRef object)
+ReturnedValue Lookup::getterAccessor2(Lookup *l, ExecutionEngine *engine, const Value &object)
{
- if (object->isManaged()) {
+ if (object.isManaged()) {
// we can safely cast to a QV4::Object here. If object is actually a string,
// the internal class won't match
- Object *o = object->objectValue();
- if (l->classList[0] == o->internalClass()) {
- o = o->prototype();
- if (l->classList[1] == o->internalClass()) {
- o = o->prototype();
- if (l->classList[2] == o->internalClass()) {
- Scope scope(o->engine());
- FunctionObject *getter = o->propertyAt(l->index)->getter();
+ Heap::Object *o = object.objectValue()->d();
+ if (l->classList[0] == o->internalClass) {
+ o = o->prototype;
+ if (l->classList[1] == o->internalClass) {
+ o = o->prototype;
+ if (l->classList[2] == o->internalClass) {
+ Scope scope(o->internalClass->engine);
+ ScopedFunctionObject getter(scope, o->propertyAt(l->index)->getter());
if (!getter)
return Encode::undefined();
ScopedCallData callData(scope, 0);
- callData->thisObject = *object;
+ callData->thisObject = object;
return getter->call(callData);
}
}
}
}
l->getter = getterFallback;
- return getterFallback(l, object);
+ return getterFallback(l, engine, object);
}
-ReturnedValue Lookup::primitiveGetter0(Lookup *l, const ValueRef object)
+ReturnedValue Lookup::primitiveGetter0(Lookup *l, ExecutionEngine *engine, const Value &object)
{
- if (object->type() == l->type) {
+ if (object.type() == l->type) {
Object *o = l->proto;
if (l->classList[0] == o->internalClass())
- return o->memberData()[l->index].asReturnedValue();
+ return o->memberData()->data[l->index].asReturnedValue();
}
l->getter = getterGeneric;
- return getterGeneric(l, object);
+ return getterGeneric(l, engine, object);
}
-ReturnedValue Lookup::primitiveGetter1(Lookup *l, const ValueRef object)
+ReturnedValue Lookup::primitiveGetter1(Lookup *l, ExecutionEngine *engine, const Value &object)
{
- if (object->type() == l->type) {
+ if (object.type() == l->type) {
Object *o = l->proto;
if (l->classList[0] == o->internalClass() &&
- l->classList[1] == o->prototype()->internalClass())
- return o->prototype()->memberData()[l->index].asReturnedValue();
+ l->classList[1] == o->prototype()->internalClass)
+ return o->prototype()->memberData->data[l->index].asReturnedValue();
}
l->getter = getterGeneric;
- return getterGeneric(l, object);
+ return getterGeneric(l, engine, object);
}
-ReturnedValue Lookup::primitiveGetterAccessor0(Lookup *l, const ValueRef object)
+ReturnedValue Lookup::primitiveGetterAccessor0(Lookup *l, ExecutionEngine *engine, const Value &object)
{
- if (object->type() == l->type) {
+ if (object.type() == l->type) {
Object *o = l->proto;
if (l->classList[0] == o->internalClass()) {
Scope scope(o->engine());
- FunctionObject *getter = o->propertyAt(l->index)->getter();
+ ScopedFunctionObject getter(scope, o->propertyAt(l->index)->getter());
if (!getter)
return Encode::undefined();
ScopedCallData callData(scope, 0);
- callData->thisObject = *object;
+ callData->thisObject = object;
return getter->call(callData);
}
}
l->getter = getterGeneric;
- return getterGeneric(l, object);
+ return getterGeneric(l, engine, object);
}
-ReturnedValue Lookup::primitiveGetterAccessor1(Lookup *l, const ValueRef object)
+ReturnedValue Lookup::primitiveGetterAccessor1(Lookup *l, ExecutionEngine *engine, const Value &object)
{
- if (object->type() == l->type) {
+ if (object.type() == l->type) {
Object *o = l->proto;
if (l->classList[0] == o->internalClass() &&
- l->classList[1] == o->prototype()->internalClass()) {
+ l->classList[1] == o->prototype()->internalClass) {
Scope scope(o->engine());
- FunctionObject *getter = o->prototype()->propertyAt(l->index)->getter();
+ ScopedFunctionObject getter(scope, o->prototype()->propertyAt(l->index)->getter());
if (!getter)
return Encode::undefined();
ScopedCallData callData(scope, 0);
- callData->thisObject = *object;
+ callData->thisObject = object;
return getter->call(callData);
}
}
l->getter = getterGeneric;
- return getterGeneric(l, object);
+ return getterGeneric(l, engine, object);
}
-ReturnedValue Lookup::stringLengthGetter(Lookup *l, const ValueRef object)
+ReturnedValue Lookup::stringLengthGetter(Lookup *l, ExecutionEngine *engine, const Value &object)
{
- if (String *s = object->asString())
+ if (String *s = object.asString())
return Encode(s->d()->length());
l->getter = getterGeneric;
- return getterGeneric(l, object);
+ return getterGeneric(l, engine, object);
}
-ReturnedValue Lookup::arrayLengthGetter(Lookup *l, const ValueRef object)
+ReturnedValue Lookup::arrayLengthGetter(Lookup *l, ExecutionEngine *engine, const Value &object)
{
- if (ArrayObject *a = object->asArrayObject())
- return a->memberData()[ArrayObject::LengthPropertyIndex].asReturnedValue();
+ if (ArrayObject *a = object.asArrayObject())
+ return a->memberData()->data[Heap::ArrayObject::LengthPropertyIndex].asReturnedValue();
l->getter = getterGeneric;
- return getterGeneric(l, object);
+ return getterGeneric(l, engine, object);
}
-ReturnedValue Lookup::globalGetterGeneric(Lookup *l, ExecutionContext *ctx)
+ReturnedValue Lookup::globalGetterGeneric(Lookup *l, ExecutionEngine *engine)
{
- Object *o = ctx->d()->engine->globalObject;
+ Object *o = engine->globalObject();
PropertyAttributes attrs;
ReturnedValue v = l->lookup(o, &attrs);
if (v != Primitive::emptyValue().asReturnedValue()) {
@@ -596,54 +601,54 @@ ReturnedValue Lookup::globalGetterGeneric(Lookup *l, ExecutionContext *ctx)
return v;
}
}
- Scope scope(ctx);
- Scoped<String> n(scope, l->name);
- return ctx->throwReferenceError(n);
+ Scope scope(engine);
+ ScopedString n(scope, engine->currentContext()->compilationUnit->runtimeStrings[l->nameIndex]);
+ return engine->throwReferenceError(n);
}
-ReturnedValue Lookup::globalGetter0(Lookup *l, ExecutionContext *ctx)
+ReturnedValue Lookup::globalGetter0(Lookup *l, ExecutionEngine *engine)
{
- Object *o = ctx->d()->engine->globalObject;
+ Object *o = engine->globalObject();
if (l->classList[0] == o->internalClass())
- return o->memberData()[l->index].asReturnedValue();
+ return o->memberData()->data[l->index].asReturnedValue();
l->globalGetter = globalGetterGeneric;
- return globalGetterGeneric(l, ctx);
+ return globalGetterGeneric(l, engine);
}
-ReturnedValue Lookup::globalGetter1(Lookup *l, ExecutionContext *ctx)
+ReturnedValue Lookup::globalGetter1(Lookup *l, ExecutionEngine *engine)
{
- Object *o = ctx->d()->engine->globalObject;
+ Object *o = engine->globalObject();
if (l->classList[0] == o->internalClass() &&
- l->classList[1] == o->prototype()->internalClass())
- return o->prototype()->memberData()[l->index].asReturnedValue();
+ l->classList[1] == o->prototype()->internalClass)
+ return o->prototype()->memberData->data[l->index].asReturnedValue();
l->globalGetter = globalGetterGeneric;
- return globalGetterGeneric(l, ctx);
+ return globalGetterGeneric(l, engine);
}
-ReturnedValue Lookup::globalGetter2(Lookup *l, ExecutionContext *ctx)
+ReturnedValue Lookup::globalGetter2(Lookup *l, ExecutionEngine *engine)
{
- Object *o = ctx->d()->engine->globalObject;
- if (l->classList[0] == o->internalClass()) {
- o = o->prototype();
- if (l->classList[1] == o->internalClass()) {
- o = o->prototype();
- if (l->classList[2] == o->internalClass()) {
- return o->prototype()->memberData()[l->index].asReturnedValue();
+ Heap::Object *o = engine->globalObject()->d();
+ if (l->classList[0] == o->internalClass) {
+ o = o->prototype;
+ if (l->classList[1] == o->internalClass) {
+ o = o->prototype;
+ if (l->classList[2] == o->internalClass) {
+ return o->prototype->memberData->data[l->index].asReturnedValue();
}
}
}
l->globalGetter = globalGetterGeneric;
- return globalGetterGeneric(l, ctx);
+ return globalGetterGeneric(l, engine);
}
-ReturnedValue Lookup::globalGetterAccessor0(Lookup *l, ExecutionContext *ctx)
+ReturnedValue Lookup::globalGetterAccessor0(Lookup *l, ExecutionEngine *engine)
{
- Object *o = ctx->d()->engine->globalObject;
+ Object *o = engine->globalObject();
if (l->classList[0] == o->internalClass()) {
Scope scope(o->engine());
- FunctionObject *getter = o->propertyAt(l->index)->getter();
+ ScopedFunctionObject getter(scope, o->propertyAt(l->index)->getter());
if (!getter)
return Encode::undefined();
@@ -652,16 +657,16 @@ ReturnedValue Lookup::globalGetterAccessor0(Lookup *l, ExecutionContext *ctx)
return getter->call(callData);
}
l->globalGetter = globalGetterGeneric;
- return globalGetterGeneric(l, ctx);
+ return globalGetterGeneric(l, engine);
}
-ReturnedValue Lookup::globalGetterAccessor1(Lookup *l, ExecutionContext *ctx)
+ReturnedValue Lookup::globalGetterAccessor1(Lookup *l, ExecutionEngine *engine)
{
- Object *o = ctx->d()->engine->globalObject;
+ Object *o = engine->globalObject();
if (l->classList[0] == o->internalClass() &&
- l->classList[1] == o->prototype()->internalClass()) {
+ l->classList[1] == o->prototype()->internalClass) {
Scope scope(o->engine());
- FunctionObject *getter = o->prototype()->propertyAt(l->index)->getter();
+ ScopedFunctionObject getter(scope, o->prototype()->propertyAt(l->index)->getter());
if (!getter)
return Encode::undefined();
@@ -670,19 +675,19 @@ ReturnedValue Lookup::globalGetterAccessor1(Lookup *l, ExecutionContext *ctx)
return getter->call(callData);
}
l->globalGetter = globalGetterGeneric;
- return globalGetterGeneric(l, ctx);
+ return globalGetterGeneric(l, engine);
}
-ReturnedValue Lookup::globalGetterAccessor2(Lookup *l, ExecutionContext *ctx)
+ReturnedValue Lookup::globalGetterAccessor2(Lookup *l, ExecutionEngine *engine)
{
- Object *o = ctx->d()->engine->globalObject;
- if (l->classList[0] == o->internalClass()) {
- o = o->prototype();
- if (l->classList[1] == o->internalClass()) {
- o = o->prototype();
- if (l->classList[2] == o->internalClass()) {
- Scope scope(o->engine());
- FunctionObject *getter = o->propertyAt(l->index)->getter();
+ Heap::Object *o = engine->globalObject()->d();
+ if (l->classList[0] == o->internalClass) {
+ o = o->prototype;
+ if (l->classList[1] == o->internalClass) {
+ o = o->prototype;
+ if (l->classList[2] == o->internalClass) {
+ Scope scope(o->internalClass->engine);
+ ScopedFunctionObject getter(scope, o->propertyAt(l->index)->getter());
if (!getter)
return Encode::undefined();
@@ -693,29 +698,29 @@ ReturnedValue Lookup::globalGetterAccessor2(Lookup *l, ExecutionContext *ctx)
}
}
l->globalGetter = globalGetterGeneric;
- return globalGetterGeneric(l, ctx);
+ return globalGetterGeneric(l, engine);
}
-void Lookup::setterGeneric(Lookup *l, const ValueRef object, const ValueRef value)
+void Lookup::setterGeneric(Lookup *l, ExecutionEngine *engine, const Value &object, const Value &value)
{
- Scope scope(l->name->engine());
+ Scope scope(engine);
ScopedObject o(scope, object);
if (!o) {
- o = RuntimeHelpers::convertToObject(scope.engine->currentContext(), object);
+ o = RuntimeHelpers::convertToObject(scope.engine, object);
if (!o) // type error
return;
- ScopedString s(scope, l->name);
- o->put(s.getPointer(), value);
+ ScopedString name(scope, engine->currentContext()->compilationUnit->runtimeStrings[l->nameIndex]);
+ o->put(name, value);
return;
}
o->setLookup(l, value);
}
-void Lookup::setterTwoClasses(Lookup *l, const ValueRef object, const ValueRef value)
+void Lookup::setterTwoClasses(Lookup *l, ExecutionEngine *engine, const Value &object, const Value &value)
{
Lookup l1 = *l;
- if (Object *o = object->asObject()) {
+ if (Object *o = object.asObject()) {
o->setLookup(l, value);
if (l->setter == Lookup::setter0) {
@@ -727,76 +732,76 @@ void Lookup::setterTwoClasses(Lookup *l, const ValueRef object, const ValueRef v
}
l->setter = setterFallback;
- setterFallback(l, object, value);
+ setterFallback(l, engine, object, value);
}
-void Lookup::setterFallback(Lookup *l, const ValueRef object, const ValueRef value)
+void Lookup::setterFallback(Lookup *l, ExecutionEngine *engine, const Value &object, const Value &value)
{
- QV4::Scope scope(l->name->engine());
- QV4::ScopedObject o(scope, object->toObject(scope.engine->currentContext()));
+ QV4::Scope scope(engine);
+ QV4::ScopedObject o(scope, object.toObject(scope.engine));
if (o) {
- QV4::ScopedString s(scope, l->name);
- o->put(s.getPointer(), value);
+ ScopedString name(scope, engine->currentContext()->compilationUnit->runtimeStrings[l->nameIndex]);
+ o->put(name, value);
}
}
-void Lookup::setter0(Lookup *l, const ValueRef object, const ValueRef value)
+void Lookup::setter0(Lookup *l, ExecutionEngine *engine, const Value &object, const Value &value)
{
- Object *o = static_cast<Object *>(object->asManaged());
+ Object *o = static_cast<Object *>(object.asManaged());
if (o && o->internalClass() == l->classList[0]) {
- o->memberData()[l->index] = *value;
+ o->memberData()->data[l->index] = value;
return;
}
- setterTwoClasses(l, object, value);
+ setterTwoClasses(l, engine, object, value);
}
-void Lookup::setterInsert0(Lookup *l, const ValueRef object, const ValueRef value)
+void Lookup::setterInsert0(Lookup *l, ExecutionEngine *engine, const Value &object, const Value &value)
{
- Object *o = static_cast<Object *>(object->asManaged());
+ Object *o = static_cast<Object *>(object.asManaged());
if (o && o->internalClass() == l->classList[0]) {
if (!o->prototype()) {
- if (l->index >= o->memberData().size())
+ if (!o->memberData() || l->index >= o->memberData()->size)
o->ensureMemberIndex(l->index);
- o->memberData()[l->index] = *value;
+ o->memberData()->data[l->index] = value;
o->setInternalClass(l->classList[3]);
return;
}
}
l->setter = setterFallback;
- setterFallback(l, object, value);
+ setterFallback(l, engine, object, value);
}
-void Lookup::setterInsert1(Lookup *l, const ValueRef object, const ValueRef value)
+void Lookup::setterInsert1(Lookup *l, ExecutionEngine *engine, const Value &object, const Value &value)
{
- Object *o = static_cast<Object *>(object->asManaged());
+ Object *o = static_cast<Object *>(object.asManaged());
if (o && o->internalClass() == l->classList[0]) {
- Object *p = o->prototype();
- if (p && p->internalClass() == l->classList[1]) {
- if (l->index >= o->memberData().size())
+ Heap::Object *p = o->prototype();
+ if (p && p->internalClass == l->classList[1]) {
+ if (!o->memberData() || l->index >= o->memberData()->size)
o->ensureMemberIndex(l->index);
- o->memberData()[l->index] = *value;
+ o->memberData()->data[l->index] = value;
o->setInternalClass(l->classList[3]);
return;
}
}
l->setter = setterFallback;
- setterFallback(l, object, value);
+ setterFallback(l, engine, object, value);
}
-void Lookup::setterInsert2(Lookup *l, const ValueRef object, const ValueRef value)
+void Lookup::setterInsert2(Lookup *l, ExecutionEngine *engine, const Value &object, const Value &value)
{
- Object *o = static_cast<Object *>(object->asManaged());
+ Object *o = static_cast<Object *>(object.asManaged());
if (o && o->internalClass() == l->classList[0]) {
- Object *p = o->prototype();
- if (p && p->internalClass() == l->classList[1]) {
- p = p->prototype();
- if (p && p->internalClass() == l->classList[2]) {
- if (l->index >= o->memberData().size())
+ Heap::Object *p = o->prototype();
+ if (p && p->internalClass == l->classList[1]) {
+ p = p->prototype;
+ if (p && p->internalClass == l->classList[2]) {
+ if (!o->memberData() || l->index >= o->memberData()->size)
o->ensureMemberIndex(l->index);
- o->memberData()[l->index] = *value;
+ o->memberData()->data[l->index] = value;
o->setInternalClass(l->classList[3]);
return;
}
@@ -804,25 +809,25 @@ void Lookup::setterInsert2(Lookup *l, const ValueRef object, const ValueRef valu
}
l->setter = setterFallback;
- setterFallback(l, object, value);
+ setterFallback(l, engine, object, value);
}
-void Lookup::setter0setter0(Lookup *l, const ValueRef object, const ValueRef value)
+void Lookup::setter0setter0(Lookup *l, ExecutionEngine *engine, const Value &object, const Value &value)
{
- Object *o = static_cast<Object *>(object->asManaged());
+ Object *o = static_cast<Object *>(object.asManaged());
if (o) {
if (o->internalClass() == l->classList[0]) {
- o->memberData()[l->index] = *value;
+ o->memberData()->data[l->index] = value;
return;
}
if (o->internalClass() == l->classList[1]) {
- o->memberData()[l->index2] = *value;
+ o->memberData()->data[l->index2] = value;
return;
}
}
l->setter = setterFallback;
- setterFallback(l, object, value);
+ setterFallback(l, engine, object, value);
}
diff --git a/src/qml/jsruntime/qv4lookup_p.h b/src/qml/jsruntime/qv4lookup_p.h
index 8ff7e98d0f..88397dc36c 100644
--- a/src/qml/jsruntime/qv4lookup_p.h
+++ b/src/qml/jsruntime/qv4lookup_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -47,11 +47,11 @@ namespace QV4 {
struct Lookup {
enum { Size = 4 };
union {
- ReturnedValue (*indexedGetter)(Lookup *l, const ValueRef object, const ValueRef index);
- void (*indexedSetter)(Lookup *l, const ValueRef object, const ValueRef index, const ValueRef v);
- ReturnedValue (*getter)(Lookup *l, const ValueRef object);
- ReturnedValue (*globalGetter)(Lookup *l, ExecutionContext *ctx);
- void (*setter)(Lookup *l, const ValueRef object, const ValueRef v);
+ ReturnedValue (*indexedGetter)(Lookup *l, const Value &object, const Value &index);
+ void (*indexedSetter)(Lookup *l, const Value &object, const Value &index, const Value &v);
+ ReturnedValue (*getter)(Lookup *l, ExecutionEngine *engine, const Value &object);
+ ReturnedValue (*globalGetter)(Lookup *l, ExecutionEngine *engine);
+ void (*setter)(Lookup *l, ExecutionEngine *engine, const Value &object, const Value &v);
};
union {
ExecutionEngine *engine;
@@ -68,55 +68,55 @@ struct Lookup {
uint index2;
};
uint index;
- String *name;
-
- static ReturnedValue indexedGetterGeneric(Lookup *l, const ValueRef object, const ValueRef index);
- static ReturnedValue indexedGetterFallback(Lookup *l, const ValueRef object, const ValueRef index);
- static ReturnedValue indexedGetterObjectInt(Lookup *l, const ValueRef object, const ValueRef index);
-
- static void indexedSetterGeneric(Lookup *l, const ValueRef object, const ValueRef index, const ValueRef v);
- static void indexedSetterFallback(Lookup *l, const ValueRef object, const ValueRef index, const ValueRef value);
- static void indexedSetterObjectInt(Lookup *l, const ValueRef object, const ValueRef index, const ValueRef v);
-
- static ReturnedValue getterGeneric(Lookup *l, const ValueRef object);
- static ReturnedValue getterTwoClasses(Lookup *l, const ValueRef object);
- static ReturnedValue getterFallback(Lookup *l, const ValueRef object);
-
- static ReturnedValue getter0(Lookup *l, const ValueRef object);
- static ReturnedValue getter1(Lookup *l, const ValueRef object);
- static ReturnedValue getter2(Lookup *l, const ValueRef object);
- static ReturnedValue getter0getter0(Lookup *l, const ValueRef object);
- static ReturnedValue getter0getter1(Lookup *l, const ValueRef object);
- static ReturnedValue getter1getter1(Lookup *l, const ValueRef object);
- static ReturnedValue getterAccessor0(Lookup *l, const ValueRef object);
- static ReturnedValue getterAccessor1(Lookup *l, const ValueRef object);
- static ReturnedValue getterAccessor2(Lookup *l, const ValueRef object);
-
- static ReturnedValue primitiveGetter0(Lookup *l, const ValueRef object);
- static ReturnedValue primitiveGetter1(Lookup *l, const ValueRef object);
- static ReturnedValue primitiveGetterAccessor0(Lookup *l, const ValueRef object);
- static ReturnedValue primitiveGetterAccessor1(Lookup *l, const ValueRef object);
- static ReturnedValue stringLengthGetter(Lookup *l, const ValueRef object);
- static ReturnedValue arrayLengthGetter(Lookup *l, const ValueRef object);
-
- static ReturnedValue globalGetterGeneric(Lookup *l, ExecutionContext *ctx);
- static ReturnedValue globalGetter0(Lookup *l, ExecutionContext *ctx);
- static ReturnedValue globalGetter1(Lookup *l, ExecutionContext *ctx);
- static ReturnedValue globalGetter2(Lookup *l, ExecutionContext *ctx);
- static ReturnedValue globalGetterAccessor0(Lookup *l, ExecutionContext *ctx);
- static ReturnedValue globalGetterAccessor1(Lookup *l, ExecutionContext *ctx);
- static ReturnedValue globalGetterAccessor2(Lookup *l, ExecutionContext *ctx);
-
- static void setterGeneric(Lookup *l, const ValueRef object, const ValueRef value);
- static void setterTwoClasses(Lookup *l, const ValueRef object, const ValueRef value);
- static void setterFallback(Lookup *l, const ValueRef object, const ValueRef value);
- static void setter0(Lookup *l, const ValueRef object, const ValueRef value);
- static void setterInsert0(Lookup *l, const ValueRef object, const ValueRef value);
- static void setterInsert1(Lookup *l, const ValueRef object, const ValueRef value);
- static void setterInsert2(Lookup *l, const ValueRef object, const ValueRef value);
- static void setter0setter0(Lookup *l, const ValueRef object, const ValueRef value);
-
- ReturnedValue lookup(ValueRef thisObject, Object *obj, PropertyAttributes *attrs);
+ uint nameIndex;
+
+ static ReturnedValue indexedGetterGeneric(Lookup *l, const Value &object, const Value &index);
+ static ReturnedValue indexedGetterFallback(Lookup *l, const Value &object, const Value &index);
+ static ReturnedValue indexedGetterObjectInt(Lookup *l, const Value &object, const Value &index);
+
+ static void indexedSetterGeneric(Lookup *l, const Value &object, const Value &index, const Value &v);
+ static void indexedSetterFallback(Lookup *l, const Value &object, const Value &index, const Value &value);
+ static void indexedSetterObjectInt(Lookup *l, const Value &object, const Value &index, const Value &v);
+
+ static ReturnedValue getterGeneric(Lookup *l, ExecutionEngine *engine, const Value &object);
+ static ReturnedValue getterTwoClasses(Lookup *l, ExecutionEngine *engine, const Value &object);
+ static ReturnedValue getterFallback(Lookup *l, ExecutionEngine *engine, const Value &object);
+
+ static ReturnedValue getter0(Lookup *l, ExecutionEngine *engine, const Value &object);
+ static ReturnedValue getter1(Lookup *l, ExecutionEngine *engine, const Value &object);
+ static ReturnedValue getter2(Lookup *l, ExecutionEngine *engine, const Value &object);
+ static ReturnedValue getter0getter0(Lookup *l, ExecutionEngine *engine, const Value &object);
+ static ReturnedValue getter0getter1(Lookup *l, ExecutionEngine *engine, const Value &object);
+ static ReturnedValue getter1getter1(Lookup *l, ExecutionEngine *engine, const Value &object);
+ static ReturnedValue getterAccessor0(Lookup *l, ExecutionEngine *engine, const Value &object);
+ static ReturnedValue getterAccessor1(Lookup *l, ExecutionEngine *engine, const Value &object);
+ static ReturnedValue getterAccessor2(Lookup *l, ExecutionEngine *engine, const Value &object);
+
+ static ReturnedValue primitiveGetter0(Lookup *l, ExecutionEngine *engine, const Value &object);
+ static ReturnedValue primitiveGetter1(Lookup *l, ExecutionEngine *engine, const Value &object);
+ static ReturnedValue primitiveGetterAccessor0(Lookup *l, ExecutionEngine *engine, const Value &object);
+ static ReturnedValue primitiveGetterAccessor1(Lookup *l, ExecutionEngine *engine, const Value &object);
+ static ReturnedValue stringLengthGetter(Lookup *l, ExecutionEngine *engine, const Value &object);
+ static ReturnedValue arrayLengthGetter(Lookup *l, ExecutionEngine *engine, const Value &object);
+
+ static ReturnedValue globalGetterGeneric(Lookup *l, ExecutionEngine *engine);
+ static ReturnedValue globalGetter0(Lookup *l, ExecutionEngine *engine);
+ static ReturnedValue globalGetter1(Lookup *l, ExecutionEngine *engine);
+ static ReturnedValue globalGetter2(Lookup *l, ExecutionEngine *engine);
+ static ReturnedValue globalGetterAccessor0(Lookup *l, ExecutionEngine *engine);
+ static ReturnedValue globalGetterAccessor1(Lookup *l, ExecutionEngine *engine);
+ static ReturnedValue globalGetterAccessor2(Lookup *l, ExecutionEngine *engine);
+
+ static void setterGeneric(Lookup *l, ExecutionEngine *engine, const Value &object, const Value &value);
+ static void setterTwoClasses(Lookup *l, ExecutionEngine *engine, const Value &object, const Value &value);
+ static void setterFallback(Lookup *l, ExecutionEngine *engine, const Value &object, const Value &value);
+ static void setter0(Lookup *l, ExecutionEngine *engine, const Value &object, const Value &value);
+ static void setterInsert0(Lookup *l, ExecutionEngine *engine, const Value &object, const Value &value);
+ static void setterInsert1(Lookup *l, ExecutionEngine *engine, const Value &object, const Value &value);
+ static void setterInsert2(Lookup *l, ExecutionEngine *engine, const Value &object, const Value &value);
+ static void setter0setter0(Lookup *l, ExecutionEngine *engine, const Value &object, const Value &value);
+
+ ReturnedValue lookup(const Value &thisObject, Object *obj, PropertyAttributes *attrs);
ReturnedValue lookup(Object *obj, PropertyAttributes *attrs);
};
diff --git a/src/qml/jsruntime/qv4managed.cpp b/src/qml/jsruntime/qv4managed.cpp
index c7327addfd..c4b9fc597e 100644
--- a/src/qml/jsruntime/qv4managed.cpp
+++ b/src/qml/jsruntime/qv4managed.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -56,22 +56,10 @@ const ManagedVTable Managed::static_vtbl =
};
-void *Managed::operator new(size_t size, MemoryManager *mm)
-{
- assert(mm);
-
- return mm->allocManaged(size);
-}
-
-ExecutionEngine *Managed::engine() const
-{
- return internalClass()->engine;
-}
-
QString Managed::className() const
{
const char *s = 0;
- switch (Type(internalClass()->vtable->type)) {
+ switch (Type(d()->vtable->type)) {
case Type_Invalid:
case Type_String:
return QString();
@@ -100,26 +88,26 @@ QString Managed::className() const
s = "RegExp";
break;
case Type_ErrorObject:
- switch (ErrorObject::ErrorType(subtype())) {
- case ErrorObject::Error:
+ switch (static_cast<Heap::ErrorObject *>(d())->errorType) {
+ case Heap::ErrorObject::Error:
s = "Error";
break;
- case ErrorObject::EvalError:
+ case Heap::ErrorObject::EvalError:
s = "EvalError";
break;
- case ErrorObject::RangeError:
+ case Heap::ErrorObject::RangeError:
s = "RangeError";
break;
- case ErrorObject::ReferenceError:
+ case Heap::ErrorObject::ReferenceError:
s = "ReferenceError";
break;
- case ErrorObject::SyntaxError:
+ case Heap::ErrorObject::SyntaxError:
s = "SyntaxError";
break;
- case ErrorObject::TypeError:
+ case Heap::ErrorObject::TypeError:
s = "TypeError";
break;
- case ErrorObject::URIError:
+ case Heap::ErrorObject::URIError:
s = "URIError";
break;
}
@@ -151,19 +139,6 @@ QString Managed::className() const
return QString::fromLatin1(s);
}
-void Managed::setVTable(const ManagedVTable *vt)
-{
- Q_ASSERT(internalClass());
- d()->internalClass = internalClass()->changeVTable(vt);
-}
-
-void Managed::Data::setVTable(const ManagedVTable *vt)
-{
- Q_ASSERT(internalClass);
- internalClass = internalClass->changeVTable(vt);
-}
-
-
bool Managed::isEqualTo(Managed *, Managed *)
{
return false;
diff --git a/src/qml/jsruntime/qv4managed_p.h b/src/qml/jsruntime/qv4managed_p.h
index e679017b7e..0fe5c7ee49 100644
--- a/src/qml/jsruntime/qv4managed_p.h
+++ b/src/qml/jsruntime/qv4managed_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -33,9 +33,6 @@
#ifndef QMLJS_MANAGED_H
#define QMLJS_MANAGED_H
-#include <QtCore/QString>
-#include <QtCore/QVector>
-#include <QtCore/QDebug>
#include "qv4global_p.h"
#include "qv4value_p.h"
#include "qv4internalclass_p.h"
@@ -45,7 +42,7 @@ QT_BEGIN_NAMESPACE
namespace QV4 {
#define Q_MANAGED_CHECK \
- template <typename T> inline void qt_check_for_QMANAGED_macro(const T *_q_argument) const \
+ template <typename _T> inline void qt_check_for_QMANAGED_macro(const _T *_q_argument) const \
{ int i = qYouForgotTheQ_MANAGED_Macro(this, _q_argument); i = i + 1; }
template <typename T>
@@ -60,29 +57,18 @@ inline void qYouForgotTheQ_MANAGED_Macro(T1, T2) {}
#define V4_MANAGED_SIZE_TEST
#endif
-#define V4_MANAGED(superClass) \
+#define V4_NEEDS_DESTROY static void destroy(QV4::Heap::Base *b) { static_cast<Data *>(b)->~Data(); }
+
+
+#define V4_MANAGED(DataClass, superClass) \
public: \
Q_MANAGED_CHECK \
+ typedef QV4::Heap::DataClass Data; \
typedef superClass SuperClass; \
static const QV4::ManagedVTable static_vtbl; \
static inline const QV4::ManagedVTable *staticVTable() { return &static_vtbl; } \
- template <typename T> \
- QV4::Returned<T> *asReturned() { return QV4::Returned<T>::create(this); } \
- V4_MANAGED_SIZE_TEST \
- const Data *d() const { return &static_cast<const Data &>(Managed::data); } \
- Data *d() { return &static_cast<Data &>(Managed::data); }
-
-#define V4_OBJECT(superClass) \
- public: \
- Q_MANAGED_CHECK \
- typedef superClass SuperClass; \
- static const QV4::ObjectVTable static_vtbl; \
- static inline const QV4::ManagedVTable *staticVTable() { return &static_vtbl.managedVTable; } \
- template <typename T> \
- QV4::Returned<T> *asReturned() { return QV4::Returned<T>::create(this); } \
V4_MANAGED_SIZE_TEST \
- const Data *d() const { return &static_cast<const Data &>(Managed::data); } \
- Data *d() { return &static_cast<Data &>(Managed::data); }
+ QV4::Heap::DataClass *d() const { return static_cast<QV4::Heap::DataClass *>(m); }
#define Q_MANAGED_TYPE(type) \
public: \
@@ -112,30 +98,11 @@ struct ManagedVTable
uint unused : 18;
uint type : 8;
const char *className;
- void (*destroy)(Managed *);
- void (*markObjects)(Managed *, ExecutionEngine *e);
+ void (*destroy)(Heap::Base *);
+ void (*markObjects)(Heap::Base *, ExecutionEngine *e);
bool (*isEqualTo)(Managed *m, Managed *other);
};
-struct ObjectVTable
-{
- ManagedVTable managedVTable;
- ReturnedValue (*call)(Managed *, CallData *data);
- ReturnedValue (*construct)(Managed *, CallData *data);
- ReturnedValue (*get)(Managed *, String *name, bool *hasProperty);
- ReturnedValue (*getIndexed)(Managed *, uint index, bool *hasProperty);
- void (*put)(Managed *, String *name, const ValueRef value);
- void (*putIndexed)(Managed *, uint index, const ValueRef value);
- PropertyAttributes (*query)(const Managed *, String *name);
- PropertyAttributes (*queryIndexed)(const Managed *, uint index);
- bool (*deleteProperty)(Managed *m, String *name);
- bool (*deleteIndexedProperty)(Managed *m, uint index);
- ReturnedValue (*getLookup)(Managed *m, Lookup *l);
- void (*setLookup)(Managed *m, Lookup *l, const ValueRef v);
- uint (*getLength)(const Managed *m);
- void (*advanceIterator)(Managed *m, ObjectIterator *it, String *&name, uint *index, Property *p, PropertyAttributes *attributes);
-};
-
#define DEFINE_MANAGED_VTABLE_INT(classname, parentVTable) \
{ \
parentVTable, \
@@ -156,66 +123,9 @@ struct ObjectVTable
#define DEFINE_MANAGED_VTABLE(classname) \
const QV4::ManagedVTable classname::static_vtbl = DEFINE_MANAGED_VTABLE_INT(classname, 0)
-
-#define DEFINE_OBJECT_VTABLE(classname) \
-const QV4::ObjectVTable classname::static_vtbl = \
-{ \
- DEFINE_MANAGED_VTABLE_INT(classname, &classname::SuperClass::static_vtbl == &Object::static_vtbl ? 0 : &classname::SuperClass::static_vtbl.managedVTable), \
- call, \
- construct, \
- get, \
- getIndexed, \
- put, \
- putIndexed, \
- query, \
- queryIndexed, \
- deleteProperty, \
- deleteIndexedProperty, \
- getLookup, \
- setLookup, \
- getLength, \
- advanceIterator \
-}
-
-struct Q_QML_PRIVATE_EXPORT Managed
+struct Q_QML_PRIVATE_EXPORT Managed : Value
{
- struct Q_QML_PRIVATE_EXPORT Data : HeapObject {
- Data() {}
- Data(InternalClass *internal)
- : internalClass(internal)
- , markBit(0)
- , inUse(1)
- , extensible(1)
- {
- // ####
-// Q_ASSERT(internal && internal->vtable);
- }
- InternalClass *internalClass;
- struct {
- uchar markBit : 1;
- uchar inUse : 1;
- uchar extensible : 1; // used by Object
- uchar _unused : 1;
- uchar needsActivation : 1; // used by FunctionObject
- uchar strictMode : 1; // used by FunctionObject
- uchar bindingKeyFlag : 1;
- uchar hasAccessorProperty : 1;
- uchar _type;
- mutable uchar subtype;
- uchar _flags;
- };
-
- void setVTable(const ManagedVTable *vt);
- ReturnedValue asReturnedValue() const {
- return reinterpret_cast<Managed *>(const_cast<Data *>(this))->asReturnedValue();
- }
-
- void *operator new(size_t, Managed *m) { return m; }
- void *operator new(size_t, Managed::Data *m) { return m; }
- void operator delete(void *, Managed::Data *) {}
- };
- Data data;
- V4_MANAGED(Managed)
+ V4_MANAGED(Base, Managed)
enum {
IsExecutionContext = false,
IsString = false,
@@ -226,18 +136,10 @@ struct Q_QML_PRIVATE_EXPORT Managed
};
private:
void *operator new(size_t);
- Managed(const Managed &other);
- void operator = (const Managed &other);
-
-protected:
- Managed(InternalClass *internal)
- : data(internal)
- {
- }
+ Managed() Q_DECL_EQ_DELETE;
+ Q_DISABLE_COPY(Managed)
public:
- void *operator new(size_t size, MemoryManager *mm);
- void *operator new(size_t, Managed *m) { return m; }
inline void mark(QV4::ExecutionEngine *engine);
@@ -265,15 +167,13 @@ public:
};
Q_MANAGED_TYPE(Invalid)
- ExecutionEngine *engine() const;
-
template <typename T>
T *as() {
- Q_ASSERT(internalClass());
+ Q_ASSERT(d()->vtable);
#if !defined(QT_NO_QOBJECT_CHECK)
static_cast<T *>(this)->qt_check_for_QMANAGED_macro(static_cast<T *>(this));
#endif
- const ManagedVTable *vt = internalClass()->vtable;
+ const ManagedVTable *vt = d()->vtable;
while (vt) {
if (vt == T::staticVTable())
return static_cast<T *>(this);
@@ -283,11 +183,11 @@ public:
}
template <typename T>
const T *as() const {
- Q_ASSERT(internalClass());
+ Q_ASSERT(d()->vtable);
#if !defined(QT_NO_QOBJECT_CHECK)
static_cast<T *>(this)->qt_check_for_QMANAGED_macro(static_cast<T *>(const_cast<Managed *>(this)));
#endif
- const ManagedVTable *vt = internalClass()->vtable;
+ const ManagedVTable *vt = d()->vtable;
while (vt) {
if (vt == T::staticVTable())
return static_cast<T *>(this);
@@ -296,53 +196,33 @@ public:
return 0;
}
- String *asString() { return internalClass()->vtable->isString ? reinterpret_cast<String *>(this) : 0; }
- Object *asObject() { return internalClass()->vtable->isObject ? reinterpret_cast<Object *>(this) : 0; }
- ArrayObject *asArrayObject() { return internalClass()->vtable->type == Type_ArrayObject ? reinterpret_cast<ArrayObject *>(this) : 0; }
- FunctionObject *asFunctionObject() { return internalClass()->vtable->isFunctionObject ? reinterpret_cast<FunctionObject *>(this) : 0; }
- BooleanObject *asBooleanObject() { return internalClass()->vtable->type == Type_BooleanObject ? reinterpret_cast<BooleanObject *>(this) : 0; }
- NumberObject *asNumberObject() { return internalClass()->vtable->type == Type_NumberObject ? reinterpret_cast<NumberObject *>(this) : 0; }
- StringObject *asStringObject() { return internalClass()->vtable->type == Type_StringObject ? reinterpret_cast<StringObject *>(this) : 0; }
- DateObject *asDateObject() { return internalClass()->vtable->type == Type_DateObject ? reinterpret_cast<DateObject *>(this) : 0; }
- ErrorObject *asErrorObject() { return internalClass()->vtable->isErrorObject ? reinterpret_cast<ErrorObject *>(this) : 0; }
- ArgumentsObject *asArgumentsObject() { return internalClass()->vtable->type == Type_ArgumentsObject ? reinterpret_cast<ArgumentsObject *>(this) : 0; }
+ String *asString() { return d()->vtable->isString ? reinterpret_cast<String *>(this) : 0; }
+ Object *asObject() { return d()->vtable->isObject ? reinterpret_cast<Object *>(this) : 0; }
+ ArrayObject *asArrayObject() { return d()->vtable->type == Type_ArrayObject ? reinterpret_cast<ArrayObject *>(this) : 0; }
+ FunctionObject *asFunctionObject() { return d()->vtable->isFunctionObject ? reinterpret_cast<FunctionObject *>(this) : 0; }
+ BooleanObject *asBooleanObject() { return d()->vtable->type == Type_BooleanObject ? reinterpret_cast<BooleanObject *>(this) : 0; }
+ NumberObject *asNumberObject() { return d()->vtable->type == Type_NumberObject ? reinterpret_cast<NumberObject *>(this) : 0; }
+ StringObject *asStringObject() { return d()->vtable->type == Type_StringObject ? reinterpret_cast<StringObject *>(this) : 0; }
+ DateObject *asDateObject() { return d()->vtable->type == Type_DateObject ? reinterpret_cast<DateObject *>(this) : 0; }
+ ErrorObject *asErrorObject() { return d()->vtable->isErrorObject ? reinterpret_cast<ErrorObject *>(this) : 0; }
+ ArgumentsObject *asArgumentsObject() { return d()->vtable->type == Type_ArgumentsObject ? reinterpret_cast<ArgumentsObject *>(this) : 0; }
- bool isListType() const { return internalClass()->vtable->type == Type_QmlSequence; }
+ bool isListType() const { return d()->vtable->type == Type_QmlSequence; }
- bool isArrayObject() const { return internalClass()->vtable->type == Type_ArrayObject; }
- bool isStringObject() const { return internalClass()->vtable->type == Type_StringObject; }
+ bool isArrayObject() const { return d()->vtable->type == Type_ArrayObject; }
+ bool isStringObject() const { return d()->vtable->type == Type_StringObject; }
QString className() const;
- Managed **nextFreeRef() {
- return reinterpret_cast<Managed **>(this);
- }
- Managed *nextFree() {
- return *reinterpret_cast<Managed **>(this);
- }
- void setNextFree(Managed *m) {
- *reinterpret_cast<Managed **>(this) = m;
- }
-
- void setVTable(const ManagedVTable *vt);
-
- bool isEqualTo(Managed *other)
- { return internalClass()->vtable->isEqualTo(this, other); }
+ bool isEqualTo(const Managed *other) const
+ { return d()->vtable->isEqualTo(const_cast<Managed *>(this), const_cast<Managed *>(other)); }
static bool isEqualTo(Managed *m, Managed *other);
- ReturnedValue asReturnedValue() { return Value::fromManaged(this).asReturnedValue(); }
-
- InternalClass *internalClass() const { return d()->internalClass; }
- void setInternalClass(InternalClass *ic) { d()->internalClass = ic; }
-
- uchar subtype() const { return d()->subtype; }
- void setSubtype(uchar subtype) const { d()->subtype = subtype; }
+ bool inUse() const { return d()->inUse(); }
+ bool markBit() const { return d()->isMarked(); }
- bool inUse() const { return d()->inUse; }
- bool markBit() const { return d()->markBit; }
-
- static void destroy(Managed *) {}
+ static void destroy(Heap::Base *) {}
private:
friend class MemoryManager;
friend struct Identifiers;
@@ -377,6 +257,13 @@ inline FunctionObject *managed_cast(Managed *m)
return m ? m->asFunctionObject() : 0;
}
+inline Value Value::fromManaged(Managed *m)
+{
+ if (!m)
+ return QV4::Primitive::undefinedValue();
+ return *m;
+}
+
}
diff --git a/src/qml/jsruntime/qv4math_p.h b/src/qml/jsruntime/qv4math_p.h
index 4fdad40a69..4f550752aa 100644
--- a/src/qml/jsruntime/qv4math_p.h
+++ b/src/qml/jsruntime/qv4math_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/jsruntime/qv4mathobject.cpp b/src/qml/jsruntime/qv4mathobject.cpp
index 1148b0f97d..473e05bf88 100644
--- a/src/qml/jsruntime/qv4mathobject.cpp
+++ b/src/qml/jsruntime/qv4mathobject.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -34,52 +34,52 @@
#include "qv4mathobject_p.h"
#include "qv4objectproto_p.h"
-#include <cmath>
-#include <qmath.h>
-#include <qnumeric.h>
-
#include <QtCore/qdatetime.h>
+#include <QtCore/qmath.h>
+#include <QtCore/qnumeric.h>
#include <QtCore/qthreadstorage.h>
+#include <cmath>
+
using namespace QV4;
DEFINE_OBJECT_VTABLE(MathObject);
static const double qt_PI = 2.0 * ::asin(1.0);
-MathObject::Data::Data(InternalClass *ic)
- : Object::Data(ic)
+Heap::MathObject::MathObject(ExecutionEngine *e)
+ : Heap::Object(e->emptyClass, e->objectPrototype.asObject())
{
- Scope scope(ic->engine);
+ Scope scope(e);
ScopedObject m(scope, this);
- m->defineReadonlyProperty(QStringLiteral("E"), Primitive::fromDouble(::exp(1.0)));
- m->defineReadonlyProperty(QStringLiteral("LN2"), Primitive::fromDouble(::log(2.0)));
- m->defineReadonlyProperty(QStringLiteral("LN10"), Primitive::fromDouble(::log(10.0)));
- m->defineReadonlyProperty(QStringLiteral("LOG2E"), Primitive::fromDouble(1.0/::log(2.0)));
- m->defineReadonlyProperty(QStringLiteral("LOG10E"), Primitive::fromDouble(1.0/::log(10.0)));
- m->defineReadonlyProperty(QStringLiteral("PI"), Primitive::fromDouble(qt_PI));
- m->defineReadonlyProperty(QStringLiteral("SQRT1_2"), Primitive::fromDouble(::sqrt(0.5)));
- m->defineReadonlyProperty(QStringLiteral("SQRT2"), Primitive::fromDouble(::sqrt(2.0)));
-
- m->defineDefaultProperty(QStringLiteral("abs"), method_abs, 1);
- m->defineDefaultProperty(QStringLiteral("acos"), method_acos, 1);
- m->defineDefaultProperty(QStringLiteral("asin"), method_asin, 0);
- m->defineDefaultProperty(QStringLiteral("atan"), method_atan, 1);
- m->defineDefaultProperty(QStringLiteral("atan2"), method_atan2, 2);
- m->defineDefaultProperty(QStringLiteral("ceil"), method_ceil, 1);
- m->defineDefaultProperty(QStringLiteral("cos"), method_cos, 1);
- m->defineDefaultProperty(QStringLiteral("exp"), method_exp, 1);
- m->defineDefaultProperty(QStringLiteral("floor"), method_floor, 1);
- m->defineDefaultProperty(QStringLiteral("log"), method_log, 1);
- m->defineDefaultProperty(QStringLiteral("max"), method_max, 2);
- m->defineDefaultProperty(QStringLiteral("min"), method_min, 2);
- m->defineDefaultProperty(QStringLiteral("pow"), method_pow, 2);
- m->defineDefaultProperty(QStringLiteral("random"), method_random, 0);
- m->defineDefaultProperty(QStringLiteral("round"), method_round, 1);
- m->defineDefaultProperty(QStringLiteral("sin"), method_sin, 1);
- m->defineDefaultProperty(QStringLiteral("sqrt"), method_sqrt, 1);
- m->defineDefaultProperty(QStringLiteral("tan"), method_tan, 1);
+ m->defineReadonlyProperty(QStringLiteral("E"), Primitive::fromDouble(M_E));
+ m->defineReadonlyProperty(QStringLiteral("LN2"), Primitive::fromDouble(M_LN2));
+ m->defineReadonlyProperty(QStringLiteral("LN10"), Primitive::fromDouble(M_LN10));
+ m->defineReadonlyProperty(QStringLiteral("LOG2E"), Primitive::fromDouble(M_LOG2E));
+ m->defineReadonlyProperty(QStringLiteral("LOG10E"), Primitive::fromDouble(M_LOG10E));
+ m->defineReadonlyProperty(QStringLiteral("PI"), Primitive::fromDouble(M_PI));
+ m->defineReadonlyProperty(QStringLiteral("SQRT1_2"), Primitive::fromDouble(M_SQRT1_2));
+ m->defineReadonlyProperty(QStringLiteral("SQRT2"), Primitive::fromDouble(M_SQRT2));
+
+ m->defineDefaultProperty(QStringLiteral("abs"), QV4::MathObject::method_abs, 1);
+ m->defineDefaultProperty(QStringLiteral("acos"), QV4::MathObject::method_acos, 1);
+ m->defineDefaultProperty(QStringLiteral("asin"), QV4::MathObject::method_asin, 0);
+ m->defineDefaultProperty(QStringLiteral("atan"), QV4::MathObject::method_atan, 1);
+ m->defineDefaultProperty(QStringLiteral("atan2"), QV4::MathObject::method_atan2, 2);
+ m->defineDefaultProperty(QStringLiteral("ceil"), QV4::MathObject::method_ceil, 1);
+ m->defineDefaultProperty(QStringLiteral("cos"), QV4::MathObject::method_cos, 1);
+ m->defineDefaultProperty(QStringLiteral("exp"), QV4::MathObject::method_exp, 1);
+ m->defineDefaultProperty(QStringLiteral("floor"), QV4::MathObject::method_floor, 1);
+ m->defineDefaultProperty(QStringLiteral("log"), QV4::MathObject::method_log, 1);
+ m->defineDefaultProperty(QStringLiteral("max"), QV4::MathObject::method_max, 2);
+ m->defineDefaultProperty(QStringLiteral("min"), QV4::MathObject::method_min, 2);
+ m->defineDefaultProperty(QStringLiteral("pow"), QV4::MathObject::method_pow, 2);
+ m->defineDefaultProperty(QStringLiteral("random"), QV4::MathObject::method_random, 0);
+ m->defineDefaultProperty(QStringLiteral("round"), QV4::MathObject::method_round, 1);
+ m->defineDefaultProperty(QStringLiteral("sin"), QV4::MathObject::method_sin, 1);
+ m->defineDefaultProperty(QStringLiteral("sqrt"), QV4::MathObject::method_sqrt, 1);
+ m->defineDefaultProperty(QStringLiteral("tan"), QV4::MathObject::method_tan, 1);
}
/* copies the sign from y to x and returns the result */
@@ -96,15 +96,15 @@ static double copySign(double x, double y)
ReturnedValue MathObject::method_abs(CallContext *context)
{
- if (!context->d()->callData->argc)
+ if (!context->argc())
return Encode(qSNaN());
- if (context->d()->callData->args[0].isInteger()) {
- int i = context->d()->callData->args[0].integerValue();
+ if (context->args()[0].isInteger()) {
+ int i = context->args()[0].integerValue();
return Encode(i < 0 ? - i : i);
}
- double v = context->d()->callData->args[0].toNumber();
+ double v = context->args()[0].toNumber();
if (v == 0) // 0 | -0
return Encode(0);
@@ -113,97 +113,97 @@ ReturnedValue MathObject::method_abs(CallContext *context)
ReturnedValue MathObject::method_acos(CallContext *context)
{
- double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : 2;
+ double v = context->argc() ? context->args()[0].toNumber() : 2;
if (v > 1)
return Encode(qSNaN());
- return Encode(::acos(v));
+ return Encode(std::acos(v));
}
ReturnedValue MathObject::method_asin(CallContext *context)
{
- double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : 2;
+ double v = context->argc() ? context->args()[0].toNumber() : 2;
if (v > 1)
return Encode(qSNaN());
else
- return Encode(::asin(v));
+ return Encode(std::asin(v));
}
ReturnedValue MathObject::method_atan(CallContext *context)
{
- double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
+ double v = context->argc() ? context->args()[0].toNumber() : qSNaN();
if (v == 0.0)
return Encode(v);
else
- return Encode(::atan(v));
+ return Encode(std::atan(v));
}
ReturnedValue MathObject::method_atan2(CallContext *context)
{
- double v1 = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
- double v2 = context->d()->callData->argc > 1 ? context->d()->callData->args[1].toNumber() : qSNaN();
+ double v1 = context->argc() ? context->args()[0].toNumber() : qSNaN();
+ double v2 = context->argc() > 1 ? context->args()[1].toNumber() : qSNaN();
if ((v1 < 0) && qIsFinite(v1) && qIsInf(v2) && (copySign(1.0, v2) == 1.0))
return Encode(copySign(0, -1.0));
if ((v1 == 0.0) && (v2 == 0.0)) {
if ((copySign(1.0, v1) == 1.0) && (copySign(1.0, v2) == -1.0)) {
- return Encode(qt_PI);
+ return Encode(M_PI);
} else if ((copySign(1.0, v1) == -1.0) && (copySign(1.0, v2) == -1.0)) {
- return Encode(-qt_PI);
+ return Encode(-M_PI);
}
}
- return Encode(::atan2(v1, v2));
+ return Encode(std::atan2(v1, v2));
}
ReturnedValue MathObject::method_ceil(CallContext *context)
{
- double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
+ double v = context->argc() ? context->args()[0].toNumber() : qSNaN();
if (v < 0.0 && v > -1.0)
return Encode(copySign(0, -1.0));
else
- return Encode(::ceil(v));
+ return Encode(std::ceil(v));
}
ReturnedValue MathObject::method_cos(CallContext *context)
{
- double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
- return Encode(::cos(v));
+ double v = context->argc() ? context->args()[0].toNumber() : qSNaN();
+ return Encode(std::cos(v));
}
ReturnedValue MathObject::method_exp(CallContext *context)
{
- double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
+ double v = context->argc() ? context->args()[0].toNumber() : qSNaN();
if (qIsInf(v)) {
if (copySign(1.0, v) == -1.0)
return Encode(0);
else
return Encode(qInf());
} else {
- return Encode(::exp(v));
+ return Encode(std::exp(v));
}
}
ReturnedValue MathObject::method_floor(CallContext *context)
{
- double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
- return Encode(::floor(v));
+ double v = context->argc() ? context->args()[0].toNumber() : qSNaN();
+ return Encode(std::floor(v));
}
ReturnedValue MathObject::method_log(CallContext *context)
{
- double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
+ double v = context->argc() ? context->args()[0].toNumber() : qSNaN();
if (v < 0)
return Encode(qSNaN());
else
- return Encode(::log(v));
+ return Encode(std::log(v));
}
ReturnedValue MathObject::method_max(CallContext *context)
{
double mx = -qInf();
- for (int i = 0; i < context->d()->callData->argc; ++i) {
- double x = context->d()->callData->args[i].toNumber();
+ for (int i = 0; i < context->argc(); ++i) {
+ double x = context->args()[i].toNumber();
if (x > mx || std::isnan(x))
mx = x;
}
@@ -213,8 +213,8 @@ ReturnedValue MathObject::method_max(CallContext *context)
ReturnedValue MathObject::method_min(CallContext *context)
{
double mx = qInf();
- for (int i = 0; i < context->d()->callData->argc; ++i) {
- double x = context->d()->callData->args[i].toNumber();
+ for (int i = 0; i < context->argc(); ++i) {
+ double x = context->args()[i].toNumber();
if ((x == 0 && mx == x && copySign(1.0, x) == -1.0)
|| (x < mx) || std::isnan(x)) {
mx = x;
@@ -225,8 +225,8 @@ ReturnedValue MathObject::method_min(CallContext *context)
ReturnedValue MathObject::method_pow(CallContext *context)
{
- double x = context->d()->callData->argc > 0 ? context->d()->callData->args[0].toNumber() : qSNaN();
- double y = context->d()->callData->argc > 1 ? context->d()->callData->args[1].toNumber() : qSNaN();
+ double x = context->argc() > 0 ? context->args()[0].toNumber() : qSNaN();
+ double y = context->argc() > 1 ? context->args()[1].toNumber() : qSNaN();
if (std::isnan(y))
return Encode(qSNaN());
@@ -239,12 +239,12 @@ ReturnedValue MathObject::method_pow(CallContext *context)
return Encode(qInf());
} else if ((x == 0) && copySign(1.0, x) == -1.0) {
if (y < 0) {
- if (::fmod(-y, 2.0) == 1.0)
+ if (std::fmod(-y, 2.0) == 1.0)
return Encode(-qInf());
else
return Encode(qInf());
} else if (y > 0) {
- if (::fmod(y, 2.0) == 1.0)
+ if (std::fmod(y, 2.0) == 1.0)
return Encode(copySign(0, -1.0));
else
return Encode(0);
@@ -254,12 +254,12 @@ ReturnedValue MathObject::method_pow(CallContext *context)
#ifdef Q_OS_AIX
else if (qIsInf(x) && copySign(1.0, x) == -1.0) {
if (y > 0) {
- if (::fmod(y, 2.0) == 1.0)
+ if (std::fmod(y, 2.0) == 1.0)
return Encode(-qInf());
else
return Encode(qInf());
} else if (y < 0) {
- if (::fmod(-y, 2.0) == 1.0)
+ if (std::fmod(-y, 2.0) == 1.0)
return Encode(copySign(0, -1.0));
else
return Encode(0);
@@ -267,7 +267,7 @@ ReturnedValue MathObject::method_pow(CallContext *context)
}
#endif
else {
- return Encode(::pow(x, y));
+ return Encode(std::pow(x, y));
}
// ###
return Encode(qSNaN());
@@ -286,29 +286,29 @@ ReturnedValue MathObject::method_random(CallContext *context)
ReturnedValue MathObject::method_round(CallContext *context)
{
- double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
- v = copySign(::floor(v + 0.5), v);
+ double v = context->argc() ? context->args()[0].toNumber() : qSNaN();
+ v = copySign(std::floor(v + 0.5), v);
return Encode(v);
}
ReturnedValue MathObject::method_sin(CallContext *context)
{
- double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
- return Encode(::sin(v));
+ double v = context->argc() ? context->args()[0].toNumber() : qSNaN();
+ return Encode(std::sin(v));
}
ReturnedValue MathObject::method_sqrt(CallContext *context)
{
- double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
- return Encode(::sqrt(v));
+ double v = context->argc() ? context->args()[0].toNumber() : qSNaN();
+ return Encode(std::sqrt(v));
}
ReturnedValue MathObject::method_tan(CallContext *context)
{
- double v = context->d()->callData->argc ? context->d()->callData->args[0].toNumber() : qSNaN();
+ double v = context->argc() ? context->args()[0].toNumber() : qSNaN();
if (v == 0.0)
return Encode(v);
else
- return Encode(::tan(v));
+ return Encode(std::tan(v));
}
diff --git a/src/qml/jsruntime/qv4mathobject_p.h b/src/qml/jsruntime/qv4mathobject_p.h
index ab50b0105a..472b2020b1 100644
--- a/src/qml/jsruntime/qv4mathobject_p.h
+++ b/src/qml/jsruntime/qv4mathobject_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -39,13 +39,17 @@ QT_BEGIN_NAMESPACE
namespace QV4 {
+namespace Heap {
+
+struct MathObject : Object {
+ MathObject(ExecutionEngine *e);
+};
+
+}
+
struct MathObject: Object
{
- struct Data : Object::Data {
- Data(InternalClass *ic);
- };
-
- V4_OBJECT(Object)
+ V4_OBJECT2(MathObject, Object)
Q_MANAGED_TYPE(MathObject)
static ReturnedValue method_abs(CallContext *context);
diff --git a/src/qml/jsruntime/qv4memberdata.cpp b/src/qml/jsruntime/qv4memberdata.cpp
index 405594ca9b..03dfee3dcf 100644
--- a/src/qml/jsruntime/qv4memberdata.cpp
+++ b/src/qml/jsruntime/qv4memberdata.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -38,25 +38,27 @@ using namespace QV4;
DEFINE_MANAGED_VTABLE(MemberData);
-void MemberData::markObjects(Managed *that, ExecutionEngine *e)
+void MemberData::markObjects(Heap::Base *that, ExecutionEngine *e)
{
- MemberData *m = static_cast<MemberData *>(that);
- for (uint i = 0; i < m->d()->size; ++i)
- m->d()->data[i].mark(e);
+ Heap::MemberData *m = static_cast<Heap::MemberData *>(that);
+ for (uint i = 0; i < m->size; ++i)
+ m->data[i].mark(e);
}
-void Members::ensureIndex(QV4::ExecutionEngine *e, uint idx)
+Heap::MemberData *MemberData::reallocate(ExecutionEngine *e, Heap::MemberData *old, uint idx)
{
- uint s = size();
- if (idx >= s) {
- int newAlloc = qMax((uint)4, 2*idx);
- uint alloc = sizeof(MemberData::Data) + (newAlloc)*sizeof(Value);
- MemberData *newMemberData = static_cast<MemberData *>(e->memoryManager->allocManaged(alloc));
- if (d())
- memcpy(newMemberData, d(), sizeof(MemberData::Data) + s*sizeof(Value));
- else
- new (newMemberData) MemberData(e->memberDataClass);
- newMemberData->d()->size = newAlloc;
- m = newMemberData;
- }
+ uint s = old ? old->size : 0;
+ if (idx < s)
+ return old;
+
+ int newAlloc = qMax((uint)4, 2*idx);
+ uint alloc = sizeof(Heap::MemberData) + (newAlloc)*sizeof(Value);
+ Scope scope(e);
+ Scoped<MemberData> newMemberData(scope, e->memoryManager->allocManaged<MemberData>(alloc));
+ if (old)
+ memcpy(newMemberData->d(), old, sizeof(Heap::MemberData) + s*sizeof(Value));
+ else
+ new (newMemberData->d()) Heap::MemberData;
+ newMemberData->d()->size = newAlloc;
+ return newMemberData->d();
}
diff --git a/src/qml/jsruntime/qv4memberdata_p.h b/src/qml/jsruntime/qv4memberdata_p.h
index 83732113a9..4c7cfa47cb 100644
--- a/src/qml/jsruntime/qv4memberdata_p.h
+++ b/src/qml/jsruntime/qv4memberdata_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -40,37 +40,30 @@ QT_BEGIN_NAMESPACE
namespace QV4 {
+namespace Heap {
+
+struct MemberData : Base {
+ union {
+ uint size;
+ double _dummy;
+ };
+ Value data[1];
+};
+
+}
+
struct MemberData : Managed
{
- struct Data : Managed::Data {
- union {
- uint size;
- double _dummy;
- };
- Value data[1];
- };
- V4_MANAGED(Managed)
+ V4_MANAGED(MemberData, Managed)
- MemberData(QV4::InternalClass *ic) : Managed(ic) {}
Value &operator[] (uint idx) { return d()->data[idx]; }
+ const Value *data() const { return d()->data; }
+ Value *data() { return d()->data; }
+ inline uint size() const { return d()->size; }
- static void markObjects(Managed *that, ExecutionEngine *e);
-};
-
-struct Members : Value
-{
- void reset() { m = 0; }
- void ensureIndex(QV4::ExecutionEngine *e, uint idx);
- Value &operator[] (uint idx) const { return static_cast<MemberData *>(managed())->d()->data[idx]; }
- inline uint size() const { return d() ? d()->d()->size : 0; }
- inline MemberData *d() const { return static_cast<MemberData *>(managed()); }
- Value *data() const { return static_cast<MemberData *>(managed())->d()->data; }
+ static Heap::MemberData *reallocate(QV4::ExecutionEngine *e, Heap::MemberData *old, uint idx);
- void mark(ExecutionEngine *e) const {
- MemberData *m = d();
- if (m)
- m->mark(e);
- }
+ static void markObjects(Heap::Base *that, ExecutionEngine *e);
};
}
diff --git a/src/qml/jsruntime/qv4mm.cpp b/src/qml/jsruntime/qv4mm.cpp
index 975a5d5833..64491e1376 100644
--- a/src/qml/jsruntime/qv4mm.cpp
+++ b/src/qml/jsruntime/qv4mm.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -64,20 +64,29 @@
#include <pthread_np.h>
#endif
+using namespace WTF;
+
QT_BEGIN_NAMESPACE
using namespace QV4;
-using namespace WTF;
struct MemoryManager::Data
{
+ struct ChunkHeader {
+ Heap::Base freeItems;
+ ChunkHeader *nextNonFull;
+ char *itemStart;
+ char *itemEnd;
+ int itemSize;
+ };
+
bool gcBlocked;
bool aggressiveGC;
bool gcStats;
ExecutionEngine *engine;
enum { MaxItemSize = 512 };
- Managed *smallItems[MaxItemSize/16];
+ ChunkHeader *nonFullChunks[MaxItemSize/16];
uint nChunks[MaxItemSize/16];
uint availableItems[MaxItemSize/16];
uint allocCount[MaxItemSize/16];
@@ -85,21 +94,17 @@ struct MemoryManager::Data
int totalAlloc;
uint maxShift;
std::size_t maxChunkSize;
- struct Chunk {
- PageAllocation memory;
- int chunkSize;
- };
-
- QVector<Chunk> heapChunks;
-
+ QVector<PageAllocation> heapChunks;
+ std::size_t unmanagedHeapSize; // the amount of bytes of heap that is not managed by the memory manager, but which is held onto by managed items.
+ std::size_t unmanagedHeapSizeGCLimit;
struct LargeItem {
LargeItem *next;
size_t size;
void *data;
- Managed *managed() {
- return reinterpret_cast<Managed *>(&data);
+ Heap::Base *heapObject() {
+ return reinterpret_cast<Heap::Base *>(&data);
}
};
@@ -120,11 +125,13 @@ struct MemoryManager::Data
, totalAlloc(0)
, maxShift(6)
, maxChunkSize(32*1024)
+ , unmanagedHeapSize(0)
+ , unmanagedHeapSizeGCLimit(64 * 1024)
, largeItems(0)
, totalLargeItemsAllocated(0)
, deletable(0)
{
- memset(smallItems, 0, sizeof(smallItems));
+ memset(nonFullChunks, 0, sizeof(nonFullChunks));
memset(nChunks, 0, sizeof(nChunks));
memset(availableItems, 0, sizeof(availableItems));
memset(allocCount, 0, sizeof(allocCount));
@@ -145,34 +152,87 @@ struct MemoryManager::Data
~Data()
{
- for (QVector<Chunk>::iterator i = heapChunks.begin(), ei = heapChunks.end(); i != ei; ++i) {
- Q_V4_PROFILE_DEALLOC(engine, 0, i->memory.size(), Profiling::HeapPage);
- i->memory.deallocate();
+ for (QVector<PageAllocation>::iterator i = heapChunks.begin(), ei = heapChunks.end(); i != ei; ++i) {
+ Q_V4_PROFILE_DEALLOC(engine, 0, i->size(), Profiling::HeapPage);
+ i->deallocate();
}
}
};
+namespace {
-namespace QV4 {
-
-bool operator<(const MemoryManager::Data::Chunk &a, const MemoryManager::Data::Chunk &b)
+bool sweepChunk(MemoryManager::Data::ChunkHeader *header, uint *itemsInUse, ExecutionEngine *engine, std::size_t *unmanagedHeapSize)
{
- return a.memory.base() < b.memory.base();
+ Q_ASSERT(unmanagedHeapSize);
+
+ bool isEmpty = true;
+ Heap::Base *tail = &header->freeItems;
+// qDebug("chunkStart @ %p, size=%x, pos=%x", header->itemStart, header->itemSize, header->itemSize>>4);
+#ifdef V4_USE_VALGRIND
+ VALGRIND_DISABLE_ERROR_REPORTING;
+#endif
+ for (char *item = header->itemStart; item <= header->itemEnd; item += header->itemSize) {
+ Heap::Base *m = reinterpret_cast<Heap::Base *>(item);
+// qDebug("chunk @ %p, in use: %s, mark bit: %s",
+// item, (m->inUse() ? "yes" : "no"), (m->isMarked() ? "true" : "false"));
+
+ Q_ASSERT((qintptr) item % 16 == 0);
+
+ if (m->isMarked()) {
+ Q_ASSERT(m->inUse());
+ m->clearMarkBit();
+ isEmpty = false;
+ ++(*itemsInUse);
+ } else {
+ if (m->inUse()) {
+// qDebug() << "-- collecting it." << m << tail << m->nextFree();
+#ifdef V4_USE_VALGRIND
+ VALGRIND_ENABLE_ERROR_REPORTING;
+#endif
+ if (std::size_t(header->itemSize) == MemoryManager::align(sizeof(Heap::String)) && m->gcGetVtable()->isString) {
+ std::size_t heapBytes = static_cast<Heap::String *>(m)->retainedTextSize();
+ Q_ASSERT(*unmanagedHeapSize >= heapBytes);
+// qDebug() << "-- it's a string holding on to" << heapBytes << "bytes";
+ *unmanagedHeapSize -= heapBytes;
+ }
+
+ if (m->gcGetVtable()->destroy)
+ m->gcGetVtable()->destroy(m);
+
+ memset(m, 0, header->itemSize);
+#ifdef V4_USE_VALGRIND
+ VALGRIND_DISABLE_ERROR_REPORTING;
+ VALGRIND_MEMPOOL_FREE(engine->memoryManager, m);
+#endif
+ Q_V4_PROFILE_DEALLOC(engine, m, header->itemSize, Profiling::SmallItem);
+ ++(*itemsInUse);
+ }
+ // Relink all free blocks to rewrite references to any released chunk.
+ tail->setNextFree(m);
+ tail = m;
+ }
+ }
+ tail->setNextFree(0);
+#ifdef V4_USE_VALGRIND
+ VALGRIND_ENABLE_ERROR_REPORTING;
+#endif
+ return isEmpty;
}
-} // namespace QV4
+} // namespace
-MemoryManager::MemoryManager()
+MemoryManager::MemoryManager(ExecutionEngine *engine)
: m_d(new Data)
- , m_persistentValues(0)
- , m_weakValues(0)
+ , m_persistentValues(new PersistentValueStorage(engine))
+ , m_weakValues(new PersistentValueStorage(engine))
{
#ifdef V4_USE_VALGRIND
VALGRIND_CREATE_MEMPOOL(this, 0, true);
#endif
+ m_d->engine = engine;
}
-Managed *MemoryManager::allocData(std::size_t size)
+Heap::Base *MemoryManager::allocData(std::size_t size, std::size_t unmanagedSize)
{
if (m_d->aggressiveGC)
runGC();
@@ -183,11 +243,27 @@ Managed *MemoryManager::allocData(std::size_t size)
Q_ASSERT(size >= 16);
Q_ASSERT(size % 16 == 0);
+// qDebug() << "unmanagedHeapSize:" << m_d->unmanagedHeapSize << "limit:" << m_d->unmanagedHeapSizeGCLimit << "unmanagedSize:" << unmanagedSize;
+ m_d->unmanagedHeapSize += unmanagedSize;
+ bool didGCRun = false;
+ if (m_d->unmanagedHeapSize > m_d->unmanagedHeapSizeGCLimit) {
+ runGC();
+
+ if (m_d->unmanagedHeapSizeGCLimit <= m_d->unmanagedHeapSize)
+ m_d->unmanagedHeapSizeGCLimit = std::max(m_d->unmanagedHeapSizeGCLimit, m_d->unmanagedHeapSize) * 2;
+ else if (m_d->unmanagedHeapSize * 4 <= m_d->unmanagedHeapSizeGCLimit)
+ m_d->unmanagedHeapSizeGCLimit /= 2;
+ else if (m_d->unmanagedHeapSizeGCLimit - m_d->unmanagedHeapSize < 5 * unmanagedSize)
+ // try preventing running the GC all the time when we're just below the threshold limit and manage to collect just enough to do this one allocation
+ m_d->unmanagedHeapSizeGCLimit += std::max(std::size_t(8 * 1024), 5 * unmanagedSize);
+ didGCRun = true;
+ }
+
size_t pos = size >> 4;
// doesn't fit into a small bucket
if (size >= MemoryManager::Data::MaxItemSize) {
- if (m_d->totalLargeItemsAllocated > 8 * 1024 * 1024)
+ if (!didGCRun && m_d->totalLargeItemsAllocated > 8 * 1024 * 1024)
runGC();
// we use malloc for this
@@ -199,19 +275,24 @@ Managed *MemoryManager::allocData(std::size_t size)
item->size = size;
m_d->largeItems = item;
m_d->totalLargeItemsAllocated += size;
- return item->managed();
+ return item->heapObject();
}
- Managed *m = m_d->smallItems[pos];
- if (m)
+ Heap::Base *m = 0;
+ Data::ChunkHeader *header = m_d->nonFullChunks[pos];
+ if (header) {
+ m = header->freeItems.nextFree();
goto found;
+ }
// try to free up space, otherwise allocate
- if (m_d->allocCount[pos] > (m_d->availableItems[pos] >> 1) && m_d->totalAlloc > (m_d->totalItems >> 1) && !m_d->aggressiveGC) {
+ if (!didGCRun && m_d->allocCount[pos] > (m_d->availableItems[pos] >> 1) && m_d->totalAlloc > (m_d->totalItems >> 1) && !m_d->aggressiveGC) {
runGC();
- m = m_d->smallItems[pos];
- if (m)
+ header = m_d->nonFullChunks[pos];
+ if (header) {
+ m = header->freeItems.nextFree();
goto found;
+ }
}
// no free item available, allocate a new chunk
@@ -222,30 +303,35 @@ Managed *MemoryManager::allocData(std::size_t size)
shift = m_d->maxShift;
std::size_t allocSize = m_d->maxChunkSize*(size_t(1) << shift);
allocSize = roundUpToMultipleOf(WTF::pageSize(), allocSize);
- Data::Chunk allocation;
- allocation.memory = PageAllocation::allocate(
+ PageAllocation allocation = PageAllocation::allocate(
Q_V4_PROFILE_ALLOC(m_d->engine, allocSize, Profiling::HeapPage),
OSAllocator::JSGCHeapPages);
- allocation.chunkSize = int(size);
m_d->heapChunks.append(allocation);
std::sort(m_d->heapChunks.begin(), m_d->heapChunks.end());
- char *chunk = (char *)allocation.memory.base();
- char *end = chunk + allocation.memory.size() - size;
-
- Managed **last = &m_d->smallItems[pos];
- while (chunk <= end) {
- Managed *o = reinterpret_cast<Managed *>(chunk);
- *last = o;
- last = o->nextFreeRef();
- chunk += size;
+
+ header = reinterpret_cast<Data::ChunkHeader *>(allocation.base());
+ header->itemSize = int(size);
+ header->itemStart = reinterpret_cast<char *>(allocation.base()) + roundUpToMultipleOf(16, sizeof(Data::ChunkHeader));
+ header->itemEnd = reinterpret_cast<char *>(allocation.base()) + allocation.size() - header->itemSize;
+
+ header->nextNonFull = m_d->nonFullChunks[pos];
+ m_d->nonFullChunks[pos] = header;
+
+ Heap::Base *last = &header->freeItems;
+ for (char *item = header->itemStart; item <= header->itemEnd; item += header->itemSize) {
+ Heap::Base *o = reinterpret_cast<Heap::Base *>(item);
+ last->setNextFree(o);
+ last = o;
+
}
- *last = 0;
- m = m_d->smallItems[pos];
- const size_t increase = allocation.memory.size()/size - 1;
+ last->setNextFree(0);
+ m = header->freeItems.nextFree();
+ const size_t increase = (header->itemEnd - header->itemStart) / header->itemSize;
m_d->availableItems[pos] += uint(increase);
m_d->totalItems += int(increase);
#ifdef V4_USE_VALGRIND
- VALGRIND_MAKE_MEM_NOACCESS(allocation.memory.base(), allocSize);
+ VALGRIND_MAKE_MEM_NOACCESS(allocation.base(), allocSize);
+ VALGRIND_MEMPOOL_ALLOC(this, header, sizeof(Data::ChunkHeader));
#endif
}
@@ -257,16 +343,18 @@ Managed *MemoryManager::allocData(std::size_t size)
++m_d->allocCount[pos];
++m_d->totalAlloc;
- m_d->smallItems[pos] = m->nextFree();
+ header->freeItems.setNextFree(m->nextFree());
+ if (!header->freeItems.nextFree())
+ m_d->nonFullChunks[pos] = header->nextNonFull;
return m;
}
static void drainMarkStack(QV4::ExecutionEngine *engine, Value *markBase)
{
while (engine->jsStackTop > markBase) {
- Managed *m = engine->popForGC();
- Q_ASSERT (m->internalClass()->vtable->markObjects);
- m->internalClass()->vtable->markObjects(m, engine);
+ Heap::Base *h = engine->popForGC();
+ Q_ASSERT (h->gcGetVtable()->markObjects);
+ h->gcGetVtable()->markObjects(h, engine);
}
}
@@ -276,21 +364,7 @@ void MemoryManager::mark()
m_d->engine->markObjects();
- PersistentValuePrivate *persistent = m_persistentValues;
- while (persistent) {
- if (!persistent->refcount) {
- PersistentValuePrivate *n = persistent->next;
- persistent->removeFromList();
- delete persistent;
- persistent = n;
- continue;
- }
- persistent->value.mark(m_d->engine);
- persistent = persistent->next;
-
- if (m_d->engine->jsStackTop >= m_d->engine->jsStackLimit)
- drainMarkStack(m_d->engine, markBase);
- }
+ m_persistentValues->mark(m_d->engine);
collectFromJSStack();
@@ -300,13 +374,15 @@ void MemoryManager::mark()
// Do this _after_ collectFromStack to ensure that processing the weak
// managed objects in the loop down there doesn't make then end up as leftovers
// on the stack and thus always get collected.
- for (PersistentValuePrivate *weak = m_weakValues; weak; weak = weak->next) {
- if (!weak->refcount)
+ for (PersistentValueStorage::Iterator it = m_weakValues->begin(); it != m_weakValues->end(); ++it) {
+ if (!(*it).isManaged())
continue;
- Returned<QObjectWrapper> *qobjectWrapper = weak->value.as<QObjectWrapper>();
+ if ((*it).managed()->d()->gcGetVtable() != QObjectWrapper::staticVTable())
+ continue;
+ QObjectWrapper *qobjectWrapper = static_cast<QObjectWrapper*>((*it).managed());
if (!qobjectWrapper)
continue;
- QObject *qobject = qobjectWrapper->getPointer()->object();
+ QObject *qobject = qobjectWrapper->object();
if (!qobject)
continue;
bool keepAlive = QQmlData::keepAliveDuringGarbageCollection(qobject);
@@ -321,7 +397,7 @@ void MemoryManager::mark()
}
if (keepAlive)
- qobjectWrapper->getPointer()->mark(m_d->engine);
+ qobjectWrapper->mark(m_d->engine);
if (m_d->engine->jsStackTop >= m_d->engine->jsStackLimit)
drainMarkStack(m_d->engine, markBase);
@@ -332,52 +408,73 @@ void MemoryManager::mark()
void MemoryManager::sweep(bool lastSweep)
{
- PersistentValuePrivate *weak = m_weakValues;
- while (weak) {
- if (!weak->refcount) {
- PersistentValuePrivate *n = weak->next;
- weak->removeFromList();
- delete weak;
- weak = n;
- continue;
- }
- if (Managed *m = weak->value.asManaged()) {
- if (!m->markBit()) {
- weak->value = Primitive::undefinedValue();
- PersistentValuePrivate *n = weak->next;
- weak->removeFromList();
- weak = n;
- continue;
+ if (m_weakValues) {
+ for (PersistentValueStorage::Iterator it = m_weakValues->begin(); it != m_weakValues->end(); ++it) {
+ if (Managed *m = (*it).asManaged()) {
+ if (!m->markBit())
+ (*it) = Primitive::undefinedValue();
}
}
- weak = weak->next;
}
if (MultiplyWrappedQObjectMap *multiplyWrappedQObjects = m_d->engine->m_multiplyWrappedQObjects) {
for (MultiplyWrappedQObjectMap::Iterator it = multiplyWrappedQObjects->begin(); it != multiplyWrappedQObjects->end();) {
- if (!it.value()->markBit())
+ if (!it.value().isNullOrUndefined())
it = multiplyWrappedQObjects->erase(it);
else
++it;
}
}
- for (QVector<Data::Chunk>::iterator i = m_d->heapChunks.begin(), ei = m_d->heapChunks.end(); i != ei; ++i)
- sweep(reinterpret_cast<char*>(i->memory.base()), i->memory.size(), i->chunkSize);
+ bool *chunkIsEmpty = (bool *)alloca(m_d->heapChunks.size() * sizeof(bool));
+ uint itemsInUse[MemoryManager::Data::MaxItemSize/16];
+ memset(itemsInUse, 0, sizeof(itemsInUse));
+ memset(m_d->nonFullChunks, 0, sizeof(m_d->nonFullChunks));
+
+ for (int i = 0; i < m_d->heapChunks.size(); ++i) {
+ Data::ChunkHeader *header = reinterpret_cast<Data::ChunkHeader *>(m_d->heapChunks[i].base());
+ chunkIsEmpty[i] = sweepChunk(header, &itemsInUse[header->itemSize >> 4], m_d->engine, &m_d->unmanagedHeapSize);
+ }
+
+ QVector<PageAllocation>::iterator chunkIter = m_d->heapChunks.begin();
+ for (int i = 0; i < m_d->heapChunks.size(); ++i) {
+ Q_ASSERT(chunkIter != m_d->heapChunks.end());
+ Data::ChunkHeader *header = reinterpret_cast<Data::ChunkHeader *>(chunkIter->base());
+ const size_t pos = header->itemSize >> 4;
+ const size_t decrease = (header->itemEnd - header->itemStart) / header->itemSize;
+
+ // Release that chunk if it could have been spared since the last GC run without any difference.
+ if (chunkIsEmpty[i] && m_d->availableItems[pos] - decrease >= itemsInUse[pos]) {
+ Q_V4_PROFILE_DEALLOC(m_d->engine, 0, chunkIter->size(), Profiling::HeapPage);
+#ifdef V4_USE_VALGRIND
+ VALGRIND_MEMPOOL_FREE(this, header);
+#endif
+ --m_d->nChunks[pos];
+ m_d->availableItems[pos] -= uint(decrease);
+ m_d->totalItems -= int(decrease);
+ chunkIter->deallocate();
+ chunkIter = m_d->heapChunks.erase(chunkIter);
+ continue;
+ } else if (header->freeItems.nextFree()) {
+ header->nextNonFull = m_d->nonFullChunks[pos];
+ m_d->nonFullChunks[pos] = header;
+ }
+ ++chunkIter;
+ }
Data::LargeItem *i = m_d->largeItems;
Data::LargeItem **last = &m_d->largeItems;
while (i) {
- Managed *m = i->managed();
+ Heap::Base *m = i->heapObject();
Q_ASSERT(m->inUse());
- if (m->markBit()) {
- m->d()->markBit = 0;
+ if (m->isMarked()) {
+ m->clearMarkBit();
last = &i->next;
i = i->next;
continue;
}
- if (m->internalClass()->vtable->destroy)
- m->internalClass()->vtable->destroy(m);
+ if (m->gcGetVtable()->destroy)
+ m->gcGetVtable()->destroy(m);
*last = i->next;
free(Q_V4_PROFILE_DEALLOC(m_d->engine, i, i->size + sizeof(Data::LargeItem),
@@ -393,48 +490,15 @@ void MemoryManager::sweep(bool lastSweep)
delete deletable;
deletable = next;
}
-}
-
-void MemoryManager::sweep(char *chunkStart, std::size_t chunkSize, size_t size)
-{
-// qDebug("chunkStart @ %p, size=%x, pos=%x (%x)", chunkStart, size, size>>4, m_d->smallItems[size >> 4]);
- Managed **f = &m_d->smallItems[size >> 4];
-#ifdef V4_USE_VALGRIND
- VALGRIND_DISABLE_ERROR_REPORTING;
-#endif
- for (char *chunk = chunkStart, *chunkEnd = chunk + chunkSize - size; chunk <= chunkEnd; chunk += size) {
- Managed *m = reinterpret_cast<Managed *>(chunk);
-// qDebug("chunk @ %p, size = %lu, in use: %s, mark bit: %s",
-// chunk, m->size, (m->inUse ? "yes" : "no"), (m->markBit ? "true" : "false"));
-
- Q_ASSERT((qintptr) chunk % 16 == 0);
-
- if (m->inUse()) {
- if (m->markBit()) {
- m->d()->markBit = 0;
- } else {
-// qDebug() << "-- collecting it." << m << *f << m->nextFree();
-#ifdef V4_USE_VALGRIND
- VALGRIND_ENABLE_ERROR_REPORTING;
-#endif
- if (m->internalClass()->vtable->destroy)
- m->internalClass()->vtable->destroy(m);
-
- memset(m, 0, size);
- m->setNextFree(*f);
-#ifdef V4_USE_VALGRIND
- VALGRIND_DISABLE_ERROR_REPORTING;
- VALGRIND_MEMPOOL_FREE(this, m);
-#endif
- Q_V4_PROFILE_DEALLOC(m_d->engine, m, size, Profiling::SmallItem);
- *f = m;
- }
+ // some execution contexts are allocated on the stack, make sure we clear their markBit as well
+ if (!lastSweep) {
+ Heap::ExecutionContext *ctx = engine()->current;
+ while (ctx) {
+ ctx->clearMarkBit();
+ ctx = ctx->parent;
}
}
-#ifdef V4_USE_VALGRIND
- VALGRIND_ENABLE_ERROR_REPORTING;
-#endif
}
bool MemoryManager::isGCBlocked() const
@@ -458,16 +522,17 @@ void MemoryManager::runGC()
mark();
sweep();
} else {
- int totalMem = getAllocatedMem();
+ const size_t totalMem = getAllocatedMem();
QTime t;
t.start();
mark();
int markTime = t.elapsed();
t.restart();
- int usedBefore = getUsedMem();
+ const size_t usedBefore = getUsedMem();
+ int chunksBefore = m_d->heapChunks.size();
sweep();
- int usedAfter = getUsedMem();
+ const size_t usedAfter = getUsedMem();
int sweepTime = t.elapsed();
qDebug() << "========== GC ==========";
@@ -477,6 +542,7 @@ void MemoryManager::runGC()
qDebug() << "Used memory before GC:" << usedBefore;
qDebug() << "Used memory after GC:" << usedAfter;
qDebug() << "Freed up bytes:" << (usedBefore - usedAfter);
+ qDebug() << "Released chunks:" << (chunksBefore - m_d->heapChunks.size());
qDebug() << "======== End GC ========";
}
@@ -488,14 +554,13 @@ void MemoryManager::runGC()
size_t MemoryManager::getUsedMem() const
{
size_t usedMem = 0;
- for (QVector<Data::Chunk>::const_iterator i = m_d->heapChunks.begin(), ei = m_d->heapChunks.end(); i != ei; ++i) {
- char *chunkStart = reinterpret_cast<char *>(i->memory.base());
- char *chunkEnd = chunkStart + i->memory.size() - i->chunkSize;
- for (char *chunk = chunkStart; chunk <= chunkEnd; chunk += i->chunkSize) {
- Managed *m = reinterpret_cast<Managed *>(chunk);
- Q_ASSERT((qintptr) chunk % 16 == 0);
+ for (QVector<PageAllocation>::const_iterator i = m_d->heapChunks.begin(), ei = m_d->heapChunks.end(); i != ei; ++i) {
+ Data::ChunkHeader *header = reinterpret_cast<Data::ChunkHeader *>(i->base());
+ for (char *item = header->itemStart; item <= header->itemEnd; item += header->itemSize) {
+ Heap::Base *m = reinterpret_cast<Heap::Base *>(item);
+ Q_ASSERT((qintptr) item % 16 == 0);
if (m->inUse())
- usedMem += i->chunkSize;
+ usedMem += header->itemSize;
}
}
return usedMem;
@@ -505,7 +570,7 @@ size_t MemoryManager::getAllocatedMem() const
{
size_t total = 0;
for (int i = 0; i < m_d->heapChunks.size(); ++i)
- total += m_d->heapChunks.at(i).memory.size();
+ total += m_d->heapChunks.at(i).size();
return total;
}
@@ -517,17 +582,16 @@ size_t MemoryManager::getLargeItemsMem() const
return total;
}
+void MemoryManager::growUnmanagedHeapSizeUsage(size_t delta)
+{
+ m_d->unmanagedHeapSize += delta;
+}
+
MemoryManager::~MemoryManager()
{
- PersistentValuePrivate *persistent = m_persistentValues;
- while (persistent) {
- PersistentValuePrivate *n = persistent->next;
- persistent->value = Primitive::undefinedValue();
- persistent->engine = 0;
- persistent->prev = 0;
- persistent->next = 0;
- persistent = n;
- }
+ delete m_persistentValues;
+ delete m_weakValues;
+ m_weakValues = 0;
sweep(/*lastSweep*/true);
#ifdef V4_USE_VALGRIND
@@ -535,9 +599,9 @@ MemoryManager::~MemoryManager()
#endif
}
-void MemoryManager::setExecutionEngine(ExecutionEngine *engine)
+ExecutionEngine *MemoryManager::engine() const
{
- m_d->engine = engine;
+ return m_d->engine;
}
void MemoryManager::dumpStats() const
diff --git a/src/qml/jsruntime/qv4mm_p.h b/src/qml/jsruntime/qv4mm_p.h
index d5e28f7f84..7f6d2edba3 100644
--- a/src/qml/jsruntime/qv4mm_p.h
+++ b/src/qml/jsruntime/qv4mm_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -35,10 +35,8 @@
#define QV4GC_H
#include "qv4global_p.h"
-#include "qv4context_p.h"
#include "qv4value_inl_p.h"
-
-#include <QScopedPointer>
+#include "qv4scopedvalue_p.h"
//#define DETAILED_MM_STATS
@@ -46,15 +44,11 @@ QT_BEGIN_NAMESPACE
namespace QV4 {
-struct ExecutionEngine;
-struct ExecutionContext;
-struct Managed;
struct GCDeletable;
class Q_QML_EXPORT MemoryManager
{
- MemoryManager(const MemoryManager &);
- MemoryManager &operator=(const MemoryManager&);
+ Q_DISABLE_COPY(MemoryManager);
public:
struct Data;
@@ -80,7 +74,7 @@ public:
};
public:
- MemoryManager();
+ MemoryManager(ExecutionEngine *engine);
~MemoryManager();
// TODO: this is only for 64bit (and x86 with SSE/AVX), so exend it for other architectures to be slightly more efficient (meaning, align on 8-byte boundaries).
@@ -88,66 +82,83 @@ public:
static inline std::size_t align(std::size_t size)
{ return (size + 15) & ~0xf; }
- inline Managed *allocManaged(std::size_t size)
+ template<typename ManagedType>
+ inline typename ManagedType::Data *allocManaged(std::size_t size, std::size_t unmanagedSize = 0)
{
size = align(size);
- Managed *o = allocData(size);
- return o;
+ Heap::Base *o = allocData(size, unmanagedSize);
+ o->vtable = ManagedType::staticVTable();
+ return static_cast<typename ManagedType::Data *>(o);
}
template <typename ManagedType>
- ManagedType *alloc()
+ typename ManagedType::Data *alloc()
{
- ManagedType *t = static_cast<ManagedType*>(allocManaged(sizeof(typename ManagedType::Data)));
+ Scope scope(engine());
+ Scoped<ManagedType> t(scope, allocManaged<ManagedType>(sizeof(typename ManagedType::Data)));
(void)new (t->d()) typename ManagedType::Data();
- return t;
+ return t->d();
}
template <typename ManagedType, typename Arg1>
- ManagedType *alloc(Arg1 arg1)
+ typename ManagedType::Data *alloc(Arg1 arg1)
{
- ManagedType *t = static_cast<ManagedType*>(allocManaged(sizeof(typename ManagedType::Data)));
+ Scope scope(engine());
+ Scoped<ManagedType> t(scope, allocManaged<ManagedType>(sizeof(typename ManagedType::Data)));
(void)new (t->d()) typename ManagedType::Data(arg1);
- return t;
+ return t->d();
+ }
+
+ template <typename ManagedType, typename Arg1>
+ typename ManagedType::Data *allocWithStringData(std::size_t unmanagedSize, Arg1 arg1)
+ {
+ Scope scope(engine());
+ Scoped<ManagedType> t(scope, allocManaged<ManagedType>(sizeof(typename ManagedType::Data), unmanagedSize));
+ (void)new (t->d()) typename ManagedType::Data(this, arg1);
+ return t->d();
}
template <typename ManagedType, typename Arg1, typename Arg2>
- ManagedType *alloc(Arg1 arg1, Arg2 arg2)
+ typename ManagedType::Data *alloc(Arg1 arg1, Arg2 arg2)
{
- ManagedType *t = static_cast<ManagedType*>(allocManaged(sizeof(typename ManagedType::Data)));
+ Scope scope(engine());
+ Scoped<ManagedType> t(scope, allocManaged<ManagedType>(sizeof(typename ManagedType::Data)));
(void)new (t->d()) typename ManagedType::Data(arg1, arg2);
- return t;
+ return t->d();
}
template <typename ManagedType, typename Arg1, typename Arg2, typename Arg3>
- ManagedType *alloc(Arg1 arg1, Arg2 arg2, Arg3 arg3)
+ typename ManagedType::Data *alloc(Arg1 arg1, Arg2 arg2, Arg3 arg3)
{
- ManagedType *t = static_cast<ManagedType*>(allocManaged(sizeof(typename ManagedType::Data)));
+ Scope scope(engine());
+ Scoped<ManagedType> t(scope, allocManaged<ManagedType>(sizeof(typename ManagedType::Data)));
(void)new (t->d()) typename ManagedType::Data(arg1, arg2, arg3);
- return t;
+ return t->d();
}
template <typename ManagedType, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
- ManagedType *alloc(Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4)
+ typename ManagedType::Data *alloc(Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4)
{
- ManagedType *t = static_cast<ManagedType*>(allocManaged(sizeof(typename ManagedType::Data)));
+ Scope scope(engine());
+ Scoped<ManagedType> t(scope, allocManaged<ManagedType>(sizeof(typename ManagedType::Data)));
(void)new (t->d()) typename ManagedType::Data(arg1, arg2, arg3, arg4);
- return t;
+ return t->d();
}
template <typename ManagedType, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5>
- ManagedType *alloc(Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5)
+ typename ManagedType::Data *alloc(Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4, Arg5 arg5)
{
- ManagedType *t = static_cast<ManagedType*>(allocManaged(sizeof(typename ManagedType::Data)));
+ Scope scope(engine());
+ Scoped<ManagedType> t(scope, allocManaged<ManagedType>(sizeof(typename ManagedType::Data)));
(void)new (t->d()) typename ManagedType::Data(arg1, arg2, arg3, arg4, arg5);
- return t;
+ return t->d();
}
bool isGCBlocked() const;
void setGCBlocked(bool blockGC);
void runGC();
- void setExecutionEngine(ExecutionEngine *engine);
+ ExecutionEngine *engine() const;
void dumpStats() const;
@@ -157,10 +168,12 @@ public:
size_t getAllocatedMem() const;
size_t getLargeItemsMem() const;
+ void growUnmanagedHeapSizeUsage(size_t delta); // called when a JS object grows itself. Specifically: Heap::String::append
+
protected:
/// expects size to be aligned
// TODO: try to inline
- Managed *allocData(std::size_t size);
+ Heap::Base *allocData(std::size_t size, std::size_t unmanagedSize);
#ifdef DETAILED_MM_STATS
void willAllocate(std::size_t size);
@@ -170,13 +183,12 @@ private:
void collectFromJSStack() const;
void mark();
void sweep(bool lastSweep = false);
- void sweep(char *chunkStart, std::size_t chunkSize, size_t size);
protected:
QScopedPointer<Data> m_d;
public:
- PersistentValuePrivate *m_persistentValues;
- PersistentValuePrivate *m_weakValues;
+ PersistentValueStorage *m_persistentValues;
+ PersistentValueStorage *m_weakValues;
};
}
diff --git a/src/qml/jsruntime/qv4numberobject.cpp b/src/qml/jsruntime/qv4numberobject.cpp
index 236091ba68..89ff110b20 100644
--- a/src/qml/jsruntime/qv4numberobject.cpp
+++ b/src/qml/jsruntime/qv4numberobject.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -32,6 +32,8 @@
****************************************************************************/
#include "qv4numberobject_p.h"
+#include "qv4runtime_p.h"
+
#include <QtCore/qnumeric.h>
#include <QtCore/qmath.h>
#include <QtCore/QDebug>
@@ -43,18 +45,16 @@ using namespace QV4;
DEFINE_OBJECT_VTABLE(NumberCtor);
DEFINE_OBJECT_VTABLE(NumberObject);
-NumberCtor::Data::Data(ExecutionContext *scope)
- : FunctionObject::Data(scope, QStringLiteral("Number"))
+Heap::NumberCtor::NumberCtor(QV4::ExecutionContext *scope)
+ : Heap::FunctionObject(scope, QStringLiteral("Number"))
{
- setVTable(staticVTable());
}
ReturnedValue NumberCtor::construct(Managed *m, CallData *callData)
{
- Scope scope(m->engine());
+ Scope scope(m->cast<NumberCtor>()->engine());
double dbl = callData->argc ? callData->args[0].toNumber() : 0.;
- ScopedValue d(scope, QV4::Primitive::fromDouble(dbl));
- return Encode(m->engine()->newNumberObject(d));
+ return Encode(scope.engine->newNumberObject(dbl));
}
ReturnedValue NumberCtor::call(Managed *, CallData *callData)
@@ -95,40 +95,41 @@ void NumberPrototype::init(ExecutionEngine *engine, Object *ctor)
inline ReturnedValue thisNumberValue(ExecutionContext *ctx)
{
- if (ctx->d()->callData->thisObject.isNumber())
- return ctx->d()->callData->thisObject.asReturnedValue();
- NumberObject *n = ctx->d()->callData->thisObject.asNumberObject();
+ if (ctx->thisObject().isNumber())
+ return ctx->thisObject().asReturnedValue();
+ NumberObject *n = ctx->thisObject().asNumberObject();
if (!n)
- return ctx->throwTypeError();
- return n->value().asReturnedValue();
+ return ctx->engine()->throwTypeError();
+ return Encode(n->value());
}
inline double thisNumber(ExecutionContext *ctx)
{
- if (ctx->d()->callData->thisObject.isNumber())
- return ctx->d()->callData->thisObject.asDouble();
- NumberObject *n = ctx->d()->callData->thisObject.asNumberObject();
+ if (ctx->thisObject().isNumber())
+ return ctx->thisObject().asDouble();
+ NumberObject *n = ctx->thisObject().asNumberObject();
if (!n)
- return ctx->throwTypeError();
- return n->value().asDouble();
+ return ctx->engine()->throwTypeError();
+ return n->value();
}
ReturnedValue NumberPrototype::method_toString(CallContext *ctx)
{
+ Scope scope(ctx);
double num = thisNumber(ctx);
- if (ctx->d()->engine->hasException)
+ if (scope.engine->hasException)
return Encode::undefined();
- if (ctx->d()->callData->argc && !ctx->d()->callData->args[0].isUndefined()) {
- int radix = ctx->d()->callData->args[0].toInt32();
+ if (ctx->argc() && !ctx->args()[0].isUndefined()) {
+ int radix = ctx->args()[0].toInt32();
if (radix < 2 || radix > 36)
- return ctx->throwError(QString::fromLatin1("Number.prototype.toString: %0 is not a valid radix")
+ return ctx->engine()->throwError(QString::fromLatin1("Number.prototype.toString: %0 is not a valid radix")
.arg(radix));
if (std::isnan(num)) {
- return ctx->d()->engine->newString(QStringLiteral("NaN"))->asReturnedValue();
+ return scope.engine->newString(QStringLiteral("NaN"))->asReturnedValue();
} else if (qIsInf(num)) {
- return ctx->d()->engine->newString(QLatin1String(num < 0 ? "-Infinity" : "Infinity"))->asReturnedValue();
+ return scope.engine->newString(QLatin1String(num < 0 ? "-Infinity" : "Infinity"))->asReturnedValue();
}
if (radix != 10) {
@@ -138,39 +139,39 @@ ReturnedValue NumberPrototype::method_toString(CallContext *ctx)
negative = true;
num = -num;
}
- double frac = num - ::floor(num);
+ double frac = num - std::floor(num);
num = Primitive::toInteger(num);
do {
- char c = (char)::fmod(num, radix);
+ char c = (char)std::fmod(num, radix);
c = (c < 10) ? (c + '0') : (c - 10 + 'a');
str.prepend(QLatin1Char(c));
- num = ::floor(num / radix);
+ num = std::floor(num / radix);
} while (num != 0);
if (frac != 0) {
str.append(QLatin1Char('.'));
do {
frac = frac * radix;
- char c = (char)::floor(frac);
+ char c = (char)std::floor(frac);
c = (c < 10) ? (c + '0') : (c - 10 + 'a');
str.append(QLatin1Char(c));
- frac = frac - ::floor(frac);
+ frac = frac - std::floor(frac);
} while (frac != 0);
}
if (negative)
str.prepend(QLatin1Char('-'));
- return ctx->d()->engine->newString(str)->asReturnedValue();
+ return scope.engine->newString(str)->asReturnedValue();
}
}
- return Primitive::fromDouble(num).toString(ctx)->asReturnedValue();
+ return Primitive::fromDouble(num).toString(scope.engine)->asReturnedValue();
}
ReturnedValue NumberPrototype::method_toLocaleString(CallContext *ctx)
{
Scope scope(ctx);
ScopedValue v(scope, thisNumberValue(ctx));
- ScopedString str(scope, v->toString(ctx));
- if (ctx->d()->engine->hasException)
+ ScopedString str(scope, v->toString(scope.engine));
+ if (scope.engine->hasException)
return Encode::undefined();
return str.asReturnedValue();
}
@@ -182,20 +183,21 @@ ReturnedValue NumberPrototype::method_valueOf(CallContext *ctx)
ReturnedValue NumberPrototype::method_toFixed(CallContext *ctx)
{
+ Scope scope(ctx);
double v = thisNumber(ctx);
- if (ctx->d()->engine->hasException)
+ if (scope.engine->hasException)
return Encode::undefined();
double fdigits = 0;
- if (ctx->d()->callData->argc > 0)
- fdigits = ctx->d()->callData->args[0].toInteger();
+ if (ctx->argc() > 0)
+ fdigits = ctx->args()[0].toInteger();
if (std::isnan(fdigits))
fdigits = 0;
if (fdigits < 0 || fdigits > 20)
- return ctx->throwRangeError(ctx->d()->callData->thisObject);
+ return ctx->engine()->throwRangeError(ctx->thisObject());
QString str;
if (std::isnan(v))
@@ -211,24 +213,24 @@ ReturnedValue NumberPrototype::method_toFixed(CallContext *ctx)
// When that's done, we can use:
// str = QString::number(v, 'f', int (fdigits));
} else
- return RuntimeHelpers::stringFromNumber(ctx, v)->asReturnedValue();
- return ctx->d()->engine->newString(str)->asReturnedValue();
+ return RuntimeHelpers::stringFromNumber(ctx->engine(), v)->asReturnedValue();
+ return scope.engine->newString(str)->asReturnedValue();
}
ReturnedValue NumberPrototype::method_toExponential(CallContext *ctx)
{
Scope scope(ctx);
double d = thisNumber(ctx);
- if (ctx->d()->engine->hasException)
+ if (scope.engine->hasException)
return Encode::undefined();
int fdigits = -1;
- if (ctx->d()->callData->argc && !ctx->d()->callData->args[0].isUndefined()) {
- fdigits = ctx->d()->callData->args[0].toInt32();
+ if (ctx->argc() && !ctx->args()[0].isUndefined()) {
+ fdigits = ctx->args()[0].toInt32();
if (fdigits < 0 || fdigits > 20) {
- ScopedString error(scope, ctx->d()->engine->newString(QStringLiteral("Number.prototype.toExponential: fractionDigits out of range")));
- return ctx->throwRangeError(error);
+ ScopedString error(scope, scope.engine->newString(QStringLiteral("Number.prototype.toExponential: fractionDigits out of range")));
+ return ctx->engine()->throwRangeError(error);
}
}
@@ -237,23 +239,23 @@ ReturnedValue NumberPrototype::method_toExponential(CallContext *ctx)
double_conversion::DoubleToStringConverter::EcmaScriptConverter().ToExponential(d, fdigits, &builder);
QString result = QString::fromLatin1(builder.Finalize());
- return ctx->d()->engine->newString(result)->asReturnedValue();
+ return scope.engine->newString(result)->asReturnedValue();
}
ReturnedValue NumberPrototype::method_toPrecision(CallContext *ctx)
{
Scope scope(ctx);
ScopedValue v(scope, thisNumberValue(ctx));
- if (ctx->d()->engine->hasException)
+ if (scope.engine->hasException)
return Encode::undefined();
- if (!ctx->d()->callData->argc || ctx->d()->callData->args[0].isUndefined())
- return RuntimeHelpers::toString(ctx, v);
+ if (!ctx->argc() || ctx->args()[0].isUndefined())
+ return RuntimeHelpers::toString(scope.engine, v);
- double precision = ctx->d()->callData->args[0].toInt32();
+ double precision = ctx->args()[0].toInt32();
if (precision < 1 || precision > 21) {
- ScopedString error(scope, ctx->d()->engine->newString(QStringLiteral("Number.prototype.toPrecision: precision out of range")));
- return ctx->throwRangeError(error);
+ ScopedString error(scope, scope.engine->newString(QStringLiteral("Number.prototype.toPrecision: precision out of range")));
+ return ctx->engine()->throwRangeError(error);
}
char str[100];
@@ -261,5 +263,5 @@ ReturnedValue NumberPrototype::method_toPrecision(CallContext *ctx)
double_conversion::DoubleToStringConverter::EcmaScriptConverter().ToPrecision(v->asDouble(), precision, &builder);
QString result = QString::fromLatin1(builder.Finalize());
- return ctx->d()->engine->newString(result)->asReturnedValue();
+ return scope.engine->newString(result)->asReturnedValue();
}
diff --git a/src/qml/jsruntime/qv4numberobject_p.h b/src/qml/jsruntime/qv4numberobject_p.h
index 9edaf09749..205995701b 100644
--- a/src/qml/jsruntime/qv4numberobject_p.h
+++ b/src/qml/jsruntime/qv4numberobject_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -41,12 +41,17 @@ QT_BEGIN_NAMESPACE
namespace QV4 {
+namespace Heap {
+
+struct NumberCtor : FunctionObject {
+ NumberCtor(QV4::ExecutionContext *scope);
+};
+
+}
+
struct NumberCtor: FunctionObject
{
- struct Data : FunctionObject::Data {
- Data(ExecutionContext *scope);
- };
- V4_OBJECT(FunctionObject)
+ V4_OBJECT2(NumberCtor, FunctionObject)
static ReturnedValue construct(Managed *that, CallData *callData);
static ReturnedValue call(Managed *, CallData *callData);
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp
index 0c61d666ab..211fd1812e 100644
--- a/src/qml/jsruntime/qv4object.cpp
+++ b/src/qml/jsruntime/qv4object.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -41,82 +41,72 @@
#include "qv4lookup_p.h"
#include "qv4scopedvalue_p.h"
#include "qv4memberdata_p.h"
+#include "qv4objectiterator_p.h"
+#include "qv4identifier_p.h"
-#include <private/qqmljsengine_p.h>
-#include <private/qqmljslexer_p.h>
-#include <private/qqmljsparser_p.h>
-#include <private/qqmljsast_p.h>
-#include <qv4jsir_p.h>
-#include <qv4codegen_p.h>
-#include "private/qlocale_tools_p.h"
-
-#include <QtCore/qmath.h>
-#include <QtCore/QDebug>
-#include <cassert>
-#include <typeinfo>
-#include <iostream>
#include <stdint.h>
-#include "qv4alloca_p.h"
using namespace QV4;
DEFINE_OBJECT_VTABLE(Object);
-Object::Data::Data(InternalClass *internalClass)
- : Managed::Data(internalClass)
+Heap::Object::Object(InternalClass *internalClass, QV4::Object *prototype)
+ : internalClass(internalClass),
+ prototype(prototype ? prototype->d() : 0)
{
if (internalClass->size) {
Scope scope(internalClass->engine);
ScopedObject o(scope, this);
- o->memberData().ensureIndex(internalClass->engine, internalClass->size);
+ o->ensureMemberIndex(internalClass->engine, internalClass->size);
}
}
bool Object::setPrototype(Object *proto)
{
- Object *pp = proto;
+ Heap::Object *pp = proto ? proto->d() : 0;
while (pp) {
- if (pp == this)
+ if (pp == d())
return false;
- pp = pp->prototype();
+ pp = pp->prototype;
}
- setInternalClass(internalClass()->changePrototype(proto));
+ d()->prototype = proto ? proto->d() : 0;
return true;
}
-void Object::put(ExecutionContext *ctx, const QString &name, const ValueRef value)
+void Object::put(ExecutionEngine *engine, const QString &name, const Value &value)
{
- Scope scope(ctx);
- ScopedString n(scope, ctx->d()->engine->newString(name));
- put(n.getPointer(), value);
+ Scope scope(engine);
+ ScopedString n(scope, engine->newString(name));
+ put(n, value);
}
-ReturnedValue Object::getValue(const ValueRef thisObject, const Property *p, PropertyAttributes attrs)
+ReturnedValue Object::getValue(const Value &thisObject, const Property *p, PropertyAttributes attrs)
{
if (!attrs.isAccessor())
return p->value.asReturnedValue();
- FunctionObject *getter = p->getter();
- if (!getter)
+ if (!p->getter())
return Encode::undefined();
- Scope scope(getter->engine());
- ScopedCallData callData(scope, 0);
- callData->thisObject = *thisObject;
+ Scope scope(p->getter()->internalClass->engine);
+ ScopedFunctionObject getter(scope, p->getter());
+ ScopedCallData callData(scope);
+ callData->thisObject = thisObject;
return getter->call(callData);
}
-void Object::putValue(Property *pd, PropertyAttributes attrs, const ValueRef value)
+void Object::putValue(Property *pd, PropertyAttributes attrs, const Value &value)
{
if (internalClass()->engine->hasException)
return;
if (attrs.isAccessor()) {
- if (FunctionObject *set = pd->setter()) {
- Scope scope(set->engine());
+ if (Heap::FunctionObject *set = pd->setter()) {
+ Scope scope(set->internalClass->engine);
+ ScopedFunctionObject setter(scope, set);
ScopedCallData callData(scope, 1);
- callData->args[0] = *value;
+ callData->args[0] = value;
callData->thisObject = this;
- set->call(callData);
+ setter->call(callData);
return;
}
goto reject;
@@ -125,20 +115,20 @@ void Object::putValue(Property *pd, PropertyAttributes attrs, const ValueRef val
if (!attrs.isWritable())
goto reject;
- pd->value = *value;
+ pd->value = value;
return;
reject:
- if (engine()->currentContext()->d()->strictMode)
- engine()->currentContext()->throwTypeError();
+ if (engine()->currentContext()->strictMode)
+ engine()->throwTypeError();
}
-void Object::defineDefaultProperty(const QString &name, ValueRef value)
+void Object::defineDefaultProperty(const QString &name, const Value &value)
{
ExecutionEngine *e = engine();
Scope scope(e);
ScopedString s(scope, e->newIdentifier(name));
- defineDefaultProperty(s.getPointer(), value);
+ defineDefaultProperty(s, value);
}
void Object::defineDefaultProperty(const QString &name, ReturnedValue (*code)(CallContext *), int argumentCount)
@@ -146,16 +136,18 @@ void Object::defineDefaultProperty(const QString &name, ReturnedValue (*code)(Ca
ExecutionEngine *e = engine();
Scope scope(e);
ScopedString s(scope, e->newIdentifier(name));
- Scoped<FunctionObject> function(scope, BuiltinFunction::create(e->rootContext, s.getPointer(), code));
+ ScopedContext global(scope, e->rootContext());
+ ScopedFunctionObject function(scope, BuiltinFunction::create(global, s, code));
function->defineReadonlyProperty(e->id_length, Primitive::fromInt32(argumentCount));
- defineDefaultProperty(s.getPointer(), function);
+ defineDefaultProperty(s, function);
}
void Object::defineDefaultProperty(String *name, ReturnedValue (*code)(CallContext *), int argumentCount)
{
ExecutionEngine *e = engine();
Scope scope(e);
- Scoped<FunctionObject> function(scope, BuiltinFunction::create(e->rootContext, name, code));
+ ScopedContext global(scope, e->rootContext());
+ ScopedFunctionObject function(scope, BuiltinFunction::create(global, name, code));
function->defineReadonlyProperty(e->id_length, Primitive::fromInt32(argumentCount));
defineDefaultProperty(name, function);
}
@@ -164,8 +156,8 @@ void Object::defineAccessorProperty(const QString &name, ReturnedValue (*getter)
{
ExecutionEngine *e = engine();
Scope scope(e);
- Scoped<String> s(scope, e->newIdentifier(name));
- defineAccessorProperty(s.getPointer(), getter, setter);
+ ScopedString s(scope, e->newIdentifier(name));
+ defineAccessorProperty(s, getter, setter);
}
void Object::defineAccessorProperty(String *name, ReturnedValue (*getter)(CallContext *), ReturnedValue (*setter)(CallContext *))
@@ -173,39 +165,43 @@ void Object::defineAccessorProperty(String *name, ReturnedValue (*getter)(CallCo
ExecutionEngine *v4 = engine();
QV4::Scope scope(v4);
ScopedProperty p(scope);
- p->setGetter(getter ? ScopedFunctionObject(scope, BuiltinFunction::create(v4->rootContext, name, getter)).getPointer() : 0);
- p->setSetter(setter ? ScopedFunctionObject(scope, BuiltinFunction::create(v4->rootContext, name, setter)).getPointer() : 0);
+ ScopedContext global(scope, scope.engine->rootContext());
+ p->setGetter(ScopedFunctionObject(scope, (getter ? BuiltinFunction::create(global, name, getter) : 0)));
+ p->setSetter(ScopedFunctionObject(scope, (setter ? BuiltinFunction::create(global, name, setter) : 0)));
insertMember(name, p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
}
-void Object::defineReadonlyProperty(const QString &name, ValueRef value)
+void Object::defineReadonlyProperty(const QString &name, const Value &value)
{
QV4::ExecutionEngine *e = engine();
Scope scope(e);
ScopedString s(scope, e->newIdentifier(name));
- defineReadonlyProperty(s.getPointer(), value);
+ defineReadonlyProperty(s, value);
}
-void Object::defineReadonlyProperty(String *name, ValueRef value)
+void Object::defineReadonlyProperty(String *name, const Value &value)
{
insertMember(name, value, Attr_ReadOnly);
}
-void Object::markObjects(Managed *that, ExecutionEngine *e)
+void Object::markObjects(Heap::Base *that, ExecutionEngine *e)
{
- Object *o = static_cast<Object *>(that);
-
- o->memberData().mark(e);
- if (o->arrayData())
- o->arrayData()->mark(e);
+ Heap::Object *o = static_cast<Heap::Object *>(that);
+
+ if (o->memberData)
+ o->memberData->mark(e);
+ if (o->arrayData)
+ o->arrayData->mark(e);
+ if (o->prototype)
+ o->prototype->mark(e);
}
void Object::ensureMemberIndex(uint idx)
{
- memberData().ensureIndex(engine(), idx);
+ d()->memberData = MemberData::reallocate(engine(), d()->memberData, idx);
}
-void Object::insertMember(String *s, const Property &p, PropertyAttributes attributes)
+void Object::insertMember(String *s, const Property *p, PropertyAttributes attributes)
{
uint idx;
InternalClass::addMember(this, s, attributes, &idx);
@@ -214,12 +210,11 @@ void Object::insertMember(String *s, const Property &p, PropertyAttributes attri
ensureMemberIndex(internalClass()->size);
if (attributes.isAccessor()) {
- setHasAccessorProperty();
Property *pp = propertyAt(idx);
- pp->value = p.value;
- pp->set = p.set;
+ pp->value = p->value;
+ pp->set = p->set;
} else {
- memberData()[idx] = p.value;
+ d()->memberData->data[idx] = p->value;
}
}
@@ -269,16 +264,16 @@ Property *Object::__getPropertyDescriptor__(String *name, PropertyAttributes *at
return __getPropertyDescriptor__(idx, attrs);
- const Object *o = this;
+ const Heap::Object *o = d();
while (o) {
- uint idx = o->internalClass()->find(name);
+ uint idx = o->internalClass->find(name);
if (idx < UINT_MAX) {
if (attrs)
- *attrs = o->internalClass()->propertyData[idx];
- return o->propertyAt(idx);
+ *attrs = o->internalClass->propertyData[idx];
+ return const_cast<Property *>(o->propertyAt(idx));
}
- o = o->prototype();
+ o = o->prototype;
}
if (attrs)
*attrs = Attr_Invalid;
@@ -287,23 +282,23 @@ Property *Object::__getPropertyDescriptor__(String *name, PropertyAttributes *at
Property *Object::__getPropertyDescriptor__(uint index, PropertyAttributes *attrs) const
{
- const Object *o = this;
+ const Heap::Object *o = d();
while (o) {
- Property *p = o->arrayData() ? o->arrayData()->getProperty(index) : 0;
+ Property *p = o->arrayData ? o->arrayData->getProperty(index) : 0;
if (p) {
if (attrs)
- *attrs = o->arrayData()->attributes(index);
+ *attrs = o->arrayData->attributes(index);
return p;
}
- if (o->isStringObject()) {
- Property *p = static_cast<const StringObject *>(o)->getIndex(index);
+ if (o->vtable->type == Type_StringObject) {
+ Property *p = static_cast<const Heap::StringObject *>(o)->getIndex(index);
if (p) {
if (attrs)
*attrs = (Attr_NotWritable|Attr_NotConfigurable);
return p;
}
}
- o = o->prototype();
+ o = o->prototype;
}
if (attrs)
*attrs = Attr_Invalid;
@@ -316,7 +311,8 @@ bool Object::hasProperty(String *name) const
if (idx != UINT_MAX)
return hasProperty(idx);
- const Object *o = this;
+ Scope scope(engine());
+ ScopedObject o(scope, d());
while (o) {
if (o->hasOwnProperty(name))
return true;
@@ -329,7 +325,8 @@ bool Object::hasProperty(String *name) const
bool Object::hasProperty(uint index) const
{
- const Object *o = this;
+ Scope scope(engine());
+ ScopedObject o(scope, d());
while (o) {
if (o->hasOwnProperty(index))
return true;
@@ -357,6 +354,7 @@ bool Object::hasOwnProperty(uint index) const
{
if (arrayData() && !arrayData()->isEmpty(index))
return true;
+
if (isStringObject()) {
String *s = static_cast<const StringObject *>(this)->d()->value.asString();
if (index < (uint)s->d()->length())
@@ -369,12 +367,12 @@ bool Object::hasOwnProperty(uint index) const
ReturnedValue Object::construct(Managed *m, CallData *)
{
- return m->engine()->currentContext()->throwTypeError();
+ return static_cast<Object *>(m)->engine()->throwTypeError();
}
ReturnedValue Object::call(Managed *m, CallData *)
{
- return m->engine()->currentContext()->throwTypeError();
+ return static_cast<Object *>(m)->engine()->throwTypeError();
}
ReturnedValue Object::get(Managed *m, String *name, bool *hasProperty)
@@ -387,12 +385,12 @@ ReturnedValue Object::getIndexed(Managed *m, uint index, bool *hasProperty)
return static_cast<Object *>(m)->internalGetIndexed(index, hasProperty);
}
-void Object::put(Managed *m, String *name, const ValueRef value)
+void Object::put(Managed *m, String *name, const Value &value)
{
static_cast<Object *>(m)->internalPut(name, value);
}
-void Object::putIndexed(Managed *m, uint index, const ValueRef value)
+void Object::putIndexed(Managed *m, uint index, const Value &value)
{
static_cast<Object *>(m)->internalPutIndexed(index, value);
}
@@ -414,7 +412,7 @@ PropertyAttributes Object::query(const Managed *m, String *name)
PropertyAttributes Object::queryIndexed(const Managed *m, uint index)
{
const Object *o = static_cast<const Object *>(m);
- if (o->arrayData() && o->arrayData()->get(index) != Primitive::emptyValue().asReturnedValue())
+ if (o->arrayData() && !o->arrayData()->isEmpty(index))
return o->arrayData()->attributes(index);
if (o->isStringObject()) {
@@ -466,19 +464,20 @@ ReturnedValue Object::getLookup(Managed *m, Lookup *l)
return Encode::undefined();
}
-void Object::setLookup(Managed *m, Lookup *l, const ValueRef value)
+void Object::setLookup(Managed *m, Lookup *l, const Value &value)
{
- Scope scope(m->engine());
+ Scope scope(static_cast<Object *>(m)->engine());
ScopedObject o(scope, static_cast<Object *>(m));
+ ScopedString name(scope, scope.engine->currentContext()->compilationUnit->runtimeStrings[l->nameIndex]);
InternalClass *c = o->internalClass();
- uint idx = c->find(l->name);
- if (!o->isArrayObject() || idx != ArrayObject::LengthPropertyIndex) {
+ uint idx = c->find(name);
+ if (!o->isArrayObject() || idx != Heap::ArrayObject::LengthPropertyIndex) {
if (idx != UINT_MAX && o->internalClass()->propertyData[idx].isData() && o->internalClass()->propertyData[idx].isWritable()) {
l->classList[0] = o->internalClass();
l->index = idx;
l->setter = Lookup::setter0;
- o->memberData()[idx] = *value;
+ o->memberData()->data[idx] = value;
return;
}
@@ -488,12 +487,11 @@ void Object::setLookup(Managed *m, Lookup *l, const ValueRef value)
}
}
- ScopedString s(scope, l->name);
- o->put(s.getPointer(), value);
+ o->put(name, value);
if (o->internalClass() == c)
return;
- idx = o->internalClass()->find(l->name);
+ idx = o->internalClass()->find(name);
if (idx == UINT_MAX)
return;
l->classList[0] = c;
@@ -518,10 +516,10 @@ void Object::setLookup(Managed *m, Lookup *l, const ValueRef value)
l->setter = Lookup::setterGeneric;
}
-void Object::advanceIterator(Managed *m, ObjectIterator *it, String *&name, uint *index, Property *pd, PropertyAttributes *attrs)
+void Object::advanceIterator(Managed *m, ObjectIterator *it, Heap::String **name, uint *index, Property *pd, PropertyAttributes *attrs)
{
Object *o = static_cast<Object *>(m);
- name = (String *)0;
+ *name = 0;
*index = UINT_MAX;
if (o->arrayData()) {
@@ -533,15 +531,15 @@ void Object::advanceIterator(Managed *m, ObjectIterator *it, String *&name, uint
while (it->arrayNode != o->sparseEnd()) {
int k = it->arrayNode->key();
uint pidx = it->arrayNode->value;
- SparseArrayData *sa = static_cast<SparseArrayData *>(o->arrayData());
- Property *p = reinterpret_cast<Property *>(sa->arrayData() + pidx);
+ Heap::SparseArrayData *sa = static_cast<Heap::SparseArrayData *>(o->d()->arrayData);
+ Property *p = reinterpret_cast<Property *>(sa->arrayData + pidx);
it->arrayNode = it->arrayNode->nextNode();
- PropertyAttributes a = o->arrayData()->attributes(k);
+ PropertyAttributes a = sa->attrs ? sa->attrs[pidx] : Attr_Data;
if (!(it->flags & ObjectIterator::EnumerableOnly) || a.isEnumerable()) {
it->arrayIndex = k + 1;
*index = k;
*attrs = a;
- pd->copy(*p, a);
+ pd->copy(p, a);
return;
}
}
@@ -549,8 +547,8 @@ void Object::advanceIterator(Managed *m, ObjectIterator *it, String *&name, uint
it->arrayIndex = UINT_MAX;
}
// dense arrays
- while (it->arrayIndex < o->arrayData()->length()) {
- SimpleArrayData *sa = static_cast<SimpleArrayData *>(o->arrayData());
+ while (it->arrayIndex < o->d()->arrayData->len) {
+ Heap::SimpleArrayData *sa = static_cast<Heap::SimpleArrayData *>(o->d()->arrayData);
Value &val = sa->data(it->arrayIndex);
PropertyAttributes a = o->arrayData()->attributes(it->arrayIndex);
++it->arrayIndex;
@@ -565,7 +563,7 @@ void Object::advanceIterator(Managed *m, ObjectIterator *it, String *&name, uint
}
while (it->memberIndex < o->internalClass()->size) {
- String *n = o->internalClass()->nameMap.at(it->memberIndex);
+ Identifier *n = o->internalClass()->nameMap.at(it->memberIndex);
if (!n) {
// accessor properties have a dummy entry with n == 0
++it->memberIndex;
@@ -576,9 +574,9 @@ void Object::advanceIterator(Managed *m, ObjectIterator *it, String *&name, uint
PropertyAttributes a = o->internalClass()->propertyData[it->memberIndex];
++it->memberIndex;
if (!(it->flags & ObjectIterator::EnumerableOnly) || a.isEnumerable()) {
- name = n;
+ *name = o->engine()->newString(n->string);
*attrs = a;
- pd->copy(*p, a);
+ pd->copy(p, a);
return;
}
}
@@ -593,9 +591,10 @@ ReturnedValue Object::internalGet(String *name, bool *hasProperty)
if (idx != UINT_MAX)
return getIndexed(idx, hasProperty);
- name->makeIdentifier();
+ Scope scope(engine());
+ name->makeIdentifier(scope.engine);
- Object *o = this;
+ ScopedObject o(scope, this);
while (o) {
uint idx = o->internalClass()->find(name);
if (idx < UINT_MAX) {
@@ -616,7 +615,8 @@ ReturnedValue Object::internalGetIndexed(uint index, bool *hasProperty)
{
Property *pd = 0;
PropertyAttributes attrs;
- Object *o = this;
+ Scope scope(engine());
+ ScopedObject o(scope, this);
while (o) {
Property *p = o->arrayData() ? o->arrayData()->getProperty(index) : 0;
if (p) {
@@ -625,7 +625,7 @@ ReturnedValue Object::internalGetIndexed(uint index, bool *hasProperty)
break;
}
if (o->isStringObject()) {
- pd = static_cast<StringObject *>(o)->getIndex(index);
+ pd = static_cast<StringObject *>(o.getPointer())->getIndex(index);
if (pd) {
attrs = (Attr_NotWritable|Attr_NotConfigurable);
break;
@@ -647,7 +647,7 @@ ReturnedValue Object::internalGetIndexed(uint index, bool *hasProperty)
// Section 8.12.5
-void Object::internalPut(String *name, const ValueRef value)
+void Object::internalPut(String *name, const Value &value)
{
if (internalClass()->engine->hasException)
return;
@@ -656,7 +656,7 @@ void Object::internalPut(String *name, const ValueRef value)
if (idx != UINT_MAX)
return putIndexed(idx, value);
- name->makeIdentifier();
+ name->makeIdentifier(engine());
uint member = internalClass()->find(name);
Property *pd = 0;
@@ -676,16 +676,16 @@ void Object::internalPut(String *name, const ValueRef value)
goto reject;
else if (isArrayObject() && name->equals(engine()->id_length)) {
bool ok;
- uint l = value->asArrayLength(&ok);
+ uint l = value.asArrayLength(&ok);
if (!ok) {
- engine()->currentContext()->throwRangeError(value);
+ engine()->throwRangeError(value);
return;
}
ok = setArrayLength(l);
if (!ok)
goto reject;
} else {
- pd->value = *value;
+ pd->value = value;
}
return;
} else if (!prototype()) {
@@ -693,7 +693,8 @@ void Object::internalPut(String *name, const ValueRef value)
goto reject;
} else {
// clause 4
- if ((pd = prototype()->__getPropertyDescriptor__(name, &attrs))) {
+ Scope scope(engine());
+ if ((pd = ScopedObject(scope, prototype())->__getPropertyDescriptor__(name, &attrs))) {
if (attrs.isAccessor()) {
if (!pd->setter())
goto reject;
@@ -712,10 +713,11 @@ void Object::internalPut(String *name, const ValueRef value)
assert(pd->setter() != 0);
Scope scope(engine());
+ ScopedFunctionObject setter(scope, pd->setter());
ScopedCallData callData(scope, 1);
- callData->args[0] = *value;
+ callData->args[0] = value;
callData->thisObject = this;
- pd->setter()->call(callData);
+ setter->call(callData);
return;
}
@@ -723,15 +725,15 @@ void Object::internalPut(String *name, const ValueRef value)
return;
reject:
- if (engine()->currentContext()->d()->strictMode) {
+ if (engine()->currentContext()->strictMode) {
QString message = QStringLiteral("Cannot assign to read-only property \"");
message += name->toQString();
message += QLatin1Char('\"');
- engine()->currentContext()->throwTypeError(message);
+ engine()->throwTypeError(message);
}
}
-void Object::internalPutIndexed(uint index, const ValueRef value)
+void Object::internalPutIndexed(uint index, const Value &value)
{
if (internalClass()->engine->hasException)
return;
@@ -758,14 +760,15 @@ void Object::internalPutIndexed(uint index, const ValueRef value)
} else if (!attrs.isWritable())
goto reject;
else
- pd->value = *value;
+ pd->value = value;
return;
} else if (!prototype()) {
if (!isExtensible())
goto reject;
} else {
// clause 4
- if ((pd = prototype()->__getPropertyDescriptor__(index, &attrs))) {
+ Scope scope(engine());
+ if ((pd = ScopedObject(scope, prototype())->__getPropertyDescriptor__(index, &attrs))) {
if (attrs.isAccessor()) {
if (!pd->setter())
goto reject;
@@ -784,10 +787,11 @@ void Object::internalPutIndexed(uint index, const ValueRef value)
assert(pd->setter() != 0);
Scope scope(engine());
+ ScopedFunctionObject setter(scope, pd->setter());
ScopedCallData callData(scope, 1);
- callData->args[0] = *value;
+ callData->args[0] = value;
callData->thisObject = this;
- pd->setter()->call(callData);
+ setter->call(callData);
return;
}
@@ -795,8 +799,8 @@ void Object::internalPutIndexed(uint index, const ValueRef value)
return;
reject:
- if (engine()->currentContext()->d()->strictMode)
- engine()->currentContext()->throwTypeError();
+ if (engine()->currentContext()->strictMode)
+ engine()->throwTypeError();
}
// Section 8.12.7
@@ -809,7 +813,7 @@ bool Object::internalDeleteProperty(String *name)
if (idx != UINT_MAX)
return deleteIndexedProperty(idx);
- name->makeIdentifier();
+ name->makeIdentifier(engine());
uint memberIdx = internalClass()->find(name);
if (memberIdx != UINT_MAX) {
@@ -817,8 +821,8 @@ bool Object::internalDeleteProperty(String *name)
InternalClass::removeMember(this, name->identifier());
return true;
}
- if (engine()->currentContext()->d()->strictMode)
- engine()->currentContext()->throwTypeError();
+ if (engine()->currentContext()->strictMode)
+ engine()->throwTypeError();
return false;
}
@@ -827,46 +831,48 @@ bool Object::internalDeleteProperty(String *name)
bool Object::internalDeleteIndexedProperty(uint index)
{
- if (internalClass()->engine->hasException)
+ Scope scope(engine());
+ if (scope.engine->hasException)
return false;
- if (!arrayData() || arrayData()->vtable()->del(this, index))
+ Scoped<ArrayData> ad(scope, arrayData());
+ if (!ad || ad->vtable()->del(this, index))
return true;
- if (engine()->currentContext()->d()->strictMode)
- engine()->currentContext()->throwTypeError();
+ if (engine()->currentContext()->strictMode)
+ engine()->throwTypeError();
return false;
}
// Section 8.12.9
-bool Object::__defineOwnProperty__(ExecutionContext *ctx, String *name, const Property &p, PropertyAttributes attrs)
+bool Object::__defineOwnProperty__(ExecutionEngine *engine, String *name, const Property *p, PropertyAttributes attrs)
{
uint idx = name->asArrayIndex();
if (idx != UINT_MAX)
- return __defineOwnProperty__(ctx, idx, p, attrs);
+ return __defineOwnProperty__(engine, idx, p, attrs);
- name->makeIdentifier();
+ Scope scope(engine);
+ name->makeIdentifier(scope.engine);
- Scope scope(ctx);
Property *current;
PropertyAttributes *cattrs;
uint memberIndex;
- if (isArrayObject() && name->equals(ctx->d()->engine->id_length)) {
- assert(ArrayObject::LengthPropertyIndex == internalClass()->find(ctx->d()->engine->id_length));
- Property *lp = propertyAt(ArrayObject::LengthPropertyIndex);
- cattrs = internalClass()->propertyData.constData() + ArrayObject::LengthPropertyIndex;
- if (attrs.isEmpty() || p.isSubset(attrs, *lp, *cattrs))
+ if (isArrayObject() && name->equals(engine->id_length)) {
+ Q_ASSERT(Heap::ArrayObject::LengthPropertyIndex == internalClass()->find(engine->id_length));
+ Property *lp = propertyAt(Heap::ArrayObject::LengthPropertyIndex);
+ cattrs = internalClass()->propertyData.constData() + Heap::ArrayObject::LengthPropertyIndex;
+ if (attrs.isEmpty() || p->isSubset(attrs, lp, *cattrs))
return true;
if (!cattrs->isWritable() || attrs.type() == PropertyAttributes::Accessor || attrs.isConfigurable() || attrs.isEnumerable())
goto reject;
bool succeeded = true;
if (attrs.type() == PropertyAttributes::Data) {
bool ok;
- uint l = p.value.asArrayLength(&ok);
+ uint l = p->value.asArrayLength(&ok);
if (!ok) {
- ScopedValue v(scope, p.value);
- ctx->throwRangeError(v);
+ ScopedValue v(scope, p->value);
+ engine->throwRangeError(v);
return false;
}
succeeded = setArrayLength(l);
@@ -875,8 +881,6 @@ bool Object::__defineOwnProperty__(ExecutionContext *ctx, String *name, const Pr
cattrs->setWritable(false);
if (!succeeded)
goto reject;
- if (attrs.isAccessor())
- setHasAccessorProperty();
return true;
}
@@ -890,37 +894,37 @@ bool Object::__defineOwnProperty__(ExecutionContext *ctx, String *name, const Pr
if (!isExtensible())
goto reject;
// clause 4
- Property pd;
- pd.copy(p, attrs);
- pd.fullyPopulated(&attrs);
+ ScopedProperty pd(scope);
+ pd->copy(p, attrs);
+ pd->fullyPopulated(&attrs);
insertMember(name, pd, attrs);
return true;
}
- return __defineOwnProperty__(ctx, memberIndex, name, p, attrs);
+ return __defineOwnProperty__(engine, memberIndex, name, p, attrs);
reject:
- if (ctx->d()->strictMode)
- ctx->throwTypeError();
+ if (engine->currentContext()->strictMode)
+ engine->throwTypeError();
return false;
}
-bool Object::__defineOwnProperty__(ExecutionContext *ctx, uint index, const Property &p, PropertyAttributes attrs)
+bool Object::__defineOwnProperty__(ExecutionEngine *engine, uint index, const Property *p, PropertyAttributes attrs)
{
// 15.4.5.1, 4b
- if (isArrayObject() && index >= getLength() && !internalClass()->propertyData[ArrayObject::LengthPropertyIndex].isWritable())
+ if (isArrayObject() && index >= getLength() && !internalClass()->propertyData[Heap::ArrayObject::LengthPropertyIndex].isWritable())
goto reject;
if (ArgumentsObject::isNonStrictArgumentsObject(this))
- return static_cast<ArgumentsObject *>(this)->defineOwnProperty(ctx, index, p, attrs);
+ return static_cast<ArgumentsObject *>(this)->defineOwnProperty(engine, index, p, attrs);
- return defineOwnProperty2(ctx, index, p, attrs);
+ return defineOwnProperty2(engine, index, p, attrs);
reject:
- if (ctx->d()->strictMode)
- ctx->throwTypeError();
+ if (engine->currentContext()->strictMode)
+ engine->throwTypeError();
return false;
}
-bool Object::defineOwnProperty2(ExecutionContext *ctx, uint index, const Property &p, PropertyAttributes attrs)
+bool Object::defineOwnProperty2(ExecutionEngine *engine, uint index, const Property *p, PropertyAttributes attrs)
{
Property *current = 0;
@@ -936,12 +940,12 @@ bool Object::defineOwnProperty2(ExecutionContext *ctx, uint index, const Propert
if (!isExtensible())
goto reject;
// clause 4
- Property pp;
- pp.copy(p, attrs);
- pp.fullyPopulated(&attrs);
+ Scope scope(engine);
+ ScopedProperty pp(scope);
+ pp->copy(p, attrs);
+ pp->fullyPopulated(&attrs);
if (attrs == Attr_Data) {
- Scope scope(ctx);
- ScopedValue v(scope, pp.value);
+ ScopedValue v(scope, pp->value);
arraySet(index, v);
} else {
arraySet(index, pp, attrs);
@@ -949,14 +953,14 @@ bool Object::defineOwnProperty2(ExecutionContext *ctx, uint index, const Propert
return true;
}
- return __defineOwnProperty__(ctx, index, 0, p, attrs);
+ return __defineOwnProperty__(engine, index, 0, p, attrs);
reject:
- if (ctx->d()->strictMode)
- ctx->throwTypeError();
+ if (engine->currentContext()->strictMode)
+ engine->throwTypeError();
return false;
}
-bool Object::__defineOwnProperty__(ExecutionContext *ctx, uint index, String *member, const Property &p, PropertyAttributes attrs)
+bool Object::__defineOwnProperty__(ExecutionEngine *engine, uint index, String *member, const Property *p, PropertyAttributes attrs)
{
// clause 5
if (attrs.isEmpty())
@@ -973,7 +977,7 @@ bool Object::__defineOwnProperty__(ExecutionContext *ctx, uint index, String *me
}
// clause 6
- if (p.isSubset(attrs, *current, cattrs))
+ if (p->isSubset(attrs, current, cattrs))
return true;
// clause 7
@@ -1019,15 +1023,15 @@ bool Object::__defineOwnProperty__(ExecutionContext *ctx, uint index, String *me
}
} else if (cattrs.isData() && attrs.isData()) { // clause 10
if (!cattrs.isConfigurable() && !cattrs.isWritable()) {
- if (attrs.isWritable() || !current->value.sameValue(p.value))
+ if (attrs.isWritable() || !current->value.sameValue(p->value))
goto reject;
}
} else { // clause 10
Q_ASSERT(cattrs.isAccessor() && attrs.isAccessor());
if (!cattrs.isConfigurable()) {
- if (!p.value.isEmpty() && current->value.val != p.value.val)
+ if (!p->value.isEmpty() && current->value.val != p->value.val)
goto reject;
- if (!p.set.isEmpty() && current->set.val != p.set.val)
+ if (!p->set.isEmpty() && current->set.val != p->set.val)
goto reject;
}
}
@@ -1040,21 +1044,19 @@ bool Object::__defineOwnProperty__(ExecutionContext *ctx, uint index, String *me
} else {
setArrayAttributes(index, cattrs);
}
- if (cattrs.isAccessor())
- setHasAccessorProperty();
return true;
reject:
- if (ctx->d()->strictMode)
- ctx->throwTypeError();
+ if (engine->currentContext()->strictMode)
+ engine->throwTypeError();
return false;
}
-bool Object::__defineOwnProperty__(ExecutionContext *ctx, const QString &name, const Property &p, PropertyAttributes attrs)
+bool Object::__defineOwnProperty__(ExecutionEngine *engine, const QString &name, const Property *p, PropertyAttributes attrs)
{
- Scope scope(ctx);
- ScopedString s(scope, ctx->d()->engine->newString(name));
- return __defineOwnProperty__(ctx, s.getPointer(), p, attrs);
+ Scope scope(engine);
+ ScopedString s(scope, engine->newString(name));
+ return __defineOwnProperty__(engine, s, p, attrs);
}
@@ -1063,7 +1065,8 @@ void Object::copyArrayData(Object *other)
Q_ASSERT(isArrayObject());
Scope scope(engine());
- if (other->protoHasArray() || other->hasAccessorProperty()) {
+ if (other->protoHasArray() || ArgumentsObject::isNonStrictArgumentsObject(other) ||
+ (other->arrayType() == Heap::ArrayData::Sparse && other->arrayData()->attrs)) {
uint len = other->getLength();
Q_ASSERT(len);
@@ -1073,35 +1076,27 @@ void Object::copyArrayData(Object *other)
}
} else if (!other->arrayData()) {
;
- } else if (other->hasAccessorProperty() && other->arrayData()->attrs() && other->arrayData()->isSparse()){
- // do it the slow way
- ScopedValue v(scope);
- SparseArrayData *osa = static_cast<SparseArrayData *>(other->arrayData());
- for (const SparseArrayNode *it = osa->sparse()->begin(); it != osa->sparse()->end(); it = it->nextNode()) {
- v = other->getValue(reinterpret_cast<Property *>(osa->arrayData() + it->value), other->arrayData()->attrs()[it->value]);
- arraySet(it->key(), v);
- }
} else {
Q_ASSERT(!arrayData() && other->arrayData());
- ArrayData::realloc(this, other->arrayData()->type(), other->arrayData()->alloc(), false);
- if (other->arrayType() == ArrayData::Sparse) {
- SparseArrayData *od = static_cast<SparseArrayData *>(other->arrayData());
- SparseArrayData *dd = static_cast<SparseArrayData *>(arrayData());
- dd->setSparse(new SparseArray(*od->sparse()));
- dd->freeList() = od->freeList();
+ ArrayData::realloc(this, other->d()->arrayData->type, other->d()->arrayData->alloc, false);
+ if (other->arrayType() == Heap::ArrayData::Sparse) {
+ Heap::ArrayData *od = other->d()->arrayData;
+ Heap::ArrayData *dd = d()->arrayData;
+ dd->sparse = new SparseArray(*od->sparse);
+ dd->freeList = od->freeList;
} else {
- SimpleArrayData *d = static_cast<SimpleArrayData *>(arrayData());
- d->len() = static_cast<SimpleArrayData *>(other->arrayData())->len();
- d->d()->offset = static_cast<SimpleArrayData *>(other->arrayData())->d()->offset;
+ Heap::ArrayData *dd = d()->arrayData;
+ dd->len = other->d()->arrayData->len;
+ dd->offset = other->d()->arrayData->offset;
}
- memcpy(arrayData()->d()->arrayData, other->arrayData()->d()->arrayData, arrayData()->alloc()*sizeof(Value));
+ memcpy(d()->arrayData->arrayData, other->d()->arrayData->arrayData, d()->arrayData->alloc*sizeof(Value));
}
setArrayLengthUnchecked(other->getLength());
}
uint Object::getLength(const Managed *m)
{
- Scope scope(m->engine());
+ Scope scope(static_cast<const Object *>(m)->engine());
ScopedValue v(scope, static_cast<Object *>(const_cast<Managed *>(m))->get(scope.engine->id_length));
return v->toUInt32();
}
@@ -1109,7 +1104,7 @@ uint Object::getLength(const Managed *m)
bool Object::setArrayLength(uint newLen)
{
Q_ASSERT(isArrayObject());
- if (!internalClass()->propertyData[ArrayObject::LengthPropertyIndex].isWritable())
+ if (!internalClass()->propertyData[Heap::ArrayObject::LengthPropertyIndex].isWritable())
return false;
uint oldLen = getLength();
bool ok = true;
@@ -1132,17 +1127,17 @@ bool Object::setArrayLength(uint newLen)
void Object::initSparseArray()
{
- if (arrayType() == ArrayData::Sparse)
+ if (arrayType() == Heap::ArrayData::Sparse)
return;
- ArrayData::realloc(this, ArrayData::Sparse, 0, false);
+ ArrayData::realloc(this, Heap::ArrayData::Sparse, 0, false);
}
DEFINE_OBJECT_VTABLE(ArrayObject);
-ArrayObject::Data::Data(ExecutionEngine *engine, const QStringList &list)
- : Object::Data(engine->arrayClass)
+Heap::ArrayObject::ArrayObject(ExecutionEngine *engine, const QStringList &list)
+ : Heap::Object(engine->arrayClass, engine->arrayPrototype.asObject())
{
init();
Scope scope(engine);
@@ -1162,11 +1157,13 @@ ArrayObject::Data::Data(ExecutionEngine *engine, const QStringList &list)
ReturnedValue ArrayObject::getLookup(Managed *m, Lookup *l)
{
- if (l->name->equals(m->engine()->id_length)) {
+ Scope scope(static_cast<Object *>(m)->engine());
+ ScopedString name(scope, scope.engine->currentContext()->compilationUnit->runtimeStrings[l->nameIndex]);
+ if (name->equals(scope.engine->id_length)) {
// special case, as the property is on the object itself
l->getter = Lookup::arrayLengthGetter;
ArrayObject *a = static_cast<ArrayObject *>(m);
- return a->memberData()[ArrayObject::LengthPropertyIndex].asReturnedValue();
+ return a->memberData()->data[Heap::ArrayObject::LengthPropertyIndex].asReturnedValue();
}
return Object::getLookup(m, l);
}
@@ -1174,9 +1171,9 @@ ReturnedValue ArrayObject::getLookup(Managed *m, Lookup *l)
uint ArrayObject::getLength(const Managed *m)
{
const ArrayObject *a = static_cast<const ArrayObject *>(m);
- if (a->memberData()[ArrayObject::LengthPropertyIndex].isInteger())
- return a->memberData()[ArrayObject::LengthPropertyIndex].integerValue();
- return Primitive::toUInt32(a->memberData()[ArrayObject::LengthPropertyIndex].doubleValue());
+ if (a->memberData()->data[Heap::ArrayObject::LengthPropertyIndex].isInteger())
+ return a->memberData()->data[Heap::ArrayObject::LengthPropertyIndex].integerValue();
+ return Primitive::toUInt32(a->memberData()->data[Heap::ArrayObject::LengthPropertyIndex].doubleValue());
}
QStringList ArrayObject::toQStringList() const
@@ -1187,8 +1184,8 @@ QStringList ArrayObject::toQStringList() const
Scope scope(engine);
ScopedValue v(scope);
- uint32_t length = getLength();
- for (uint32_t i = 0; i < length; ++i) {
+ uint length = getLength();
+ for (uint i = 0; i < length; ++i) {
v = const_cast<ArrayObject *>(this)->getIndexed(i);
result.append(v->toQStringNoThrow());
}
diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h
index 4e9d1527c2..71a997e133 100644
--- a/src/qml/jsruntime/qv4object_p.h
+++ b/src/qml/jsruntime/qv4object_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,104 +23,126 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifndef QMLJS_OBJECTS_H
-#define QMLJS_OBJECTS_H
-
-#include "qv4global_p.h"
-#include "qv4runtime_p.h"
-#include "qv4engine_p.h"
-#include "qv4context_p.h"
-#include "qv4string_p.h"
+#ifndef QV4_OBJECT_H
+#define QV4_OBJECT_H
+
#include "qv4managed_p.h"
-#include "qv4property_p.h"
-#include "qv4internalclass_p.h"
-#include "qv4arraydata_p.h"
#include "qv4memberdata_p.h"
-
-#include <QtCore/QString>
-#include <QtCore/QHash>
-#include <QtCore/QScopedPointer>
-#include <cstdio>
-#include <cassert>
-
-#ifdef _WIN32_WCE
-#undef assert
-#define assert(x)
-#endif // _WIN32_WCE
+#include "qv4arraydata_p.h"
QT_BEGIN_NAMESPACE
namespace QV4 {
-struct Function;
-struct Lookup;
-struct Object;
-struct ObjectIterator;
-struct BooleanObject;
-struct NumberObject;
-struct StringObject;
-struct ArrayObject;
-struct DateObject;
-struct FunctionObject;
-struct RegExpObject;
-struct ErrorObject;
-struct ArgumentsObject;
-struct ExecutionContext;
-struct CallContext;
-struct ExecutionEngine;
-class MemoryManager;
-
-struct ObjectPrototype;
-struct StringPrototype;
-struct NumberPrototype;
-struct BooleanPrototype;
-struct ArrayPrototype;
-struct FunctionPrototype;
-struct DatePrototype;
-struct RegExpPrototype;
-struct ErrorPrototype;
-struct EvalErrorPrototype;
-struct RangeErrorPrototype;
-struct ReferenceErrorPrototype;
-struct SyntaxErrorPrototype;
-struct TypeErrorPrototype;
-struct URIErrorPrototype;
+namespace Heap {
+struct Object : Base {
+ Object(ExecutionEngine *engine)
+ : internalClass(engine->emptyClass),
+ prototype(static_cast<Object *>(engine->objectPrototype.m))
+ {
+ }
+ Object(InternalClass *internal, QV4::Object *prototype);
-struct Q_QML_EXPORT Object: Managed {
- struct Data : Managed::Data {
- Data(ExecutionEngine *engine)
- : Managed::Data(engine->objectClass)
- {
- }
- Data(InternalClass *internal = 0);
+ const Property *propertyAt(uint index) const { return reinterpret_cast<const Property *>(memberData->data + index); }
+ Property *propertyAt(uint index) { return reinterpret_cast<Property *>(memberData->data + index); }
- Members memberData;
- ArrayData *arrayData;
- };
- V4_OBJECT(Object)
+ InternalClass *internalClass;
+ Heap::Object *prototype;
+ MemberData *memberData;
+ ArrayData *arrayData;
+};
+
+}
+
+#define V4_OBJECT(superClass) \
+ public: \
+ Q_MANAGED_CHECK \
+ typedef superClass SuperClass; \
+ static const QV4::ObjectVTable static_vtbl; \
+ static inline const QV4::ManagedVTable *staticVTable() { return &static_vtbl.managedVTable; } \
+ V4_MANAGED_SIZE_TEST \
+ Data *d() const { return static_cast<Data *>(m); }
+
+#define V4_OBJECT2(DataClass, superClass) \
+ public: \
+ Q_MANAGED_CHECK \
+ typedef QV4::Heap::DataClass Data; \
+ typedef superClass SuperClass; \
+ static const QV4::ObjectVTable static_vtbl; \
+ static inline const QV4::ManagedVTable *staticVTable() { return &static_vtbl.managedVTable; } \
+ V4_MANAGED_SIZE_TEST \
+ QV4::Heap::DataClass *d() const { return static_cast<QV4::Heap::DataClass *>(m); }
+
+struct ObjectVTable
+{
+ ManagedVTable managedVTable;
+ ReturnedValue (*call)(Managed *, CallData *data);
+ ReturnedValue (*construct)(Managed *, CallData *data);
+ ReturnedValue (*get)(Managed *, String *name, bool *hasProperty);
+ ReturnedValue (*getIndexed)(Managed *, uint index, bool *hasProperty);
+ void (*put)(Managed *, String *name, const Value &value);
+ void (*putIndexed)(Managed *, uint index, const Value &value);
+ PropertyAttributes (*query)(const Managed *, String *name);
+ PropertyAttributes (*queryIndexed)(const Managed *, uint index);
+ bool (*deleteProperty)(Managed *m, String *name);
+ bool (*deleteIndexedProperty)(Managed *m, uint index);
+ ReturnedValue (*getLookup)(Managed *m, Lookup *l);
+ void (*setLookup)(Managed *m, Lookup *l, const Value &v);
+ uint (*getLength)(const Managed *m);
+ void (*advanceIterator)(Managed *m, ObjectIterator *it, Heap::String **name, uint *index, Property *p, PropertyAttributes *attributes);
+};
+
+#define DEFINE_OBJECT_VTABLE(classname) \
+const QV4::ObjectVTable classname::static_vtbl = \
+{ \
+ DEFINE_MANAGED_VTABLE_INT(classname, &classname::SuperClass::static_vtbl == &Object::static_vtbl ? 0 : &classname::SuperClass::static_vtbl.managedVTable), \
+ call, \
+ construct, \
+ get, \
+ getIndexed, \
+ put, \
+ putIndexed, \
+ query, \
+ queryIndexed, \
+ deleteProperty, \
+ deleteIndexedProperty, \
+ getLookup, \
+ setLookup, \
+ getLength, \
+ advanceIterator \
+}
+
+
+
+struct Q_QML_EXPORT Object: Managed {
+ V4_OBJECT2(Object, Object)
Q_MANAGED_TYPE(Object)
enum {
IsObject = true
};
- Members &memberData() { return d()->memberData; }
- const Members &memberData() const { return d()->memberData; }
- ArrayData *arrayData() const { return d()->arrayData; }
- void setArrayData(ArrayData *a) { d()->arrayData = a; }
+ InternalClass *internalClass() const { return d()->internalClass; }
+ void setInternalClass(InternalClass *ic) { d()->internalClass = ic; }
+
+ Heap::MemberData *memberData() { return d()->memberData; }
+ const Heap::MemberData *memberData() const { return d()->memberData; }
+ Heap::ArrayData *arrayData() const { return d()->arrayData; }
+ void setArrayData(ArrayData *a) { d()->arrayData = a->d(); }
- Property *propertyAt(uint index) const { return reinterpret_cast<Property *>(memberData().data() + index); }
+ const Property *propertyAt(uint index) const { return d()->propertyAt(index); }
+ Property *propertyAt(uint index) { return d()->propertyAt(index); }
- const ObjectVTable *vtable() const { return reinterpret_cast<const ObjectVTable *>(internalClass()->vtable); }
- Object *prototype() const { return internalClass()->prototype; }
+ const ObjectVTable *vtable() const { return reinterpret_cast<const ObjectVTable *>(d()->vtable); }
+ Heap::Object *prototype() const { return d()->prototype; }
bool setPrototype(Object *proto);
Property *__getOwnProperty__(String *name, PropertyAttributes *attrs = 0);
@@ -135,52 +157,54 @@ struct Q_QML_EXPORT Object: Managed {
bool hasOwnProperty(String *name) const;
bool hasOwnProperty(uint index) const;
- bool __defineOwnProperty__(ExecutionContext *ctx, uint index, String *member, const Property &p, PropertyAttributes attrs);
- bool __defineOwnProperty__(ExecutionContext *ctx, String *name, const Property &p, PropertyAttributes attrs);
- bool __defineOwnProperty__(ExecutionContext *ctx, uint index, const Property &p, PropertyAttributes attrs);
- bool __defineOwnProperty__(ExecutionContext *ctx, const QString &name, const Property &p, PropertyAttributes attrs);
- bool defineOwnProperty2(ExecutionContext *ctx, uint index, const Property &p, PropertyAttributes attrs);
+ bool __defineOwnProperty__(ExecutionEngine *engine, uint index, String *member, const Property *p, PropertyAttributes attrs);
+ bool __defineOwnProperty__(ExecutionEngine *engine, String *name, const Property *p, PropertyAttributes attrs);
+ bool __defineOwnProperty__(ExecutionEngine *engine, uint index, const Property *p, PropertyAttributes attrs);
+ bool __defineOwnProperty__(ExecutionEngine *engine, const QString &name, const Property *p, PropertyAttributes attrs);
+ bool defineOwnProperty2(ExecutionEngine *engine, uint index, const Property *p, PropertyAttributes attrs);
//
// helpers
//
- void put(ExecutionContext *ctx, const QString &name, const ValueRef value);
+ void put(ExecutionEngine *engine, const QString &name, const Value &value);
- static ReturnedValue getValue(const ValueRef thisObject, const Property *p, PropertyAttributes attrs);
+ static ReturnedValue getValue(const Value &thisObject, const Property *p, PropertyAttributes attrs);
ReturnedValue getValue(const Property *p, PropertyAttributes attrs) const {
Scope scope(this->engine());
ScopedValue t(scope, const_cast<Object *>(this));
return getValue(t, p, attrs);
}
- void putValue(Property *pd, PropertyAttributes attrs, const ValueRef value);
+ void putValue(Property *pd, PropertyAttributes attrs, const Value &value);
/* The spec default: Writable: true, Enumerable: false, Configurable: true */
- void defineDefaultProperty(String *name, ValueRef value) {
+ void defineDefaultProperty(String *name, const Value &value) {
insertMember(name, value, Attr_Data|Attr_NotEnumerable);
}
- void defineDefaultProperty(const QString &name, ValueRef value);
+ void defineDefaultProperty(const QString &name, const Value &value);
void defineDefaultProperty(const QString &name, ReturnedValue (*code)(CallContext *), int argumentCount = 0);
void defineDefaultProperty(String *name, ReturnedValue (*code)(CallContext *), int argumentCount = 0);
void defineAccessorProperty(const QString &name, ReturnedValue (*getter)(CallContext *), ReturnedValue (*setter)(CallContext *));
void defineAccessorProperty(String *name, ReturnedValue (*getter)(CallContext *), ReturnedValue (*setter)(CallContext *));
/* Fixed: Writable: false, Enumerable: false, Configurable: false */
- void defineReadonlyProperty(const QString &name, ValueRef value);
- void defineReadonlyProperty(String *name, ValueRef value);
+ void defineReadonlyProperty(const QString &name, const Value &value);
+ void defineReadonlyProperty(String *name, const Value &value);
- void insertMember(String *s, const ValueRef v, PropertyAttributes attributes = Attr_Data) {
- Property p(*v);
+ void ensureMemberIndex(QV4::ExecutionEngine *e, uint idx) {
+ d()->memberData = MemberData::reallocate(e, d()->memberData, idx);
+ }
+
+ void insertMember(String *s, const Value &v, PropertyAttributes attributes = Attr_Data) {
+ Scope scope(engine());
+ ScopedProperty p(scope);
+ p->value = v;
insertMember(s, p, attributes);
}
- void insertMember(String *s, const Property &p, PropertyAttributes attributes);
+ void insertMember(String *s, const Property *p, PropertyAttributes attributes);
inline ExecutionEngine *engine() const { return internalClass()->engine; }
- inline bool hasAccessorProperty() const { return d()->hasAccessorProperty; }
- inline void setHasAccessorProperty() { d()->hasAccessorProperty = true; }
-
- bool isExtensible() const { return d()->extensible; }
- void setExtensible(bool b) { d()->extensible = b; }
+ bool isExtensible() const { return d()->internalClass->extensible; }
// Array handling
@@ -190,55 +214,55 @@ public:
bool setArrayLength(uint newLen);
void setArrayLengthUnchecked(uint l);
- void arraySet(uint index, const Property &p, PropertyAttributes attributes = Attr_Data);
- void arraySet(uint index, ValueRef value);
+ void arraySet(uint index, const Property *p, PropertyAttributes attributes = Attr_Data);
+ void arraySet(uint index, const Value &value);
- bool arrayPut(uint index, ValueRef value) {
+ bool arrayPut(uint index, const Value &value) {
return arrayData()->vtable()->put(this, index, value);
}
- bool arrayPut(uint index, Value *values, uint n) {
+ bool arrayPut(uint index, const Value *values, uint n) {
return arrayData()->vtable()->putArray(this, index, values, n);
}
void setArrayAttributes(uint i, PropertyAttributes a) {
Q_ASSERT(arrayData());
- if (arrayData()->attrs() || a != Attr_Data) {
+ if (d()->arrayData->attrs || a != Attr_Data) {
ArrayData::ensureAttributes(this);
a.resolve();
arrayData()->vtable()->setAttribute(this, i, a);
}
}
- void push_back(const ValueRef v);
+ void push_back(const Value &v);
ArrayData::Type arrayType() const {
- return arrayData() ? arrayData()->type() : ArrayData::Simple;
+ return arrayData() ? d()->arrayData->type : Heap::ArrayData::Simple;
}
// ### remove me
void setArrayType(ArrayData::Type t) {
- Q_ASSERT(t != ArrayData::Simple && t != ArrayData::Sparse);
+ Q_ASSERT(t != Heap::ArrayData::Simple && t != Heap::ArrayData::Sparse);
arrayCreate();
- arrayData()->setType(t);
+ d()->arrayData->type = t;
}
inline void arrayReserve(uint n) {
- ArrayData::realloc(this, ArrayData::Simple, n, false);
+ ArrayData::realloc(this, Heap::ArrayData::Simple, n, false);
}
void arrayCreate() {
if (!arrayData())
- ArrayData::realloc(this, ArrayData::Simple, 0, false);
+ ArrayData::realloc(this, Heap::ArrayData::Simple, 0, false);
#ifdef CHECK_SPARSE_ARRAYS
initSparseArray();
#endif
}
void initSparseArray();
- SparseArrayNode *sparseBegin() { return arrayType() == ArrayData::Sparse ? static_cast<SparseArrayData *>(arrayData())->sparse()->begin() : 0; }
- SparseArrayNode *sparseEnd() { return arrayType() == ArrayData::Sparse ? static_cast<SparseArrayData *>(arrayData())->sparse()->end() : 0; }
+ SparseArrayNode *sparseBegin() { return arrayType() == Heap::ArrayData::Sparse ? d()->arrayData->sparse->begin() : 0; }
+ SparseArrayNode *sparseEnd() { return arrayType() == Heap::ArrayData::Sparse ? d()->arrayData->sparse->end() : 0; }
inline bool protoHasArray() {
Scope scope(engine());
- Scoped<Object> p(scope, this);
+ ScopedObject p(scope, this);
while ((p = p->prototype()))
if (p->arrayData())
@@ -252,9 +276,9 @@ public:
{ return vtable()->get(this, name, hasProperty); }
inline ReturnedValue getIndexed(uint idx, bool *hasProperty = 0)
{ return vtable()->getIndexed(this, idx, hasProperty); }
- inline void put(String *name, const ValueRef v)
+ inline void put(String *name, const Value &v)
{ vtable()->put(this, name, v); }
- inline void putIndexed(uint idx, const ValueRef v)
+ inline void putIndexed(uint idx, const Value &v)
{ vtable()->putIndexed(this, idx, v); }
PropertyAttributes query(String *name) const
{ return vtable()->query(this, name); }
@@ -266,9 +290,9 @@ public:
{ return vtable()->deleteIndexedProperty(this, index); }
ReturnedValue getLookup(Lookup *l)
{ return vtable()->getLookup(this, l); }
- void setLookup(Lookup *l, const ValueRef v)
+ void setLookup(Lookup *l, const Value &v)
{ vtable()->setLookup(this, l, v); }
- void advanceIterator(ObjectIterator *it, String *&name, uint *index, Property *p, PropertyAttributes *attributes)
+ void advanceIterator(ObjectIterator *it, Heap::String **name, uint *index, Property *p, PropertyAttributes *attributes)
{ vtable()->advanceIterator(this, it, name, index, p, attributes); }
uint getLength() const { return vtable()->getLength(this); }
@@ -277,27 +301,27 @@ public:
inline ReturnedValue call(CallData *d)
{ return vtable()->call(this, d); }
protected:
- static void markObjects(Managed *that, ExecutionEngine *e);
+ static void markObjects(Heap::Base *that, ExecutionEngine *e);
static ReturnedValue construct(Managed *m, CallData *);
static ReturnedValue call(Managed *m, CallData *);
static ReturnedValue get(Managed *m, String *name, bool *hasProperty);
static ReturnedValue getIndexed(Managed *m, uint index, bool *hasProperty);
- static void put(Managed *m, String *name, const ValueRef value);
- static void putIndexed(Managed *m, uint index, const ValueRef value);
+ static void put(Managed *m, String *name, const Value &value);
+ static void putIndexed(Managed *m, uint index, const Value &value);
static PropertyAttributes query(const Managed *m, String *name);
static PropertyAttributes queryIndexed(const Managed *m, uint index);
static bool deleteProperty(Managed *m, String *name);
static bool deleteIndexedProperty(Managed *m, uint index);
static ReturnedValue getLookup(Managed *m, Lookup *l);
- static void setLookup(Managed *m, Lookup *l, const ValueRef v);
- static void advanceIterator(Managed *m, ObjectIterator *it, String *&name, uint *index, Property *p, PropertyAttributes *attributes);
+ static void setLookup(Managed *m, Lookup *l, const Value &v);
+ static void advanceIterator(Managed *m, ObjectIterator *it, Heap::String **name, uint *index, Property *p, PropertyAttributes *attributes);
static uint getLength(const Managed *m);
private:
ReturnedValue internalGet(String *name, bool *hasProperty);
ReturnedValue internalGetIndexed(uint index, bool *hasProperty);
- void internalPut(String *name, const ValueRef value);
- void internalPutIndexed(uint index, const ValueRef value);
+ void internalPut(String *name, const Value &value);
+ void internalPutIndexed(uint index, const Value &value);
bool internalDeleteProperty(String *name);
bool internalDeleteIndexedProperty(uint index);
@@ -305,62 +329,74 @@ private:
friend struct ObjectPrototype;
};
-struct BooleanObject: Object {
- struct Data : Object::Data {
- Data(ExecutionEngine *engine, const ValueRef val)
- : Object::Data(engine->booleanClass)
- {
- value = val;
- }
- Data(InternalClass *ic)
- : Object::Data(ic)
- {
- Q_ASSERT(internalClass->vtable == staticVTable());
- value = Encode(false);
- }
- Value value;
+namespace Heap {
+
+struct BooleanObject : Object {
+ BooleanObject(InternalClass *ic, QV4::Object *prototype)
+ : Object(ic, prototype),
+ b(false)
+ {
+ }
+
+ BooleanObject(ExecutionEngine *engine, bool b)
+ : Object(engine->emptyClass, engine->booleanPrototype.asObject()),
+ b(b)
+ {
+ }
+ bool b;
+};
+
+struct NumberObject : Object {
+ NumberObject(InternalClass *ic, QV4::Object *prototype)
+ : Object(ic, prototype),
+ value(0)
+ {
+ }
+
+ NumberObject(ExecutionEngine *engine, double val)
+ : Object(engine->emptyClass, engine->numberPrototype.asObject()),
+ value(val)
+ {
+ }
+ double value;
+};
+
+struct ArrayObject : Object {
+ enum {
+ LengthPropertyIndex = 0
};
- V4_OBJECT(Object)
+
+ ArrayObject(ExecutionEngine *engine)
+ : Heap::Object(engine->arrayClass, engine->arrayPrototype.asObject())
+ { init(); }
+ ArrayObject(ExecutionEngine *engine, const QStringList &list);
+ ArrayObject(InternalClass *ic, QV4::Object *prototype)
+ : Heap::Object(ic, prototype)
+ { init(); }
+ void init()
+ { memberData->data[LengthPropertyIndex] = Primitive::fromInt32(0); }
+};
+
+}
+
+struct BooleanObject: Object {
+ V4_OBJECT2(BooleanObject, Object)
Q_MANAGED_TYPE(BooleanObject)
- Value value() const { return d()->value; }
+ bool value() const { return d()->b; }
};
struct NumberObject: Object {
- struct Data : Object::Data {
- Data(ExecutionEngine *engine, const ValueRef val)
- : Object::Data(engine->numberClass) {
- value = val;
- }
- Data(InternalClass *ic)
- : Object::Data(ic) {
- Q_ASSERT(internalClass->vtable == staticVTable());
- value = Encode((int)0);
- }
- Value value;
- };
- V4_OBJECT(Object)
+ V4_OBJECT2(NumberObject, Object)
Q_MANAGED_TYPE(NumberObject)
- Value value() const { return d()->value; }
-
+ double value() const { return d()->value; }
};
struct ArrayObject: Object {
- struct Data : Object::Data {
- Data(ExecutionEngine *engine) : Object::Data(engine->arrayClass) { init(); }
- Data(ExecutionEngine *engine, const QStringList &list);
- Data(InternalClass *ic) : Object::Data(ic) { init(); }
- void init()
- { memberData[LengthPropertyIndex] = Primitive::fromInt32(0); }
- };
-
- V4_OBJECT(Object)
+ V4_OBJECT2(ArrayObject, Object)
Q_MANAGED_TYPE(ArrayObject)
- enum {
- LengthPropertyIndex = 0
- };
void init(ExecutionEngine *engine);
@@ -374,10 +410,10 @@ struct ArrayObject: Object {
inline void Object::setArrayLengthUnchecked(uint l)
{
if (isArrayObject())
- memberData()[ArrayObject::LengthPropertyIndex] = Primitive::fromUInt32(l);
+ memberData()->data[Heap::ArrayObject::LengthPropertyIndex] = Primitive::fromUInt32(l);
}
-inline void Object::push_back(const ValueRef v)
+inline void Object::push_back(const Value &v)
{
arrayCreate();
@@ -387,36 +423,33 @@ inline void Object::push_back(const ValueRef v)
setArrayLengthUnchecked(idx + 1);
}
-inline void Object::arraySet(uint index, const Property &p, PropertyAttributes attributes)
+inline void Object::arraySet(uint index, const Property *p, PropertyAttributes attributes)
{
// ### Clean up
arrayCreate();
- if (attributes.isAccessor()) {
- setHasAccessorProperty();
- initSparseArray();
- } else if (index > 0x1000 && index > 2*arrayData()->alloc()) {
+ if (attributes.isAccessor() || (index > 0x1000 && index > 2*d()->arrayData->alloc)) {
initSparseArray();
} else {
arrayData()->vtable()->reallocate(this, index + 1, false);
}
setArrayAttributes(index, attributes);
Property *pd = ArrayData::insert(this, index, attributes.isAccessor());
- pd->value = p.value;
+ pd->value = p->value;
if (attributes.isAccessor())
- pd->set = p.set;
+ pd->set = p->set;
if (isArrayObject() && index >= getLength())
setArrayLengthUnchecked(index + 1);
}
-inline void Object::arraySet(uint index, ValueRef value)
+inline void Object::arraySet(uint index, const Value &value)
{
arrayCreate();
- if (index > 0x1000 && index > 2*arrayData()->alloc()) {
+ if (index > 0x1000 && index > 2*d()->arrayData->alloc) {
initSparseArray();
}
Property *pd = ArrayData::insert(this, index);
- pd->value = value ? *value : Primitive::undefinedValue();
+ pd->value = value;
if (isArrayObject() && index >= getLength())
setArrayLengthUnchecked(index + 1);
}
@@ -435,7 +468,7 @@ inline ArrayObject *value_cast(const Value &v) {
template<>
inline ReturnedValue value_convert<Object>(ExecutionEngine *e, const Value &v)
{
- return v.toObject(e->currentContext())->asReturnedValue();
+ return v.toObject(e)->asReturnedValue();
}
#endif
diff --git a/src/qml/jsruntime/qv4objectiterator.cpp b/src/qml/jsruntime/qv4objectiterator.cpp
index f9038472df..f36ee554a7 100644
--- a/src/qml/jsruntime/qv4objectiterator.cpp
+++ b/src/qml/jsruntime/qv4objectiterator.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -38,8 +38,9 @@
using namespace QV4;
-ObjectIterator::ObjectIterator(Value *scratch1, Value *scratch2, Object *o, uint flags)
- : object(scratch1)
+ObjectIterator::ObjectIterator(ExecutionEngine *e, Value *scratch1, Value *scratch2, Object *o, uint flags)
+ : engine(e)
+ , object(scratch1)
, current(scratch2)
, arrayNode(0)
, arrayIndex(0)
@@ -50,7 +51,8 @@ ObjectIterator::ObjectIterator(Value *scratch1, Value *scratch2, Object *o, uint
}
ObjectIterator::ObjectIterator(Scope &scope, Object *o, uint flags)
- : object(scope.alloc(1))
+ : engine(scope.engine)
+ , object(scope.alloc(1))
, current(scope.alloc(1))
, arrayNode(0)
, arrayIndex(0)
@@ -60,23 +62,10 @@ ObjectIterator::ObjectIterator(Scope &scope, Object *o, uint flags)
init(o);
}
-ObjectIterator::ObjectIterator(Value *scratch1, Value *scratch2, uint flags)
- : object(scratch1)
- , current(scratch2)
- , arrayNode(0)
- , arrayIndex(0)
- , memberIndex(0)
- , flags(flags)
-{
- object->o = (Object*)0;
- current->o = (Object*)0;
- // Caller needs to call init!
-}
-
void ObjectIterator::init(Object *o)
{
- object->o = o;
- current->o = o;
+ object->m = o ? o->m : 0;
+ current->m = o ? o->m : 0;
#if QT_POINTER_SIZE == 4
object->tag = QV4::Value::Managed_Type;
@@ -84,20 +73,23 @@ void ObjectIterator::init(Object *o)
#endif
if (object->as<ArgumentsObject>()) {
- Scope scope(object->engine());
+ Scope scope(engine);
Scoped<ArgumentsObject> (scope, object->asReturnedValue())->fullyCreate();
}
}
-void ObjectIterator::next(String *&name, uint *index, Property *pd, PropertyAttributes *attrs)
+void ObjectIterator::next(Heap::String **name, uint *index, Property *pd, PropertyAttributes *attrs)
{
- name = (String *)0;
+ *name = 0;
*index = UINT_MAX;
if (!object->asObject()) {
*attrs = PropertyAttributes();
return;
}
+ Scope scope(engine);
+ ScopedObject o(scope);
+ ScopedString n(scope);
while (1) {
if (!current->asObject())
@@ -108,11 +100,12 @@ void ObjectIterator::next(String *&name, uint *index, Property *pd, PropertyAttr
if (attrs->isEmpty())
break;
// check the property is not already defined earlier in the proto chain
- if (current->asObject() != object->asObject()) {
- Object *o = object->asObject();
+ if (current->heapObject() != object->heapObject()) {
+ o = object->asObject();
+ n = *name;
bool shadowed = false;
- while (o != current->asObject()) {
- if ((!!name && o->hasOwnProperty(name)) ||
+ while (o->asObject()->d() != current->heapObject()) {
+ if ((!!n && o->hasOwnProperty(n)) ||
(*index != UINT_MAX && o->hasOwnProperty(*index))) {
shadowed = true;
break;
@@ -126,9 +119,9 @@ void ObjectIterator::next(String *&name, uint *index, Property *pd, PropertyAttr
}
if (flags & WithProtoChain)
- current->o = current->objectValue()->prototype();
+ current->m = current->objectValue()->prototype();
else
- current->o = (Object *)0;
+ current->m = (Heap::Base *)0;
arrayIndex = 0;
memberIndex = 0;
@@ -136,23 +129,21 @@ void ObjectIterator::next(String *&name, uint *index, Property *pd, PropertyAttr
*attrs = PropertyAttributes();
}
-ReturnedValue ObjectIterator::nextPropertyName(ValueRef value)
+ReturnedValue ObjectIterator::nextPropertyName(Value *value)
{
if (!object->asObject())
return Encode::null();
PropertyAttributes attrs;
- Property p;
uint index;
- Scope scope(object->engine());
+ Scope scope(engine);
+ ScopedProperty p(scope);
ScopedString name(scope);
- String *n;
- next(n, &index, &p, &attrs);
- name = n;
+ next(name.getRef(), &index, p, &attrs);
if (attrs.isEmpty())
return Encode::null();
- value = object->objectValue()->getValue(&p, attrs);
+ *value = object->objectValue()->getValue(p, attrs);
if (!!name)
return name->asReturnedValue();
@@ -160,28 +151,26 @@ ReturnedValue ObjectIterator::nextPropertyName(ValueRef value)
return Encode(index);
}
-ReturnedValue ObjectIterator::nextPropertyNameAsString(ValueRef value)
+ReturnedValue ObjectIterator::nextPropertyNameAsString(Value *value)
{
if (!object->asObject())
return Encode::null();
PropertyAttributes attrs;
- Property p;
uint index;
- Scope scope(object->engine());
+ Scope scope(engine);
+ ScopedProperty p(scope);
ScopedString name(scope);
- String *n;
- next(n, &index, &p, &attrs);
- name = n;
+ next(name.getRef(), &index, p, &attrs);
if (attrs.isEmpty())
return Encode::null();
- value = object->objectValue()->getValue(&p, attrs);
+ *value = object->objectValue()->getValue(p, attrs);
if (!!name)
return name->asReturnedValue();
assert(index < UINT_MAX);
- return Encode(object->engine()->newString(QString::number(index)));
+ return Encode(engine->newString(QString::number(index)));
}
ReturnedValue ObjectIterator::nextPropertyNameAsString()
@@ -190,29 +179,27 @@ ReturnedValue ObjectIterator::nextPropertyNameAsString()
return Encode::null();
PropertyAttributes attrs;
- Property p;
uint index;
- Scope scope(object->engine());
+ Scope scope(engine);
+ ScopedProperty p(scope);
ScopedString name(scope);
- String *n;
- next(n, &index, &p, &attrs);
- name = n;
+ next(name.getRef(), &index, p, &attrs);
if (attrs.isEmpty())
return Encode::null();
if (!!name)
return name->asReturnedValue();
- assert(index < UINT_MAX);
- return Encode(object->engine()->newString(QString::number(index)));
+ Q_ASSERT(index < UINT_MAX);
+ return Encode(engine->newString(QString::number(index)));
}
DEFINE_OBJECT_VTABLE(ForEachIteratorObject);
-void ForEachIteratorObject::markObjects(Managed *that, ExecutionEngine *e)
+void ForEachIteratorObject::markObjects(Heap::Base *that, ExecutionEngine *e)
{
- ForEachIteratorObject *o = static_cast<ForEachIteratorObject *>(that);
- o->d()->workArea[0].mark(e);
- o->d()->workArea[1].mark(e);
+ ForEachIteratorObject::Data *o = static_cast<ForEachIteratorObject::Data *>(that);
+ o->workArea[0].mark(e);
+ o->workArea[1].mark(e);
Object::markObjects(that, e);
}
diff --git a/src/qml/jsruntime/qv4objectiterator_p.h b/src/qml/jsruntime/qv4objectiterator_p.h
index 3ed73b5c08..a7abd2ca10 100644
--- a/src/qml/jsruntime/qv4objectiterator_p.h
+++ b/src/qml/jsruntime/qv4objectiterator_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -34,24 +34,12 @@
#define QV4OBJECTITERATOR_H
#include "qv4global_p.h"
-#include "qv4property_p.h"
-#include "qv4scopedvalue_p.h"
#include "qv4object_p.h"
QT_BEGIN_NAMESPACE
namespace QV4 {
-struct SparseArrayNode;
-struct Object;
-struct ArrayObject;
-struct PropertyAttributes;
-struct ExecutionContext;
-struct Property;
-struct String;
-struct InternalClass;
-struct ForEachIteratorObject;
-
struct Q_QML_EXPORT ObjectIterator
{
enum Flags {
@@ -60,6 +48,7 @@ struct Q_QML_EXPORT ObjectIterator
WithProtoChain = 0x2,
};
+ ExecutionEngine *engine;
Value *object;
Value *current;
SparseArrayNode *arrayNode;
@@ -67,37 +56,41 @@ struct Q_QML_EXPORT ObjectIterator
uint memberIndex;
uint flags;
- ObjectIterator(Value *scratch1, Value *scratch2, Object *o, uint flags);
+ ObjectIterator(ExecutionEngine *e, Value *scratch1, Value *scratch2, Object *o, uint flags);
ObjectIterator(Scope &scope, Object *o, uint flags);
void init(Object *o);
- void next(String *&name, uint *index, Property *pd, PropertyAttributes *attributes = 0);
- ReturnedValue nextPropertyName(ValueRef value);
- ReturnedValue nextPropertyNameAsString(ValueRef value);
+ void next(Heap::String **name, uint *index, Property *pd, PropertyAttributes *attributes = 0);
+ ReturnedValue nextPropertyName(Value *value);
+ ReturnedValue nextPropertyNameAsString(Value *value);
ReturnedValue nextPropertyNameAsString();
-private:
- friend struct ForEachIteratorObject;
- ObjectIterator(Value *scratch1, Value *scratch2, uint flags); // Constructor that requires calling init()
};
+namespace Heap {
+struct ForEachIteratorObject : Object {
+ ForEachIteratorObject(QV4::ExecutionEngine *engine, QV4::Object *o);
+ ObjectIterator it;
+ Value workArea[2];
+};
+
+}
+
struct ForEachIteratorObject: Object {
- struct Data : Object::Data {
- Data(ExecutionContext *ctx, Object *o)
- : Object::Data(ctx->engine())
- , it(workArea, workArea + 1, o, ObjectIterator::EnumerableOnly|ObjectIterator::WithProtoChain) {
- setVTable(staticVTable());
- }
- ObjectIterator it;
- Value workArea[2];
- };
- V4_OBJECT(Object)
+ V4_OBJECT2(ForEachIteratorObject, Object)
Q_MANAGED_TYPE(ForeachIteratorObject)
ReturnedValue nextPropertyName() { return d()->it.nextPropertyNameAsString(); }
protected:
- static void markObjects(Managed *that, ExecutionEngine *e);
+ static void markObjects(Heap::Base *that, ExecutionEngine *e);
};
+inline
+Heap::ForEachIteratorObject::ForEachIteratorObject(QV4::ExecutionEngine *engine, QV4::Object *o)
+ : Heap::Object(engine)
+ , it(engine, workArea, workArea + 1, o, ObjectIterator::EnumerableOnly|ObjectIterator::WithProtoChain)
+{
+}
+
}
diff --git a/src/qml/jsruntime/qv4objectproto.cpp b/src/qml/jsruntime/qv4objectproto.cpp
index 9cbf4b204e..9356ea434e 100644
--- a/src/qml/jsruntime/qv4objectproto.cpp
+++ b/src/qml/jsruntime/qv4objectproto.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -36,62 +36,44 @@
#include "qv4argumentsobject_p.h"
#include "qv4mm_p.h"
#include "qv4scopedvalue_p.h"
-#include <QtCore/qnumeric.h>
-#include <QtCore/qmath.h>
+#include "qv4runtime_p.h"
+#include "qv4objectiterator_p.h"
+
#include <QtCore/QDateTime>
#include <QtCore/QStringList>
-#include <QtCore/QDebug>
-#include <cassert>
-
-#include <private/qqmljsengine_p.h>
-#include <private/qqmljslexer_p.h>
-#include <private/qqmljsparser_p.h>
-#include <private/qqmljsast_p.h>
-#include <qv4jsir_p.h>
-#include <qv4codegen_p.h>
-
-#ifndef Q_OS_WIN
-# include <time.h>
-# ifndef Q_OS_VXWORKS
-# include <sys/time.h>
-# else
-# include "qplatformdefs.h"
-# endif
-#else
-# include <windows.h>
-#endif
using namespace QV4;
DEFINE_OBJECT_VTABLE(ObjectCtor);
-ObjectCtor::Data::Data(ExecutionContext *scope)
- : FunctionObject::Data(scope, QStringLiteral("Object"))
+Heap::ObjectCtor::ObjectCtor(QV4::ExecutionContext *scope)
+ : Heap::FunctionObject(scope, QStringLiteral("Object"))
{
- setVTable(staticVTable());
}
ReturnedValue ObjectCtor::construct(Managed *that, CallData *callData)
{
- ExecutionEngine *v4 = that->engine();
- Scope scope(v4);
ObjectCtor *ctor = static_cast<ObjectCtor *>(that);
+ ExecutionEngine *v4 = ctor->engine();
+ Scope scope(v4);
if (!callData->argc || callData->args[0].isUndefined() || callData->args[0].isNull()) {
- Scoped<Object> obj(scope, v4->newObject());
- Scoped<Object> proto(scope, ctor->get(v4->id_prototype));
+ ScopedObject obj(scope, v4->newObject());
+ ScopedObject proto(scope, ctor->get(v4->id_prototype));
if (!!proto)
- obj->setPrototype(proto.getPointer());
+ obj->setPrototype(proto);
return obj.asReturnedValue();
}
- return RuntimeHelpers::toObject(v4->currentContext(), ValueRef(&callData->args[0]));
+ return RuntimeHelpers::toObject(scope.engine, callData->args[0]);
}
ReturnedValue ObjectCtor::call(Managed *m, CallData *callData)
{
+ ObjectCtor *ctor = static_cast<ObjectCtor *>(m);
+ ExecutionEngine *v4 = ctor->engine();
if (!callData->argc || callData->args[0].isUndefined() || callData->args[0].isNull())
- return m->engine()->newObject()->asReturnedValue();
- return RuntimeHelpers::toObject(m->engine()->currentContext(), ValueRef(&callData->args[0]));
+ return v4->newObject()->asReturnedValue();
+ return RuntimeHelpers::toObject(v4, callData->args[0]);
}
void ObjectPrototype::init(ExecutionEngine *v4, Object *ctor)
@@ -125,39 +107,41 @@ void ObjectPrototype::init(ExecutionEngine *v4, Object *ctor)
defineDefaultProperty(QStringLiteral("__defineGetter__"), method_defineGetter, 2);
defineDefaultProperty(QStringLiteral("__defineSetter__"), method_defineSetter, 2);
- Property p(ScopedFunctionObject(scope, BuiltinFunction::create(v4->rootContext, v4->id___proto__, method_get_proto)).getPointer(),
- ScopedFunctionObject(scope, BuiltinFunction::create(v4->rootContext, v4->id___proto__, method_set_proto)).getPointer());
+ ScopedContext global(scope, scope.engine->rootContext());
+ ScopedProperty p(scope);
+ p->value = BuiltinFunction::create(global, v4->id___proto__, method_get_proto);
+ p->set = BuiltinFunction::create(global, v4->id___proto__, method_set_proto);
insertMember(v4->id___proto__, p, Attr_Accessor|Attr_NotEnumerable);
}
ReturnedValue ObjectPrototype::method_getPrototypeOf(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Object> o(scope, ctx->argument(0));
+ ScopedObject o(scope, ctx->argument(0));
if (!o)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
- Scoped<Object> p(scope, o->prototype());
+ ScopedObject p(scope, o->prototype());
return !!p ? p->asReturnedValue() : Encode::null();
}
ReturnedValue ObjectPrototype::method_getOwnPropertyDescriptor(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Object> O(scope, ctx->argument(0));
+ ScopedObject O(scope, ctx->argument(0));
if (!O)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
- if (ArgumentsObject::isNonStrictArgumentsObject(O.getPointer()))
- Scoped<ArgumentsObject>(scope, O)->fullyCreate();
+ if (ArgumentsObject::isNonStrictArgumentsObject(O))
+ static_cast<ArgumentsObject *>(O.getPointer())->fullyCreate();
ScopedValue v(scope, ctx->argument(1));
- Scoped<String> name(scope, v->toString(ctx));
+ ScopedString name(scope, v->toString(scope.engine));
if (scope.hasException())
return Encode::undefined();
PropertyAttributes attrs;
- Property *desc = O->__getOwnProperty__(name.getPointer(), &attrs);
- return fromPropertyDescriptor(ctx, desc, attrs);
+ Property *desc = O->__getOwnProperty__(name, &attrs);
+ return fromPropertyDescriptor(scope.engine, desc, attrs);
}
ReturnedValue ObjectPrototype::method_getOwnPropertyNames(CallContext *context)
@@ -165,9 +149,9 @@ ReturnedValue ObjectPrototype::method_getOwnPropertyNames(CallContext *context)
Scope scope(context);
ScopedObject O(scope, context->argument(0));
if (!O)
- return context->throwTypeError();
+ return context->engine()->throwTypeError();
- ScopedArrayObject array(scope, getOwnPropertyNames(context->d()->engine, context->d()->callData->args[0]));
+ ScopedArrayObject array(scope, getOwnPropertyNames(context->d()->engine, context->args()[0]));
return array.asReturnedValue();
}
@@ -176,12 +160,12 @@ ReturnedValue ObjectPrototype::method_create(CallContext *ctx)
Scope scope(ctx);
ScopedValue O(scope, ctx->argument(0));
if (!O->isObject() && !O->isNull())
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
- Scoped<Object> newObject(scope, ctx->d()->engine->newObject());
+ ScopedObject newObject(scope, ctx->d()->engine->newObject());
newObject->setPrototype(O->asObject());
- if (ctx->d()->callData->argc > 1 && !ctx->d()->callData->args[1].isUndefined()) {
+ if (ctx->argc() > 1 && !ctx->args()[1].isUndefined()) {
ctx->d()->callData->args[0] = newObject.asReturnedValue();
return method_defineProperties(ctx);
}
@@ -192,23 +176,23 @@ ReturnedValue ObjectPrototype::method_create(CallContext *ctx)
ReturnedValue ObjectPrototype::method_defineProperty(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Object> O(scope, ctx->argument(0));
+ ScopedObject O(scope, ctx->argument(0));
if (!O)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
- Scoped<String> name(scope, ctx->argument(1), Scoped<String>::Convert);
+ ScopedString name(scope, ctx->argument(1), ScopedString::Convert);
if (scope.engine->hasException)
return Encode::undefined();
ScopedValue attributes(scope, ctx->argument(2));
- Property pd;
+ ScopedProperty pd(scope);
PropertyAttributes attrs;
- toPropertyDescriptor(ctx, attributes, &pd, &attrs);
+ toPropertyDescriptor(scope.engine, attributes, pd, &attrs);
if (scope.engine->hasException)
return Encode::undefined();
- if (!O->__defineOwnProperty__(ctx, name.getPointer(), pd, attrs))
- return ctx->throwTypeError();
+ if (!O->__defineOwnProperty__(scope.engine, name, pd, attrs))
+ return ctx->engine()->throwTypeError();
return O.asReturnedValue();
}
@@ -216,39 +200,37 @@ ReturnedValue ObjectPrototype::method_defineProperty(CallContext *ctx)
ReturnedValue ObjectPrototype::method_defineProperties(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Object> O(scope, ctx->argument(0));
+ ScopedObject O(scope, ctx->argument(0));
if (!O)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
- Scoped<Object> o(scope, ctx->argument(1), Scoped<Object>::Convert);
+ ScopedObject o(scope, ctx->argument(1), ScopedObject::Convert);
if (scope.engine->hasException)
return Encode::undefined();
ScopedValue val(scope);
ObjectIterator it(scope, o, ObjectIterator::EnumerableOnly);
ScopedString name(scope);
+ ScopedProperty pd(scope);
+ ScopedProperty n(scope);
while (1) {
uint index;
PropertyAttributes attrs;
- Property pd;
- String *nm;
- it.next(nm, &index, &pd, &attrs);
- name = nm;
+ it.next(name.getRef(), &index, pd, &attrs);
if (attrs.isEmpty())
break;
- Property n;
PropertyAttributes nattrs;
- val = o->getValue(&pd, attrs);
- toPropertyDescriptor(ctx, val, &n, &nattrs);
+ val = o->getValue(pd, attrs);
+ toPropertyDescriptor(scope.engine, val, n, &nattrs);
if (scope.engine->hasException)
return Encode::undefined();
bool ok;
if (name)
- ok = O->__defineOwnProperty__(ctx, name.getPointer(), n, nattrs);
+ ok = O->__defineOwnProperty__(scope.engine, name, n, nattrs);
else
- ok = O->__defineOwnProperty__(ctx, index, n, nattrs);
+ ok = O->__defineOwnProperty__(scope.engine, index, n, nattrs);
if (!ok)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
}
return O.asReturnedValue();
@@ -257,19 +239,17 @@ ReturnedValue ObjectPrototype::method_defineProperties(CallContext *ctx)
ReturnedValue ObjectPrototype::method_seal(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Object> o(scope, ctx->argument(0));
+ ScopedObject o(scope, ctx->argument(0));
if (!o)
- return ctx->throwTypeError();
-
- o->setExtensible(false);
+ return ctx->engine()->throwTypeError();
o->setInternalClass(o->internalClass()->sealed());
if (o->arrayData()) {
- ArrayData::ensureAttributes(o.getPointer());
- for (uint i = 0; i < o->arrayData()->alloc(); ++i) {
+ ArrayData::ensureAttributes(o);
+ for (uint i = 0; i < o->d()->arrayData->alloc; ++i) {
if (!o->arrayData()->isEmpty(i))
- o->arrayData()->attrs()[i].setConfigurable(false);
+ o->d()->arrayData->attrs[i].setConfigurable(false);
}
}
@@ -279,24 +259,22 @@ ReturnedValue ObjectPrototype::method_seal(CallContext *ctx)
ReturnedValue ObjectPrototype::method_freeze(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Object> o(scope, ctx->argument(0));
+ ScopedObject o(scope, ctx->argument(0));
if (!o)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
- if (ArgumentsObject::isNonStrictArgumentsObject(o.getPointer()))
- Scoped<ArgumentsObject>(scope, o)->fullyCreate();
-
- o->setExtensible(false);
+ if (ArgumentsObject::isNonStrictArgumentsObject(o))
+ static_cast<ArgumentsObject *>(o.getPointer())->fullyCreate();
o->setInternalClass(o->internalClass()->frozen());
if (o->arrayData()) {
- ArrayData::ensureAttributes(o.getPointer());
- for (uint i = 0; i < o->arrayData()->alloc(); ++i) {
+ ArrayData::ensureAttributes(o);
+ for (uint i = 0; i < o->arrayData()->alloc; ++i) {
if (!o->arrayData()->isEmpty(i))
- o->arrayData()->attrs()[i].setConfigurable(false);
- if (o->arrayData()->attrs()[i].isData())
- o->arrayData()->attrs()[i].setWritable(false);
+ o->arrayData()->attrs[i].setConfigurable(false);
+ if (o->arrayData()->attrs[i].isData())
+ o->arrayData()->attrs[i].setWritable(false);
}
}
return o.asReturnedValue();
@@ -305,20 +283,20 @@ ReturnedValue ObjectPrototype::method_freeze(CallContext *ctx)
ReturnedValue ObjectPrototype::method_preventExtensions(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Object> o(scope, ctx->argument(0));
+ ScopedObject o(scope, ctx->argument(0));
if (!o)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
- o->setExtensible(false);
+ o->setInternalClass(o->internalClass()->nonExtensible());
return o.asReturnedValue();
}
ReturnedValue ObjectPrototype::method_isSealed(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Object> o(scope, ctx->argument(0));
+ ScopedObject o(scope, ctx->argument(0));
if (!o)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
if (o->isExtensible())
return Encode(false);
@@ -330,10 +308,10 @@ ReturnedValue ObjectPrototype::method_isSealed(CallContext *ctx)
return Encode(true);
Q_ASSERT(o->arrayData() && o->arrayData()->length());
- if (!o->arrayData()->attrs())
+ if (!o->arrayData()->attrs)
return Encode(false);
- for (uint i = 0; i < o->arrayData()->alloc(); ++i) {
+ for (uint i = 0; i < o->arrayData()->alloc; ++i) {
if (!o->arrayData()->isEmpty(i))
if (o->arrayData()->attributes(i).isConfigurable())
return Encode(false);
@@ -345,9 +323,9 @@ ReturnedValue ObjectPrototype::method_isSealed(CallContext *ctx)
ReturnedValue ObjectPrototype::method_isFrozen(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Object> o(scope, ctx->argument(0));
+ ScopedObject o(scope, ctx->argument(0));
if (!o)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
if (o->isExtensible())
return Encode(false);
@@ -359,10 +337,10 @@ ReturnedValue ObjectPrototype::method_isFrozen(CallContext *ctx)
return Encode(true);
Q_ASSERT(o->arrayData() && o->arrayData()->length());
- if (!o->arrayData()->attrs())
+ if (!o->arrayData()->attrs)
return Encode(false);
- for (uint i = 0; i < o->arrayData()->alloc(); ++i) {
+ for (uint i = 0; i < o->arrayData()->alloc; ++i) {
if (!o->arrayData()->isEmpty(i))
if (o->arrayData()->attributes(i).isConfigurable() || o->arrayData()->attributes(i).isWritable())
return Encode(false);
@@ -374,9 +352,9 @@ ReturnedValue ObjectPrototype::method_isFrozen(CallContext *ctx)
ReturnedValue ObjectPrototype::method_isExtensible(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Object> o(scope, ctx->argument(0));
+ ScopedObject o(scope, ctx->argument(0));
if (!o)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
return Encode((bool)o->isExtensible());
}
@@ -384,11 +362,11 @@ ReturnedValue ObjectPrototype::method_isExtensible(CallContext *ctx)
ReturnedValue ObjectPrototype::method_keys(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Object> o(scope, ctx->argument(0));
+ ScopedObject o(scope, ctx->argument(0));
if (!o)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
- Scoped<ArrayObject> a(scope, ctx->d()->engine->newArrayObject());
+ ScopedArrayObject a(scope, ctx->d()->engine->newArrayObject());
ObjectIterator it(scope, o, ObjectIterator::EnumerableOnly);
ScopedValue name(scope);
@@ -405,12 +383,12 @@ ReturnedValue ObjectPrototype::method_keys(CallContext *ctx)
ReturnedValue ObjectPrototype::method_toString(CallContext *ctx)
{
Scope scope(ctx);
- if (ctx->d()->callData->thisObject.isUndefined()) {
+ if (ctx->thisObject().isUndefined()) {
return ctx->d()->engine->newString(QStringLiteral("[object Undefined]"))->asReturnedValue();
- } else if (ctx->d()->callData->thisObject.isNull()) {
+ } else if (ctx->thisObject().isNull()) {
return ctx->d()->engine->newString(QStringLiteral("[object Null]"))->asReturnedValue();
} else {
- ScopedObject obj(scope, RuntimeHelpers::toObject(ctx, ValueRef(&ctx->d()->callData->thisObject)));
+ ScopedObject obj(scope, RuntimeHelpers::toObject(scope.engine, ctx->thisObject()));
QString className = obj->className();
return ctx->d()->engine->newString(QString::fromLatin1("[object %1]").arg(className))->asReturnedValue();
}
@@ -419,13 +397,13 @@ ReturnedValue ObjectPrototype::method_toString(CallContext *ctx)
ReturnedValue ObjectPrototype::method_toLocaleString(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject o(scope, ctx->d()->callData->thisObject.toObject(ctx));
+ ScopedObject o(scope, ctx->thisObject().toObject(scope.engine));
if (!o)
return Encode::undefined();
- Scoped<FunctionObject> f(scope, o->get(ctx->d()->engine->id_toString));
+ ScopedFunctionObject f(scope, o->get(ctx->d()->engine->id_toString));
if (!f)
- return ctx->throwTypeError();
- ScopedCallData callData(scope, 0);
+ return ctx->engine()->throwTypeError();
+ ScopedCallData callData(scope);
callData->thisObject = o;
return f->call(callData);
}
@@ -433,40 +411,40 @@ ReturnedValue ObjectPrototype::method_toLocaleString(CallContext *ctx)
ReturnedValue ObjectPrototype::method_valueOf(CallContext *ctx)
{
Scope scope(ctx);
- ScopedValue v(scope, ctx->d()->callData->thisObject.toObject(ctx));
+ ScopedValue v(scope, ctx->thisObject().toObject(scope.engine));
if (ctx->d()->engine->hasException)
return Encode::undefined();
- return v.asReturnedValue();
+ return v->asReturnedValue();
}
ReturnedValue ObjectPrototype::method_hasOwnProperty(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<String> P(scope, ctx->argument(0), Scoped<String>::Convert);
+ ScopedString P(scope, ctx->argument(0), ScopedString::Convert);
if (scope.engine->hasException)
return Encode::undefined();
- Scoped<Object> O(scope, ctx->d()->callData->thisObject, Scoped<Object>::Convert);
+ ScopedObject O(scope, ctx->thisObject(), ScopedObject::Convert);
if (scope.engine->hasException)
return Encode::undefined();
- bool r = O->hasOwnProperty(P.getPointer());
+ bool r = O->hasOwnProperty(P);
if (!r)
- r = !O->query(P.getPointer()).isEmpty();
+ r = !O->query(P).isEmpty();
return Encode(r);
}
ReturnedValue ObjectPrototype::method_isPrototypeOf(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Object> V(scope, ctx->argument(0));
+ ScopedObject V(scope, ctx->argument(0));
if (!V)
return Encode(false);
- Scoped<Object> O(scope, ctx->d()->callData->thisObject, Scoped<Object>::Convert);
+ ScopedObject O(scope, ctx->thisObject(), ScopedObject::Convert);
if (scope.engine->hasException)
return Encode::undefined();
- Scoped<Object> proto(scope, V->prototype());
+ ScopedObject proto(scope, V->prototype());
while (proto) {
- if (O.getPointer() == proto.getPointer())
+ if (O->d() == proto->d())
return Encode(true);
proto = proto->prototype();
}
@@ -476,80 +454,80 @@ ReturnedValue ObjectPrototype::method_isPrototypeOf(CallContext *ctx)
ReturnedValue ObjectPrototype::method_propertyIsEnumerable(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<String> p(scope, ctx->argument(0), Scoped<String>::Convert);
+ ScopedString p(scope, ctx->argument(0), ScopedString::Convert);
if (scope.engine->hasException)
return Encode::undefined();
- Scoped<Object> o(scope, ctx->d()->callData->thisObject, Scoped<Object>::Convert);
+ ScopedObject o(scope, ctx->thisObject(), ScopedObject::Convert);
if (scope.engine->hasException)
return Encode::undefined();
PropertyAttributes attrs;
- o->__getOwnProperty__(p.getPointer(), &attrs);
+ o->__getOwnProperty__(p, &attrs);
return Encode(attrs.isEnumerable());
}
ReturnedValue ObjectPrototype::method_defineGetter(CallContext *ctx)
{
- if (ctx->d()->callData->argc < 2)
- return ctx->throwTypeError();
+ if (ctx->argc() < 2)
+ return ctx->engine()->throwTypeError();
Scope scope(ctx);
- Scoped<FunctionObject> f(scope, ctx->argument(1));
+ ScopedFunctionObject f(scope, ctx->argument(1));
if (!f)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
- Scoped<String> prop(scope, ctx->argument(0), Scoped<String>::Convert);
+ ScopedString prop(scope, ctx->argument(0), ScopedString::Convert);
if (scope.engine->hasException)
return Encode::undefined();
- Scoped<Object> o(scope, ctx->d()->callData->thisObject);
+ ScopedObject o(scope, ctx->thisObject());
if (!o) {
- if (!ctx->d()->callData->thisObject.isUndefined())
+ if (!ctx->thisObject().isUndefined())
return Encode::undefined();
- o = ctx->d()->engine->globalObject;
+ o = ctx->d()->engine->globalObject();
}
- Property pd;
- pd.value = f;
- pd.set = Primitive::emptyValue();
- o->__defineOwnProperty__(ctx, prop.getPointer(), pd, Attr_Accessor);
+ ScopedProperty pd(scope);
+ pd->value = f;
+ pd->set = Primitive::emptyValue();
+ o->__defineOwnProperty__(scope.engine, prop, pd, Attr_Accessor);
return Encode::undefined();
}
ReturnedValue ObjectPrototype::method_defineSetter(CallContext *ctx)
{
- if (ctx->d()->callData->argc < 2)
- return ctx->throwTypeError();
+ if (ctx->argc() < 2)
+ return ctx->engine()->throwTypeError();
Scope scope(ctx);
- Scoped<FunctionObject> f(scope, ctx->argument(1));
+ ScopedFunctionObject f(scope, ctx->argument(1));
if (!f)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
- Scoped<String> prop(scope, ctx->argument(0), Scoped<String>::Convert);
+ ScopedString prop(scope, ctx->argument(0), ScopedString::Convert);
if (scope.engine->hasException)
return Encode::undefined();
- Scoped<Object> o(scope, ctx->d()->callData->thisObject);
+ ScopedObject o(scope, ctx->thisObject());
if (!o) {
- if (!ctx->d()->callData->thisObject.isUndefined())
+ if (!ctx->thisObject().isUndefined())
return Encode::undefined();
- o = ctx->d()->engine->globalObject;
+ o = ctx->d()->engine->globalObject();
}
- Property pd;
- pd.value = Primitive::emptyValue();
- pd.set = f;
- o->__defineOwnProperty__(ctx, prop.getPointer(), pd, Attr_Accessor);
+ ScopedProperty pd(scope);
+ pd->value = Primitive::emptyValue();
+ pd->set = f;
+ o->__defineOwnProperty__(scope.engine, prop, pd, Attr_Accessor);
return Encode::undefined();
}
ReturnedValue ObjectPrototype::method_get_proto(CallContext *ctx)
{
Scope scope(ctx);
- ScopedObject o(scope, ctx->d()->callData->thisObject.asObject());
+ ScopedObject o(scope, ctx->thisObject().asObject());
if (!o)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
return o->prototype()->asReturnedValue();
}
@@ -557,35 +535,35 @@ ReturnedValue ObjectPrototype::method_get_proto(CallContext *ctx)
ReturnedValue ObjectPrototype::method_set_proto(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Object> o(scope, ctx->d()->callData->thisObject);
- if (!o || !ctx->d()->callData->argc)
- return ctx->throwTypeError();
+ ScopedObject o(scope, ctx->thisObject());
+ if (!o || !ctx->argc())
+ return ctx->engine()->throwTypeError();
- if (ctx->d()->callData->args[0].isNull()) {
+ if (ctx->args()[0].isNull()) {
o->setPrototype(0);
return Encode::undefined();
}
- Scoped<Object> p(scope, ctx->d()->callData->args[0]);
+ ScopedObject p(scope, ctx->args()[0]);
bool ok = false;
if (!!p) {
- if (o->prototype() == p.getPointer()) {
+ if (o->prototype() == p->d()) {
ok = true;
} else if (o->isExtensible()) {
- ok = o->setPrototype(p.getPointer());
+ ok = o->setPrototype(p);
}
}
if (!ok)
- return ctx->throwTypeError(QStringLiteral("Cyclic __proto__ value"));
+ return ctx->engine()->throwTypeError(QStringLiteral("Cyclic __proto__ value"));
return Encode::undefined();
}
-void ObjectPrototype::toPropertyDescriptor(ExecutionContext *ctx, const ValueRef v, Property *desc, PropertyAttributes *attrs)
+void ObjectPrototype::toPropertyDescriptor(ExecutionEngine *engine, const Value &v, Property *desc, PropertyAttributes *attrs)
{
- Scope scope(ctx);
+ Scope scope(engine);
ScopedObject o(scope, v);
if (!o) {
- ctx->throwTypeError();
+ engine->throwTypeError();
return;
}
@@ -594,52 +572,52 @@ void ObjectPrototype::toPropertyDescriptor(ExecutionContext *ctx, const ValueRef
desc->set = Primitive::emptyValue();
ScopedValue tmp(scope);
- if (o->hasProperty(ctx->d()->engine->id_enumerable))
- attrs->setEnumerable((tmp = o->get(ctx->d()->engine->id_enumerable))->toBoolean());
+ if (o->hasProperty(engine->id_enumerable))
+ attrs->setEnumerable((tmp = o->get(engine->id_enumerable))->toBoolean());
- if (o->hasProperty(ctx->d()->engine->id_configurable))
- attrs->setConfigurable((tmp = o->get(ctx->d()->engine->id_configurable))->toBoolean());
+ if (o->hasProperty(engine->id_configurable))
+ attrs->setConfigurable((tmp = o->get(engine->id_configurable))->toBoolean());
- if (o->hasProperty(ctx->d()->engine->id_get)) {
- ScopedValue get(scope, o->get(ctx->d()->engine->id_get));
+ if (o->hasProperty(engine->id_get)) {
+ ScopedValue get(scope, o->get(engine->id_get));
FunctionObject *f = get->asFunctionObject();
if (f || get->isUndefined()) {
desc->value = get;
} else {
- ctx->throwTypeError();
+ engine->throwTypeError();
return;
}
attrs->setType(PropertyAttributes::Accessor);
}
- if (o->hasProperty(ctx->d()->engine->id_set)) {
- ScopedValue set(scope, o->get(ctx->d()->engine->id_set));
+ if (o->hasProperty(engine->id_set)) {
+ ScopedValue set(scope, o->get(engine->id_set));
FunctionObject *f = set->asFunctionObject();
if (f || set->isUndefined()) {
desc->set = set;
} else {
- ctx->throwTypeError();
+ engine->throwTypeError();
return;
}
attrs->setType(PropertyAttributes::Accessor);
}
- if (o->hasProperty(ctx->d()->engine->id_writable)) {
+ if (o->hasProperty(engine->id_writable)) {
if (attrs->isAccessor()) {
- ctx->throwTypeError();
+ engine->throwTypeError();
return;
}
- attrs->setWritable((tmp = o->get(ctx->d()->engine->id_writable))->toBoolean());
+ attrs->setWritable((tmp = o->get(engine->id_writable))->toBoolean());
// writable forces it to be a data descriptor
desc->value = Primitive::undefinedValue();
}
- if (o->hasProperty(ctx->d()->engine->id_value)) {
+ if (o->hasProperty(engine->id_value)) {
if (attrs->isAccessor()) {
- ctx->throwTypeError();
+ engine->throwTypeError();
return;
}
- desc->value = o->get(ctx->d()->engine->id_value);
+ desc->value = o->get(engine->id_value);
attrs->setType(PropertyAttributes::Data);
}
@@ -648,49 +626,48 @@ void ObjectPrototype::toPropertyDescriptor(ExecutionContext *ctx, const ValueRef
}
-ReturnedValue ObjectPrototype::fromPropertyDescriptor(ExecutionContext *ctx, const Property *desc, PropertyAttributes attrs)
+ReturnedValue ObjectPrototype::fromPropertyDescriptor(ExecutionEngine *engine, const Property *desc, PropertyAttributes attrs)
{
if (!desc)
return Encode::undefined();
- ExecutionEngine *engine = ctx->d()->engine;
Scope scope(engine);
// Let obj be the result of creating a new object as if by the expression new Object() where Object
// is the standard built-in constructor with that name.
ScopedObject o(scope, engine->newObject());
ScopedString s(scope);
- Property pd;
+ ScopedProperty pd(scope);
if (attrs.isData()) {
- pd.value = desc->value;
+ pd->value = desc->value;
s = engine->newString(QStringLiteral("value"));
- o->__defineOwnProperty__(ctx, s.getPointer(), pd, Attr_Data);
- pd.value = Primitive::fromBoolean(attrs.isWritable());
+ o->__defineOwnProperty__(scope.engine, s, pd, Attr_Data);
+ pd->value = Primitive::fromBoolean(attrs.isWritable());
s = engine->newString(QStringLiteral("writable"));
- o->__defineOwnProperty__(ctx, s.getPointer(), pd, Attr_Data);
+ o->__defineOwnProperty__(scope.engine, s, pd, Attr_Data);
} else {
- pd.value = desc->getter() ? desc->getter()->asReturnedValue() : Encode::undefined();
+ pd->value = desc->getter() ? desc->getter()->asReturnedValue() : Encode::undefined();
s = engine->newString(QStringLiteral("get"));
- o->__defineOwnProperty__(ctx, s.getPointer(), pd, Attr_Data);
- pd.value = desc->setter() ? desc->setter()->asReturnedValue() : Encode::undefined();
+ o->__defineOwnProperty__(scope.engine, s, pd, Attr_Data);
+ pd->value = desc->setter() ? desc->setter()->asReturnedValue() : Encode::undefined();
s = engine->newString(QStringLiteral("set"));
- o->__defineOwnProperty__(ctx, s.getPointer(), pd, Attr_Data);
+ o->__defineOwnProperty__(scope.engine, s, pd, Attr_Data);
}
- pd.value = Primitive::fromBoolean(attrs.isEnumerable());
+ pd->value = Primitive::fromBoolean(attrs.isEnumerable());
s = engine->newString(QStringLiteral("enumerable"));
- o->__defineOwnProperty__(ctx, s.getPointer(), pd, Attr_Data);
- pd.value = Primitive::fromBoolean(attrs.isConfigurable());
+ o->__defineOwnProperty__(scope.engine, s, pd, Attr_Data);
+ pd->value = Primitive::fromBoolean(attrs.isConfigurable());
s = engine->newString(QStringLiteral("configurable"));
- o->__defineOwnProperty__(ctx, s.getPointer(), pd, Attr_Data);
+ o->__defineOwnProperty__(scope.engine, s, pd, Attr_Data);
return o.asReturnedValue();
}
-Returned<ArrayObject> *ObjectPrototype::getOwnPropertyNames(ExecutionEngine *v4, const ValueRef o)
+Heap::ArrayObject *ObjectPrototype::getOwnPropertyNames(ExecutionEngine *v4, const Value &o)
{
Scope scope(v4);
- Scoped<ArrayObject> array(scope, v4->newArrayObject());
+ ScopedArrayObject array(scope, v4->newArrayObject());
ScopedObject O(scope, o);
if (O) {
ObjectIterator it(scope, O, ObjectIterator::NoFlags);
@@ -702,5 +679,5 @@ Returned<ArrayObject> *ObjectPrototype::getOwnPropertyNames(ExecutionEngine *v4,
array->push_back(name);
}
}
- return array->asReturned<ArrayObject>();
+ return array->d();
}
diff --git a/src/qml/jsruntime/qv4objectproto_p.h b/src/qml/jsruntime/qv4objectproto_p.h
index 0a5bacbadb..4e96681017 100644
--- a/src/qml/jsruntime/qv4objectproto_p.h
+++ b/src/qml/jsruntime/qv4objectproto_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -41,12 +41,17 @@ QT_BEGIN_NAMESPACE
namespace QV4 {
+namespace Heap {
+
+struct ObjectCtor : FunctionObject {
+ ObjectCtor(QV4::ExecutionContext *scope);
+};
+
+}
+
struct ObjectCtor: FunctionObject
{
- struct Data : FunctionObject::Data {
- Data(ExecutionContext *scope);
- };
- V4_OBJECT(FunctionObject)
+ V4_OBJECT2(ObjectCtor, FunctionObject)
static ReturnedValue construct(Managed *that, CallData *callData);
static ReturnedValue call(Managed *that, CallData *callData);
@@ -83,10 +88,10 @@ struct ObjectPrototype: Object
static ReturnedValue method_get_proto(CallContext *ctx);
static ReturnedValue method_set_proto(CallContext *ctx);
- static void toPropertyDescriptor(ExecutionContext *ctx, const ValueRef v, Property *desc, PropertyAttributes *attrs);
- static ReturnedValue fromPropertyDescriptor(ExecutionContext *ctx, const Property *desc, PropertyAttributes attrs);
+ static void toPropertyDescriptor(ExecutionEngine *engine, const Value &v, Property *desc, PropertyAttributes *attrs);
+ static ReturnedValue fromPropertyDescriptor(ExecutionEngine *engine, const Property *desc, PropertyAttributes attrs);
- static Returned<ArrayObject> *getOwnPropertyNames(ExecutionEngine *v4, const ValueRef o);
+ static Heap::ArrayObject *getOwnPropertyNames(ExecutionEngine *v4, const Value &o);
};
diff --git a/src/qml/jsruntime/qv4persistent.cpp b/src/qml/jsruntime/qv4persistent.cpp
index ff10d71aae..88dc1946b8 100644
--- a/src/qml/jsruntime/qv4persistent.cpp
+++ b/src/qml/jsruntime/qv4persistent.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -33,215 +33,329 @@
#include "qv4persistent_p.h"
#include "qv4mm_p.h"
+#include "qv4object_p.h"
+#include "PageAllocation.h"
using namespace QV4;
-PersistentValue::PersistentValue(const ValueRef val)
- : d(new PersistentValuePrivate(val.asReturnedValue()))
+namespace {
+
+struct Page;
+struct Header {
+ WTF::PageAllocation alloc;
+ ExecutionEngine *engine;
+ Page **prev;
+ Page *next;
+ int refCount;
+ int freeList;
+};
+
+static const int kEntriesPerPage = int((WTF::pageSize() - sizeof(Header)) / sizeof(Value));
+
+struct Page {
+ Header header;
+ Value values[1]; // Really kEntriesPerPage, but keep the compiler happy
+};
+
+Page *getPage(Value *val) {
+ return reinterpret_cast<Page *>(reinterpret_cast<quintptr>(val) & ~((quintptr)(WTF::pageSize() - 1)));
+}
+
+
+Page *allocatePage(PersistentValueStorage *storage)
{
+ PageAllocation page = WTF::PageAllocation::allocate(WTF::pageSize());
+ Page *p = reinterpret_cast<Page *>(page.base());
+
+ Q_ASSERT(!((quintptr)p & (WTF::pageSize() - 1)));
+
+ p->header.engine = storage->engine;
+ p->header.alloc = page;
+ p->header.next = reinterpret_cast<Page *>(storage->firstPage);
+ p->header.prev = reinterpret_cast<Page **>(&storage->firstPage);
+ p->header.refCount = 0;
+ p->header.freeList = 0;
+ if (p->header.next)
+ p->header.next->header.prev = &p->header.next;
+ for (int i = 0; i < kEntriesPerPage - 1; ++i) {
+ p->values[i].tag = QV4::Value::Empty_Type;
+ p->values[i].int_32 = i + 1;
+ }
+ p->values[kEntriesPerPage - 1].tag = QV4::Value::Empty_Type;
+ p->values[kEntriesPerPage - 1].int_32 = -1;
+
+ storage->firstPage = p;
+
+ return p;
}
-PersistentValue::PersistentValue(ReturnedValue val)
- : d(new PersistentValuePrivate(val))
+
+}
+
+
+PersistentValueStorage::Iterator &PersistentValueStorage::Iterator::operator++() {
+ while (p) {
+ while (index < kEntriesPerPage - 1) {
+ ++index;
+ if (static_cast<Page *>(p)->values[index].tag != QV4::Value::Empty_Type)
+ return *this;
+ }
+ index = -1;
+ p = static_cast<Page *>(p)->header.next;
+ }
+ index = 0;
+ return *this;
+}
+
+Value &PersistentValueStorage::Iterator::operator *()
{
+ return static_cast<Page *>(p)->values[index];
}
-PersistentValue::PersistentValue(const PersistentValue &other)
- : d(other.d)
+PersistentValueStorage::PersistentValueStorage(ExecutionEngine *engine)
+ : engine(engine),
+ firstPage(0)
{
- if (d)
- d->ref();
}
-PersistentValue &PersistentValue::operator=(const PersistentValue &other)
+PersistentValueStorage::~PersistentValueStorage()
{
- if (d == other.d)
- return *this;
+ Page *p = static_cast<Page *>(firstPage);
+ while (p) {
+ for (int i = 0; i < kEntriesPerPage; ++i) {
+ if (!p->values[i].isEmpty())
+ p->values[i] = Encode::undefined();
+ }
+ Page *n = p->header.next;
+ p->header.engine = 0;
+ p->header.prev = 0;
+ p->header.next = 0;
+ Q_ASSERT(p->header.refCount);
+ p = n;
+ }
+}
+
+Value *PersistentValueStorage::allocate()
+{
+ Page *p = static_cast<Page *>(firstPage);
+ while (p) {
+ if (p->header.freeList != -1)
+ break;
+ p = p->header.next;
+ }
+ if (!p)
+ p = allocatePage(this);
- // the memory manager cleans up those with a refcount of 0
+ Value *v = p->values + p->header.freeList;
+ p->header.freeList = v->int_32;
+ ++p->header.refCount;
- if (d)
- d->deref();
- d = other.d;
- if (d)
- d->ref();
+ v->val = Encode::undefined();
- return *this;
+ return v;
}
-PersistentValue &PersistentValue::operator =(const ValueRef other)
+void PersistentValueStorage::free(Value *v)
{
- if (!d) {
- d = new PersistentValuePrivate(other.asReturnedValue());
- return *this;
+ if (!v)
+ return;
+
+ Page *p = getPage(v);
+
+ v->tag = QV4::Value::Empty_Type;
+ v->int_32 = p->header.freeList;
+ p->header.freeList = v - p->values;
+ if (!--p->header.refCount) {
+ if (p->header.prev)
+ *p->header.prev = p->header.next;
+ if (p->header.next)
+ p->header.next->header.prev = p->header.prev;
+ p->header.alloc.deallocate();
}
- d = d->detach(other.asReturnedValue());
- return *this;
}
-PersistentValue &PersistentValue::operator =(ReturnedValue other)
+static void drainMarkStack(QV4::ExecutionEngine *engine, Value *markBase)
{
- if (!d) {
- d = new PersistentValuePrivate(other);
- return *this;
+ while (engine->jsStackTop > markBase) {
+ Heap::Base *h = engine->popForGC();
+ Q_ASSERT (h->gcGetVtable()->markObjects);
+ h->gcGetVtable()->markObjects(h, engine);
}
- d = d->detach(other);
- return *this;
}
-PersistentValue::~PersistentValue()
+void PersistentValueStorage::mark(ExecutionEngine *e)
{
- if (d)
- d->deref();
+ Value *markBase = e->jsStackTop;
+
+ Page *p = static_cast<Page *>(firstPage);
+ while (p) {
+ for (int i = 0; i < kEntriesPerPage; ++i) {
+ if (Managed *m = p->values[i].asManaged())
+ m->mark(e);
+ }
+ drainMarkStack(e, markBase);
+
+ p = p->header.next;
+ }
}
-WeakValue::WeakValue(const ValueRef val)
- : d(new PersistentValuePrivate(val.asReturnedValue(), /*engine*/0, /*weak*/true))
+ExecutionEngine *PersistentValueStorage::getEngine(Value *v)
{
+ return getPage(v)->header.engine;
}
-WeakValue::WeakValue(const WeakValue &other)
- : d(other.d)
+
+PersistentValue::PersistentValue(const PersistentValue &other)
+ : val(0)
{
- if (d)
- d->ref();
+ if (other.val) {
+ val = other.engine()->memoryManager->m_persistentValues->allocate();
+ *val = *other.val;
+ }
}
-WeakValue::WeakValue(ReturnedValue val)
- : d(new PersistentValuePrivate(val, /*engine*/0, /*weak*/true))
+PersistentValue::PersistentValue(ExecutionEngine *engine, const Value &value)
{
+ val = engine->memoryManager->m_persistentValues->allocate();
+ *val = value;
}
-WeakValue &WeakValue::operator=(const WeakValue &other)
+PersistentValue::PersistentValue(ExecutionEngine *engine, ReturnedValue value)
{
- if (d == other.d)
- return *this;
+ val = engine->memoryManager->m_persistentValues->allocate();
+ *val = value;
+}
- // the memory manager cleans up those with a refcount of 0
+PersistentValue::PersistentValue(ExecutionEngine *engine, Object *object)
+ : val(0)
+{
+ if (!object)
+ return;
- if (d)
- d->deref();
- d = other.d;
- if (d)
- d->ref();
+ val = engine->memoryManager->m_persistentValues->allocate();
+ *val = object;
+}
+PersistentValue::~PersistentValue()
+{
+ PersistentValueStorage::free(val);
+}
+
+PersistentValue &PersistentValue::operator=(const PersistentValue &other)
+{
+ if (!val) {
+ if (!other.val)
+ return *this;
+ val = other.engine()->memoryManager->m_persistentValues->allocate();
+ }
+
+ Q_ASSERT(engine() == other.engine());
+
+ *val = *other.val;
return *this;
}
-WeakValue &WeakValue::operator =(const ValueRef other)
+PersistentValue &PersistentValue::operator=(const WeakValue &other)
{
- if (!d) {
- d = new PersistentValuePrivate(other.asReturnedValue(), /*engine*/0, /*weak*/true);
- return *this;
+ if (!val) {
+ if (!other.valueRef())
+ return *this;
+ val = other.engine()->memoryManager->m_persistentValues->allocate();
}
- d = d->detach(other.asReturnedValue(), /*weak*/true);
+
+ Q_ASSERT(engine() == other.engine());
+
+ *val = *other.valueRef();
return *this;
}
-WeakValue &WeakValue::operator =(const ReturnedValue &other)
+PersistentValue &PersistentValue::operator=(Object *object)
{
- if (!d) {
- d = new PersistentValuePrivate(other, /*engine*/0, /*weak*/true);
+ if (!object) {
+ PersistentValueStorage::free(val);
return *this;
}
- d = d->detach(other, /*weak*/true);
+ if (!val)
+ val = object->engine()->memoryManager->m_persistentValues->allocate();
+
+ *val = object;
return *this;
}
-
-WeakValue::~WeakValue()
+void PersistentValue::set(ExecutionEngine *engine, const Value &value)
{
- if (d)
- d->deref();
+ if (!val)
+ val = engine->memoryManager->m_persistentValues->allocate();
+ *val = value;
}
-void WeakValue::markOnce(ExecutionEngine *e)
+void PersistentValue::set(ExecutionEngine *engine, ReturnedValue value)
{
- if (!d)
- return;
- d->value.mark(e);
+ if (!val)
+ val = engine->memoryManager->m_persistentValues->allocate();
+ *val = value;
}
-PersistentValuePrivate::PersistentValuePrivate(ReturnedValue v, ExecutionEngine *e, bool weak)
- : refcount(1)
- , weak(weak)
- , engine(e)
- , prev(0)
- , next(0)
+void PersistentValue::set(ExecutionEngine *engine, Heap::Base *obj)
{
- value.val = v;
- init();
+ if (!val)
+ val = engine->memoryManager->m_persistentValues->allocate();
+ *val = obj;
}
-void PersistentValuePrivate::init()
+WeakValue::WeakValue(const WeakValue &other)
+ : val(0)
{
- if (!engine) {
- Managed *m = value.asManaged();
- if (!m)
- return;
-
- engine = m->engine();
+ if (other.val) {
+ val = other.engine()->memoryManager->m_weakValues->allocate();
+ *val = *other.val;
}
- if (engine && !prev) {
- PersistentValuePrivate **listRoot = weak ? &engine->memoryManager->m_weakValues : &engine->memoryManager->m_persistentValues;
-
- prev = listRoot;
- next = *listRoot;
- *prev = this;
- if (next)
- next->prev = &this->next;
+}
+
+WeakValue &WeakValue::operator=(const WeakValue &other)
+{
+ if (!val) {
+ if (!other.val)
+ return *this;
+ val = other.engine()->memoryManager->m_weakValues->allocate();
}
+
+ Q_ASSERT(engine() == other.engine());
+
+ *val = *other.val;
+ return *this;
}
-PersistentValuePrivate::~PersistentValuePrivate()
+WeakValue::~WeakValue()
{
+ PersistentValueStorage::free(val);
}
-void PersistentValuePrivate::removeFromList()
+void WeakValue::set(ExecutionEngine *engine, const Value &value)
{
- if (prev) {
- if (next)
- next->prev = prev;
- *prev = next;
- next = 0;
- prev = 0;
- }
+ if (!val)
+ val = engine->memoryManager->m_weakValues->allocate();
+ *val = value;
}
-void PersistentValuePrivate::deref()
+void WeakValue::set(ExecutionEngine *engine, ReturnedValue value)
{
- // if engine is not 0, they are registered with the memory manager
- // and will get cleaned up in the next gc run
- if (!--refcount) {
- removeFromList();
- delete this;
- }
+ if (!val)
+ val = engine->memoryManager->m_weakValues->allocate();
+ *val = value;
}
-PersistentValuePrivate *PersistentValuePrivate::detach(const QV4::ReturnedValue val, bool weak)
-{
- if (refcount == 1) {
- value.val = val;
-
- Managed *m = value.asManaged();
- if (!prev) {
- if (m) {
- ExecutionEngine *engine = m->engine();
- if (engine) {
- PersistentValuePrivate **listRoot = weak ? &engine->memoryManager->m_weakValues : &engine->memoryManager->m_persistentValues;
- prev = listRoot;
- next = *listRoot;
- *prev = this;
- if (next)
- next->prev = &this->next;
- }
- }
- } else if (!m)
- removeFromList();
-
- return this;
- }
- --refcount;
- return new PersistentValuePrivate(val, engine, weak);
+void WeakValue::set(ExecutionEngine *engine, Heap::Base *obj)
+{
+ if (!val)
+ val = engine->memoryManager->m_weakValues->allocate();
+ *val = obj;
+}
+
+void WeakValue::markOnce(ExecutionEngine *e)
+{
+ if (!val)
+ return;
+ val->mark(e);
}
diff --git a/src/qml/jsruntime/qv4persistent_p.h b/src/qml/jsruntime/qv4persistent_p.h
index 57b30f74ec..7cac2ed95f 100644
--- a/src/qml/jsruntime/qv4persistent_p.h
+++ b/src/qml/jsruntime/qv4persistent_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -39,115 +39,125 @@ QT_BEGIN_NAMESPACE
namespace QV4 {
-struct Q_QML_PRIVATE_EXPORT PersistentValuePrivate
+struct Q_QML_EXPORT PersistentValueStorage
{
- PersistentValuePrivate(ReturnedValue v, ExecutionEngine *engine = 0, bool weak = false);
- virtual ~PersistentValuePrivate();
- Value value;
- uint refcount;
- bool weak;
- QV4::ExecutionEngine *engine;
- PersistentValuePrivate **prev;
- PersistentValuePrivate *next;
-
- void init();
- void removeFromList();
- void ref() { ++refcount; }
- void deref();
- PersistentValuePrivate *detach(const ReturnedValue value, bool weak = false);
-
- bool checkEngine(QV4::ExecutionEngine *otherEngine) {
- if (!engine) {
- Q_ASSERT(!value.isObject());
- engine = otherEngine;
+ PersistentValueStorage(ExecutionEngine *engine);
+ ~PersistentValueStorage();
+
+ Value *allocate();
+ static void free(Value *e);
+
+ void mark(ExecutionEngine *e);
+
+ struct Iterator {
+ Q_DECL_CONSTEXPR Iterator(void *p, int idx)
+ : p(p), index(idx) {}
+ void *p;
+ int index;
+ Iterator &operator++();
+ bool operator !=(const Iterator &other) {
+ return p != other.p || index != other.index;
}
- return (engine == otherEngine);
- }
+ Value &operator *();
+ };
+ Iterator begin() { return Iterator(firstPage, 0); }
+ Iterator end() { return Iterator(0, 0); }
+
+ static ExecutionEngine *getEngine(Value *v);
+
+ ExecutionEngine *engine;
+ void *firstPage;
};
class Q_QML_EXPORT PersistentValue
{
public:
- PersistentValue() : d(0) {}
+ PersistentValue() : val(0) {}
PersistentValue(const PersistentValue &other);
PersistentValue &operator=(const PersistentValue &other);
-
- PersistentValue(const ValueRef val);
- PersistentValue(ReturnedValue val);
- template<typename T>
- PersistentValue(Returned<T> *obj);
- PersistentValue &operator=(const ValueRef other);
- PersistentValue &operator=(const ScopedValue &other);
- PersistentValue &operator =(ReturnedValue other);
- template<typename T>
- PersistentValue &operator=(Returned<T> *obj);
+ PersistentValue &operator=(const WeakValue &other);
+ PersistentValue &operator=(Object *object);
~PersistentValue();
+ PersistentValue(ExecutionEngine *engine, const Value &value);
+ PersistentValue(ExecutionEngine *engine, ReturnedValue value);
+ PersistentValue(ExecutionEngine *engine, Object *object);
+
+ void set(ExecutionEngine *engine, const Value &value);
+ void set(ExecutionEngine *engine, ReturnedValue value);
+ void set(ExecutionEngine *engine, Heap::Base *obj);
+
ReturnedValue value() const {
- return (d ? d->value.asReturnedValue() : Primitive::undefinedValue().asReturnedValue());
+ return (val ? val->asReturnedValue() : Encode::undefined());
+ }
+ Value *valueRef() const {
+ return val;
+ }
+ Managed *asManaged() const {
+ if (!val)
+ return 0;
+ return val->asManaged();
}
- ExecutionEngine *engine() {
- if (!d)
+ ExecutionEngine *engine() const {
+ if (!val)
return 0;
- if (d->engine)
- return d->engine;
- Managed *m = d->value.asManaged();
- return m ? m->engine() : 0;
+ return PersistentValueStorage::getEngine(val);
}
- bool isUndefined() const { return !d || d->value.isUndefined(); }
- bool isNullOrUndefined() const { return !d || d->value.isNullOrUndefined(); }
+ bool isUndefined() const { return !val || val->isUndefined(); }
+ bool isNullOrUndefined() const { return !val || val->isNullOrUndefined(); }
void clear() {
- *this = PersistentValue();
+ PersistentValueStorage::free(val);
+ val = 0;
}
+ bool isEmpty() { return !val; }
private:
- friend struct ValueRef;
- PersistentValuePrivate *d;
+ Value *val;
};
class Q_QML_EXPORT WeakValue
{
public:
- WeakValue() : d(0) {}
- WeakValue(const ValueRef val);
+ WeakValue() : val(0) {}
WeakValue(const WeakValue &other);
- WeakValue(ReturnedValue val);
- template<typename T>
- WeakValue(Returned<T> *obj);
WeakValue &operator=(const WeakValue &other);
- WeakValue &operator=(const ValueRef other);
- WeakValue &operator =(const ReturnedValue &other);
- template<typename T>
- WeakValue &operator=(Returned<T> *obj);
-
~WeakValue();
+ void set(ExecutionEngine *engine, const Value &value);
+ void set(ExecutionEngine *engine, ReturnedValue value);
+ void set(ExecutionEngine *engine, Heap::Base *obj);
+
ReturnedValue value() const {
- return (d ? d->value.asReturnedValue() : Primitive::undefinedValue().asReturnedValue());
+ return (val ? val->asReturnedValue() : Encode::undefined());
+ }
+ Value *valueRef() const {
+ return val;
+ }
+ Managed *asManaged() const {
+ if (!val)
+ return 0;
+ return val->asManaged();
}
- ExecutionEngine *engine() {
- if (!d)
+ ExecutionEngine *engine() const {
+ if (!val)
return 0;
- if (d->engine)
- return d->engine;
- Managed *m = d->value.asManaged();
- return m ? m->engine() : 0;
+ return PersistentValueStorage::getEngine(val);
}
- bool isUndefined() const { return !d || d->value.isUndefined(); }
- bool isNullOrUndefined() const { return !d || d->value.isNullOrUndefined(); }
+ bool isUndefined() const { return !val || val->isUndefined(); }
+ bool isNullOrUndefined() const { return !val || val->isNullOrUndefined(); }
void clear() {
- *this = WeakValue();
+ PersistentValueStorage::free(val);
+ val = 0;
}
void markOnce(ExecutionEngine *e);
private:
- friend struct ValueRef;
- PersistentValuePrivate *d;
+ Value *val;
};
} // namespace QV4
diff --git a/src/qml/jsruntime/qv4profiling.cpp b/src/qml/jsruntime/qv4profiling.cpp
index f1bd1d55d9..a7019d0558 100644
--- a/src/qml/jsruntime/qv4profiling.cpp
+++ b/src/qml/jsruntime/qv4profiling.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/jsruntime/qv4profiling_p.h b/src/qml/jsruntime/qv4profiling_p.h
index 7c66ee0049..c3441eaacd 100644
--- a/src/qml/jsruntime/qv4profiling_p.h
+++ b/src/qml/jsruntime/qv4profiling_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -120,11 +120,11 @@ private:
(engine->profiler->featuresEnabled & (1 << Profiling::FeatureMemoryAllocation)) ?\
engine->profiler->trackDealloc(pointer, size, type) : pointer)
-#define Q_V4_PROFILE(engine, ctx, function)\
+#define Q_V4_PROFILE(engine, function)\
(engine->profiler &&\
(engine->profiler->featuresEnabled & (1 << Profiling::FeatureFunctionCall)) ?\
- Profiling::FunctionCallProfiler::profileCall(engine->profiler, ctx, function) :\
- function->code(ctx, function->codeData))
+ Profiling::FunctionCallProfiler::profileCall(engine->profiler, engine, function) :\
+ function->code(engine, function->codeData))
class Q_QML_EXPORT Profiler : public QObject {
Q_OBJECT
@@ -182,10 +182,10 @@ public:
profiler->m_data.append(FunctionCall(function, startTime, profiler->m_timer.nsecsElapsed()));
}
- static ReturnedValue profileCall(Profiler *profiler, ExecutionContext *ctx, Function *function)
+ static ReturnedValue profileCall(Profiler *profiler, ExecutionEngine *engine, Function *function)
{
FunctionCallProfiler callProfiler(profiler, function);
- return function->code(ctx, function->codeData);
+ return function->code(engine, function->codeData);
}
Profiler *profiler;
diff --git a/src/qml/jsruntime/qv4property_p.h b/src/qml/jsruntime/qv4property_p.h
index f9b3159033..1b55abd1f7 100644
--- a/src/qml/jsruntime/qv4property_p.h
+++ b/src/qml/jsruntime/qv4property_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -34,7 +34,7 @@
#define QV4PROPERTYDESCRIPTOR_H
#include "qv4global_p.h"
-#include "qv4value_inl_p.h"
+#include "qv4value_p.h"
#include "qv4internalclass_p.h"
QT_BEGIN_NAMESPACE
@@ -68,33 +68,37 @@ struct Property {
return pd;
}
- inline bool isSubset(const PropertyAttributes &attrs, const Property &other, PropertyAttributes otherAttrs) const;
- inline void merge(PropertyAttributes &attrs, const Property &other, PropertyAttributes otherAttrs);
+ inline bool isSubset(const PropertyAttributes &attrs, const Property *other, PropertyAttributes otherAttrs) const;
+ inline void merge(PropertyAttributes &attrs, const Property *other, PropertyAttributes otherAttrs);
- inline FunctionObject *getter() const { return reinterpret_cast<FunctionObject *>(value.asManaged()); }
- inline FunctionObject *setter() const { return reinterpret_cast<FunctionObject *>(set.asManaged()); }
+ inline Heap::FunctionObject *getter() const { return value.isManaged() ? reinterpret_cast<Heap::FunctionObject *>(value.heapObject()) : 0; }
+ inline Heap::FunctionObject *setter() const { return set.isManaged() ? reinterpret_cast<Heap::FunctionObject *>(set.heapObject()) : 0; }
inline void setGetter(FunctionObject *g) { value = Primitive::fromManaged(reinterpret_cast<Managed *>(g)); }
- inline void setSetter(FunctionObject *s) { set = Primitive::fromManaged(reinterpret_cast<Managed *>(s)); }
+ inline void setSetter(FunctionObject *s) { set = s ? Primitive::fromManaged(reinterpret_cast<Managed *>(s)) : Value::fromHeapObject(0); }
- void copy(const Property &other, PropertyAttributes attrs) {
- value = other.value;
+ void copy(const Property *other, PropertyAttributes attrs) {
+ value = other->value;
if (attrs.isAccessor())
- set = other.set;
+ set = other->set;
}
- explicit Property() { value = Encode::undefined(); set = Encode::undefined(); }
- explicit Property(Value v) : value(v) { set = Encode::undefined(); }
+ explicit Property() { value = Encode::undefined(); set = Value::fromHeapObject(0); }
+ explicit Property(Value v) : value(v) { set = Value::fromHeapObject(0); }
Property(FunctionObject *getter, FunctionObject *setter) {
value = Primitive::fromManaged(reinterpret_cast<Managed *>(getter));
set = Primitive::fromManaged(reinterpret_cast<Managed *>(setter));
}
+ Property(Heap::FunctionObject *getter, Heap::FunctionObject *setter) {
+ value.m = reinterpret_cast<Heap::Base *>(getter);
+ set.m = reinterpret_cast<Heap::Base *>(setter);
+ }
Property &operator=(Value v) { value = v; return *this; }
private:
Property(const Property &);
Property &operator=(const Property &);
};
-inline bool Property::isSubset(const PropertyAttributes &attrs, const Property &other, PropertyAttributes otherAttrs) const
+inline bool Property::isSubset(const PropertyAttributes &attrs, const Property *other, PropertyAttributes otherAttrs) const
{
if (attrs.type() != PropertyAttributes::Generic && attrs.type() != otherAttrs.type())
return false;
@@ -104,18 +108,18 @@ inline bool Property::isSubset(const PropertyAttributes &attrs, const Property &
return false;
if (attrs.hasWritable() && attrs.isWritable() != otherAttrs.isWritable())
return false;
- if (attrs.type() == PropertyAttributes::Data && !value.sameValue(other.value))
+ if (attrs.type() == PropertyAttributes::Data && !value.sameValue(other->value))
return false;
if (attrs.type() == PropertyAttributes::Accessor) {
- if (value.asManaged() != other.value.asManaged())
+ if (value.heapObject() != other->value.heapObject())
return false;
- if (set.asManaged() != other.set.asManaged())
+ if (set.heapObject() != other->set.heapObject())
return false;
}
return true;
}
-inline void Property::merge(PropertyAttributes &attrs, const Property &other, PropertyAttributes otherAttrs)
+inline void Property::merge(PropertyAttributes &attrs, const Property *other, PropertyAttributes otherAttrs)
{
if (otherAttrs.hasEnumerable())
attrs.setEnumerable(otherAttrs.isEnumerable());
@@ -125,13 +129,13 @@ inline void Property::merge(PropertyAttributes &attrs, const Property &other, Pr
attrs.setWritable(otherAttrs.isWritable());
if (otherAttrs.type() == PropertyAttributes::Accessor) {
attrs.setType(PropertyAttributes::Accessor);
- if (!other.value.isEmpty())
- value = other.value;
- if (!other.set.isEmpty())
- set = other.set;
+ if (!other->value.isEmpty())
+ value = other->value;
+ if (!other->set.isEmpty())
+ set = other->set;
} else if (otherAttrs.type() == PropertyAttributes::Data){
attrs.setType(PropertyAttributes::Data);
- value = other.value;
+ value = other->value;
}
}
diff --git a/src/qml/jsruntime/qv4qmlextensions.cpp b/src/qml/jsruntime/qv4qmlextensions.cpp
index c2f507d267..c1c4e0ec78 100644
--- a/src/qml/jsruntime/qv4qmlextensions.cpp
+++ b/src/qml/jsruntime/qv4qmlextensions.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/jsruntime/qv4qmlextensions_p.h b/src/qml/jsruntime/qv4qmlextensions_p.h
index ffa3071227..e4b9f75298 100644
--- a/src/qml/jsruntime/qv4qmlextensions_p.h
+++ b/src/qml/jsruntime/qv4qmlextensions_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -34,12 +34,11 @@
#define QV4QMLEXTENSIONS_P_H
#include <qtqmlglobal.h>
+#include <qv4global_p.h>
QT_BEGIN_NAMESPACE
namespace QV4 {
-struct Object;
-struct ExecutionEngine;
struct Q_QML_EXPORT QmlExtensions
{
@@ -47,7 +46,7 @@ struct Q_QML_EXPORT QmlExtensions
: valueTypeWrapperPrototype(0)
{}
- Object *valueTypeWrapperPrototype;
+ Heap::Object *valueTypeWrapperPrototype;
void markObjects(ExecutionEngine *e);
};
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index db1315dc87..1e4718c208 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -94,10 +94,10 @@ static QPair<QObject *, int> extractQtMethod(QV4::FunctionObject *function)
return qMakePair((QObject *)0, -1);
}
-static QPair<QObject *, int> extractQtSignal(const ValueRef value)
+static QPair<QObject *, int> extractQtSignal(const Value &value)
{
- QV4::ExecutionEngine *v4 = value->engine();
- if (v4) {
+ if (value.isObject()) {
+ QV4::ExecutionEngine *v4 = value.asObject()->engine();
QV4::Scope scope(v4);
QV4::ScopedFunctionObject function(scope, value);
if (function)
@@ -146,12 +146,11 @@ struct ReadAccessor {
// Load value properties
template<void (*ReadFunction)(QObject *, const QQmlPropertyData &,
void *, QQmlNotifier **)>
-static QV4::ReturnedValue LoadProperty(QV8Engine *engine, QObject *object,
+static QV4::ReturnedValue LoadProperty(QV4::ExecutionEngine *v4, QObject *object,
const QQmlPropertyData &property,
QQmlNotifier **notifier)
{
Q_ASSERT(!property.isFunction());
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine);
QV4::Scope scope(v4);
if (property.isQObject()) {
@@ -159,7 +158,7 @@ static QV4::ReturnedValue LoadProperty(QV8Engine *engine, QObject *object,
ReadFunction(object, property, &rv, notifier);
return QV4::QObjectWrapper::wrap(v4, rv);
} else if (property.isQList()) {
- return QmlListWrapper::create(engine, object, property.coreIndex, property.propType);
+ return QmlListWrapper::create(v4, object, property.coreIndex, property.propType);
} else if (property.propType == QMetaType::QReal) {
qreal v = 0;
ReadFunction(object, property, &v, notifier);
@@ -195,22 +194,22 @@ static QV4::ReturnedValue LoadProperty(QV8Engine *engine, QObject *object,
} else if (property.propType == qMetaTypeId<QJSValue>()) {
QJSValue v;
ReadFunction(object, property, &v, notifier);
- return QJSValuePrivate::get(v)->getValue(v4);
+ return QJSValuePrivate::convertedToValue(v4, v);
} else if (property.isQVariant()) {
QVariant v;
ReadFunction(object, property, &v, notifier);
if (QQmlValueTypeFactory::isValueType(v.userType())) {
- if (QQmlValueType *valueType = QQmlValueTypeFactory::valueType(v.userType()))
- return QV4::QmlValueTypeWrapper::create(engine, object, property.coreIndex, valueType); // VariantReference value-type.
+ if (const QMetaObject *valueTypeMetaObject = QQmlValueTypeFactory::metaObjectForMetaType(v.userType()))
+ return QV4::QQmlValueTypeWrapper::create(v4, object, property.coreIndex, valueTypeMetaObject, v.userType()); // VariantReference value-type.
}
- return engine->fromVariant(v);
+ return scope.engine->fromVariant(v);
} else if (QQmlValueTypeFactory::isValueType(property.propType)) {
Q_ASSERT(notifier == 0);
- if (QQmlValueType *valueType = QQmlValueTypeFactory::valueType(property.propType))
- return QV4::QmlValueTypeWrapper::create(engine, object, property.coreIndex, valueType);
+ if (const QMetaObject *valueTypeMetaObject = QQmlValueTypeFactory::metaObjectForMetaType(property.propType))
+ return QV4::QQmlValueTypeWrapper::create(v4, object, property.coreIndex, valueTypeMetaObject, property.propType);
} else {
Q_ASSERT(notifier == 0);
@@ -218,7 +217,7 @@ static QV4::ReturnedValue LoadProperty(QV8Engine *engine, QObject *object,
bool succeeded = false;
QV4::ScopedValue retn(scope, QV4::SequencePrototype::newSequence(v4, property.propType, object, property.coreIndex, &succeeded));
if (succeeded)
- return retn.asReturnedValue();
+ return retn->asReturnedValue();
}
if (property.propType == QMetaType::UnknownType) {
@@ -229,21 +228,20 @@ static QV4::ReturnedValue LoadProperty(QV8Engine *engine, QObject *object,
} else {
QVariant v(property.propType, (void *)0);
ReadFunction(object, property, v.data(), notifier);
- return engine->fromVariant(v);
+ return scope.engine->fromVariant(v);
}
}
-QObjectWrapper::Data::Data(ExecutionEngine *engine, QObject *object)
- : Object::Data(engine)
+Heap::QObjectWrapper::QObjectWrapper(ExecutionEngine *engine, QObject *object)
+ : Heap::Object(engine)
, object(object)
{
- setVTable(staticVTable());
}
void QObjectWrapper::initializeBindings(ExecutionEngine *engine)
{
- engine->functionClass->prototype->defineDefaultProperty(QStringLiteral("connect"), method_connect);
- engine->functionClass->prototype->defineDefaultProperty(QStringLiteral("disconnect"), method_disconnect);
+ engine->functionPrototype.asObject()->defineDefaultProperty(QStringLiteral("connect"), method_connect);
+ engine->functionPrototype.asObject()->defineDefaultProperty(QStringLiteral("disconnect"), method_disconnect);
}
QQmlPropertyData *QObjectWrapper::findProperty(ExecutionEngine *engine, QQmlContextData *qmlContext, String *name, RevisionMode revisionMode, QQmlPropertyData *local) const
@@ -257,11 +255,11 @@ QQmlPropertyData *QObjectWrapper::findProperty(ExecutionEngine *engine, QQmlCont
if (ddata && ddata->propertyCache)
result = ddata->propertyCache->property(name, d()->object, qmlContext);
else
- result = QQmlPropertyCache::property(engine->v8Engine->engine(), d()->object, name, qmlContext, *local);
+ result = QQmlPropertyCache::property(engine->jsEngine(), d()->object, name, qmlContext, *local);
return result;
}
-ReturnedValue QObjectWrapper::getQmlProperty(ExecutionContext *ctx, QQmlContextData *qmlContext, String *n, QObjectWrapper::RevisionMode revisionMode,
+ReturnedValue QObjectWrapper::getQmlProperty(QQmlContextData *qmlContext, String *n, QObjectWrapper::RevisionMode revisionMode,
bool *hasProperty, bool includeImports)
{
if (QQmlData::wasDeleted(d()->object)) {
@@ -270,25 +268,26 @@ ReturnedValue QObjectWrapper::getQmlProperty(ExecutionContext *ctx, QQmlContextD
return QV4::Encode::undefined();
}
- QV4::Scope scope(ctx);
+ QV4::Scope scope(engine());
QV4::ScopedString name(scope, n);
if (name->equals(scope.engine->id_destroy) || name->equals(scope.engine->id_toString)) {
int index = name->equals(scope.engine->id_destroy) ? QV4::QObjectMethod::DestroyMethod : QV4::QObjectMethod::ToStringMethod;
- QV4::ScopedValue method(scope, QV4::QObjectMethod::create(ctx->d()->engine->rootContext, d()->object, index));
+ ScopedContext global(scope, scope.engine->rootContext());
+ QV4::ScopedValue method(scope, QV4::QObjectMethod::create(global, d()->object, index));
if (hasProperty)
*hasProperty = true;
- return method.asReturnedValue();
+ return method->asReturnedValue();
}
QQmlPropertyData local;
- QQmlPropertyData *result = findProperty(ctx->d()->engine, qmlContext, name.getPointer(), revisionMode, &local);
+ QQmlPropertyData *result = findProperty(scope.engine, qmlContext, name, revisionMode, &local);
if (!result) {
if (includeImports && name->startsWithUpper()) {
// Check for attached properties
if (qmlContext && qmlContext->imports) {
- QQmlTypeNameCache::Result r = qmlContext->imports->query(name.getPointer());
+ QQmlTypeNameCache::Result r = qmlContext->imports->query(name);
if (hasProperty)
*hasProperty = true;
@@ -297,15 +296,17 @@ ReturnedValue QObjectWrapper::getQmlProperty(ExecutionContext *ctx, QQmlContextD
if (r.scriptIndex != -1) {
return QV4::Encode::undefined();
} else if (r.type) {
- return QmlTypeWrapper::create(ctx->d()->engine->v8Engine, d()->object, r.type, QmlTypeWrapper::ExcludeEnums);
+ return QmlTypeWrapper::create(scope.engine, d()->object,
+ r.type, Heap::QmlTypeWrapper::ExcludeEnums);
} else if (r.importNamespace) {
- return QmlTypeWrapper::create(ctx->d()->engine->v8Engine, d()->object, qmlContext->imports, r.importNamespace, QmlTypeWrapper::ExcludeEnums);
+ return QmlTypeWrapper::create(scope.engine, d()->object,
+ qmlContext->imports, r.importNamespace, Heap::QmlTypeWrapper::ExcludeEnums);
}
Q_ASSERT(!"Unreachable");
}
}
}
- return QV4::Object::get(this, name.getPointer(), hasProperty);
+ return QV4::Object::get(this, name, hasProperty);
}
QQmlData *ddata = QQmlData::get(d()->object, false);
@@ -321,6 +322,7 @@ ReturnedValue QObjectWrapper::getQmlProperty(ExecutionContext *ctx, QQmlContextD
if (hasProperty)
*hasProperty = true;
+ ScopedContext ctx(scope, scope.engine->currentContext());
return getProperty(d()->object, ctx, result);
}
@@ -336,23 +338,25 @@ ReturnedValue QObjectWrapper::getProperty(QObject *object, ExecutionContext *ctx
Q_ASSERT(vmemo);
return vmemo->vmeMethod(property->coreIndex);
} else if (property->isV4Function()) {
- QV4::Scoped<QV4::Object> qmlcontextobject(scope, ctx->d()->engine->qmlContextObject());
- return QV4::QObjectMethod::create(ctx->d()->engine->rootContext, object, property->coreIndex, qmlcontextobject);
+ QV4::ScopedObject qmlcontextobject(scope, ctx->d()->engine->qmlContextObject());
+ ScopedContext global(scope, scope.engine->rootContext());
+ return QV4::QObjectMethod::create(global, object, property->coreIndex, qmlcontextobject);
} else if (property->isSignalHandler()) {
QV4::Scoped<QV4::QmlSignalHandler> handler(scope, scope.engine->memoryManager->alloc<QV4::QmlSignalHandler>(ctx->d()->engine, object, property->coreIndex));
QV4::ScopedString connect(scope, ctx->d()->engine->newIdentifier(QStringLiteral("connect")));
QV4::ScopedString disconnect(scope, ctx->d()->engine->newIdentifier(QStringLiteral("disconnect")));
- handler->put(connect.getPointer(), QV4::ScopedValue(scope, ctx->d()->engine->functionClass->prototype->get(connect.getPointer())));
- handler->put(disconnect.getPointer(), QV4::ScopedValue(scope, ctx->d()->engine->functionClass->prototype->get(disconnect.getPointer())));
+ handler->put(connect, QV4::ScopedValue(scope, ctx->d()->engine->functionPrototype.asObject()->get(connect)));
+ handler->put(disconnect, QV4::ScopedValue(scope, ctx->d()->engine->functionPrototype.asObject()->get(disconnect)));
return handler.asReturnedValue();
} else {
- return QV4::QObjectMethod::create(ctx->d()->engine->rootContext, object, property->coreIndex);
+ ScopedContext global(scope, scope.engine->rootContext());
+ return QV4::QObjectMethod::create(global, object, property->coreIndex);
}
}
- QQmlEnginePrivate *ep = ctx->d()->engine->v8Engine->engine() ? QQmlEnginePrivate::get(ctx->d()->engine->v8Engine->engine()) : 0;
+ QQmlEnginePrivate *ep = scope.engine->qmlEngine() ? QQmlEnginePrivate::get(scope.engine->qmlEngine()) : 0;
if (property->hasAccessors()) {
QQmlNotifier *n = 0;
@@ -361,7 +365,7 @@ ReturnedValue QObjectWrapper::getProperty(QObject *object, ExecutionContext *ctx
if (ep && ep->propertyCapture && property->accessors->notifier)
nptr = &n;
- QV4::ScopedValue rv(scope, LoadProperty<ReadAccessor::Accessor>(ctx->d()->engine->v8Engine, object, *property, nptr));
+ QV4::ScopedValue rv(scope, LoadProperty<ReadAccessor::Accessor>(ctx->d()->engine, object, *property, nptr));
if (captureRequired) {
if (property->accessors->notifier) {
@@ -372,7 +376,7 @@ ReturnedValue QObjectWrapper::getProperty(QObject *object, ExecutionContext *ctx
}
}
- return rv.asReturnedValue();
+ return rv->asReturnedValue();
}
if (captureRequired && ep && !property->isConstant())
@@ -383,15 +387,15 @@ ReturnedValue QObjectWrapper::getProperty(QObject *object, ExecutionContext *ctx
Q_ASSERT(vmemo);
return vmemo->vmeProperty(property->coreIndex);
} else if (property->isDirect()) {
- return LoadProperty<ReadAccessor::Direct>(ctx->d()->engine->v8Engine, object, *property, 0);
+ return LoadProperty<ReadAccessor::Direct>(ctx->d()->engine, object, *property, 0);
} else {
- return LoadProperty<ReadAccessor::Indirect>(ctx->d()->engine->v8Engine, object, *property, 0);
+ return LoadProperty<ReadAccessor::Indirect>(ctx->d()->engine, object, *property, 0);
}
}
-ReturnedValue QObjectWrapper::getQmlProperty(ExecutionContext *ctx, QQmlContextData *qmlContext, QObject *object, String *name, QObjectWrapper::RevisionMode revisionMode, bool *hasProperty)
+ReturnedValue QObjectWrapper::getQmlProperty(QV4::ExecutionEngine *engine, QQmlContextData *qmlContext, QObject *object, String *name, QObjectWrapper::RevisionMode revisionMode, bool *hasProperty)
{
- QV4::Scope scope(ctx);
+ QV4::Scope scope(engine);
if (QQmlData::wasDeleted(object)) {
if (hasProperty)
*hasProperty = false;
@@ -404,17 +408,17 @@ ReturnedValue QObjectWrapper::getQmlProperty(ExecutionContext *ctx, QQmlContextD
return QV4::Encode::null();
}
- QV4::Scoped<QObjectWrapper> wrapper(scope, wrap(ctx->d()->engine, object));
+ QV4::Scoped<QObjectWrapper> wrapper(scope, wrap(engine, object));
if (!wrapper) {
if (hasProperty)
*hasProperty = false;
return QV4::Encode::null();
}
- return wrapper->getQmlProperty(ctx, qmlContext, name, revisionMode, hasProperty);
+ return wrapper->getQmlProperty(qmlContext, name, revisionMode, hasProperty);
}
-bool QObjectWrapper::setQmlProperty(ExecutionContext *ctx, QQmlContextData *qmlContext, QObject *object, String *name,
- QObjectWrapper::RevisionMode revisionMode, const ValueRef value)
+bool QObjectWrapper::setQmlProperty(ExecutionEngine *engine, QQmlContextData *qmlContext, QObject *object, String *name,
+ QObjectWrapper::RevisionMode revisionMode, const Value &value)
{
if (QQmlData::wasDeleted(object))
return false;
@@ -422,7 +426,7 @@ bool QObjectWrapper::setQmlProperty(ExecutionContext *ctx, QQmlContextData *qmlC
QQmlPropertyData local;
QQmlPropertyData *result = 0;
{
- result = QQmlPropertyCache::property(ctx->d()->engine->v8Engine->engine(), object, name, qmlContext, local);
+ result = QQmlPropertyCache::property(engine->jsEngine(), object, name, qmlContext, local);
}
if (!result)
@@ -434,16 +438,18 @@ bool QObjectWrapper::setQmlProperty(ExecutionContext *ctx, QQmlContextData *qmlC
return false;
}
+ Scope scope(engine);
+ ScopedContext ctx(scope, engine->currentContext());
setProperty(object, ctx, result, value);
return true;
}
-void QObjectWrapper::setProperty(QObject *object, ExecutionContext *ctx, QQmlPropertyData *property, const ValueRef value)
+void QObjectWrapper::setProperty(QObject *object, ExecutionContext *ctx, QQmlPropertyData *property, const Value &value)
{
if (!property->isWritable() && !property->isQList()) {
QString error = QLatin1String("Cannot assign to read-only property \"") +
property->name(object) + QLatin1Char('\"');
- ctx->throwTypeError(error);
+ ctx->engine()->throwTypeError(error);
return;
}
@@ -451,7 +457,7 @@ void QObjectWrapper::setProperty(QObject *object, ExecutionContext *ctx, QQmlPro
QV4::Scope scope(ctx);
QV4::ScopedFunctionObject f(scope, value);
if (f) {
- if (!f->bindingKeyFlag()) {
+ if (!f->isBinding()) {
if (!property->isVarProperty() && property->propType != qMetaTypeId<QJSValue>()) {
// assigning a JS function to a non var or QJSValue property or is not allowed.
QString error = QLatin1String("Cannot assign JavaScript function to ");
@@ -459,14 +465,14 @@ void QObjectWrapper::setProperty(QObject *object, ExecutionContext *ctx, QQmlPro
error += QLatin1String("[unknown property type]");
else
error += QLatin1String(QMetaType::typeName(property->propType));
- ctx->throwError(error);
+ ctx->engine()->throwError(error);
return;
}
} else {
// binding assignment.
QQmlContextData *callingQmlContext = QV4::QmlContextWrapper::callingContext(ctx->d()->engine);
- QV4::Scoped<QQmlBindingFunction> bindingFunction(scope, f);
+ QV4::Scoped<QQmlBindingFunction> bindingFunction(scope, (const Value &)f);
bindingFunction->initBindingLocation();
newBinding = new QQmlBinding(value, object, callingQmlContext);
@@ -494,47 +500,47 @@ void QObjectWrapper::setProperty(QObject *object, ExecutionContext *ctx, QQmlPro
void *argv[] = { &o, 0, &status, &flags }; \
QMetaObject::metacall(object, QMetaObject::WriteProperty, property->coreIndex, argv);
- if (value->isNull() && property->isQObject()) {
+ if (value.isNull() && property->isQObject()) {
PROPERTY_STORE(QObject*, 0);
- } else if (value->isUndefined() && property->isResettable()) {
+ } else if (value.isUndefined() && property->isResettable()) {
void *a[] = { 0 };
QMetaObject::metacall(object, QMetaObject::ResetProperty, property->coreIndex, a);
- } else if (value->isUndefined() && property->propType == qMetaTypeId<QVariant>()) {
+ } else if (value.isUndefined() && property->propType == qMetaTypeId<QVariant>()) {
PROPERTY_STORE(QVariant, QVariant());
- } else if (value->isUndefined() && property->propType == QMetaType::QJsonValue) {
+ } else if (value.isUndefined() && property->propType == QMetaType::QJsonValue) {
PROPERTY_STORE(QJsonValue, QJsonValue(QJsonValue::Undefined));
} else if (!newBinding && property->propType == qMetaTypeId<QJSValue>()) {
- PROPERTY_STORE(QJSValue, new QJSValuePrivate(ctx->d()->engine, value));
- } else if (value->isUndefined() && property->propType != qMetaTypeId<QQmlScriptString>()) {
+ PROPERTY_STORE(QJSValue, QJSValue(ctx->d()->engine, value.asReturnedValue()));
+ } else if (value.isUndefined() && property->propType != qMetaTypeId<QQmlScriptString>()) {
QString error = QLatin1String("Cannot assign [undefined] to ");
if (!QMetaType::typeName(property->propType))
error += QLatin1String("[unknown property type]");
else
error += QLatin1String(QMetaType::typeName(property->propType));
- ctx->throwError(error);
+ ctx->engine()->throwError(error);
return;
- } else if (value->asFunctionObject()) {
+ } else if (value.asFunctionObject()) {
// this is handled by the binding creation above
- } else if (property->propType == QMetaType::Int && value->isNumber()) {
- PROPERTY_STORE(int, value->asDouble());
- } else if (property->propType == QMetaType::QReal && value->isNumber()) {
- PROPERTY_STORE(qreal, qreal(value->asDouble()));
- } else if (property->propType == QMetaType::Float && value->isNumber()) {
- PROPERTY_STORE(float, float(value->asDouble()));
- } else if (property->propType == QMetaType::Double && value->isNumber()) {
- PROPERTY_STORE(double, double(value->asDouble()));
- } else if (property->propType == QMetaType::QString && value->isString()) {
- PROPERTY_STORE(QString, value->toQStringNoThrow());
+ } else if (property->propType == QMetaType::Int && value.isNumber()) {
+ PROPERTY_STORE(int, value.asDouble());
+ } else if (property->propType == QMetaType::QReal && value.isNumber()) {
+ PROPERTY_STORE(qreal, qreal(value.asDouble()));
+ } else if (property->propType == QMetaType::Float && value.isNumber()) {
+ PROPERTY_STORE(float, float(value.asDouble()));
+ } else if (property->propType == QMetaType::Double && value.isNumber()) {
+ PROPERTY_STORE(double, double(value.asDouble()));
+ } else if (property->propType == QMetaType::QString && value.isString()) {
+ PROPERTY_STORE(QString, value.toQStringNoThrow());
} else if (property->isVarProperty()) {
QQmlVMEMetaObject *vmemo = QQmlVMEMetaObject::get(object);
Q_ASSERT(vmemo);
vmemo->setVMEProperty(property->coreIndex, value);
- } else if (property->propType == qMetaTypeId<QQmlScriptString>() && (value->isUndefined() || value->isPrimitive())) {
- QQmlScriptString ss(value->toQStringNoThrow(), 0 /* context */, object);
- if (value->isNumber()) {
- ss.d->numberValue = value->toNumber();
+ } else if (property->propType == qMetaTypeId<QQmlScriptString>() && (value.isUndefined() || value.isPrimitive())) {
+ QQmlScriptString ss(value.toQStringNoThrow(), 0 /* context */, object);
+ if (value.isNumber()) {
+ ss.d->numberValue = value.toNumber();
ss.d->isNumberLiteral = true;
- } else if (value->isString()) {
+ } else if (value.isString()) {
ss.d->script = QV4::CompiledData::Binding::escapedString(ss.d->script);
ss.d->isStringLiteral = true;
}
@@ -542,9 +548,9 @@ void QObjectWrapper::setProperty(QObject *object, ExecutionContext *ctx, QQmlPro
} else {
QVariant v;
if (property->isQList())
- v = ctx->d()->engine->v8Engine->toVariant(value, qMetaTypeId<QList<QObject *> >());
+ v = ctx->d()->engine->toVariant(value, qMetaTypeId<QList<QObject *> >());
else
- v = ctx->d()->engine->v8Engine->toVariant(value, property->propType);
+ v = ctx->d()->engine->toVariant(value, property->propType);
QQmlContextData *callingQmlContext = QV4::QmlContextWrapper::callingContext(ctx->d()->engine);
if (!QQmlPropertyPrivate::write(object, *property, v, callingQmlContext)) {
@@ -560,7 +566,7 @@ void QObjectWrapper::setProperty(QObject *object, ExecutionContext *ctx, QQmlPro
QLatin1String(valueType) +
QLatin1String(" to ") +
QLatin1String(targetTypeName);
- ctx->throwError(error);
+ ctx->engine()->throwError(error);
return;
}
}
@@ -583,41 +589,56 @@ ReturnedValue QObjectWrapper::wrap(ExecutionEngine *engine, QObject *object)
} else if (ddata->jsWrapper.isUndefined() &&
(ddata->jsEngineId == engine->m_engineId || // We own the QObject
ddata->jsEngineId == 0 || // No one owns the QObject
- !ddata->hasTaintedV8Object)) { // Someone else has used the QObject, but it isn't tainted
+ !ddata->hasTaintedV4Object)) { // Someone else has used the QObject, but it isn't tainted
QV4::ScopedValue rv(scope, create(engine, object));
- ddata->jsWrapper = rv;
+ ddata->jsWrapper.set(scope.engine, rv);
ddata->jsEngineId = engine->m_engineId;
- return rv.asReturnedValue();
+ return rv->asReturnedValue();
} else {
// If this object is tainted, we have to check to see if it is in our
// tainted object list
- Scoped<Object> alternateWrapper(scope, (Object *)0);
- if (engine->m_multiplyWrappedQObjects && ddata->hasTaintedV8Object)
+ ScopedObject alternateWrapper(scope, (Object *)0);
+ if (engine->m_multiplyWrappedQObjects && ddata->hasTaintedV4Object)
alternateWrapper = engine->m_multiplyWrappedQObjects->value(object);
// If our tainted handle doesn't exist or has been collected, and there isn't
- // a handle in the ddata, we can assume ownership of the ddata->v8object
+ // a handle in the ddata, we can assume ownership of the ddata->jsWrapper
if (ddata->jsWrapper.isUndefined() && !alternateWrapper) {
QV4::ScopedValue result(scope, create(engine, object));
- ddata->jsWrapper = result;
+ ddata->jsWrapper.set(scope.engine, result);
ddata->jsEngineId = engine->m_engineId;
- return result.asReturnedValue();
+ return result->asReturnedValue();
}
if (!alternateWrapper) {
alternateWrapper = create(engine, object);
if (!engine->m_multiplyWrappedQObjects)
engine->m_multiplyWrappedQObjects = new MultiplyWrappedQObjectMap;
- engine->m_multiplyWrappedQObjects->insert(object, alternateWrapper.getPointer());
- ddata->hasTaintedV8Object = true;
+ engine->m_multiplyWrappedQObjects->insert(object, alternateWrapper->d());
+ ddata->hasTaintedV4Object = true;
}
return alternateWrapper.asReturnedValue();
}
}
+void QObjectWrapper::markWrapper(QObject *object, ExecutionEngine *engine)
+{
+ if (QQmlData::wasDeleted(object))
+ return;
+
+ QQmlData *ddata = QQmlData::get(object);
+ if (!ddata)
+ return;
+
+ if (ddata->jsEngineId == engine->m_engineId)
+ ddata->jsWrapper.markOnce(engine);
+ else if (engine->m_multiplyWrappedQObjects && ddata->hasTaintedV4Object)
+ engine->m_multiplyWrappedQObjects->mark(object, engine);
+}
+
ReturnedValue QObjectWrapper::getProperty(QObject *object, ExecutionContext *ctx, int propertyIndex, bool captureRequired)
{
if (QQmlData::wasDeleted(object))
@@ -633,7 +654,7 @@ ReturnedValue QObjectWrapper::getProperty(QObject *object, ExecutionContext *ctx
return getProperty(object, ctx, property, captureRequired);
}
-void QObjectWrapper::setProperty(ExecutionContext *ctx, int propertyIndex, const ValueRef value)
+void QObjectWrapper::setProperty(ExecutionContext *ctx, int propertyIndex, const Value &value)
{
if (QQmlData::wasDeleted(d()->object))
return;
@@ -663,37 +684,35 @@ bool QObjectWrapper::isEqualTo(Managed *a, Managed *b)
ReturnedValue QObjectWrapper::create(ExecutionEngine *engine, QObject *object)
{
- QQmlEngine *qmlEngine = engine->v8Engine->engine();
- if (qmlEngine)
- QQmlData::ensurePropertyCache(qmlEngine, object);
+ if (engine->jsEngine())
+ QQmlData::ensurePropertyCache(engine->jsEngine(), object);
return (engine->memoryManager->alloc<QV4::QObjectWrapper>(engine, object))->asReturnedValue();
}
QV4::ReturnedValue QObjectWrapper::get(Managed *m, String *name, bool *hasProperty)
{
QObjectWrapper *that = static_cast<QObjectWrapper*>(m);
- ExecutionEngine *v4 = m->engine();
- QQmlContextData *qmlContext = QV4::QmlContextWrapper::callingContext(v4);
- return that->getQmlProperty(v4->currentContext(), qmlContext, name, IgnoreRevision, hasProperty, /*includeImports*/ true);
+ QQmlContextData *qmlContext = QV4::QmlContextWrapper::callingContext(that->engine());
+ return that->getQmlProperty(qmlContext, name, IgnoreRevision, hasProperty, /*includeImports*/ true);
}
-void QObjectWrapper::put(Managed *m, String *name, const ValueRef value)
+void QObjectWrapper::put(Managed *m, String *name, const Value &value)
{
QObjectWrapper *that = static_cast<QObjectWrapper*>(m);
- ExecutionEngine *v4 = m->engine();
+ ExecutionEngine *v4 = that->engine();
if (v4->hasException || QQmlData::wasDeleted(that->d()->object))
return;
QQmlContextData *qmlContext = QV4::QmlContextWrapper::callingContext(v4);
- if (!setQmlProperty(v4->currentContext(), qmlContext, that->d()->object, name, QV4::QObjectWrapper::IgnoreRevision, value)) {
+ if (!setQmlProperty(v4, qmlContext, that->d()->object, name, QV4::QObjectWrapper::IgnoreRevision, value)) {
QQmlData *ddata = QQmlData::get(that->d()->object);
// Types created by QML are not extensible at run-time, but for other QObjects we can store them
// as regular JavaScript properties, like on JavaScript objects.
if (ddata && ddata->context) {
QString error = QLatin1String("Cannot assign to non-existent property \"") +
name->toQString() + QLatin1Char('\"');
- v4->currentContext()->throwError(error);
+ v4->throwError(error);
} else {
QV4::Object::put(m, name, value);
}
@@ -713,26 +732,31 @@ PropertyAttributes QObjectWrapper::query(const Managed *m, String *name)
return QV4::Object::query(m, name);
}
-void QObjectWrapper::advanceIterator(Managed *m, ObjectIterator *it, String *&name, uint *index, Property *p, PropertyAttributes *attributes)
+void QObjectWrapper::advanceIterator(Managed *m, ObjectIterator *it, Heap::String **name, uint *index, Property *p, PropertyAttributes *attributes)
{
// Used to block access to QObject::destroyed() and QObject::deleteLater() from QML
static const int destroyedIdx1 = QObject::staticMetaObject.indexOfSignal("destroyed(QObject*)");
static const int destroyedIdx2 = QObject::staticMetaObject.indexOfSignal("destroyed()");
static const int deleteLaterIdx = QObject::staticMetaObject.indexOfSlot("deleteLater()");
- name = (String *)0;
+ *name = (Heap::String *)0;
*index = UINT_MAX;
QObjectWrapper *that = static_cast<QObjectWrapper*>(m);
if (that->d()->object) {
const QMetaObject *mo = that->d()->object->metaObject();
+ // These indices don't apply to gadgets, so don't block them.
+ const bool preventDestruction = mo->superClass() || mo == &QObject::staticMetaObject;
const int propertyCount = mo->propertyCount();
if (it->arrayIndex < static_cast<uint>(propertyCount)) {
- name = that->engine()->newString(QString::fromUtf8(mo->property(it->arrayIndex).name()))->getPointer();
+ // #### GC
+ Scope scope(that->engine());
+ ScopedString propName(scope, that->engine()->newString(QString::fromUtf8(mo->property(it->arrayIndex).name())));
+ *name = propName->d();
++it->arrayIndex;
*attributes = QV4::Attr_Data;
- p->value = that->get(name);
+ p->value = that->get(propName);
return;
}
const int methodCount = mo->methodCount();
@@ -740,11 +764,14 @@ void QObjectWrapper::advanceIterator(Managed *m, ObjectIterator *it, String *&na
const int index = it->arrayIndex - propertyCount;
const QMetaMethod method = mo->method(index);
++it->arrayIndex;
- if (method.access() == QMetaMethod::Private || index == deleteLaterIdx || index == destroyedIdx1 || index == destroyedIdx2)
+ if (method.access() == QMetaMethod::Private || (preventDestruction && (index == deleteLaterIdx || index == destroyedIdx1 || index == destroyedIdx2)))
continue;
- name = that->engine()->newString(QString::fromUtf8(method.name()))->getPointer();
+ // #### GC
+ Scope scope(that->engine());
+ ScopedString methodName(scope, that->engine()->newString(QString::fromUtf8(method.name())));
+ *name = methodName->d();
*attributes = QV4::Attr_Data;
- p->value = that->get(name);
+ p->value = that->get(methodName);
return;
}
}
@@ -781,33 +808,32 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase
break;
QVarLengthArray<int, 9> dummy;
- int *argsTypes = QQmlPropertyCache::methodParameterTypes(r, This->signalIndex, dummy, 0);
+ int *argsTypes = QQmlMetaObject(r).methodParameterTypes(This->signalIndex, dummy, 0);
int argCount = argsTypes ? argsTypes[0]:0;
QV4::Scope scope(v4);
QV4::ScopedFunctionObject f(scope, This->function.value());
- QV4::ExecutionContext *ctx = v4->currentContext();
QV4::ScopedCallData callData(scope, argCount);
- callData->thisObject = This->thisObject.isUndefined() ? v4->globalObject->asReturnedValue() : This->thisObject.value();
+ callData->thisObject = This->thisObject.isUndefined() ? v4->globalObject()->asReturnedValue() : This->thisObject.value();
for (int ii = 0; ii < argCount; ++ii) {
int type = argsTypes[ii + 1];
if (type == qMetaTypeId<QVariant>()) {
- callData->args[ii] = v4->v8Engine->fromVariant(*((QVariant *)metaArgs[ii + 1]));
+ callData->args[ii] = v4->fromVariant(*((QVariant *)metaArgs[ii + 1]));
} else {
- callData->args[ii] = v4->v8Engine->fromVariant(QVariant(type, metaArgs[ii + 1]));
+ callData->args[ii] = v4->fromVariant(QVariant(type, metaArgs[ii + 1]));
}
}
f->call(callData);
- if (scope.hasException() && v4->v8Engine) {
- QQmlError error = QV4::ExecutionEngine::catchExceptionAsQmlError(ctx);
+ if (scope.hasException()) {
+ QQmlError error = v4->catchExceptionAsQmlError();
if (error.description().isEmpty()) {
QV4::ScopedString name(scope, f->name());
error.setDescription(QString::fromLatin1("Unknown exception occurred during evaluation of connected function: %1").arg(name->toQString()));
}
- if (QQmlEngine *qmlEngine = v4->v8Engine->engine()) {
+ if (QQmlEngine *qmlEngine = v4->qmlEngine()) {
QQmlEnginePrivate::get(qmlEngine)->warning(error);
} else {
QMessageLogger(error.url().toString().toLatin1().constData(),
@@ -842,7 +868,7 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase
if (slotIndexToDisconnect != -1) {
// This is a QObject function wrapper
if (connection->thisObject.isUndefined() == thisObject->isUndefined() &&
- (connection->thisObject.isUndefined() || RuntimeHelpers::strictEqual(connection->thisObject, thisObject))) {
+ (connection->thisObject.isUndefined() || RuntimeHelpers::strictEqual(*connection->thisObject.valueRef(), thisObject))) {
QV4::ScopedFunctionObject f(scope, connection->function.value());
QPair<QObject *, int> connectedFunctionData = extractQtMethod(f);
@@ -854,9 +880,9 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase
}
} else {
// This is a normal JS function
- if (RuntimeHelpers::strictEqual(connection->function, function) &&
+ if (RuntimeHelpers::strictEqual(*connection->function.valueRef(), function) &&
connection->thisObject.isUndefined() == thisObject->isUndefined() &&
- (connection->thisObject.isUndefined() || RuntimeHelpers::strictEqual(connection->thisObject, thisObject))) {
+ (connection->thisObject.isUndefined() || RuntimeHelpers::strictEqual(*connection->thisObject.valueRef(), thisObject))) {
*ret = true;
return;
}
@@ -875,10 +901,10 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase
ReturnedValue QObjectWrapper::method_connect(CallContext *ctx)
{
- if (ctx->d()->callData->argc == 0)
+ if (ctx->argc() == 0)
V4THROW_ERROR("Function.prototype.connect: no arguments given");
- QPair<QObject *, int> signalInfo = extractQtSignal(ctx->d()->callData->thisObject);
+ QPair<QObject *, int> signalInfo = extractQtSignal(ctx->thisObject());
QObject *signalObject = signalInfo.first;
int signalIndex = signalInfo.second; // in method range, not signal range!
@@ -895,11 +921,11 @@ ReturnedValue QObjectWrapper::method_connect(CallContext *ctx)
QV4::ScopedFunctionObject f(scope);
QV4::ScopedValue thisObject (scope, QV4::Encode::undefined());
- if (ctx->d()->callData->argc == 1) {
- f = ctx->d()->callData->args[0];
- } else if (ctx->d()->callData->argc >= 2) {
- thisObject = ctx->d()->callData->args[0];
- f = ctx->d()->callData->args[1];
+ if (ctx->argc() == 1) {
+ f = ctx->args()[0];
+ } else if (ctx->argc() >= 2) {
+ thisObject = ctx->args()[0];
+ f = ctx->args()[1];
}
if (!f)
@@ -911,8 +937,8 @@ ReturnedValue QObjectWrapper::method_connect(CallContext *ctx)
QV4::QObjectSlotDispatcher *slot = new QV4::QObjectSlotDispatcher;
slot->signalIndex = signalIndex;
- slot->thisObject = thisObject;
- slot->function = f;
+ slot->thisObject.set(scope.engine, thisObject);
+ slot->function.set(scope.engine, f);
if (QQmlData *ddata = QQmlData::get(signalObject)) {
if (QQmlPropertyCache *propertyCache = ddata->propertyCache) {
@@ -926,12 +952,12 @@ ReturnedValue QObjectWrapper::method_connect(CallContext *ctx)
ReturnedValue QObjectWrapper::method_disconnect(CallContext *ctx)
{
- if (ctx->d()->callData->argc == 0)
+ if (ctx->argc() == 0)
V4THROW_ERROR("Function.prototype.disconnect: no arguments given");
QV4::Scope scope(ctx);
- QPair<QObject *, int> signalInfo = extractQtSignal(ctx->d()->callData->thisObject);
+ QPair<QObject *, int> signalInfo = extractQtSignal(ctx->thisObject());
QObject *signalObject = signalInfo.first;
int signalIndex = signalInfo.second;
@@ -947,11 +973,11 @@ ReturnedValue QObjectWrapper::method_disconnect(CallContext *ctx)
QV4::ScopedFunctionObject functionValue(scope);
QV4::ScopedValue functionThisValue(scope, QV4::Encode::undefined());
- if (ctx->d()->callData->argc == 1) {
- functionValue = ctx->d()->callData->args[0];
- } else if (ctx->d()->callData->argc >= 2) {
- functionThisValue = ctx->d()->callData->args[0];
- functionValue = ctx->d()->callData->args[1];
+ if (ctx->argc() == 1) {
+ functionValue = ctx->args()[0];
+ } else if (ctx->argc() >= 2) {
+ functionThisValue = ctx->args()[0];
+ functionValue = ctx->args()[1];
}
if (!functionValue)
@@ -982,18 +1008,16 @@ static void markChildQObjectsRecursively(QObject *parent, QV4::ExecutionEngine *
QObject *child = children.at(i);
if (!child)
continue;
- QQmlData *ddata = QQmlData::get(child, /*create*/false);
- if (ddata)
- ddata->jsWrapper.markOnce(e);
+ QObjectWrapper::markWrapper(child, e);
markChildQObjectsRecursively(child, e);
}
}
-void QObjectWrapper::markObjects(Managed *that, QV4::ExecutionEngine *e)
+void QObjectWrapper::markObjects(Heap::Base *that, QV4::ExecutionEngine *e)
{
- QObjectWrapper *This = static_cast<QObjectWrapper*>(that);
+ QObjectWrapper::Data *This = static_cast<QObjectWrapper::Data *>(that);
- if (QObject *o = This->d()->object.data()) {
+ if (QObject *o = This->object.data()) {
QQmlVMEMetaObject *vme = QQmlVMEMetaObject::get(o);
if (vme)
vme->mark(e);
@@ -1032,12 +1056,12 @@ namespace {
};
}
-void QObjectWrapper::destroy(Managed *that)
+void QObjectWrapper::destroy(Heap::Base *that)
{
- QObjectWrapper *This = static_cast<QObjectWrapper*>(that);
- QPointer<QObject> object = This->d()->object;
- ExecutionEngine *engine = This->engine();
- This->d()->~Data();
+ Heap::QObjectWrapper *This = static_cast<Heap::QObjectWrapper*>(that);
+ QPointer<QObject> object = This->object;
+ ExecutionEngine *engine = This->internalClass->engine;
+ This->~Data();
This = 0;
if (!object)
return;
@@ -1078,8 +1102,8 @@ struct CallArgument {
inline void *dataPtr();
inline void initAsType(int type);
- inline void fromValue(int type, QV8Engine *, const ValueRef);
- inline ReturnedValue toValue(QV8Engine *);
+ inline void fromValue(int type, ExecutionEngine *, const Value &);
+ inline ReturnedValue toValue(ExecutionEngine *);
private:
CallArgument(const CallArgument &);
@@ -1120,21 +1144,10 @@ private:
};
}
-static QV4::ReturnedValue CallMethod(QObject *object, int index, int returnType, int argCount,
- int *argTypes, QV8Engine *engine, QV4::CallData *callArgs)
+static QV4::ReturnedValue CallMethod(const QQmlObjectOrGadget &object, int index, int returnType, int argCount,
+ int *argTypes, QV4::ExecutionEngine *engine, QV4::CallData *callArgs)
{
if (argCount > 0) {
-
- // Special handling is required for value types.
- // We need to save the current value in a temporary,
- // and reapply it after converting all arguments.
- // This avoids the "overwriting copy-value-type-value"
- // problem during Q_INVOKABLE function invocation.
- QQmlValueType *valueTypeObject = qobject_cast<QQmlValueType*>(object);
- QVariant valueTypeValue;
- if (valueTypeObject)
- valueTypeValue = valueTypeObject->value();
-
// Convert all arguments.
QVarLengthArray<CallArgument, 9> args(argCount + 1);
args[0].initAsType(returnType);
@@ -1144,11 +1157,7 @@ static QV4::ReturnedValue CallMethod(QObject *object, int index, int returnType,
for (int ii = 0; ii < args.count(); ++ii)
argData[ii] = args[ii].dataPtr();
- // Reinstate saved value type object value if required.
- if (valueTypeObject)
- valueTypeObject->setValue(valueTypeValue);
-
- QMetaObject::metacall(object, QMetaObject::InvokeMetaMethod, index, argData.data());
+ object.metacall(QMetaObject::InvokeMetaMethod, index, argData.data());
return args[0].toValue(engine);
@@ -1159,14 +1168,14 @@ static QV4::ReturnedValue CallMethod(QObject *object, int index, int returnType,
void *args[] = { arg.dataPtr() };
- QMetaObject::metacall(object, QMetaObject::InvokeMetaMethod, index, args);
+ object.metacall(QMetaObject::InvokeMetaMethod, index, args);
return arg.toValue(engine);
} else {
void *args[] = { 0 };
- QMetaObject::metacall(object, QMetaObject::InvokeMetaMethod, index, args);
+ object.metacall(QMetaObject::InvokeMetaMethod, index, args);
return Encode::undefined();
}
@@ -1178,9 +1187,9 @@ static QV4::ReturnedValue CallMethod(QObject *object, int index, int returnType,
The conversion table is copied out of the \l QScript::callQtMethod() function.
*/
-static int MatchScore(const QV4::ValueRef actual, int conversionType)
+static int MatchScore(const QV4::Value &actual, int conversionType)
{
- if (actual->isNumber()) {
+ if (actual.isNumber()) {
switch (conversionType) {
case QMetaType::Double:
return 0;
@@ -1207,7 +1216,7 @@ static int MatchScore(const QV4::ValueRef actual, int conversionType)
default:
return 10;
}
- } else if (actual->isString()) {
+ } else if (actual.isString()) {
switch (conversionType) {
case QMetaType::QString:
return 0;
@@ -1216,7 +1225,7 @@ static int MatchScore(const QV4::ValueRef actual, int conversionType)
default:
return 10;
}
- } else if (actual->isBoolean()) {
+ } else if (actual.isBoolean()) {
switch (conversionType) {
case QMetaType::Bool:
return 0;
@@ -1225,7 +1234,7 @@ static int MatchScore(const QV4::ValueRef actual, int conversionType)
default:
return 10;
}
- } else if (actual->asDateObject()) {
+ } else if (actual.asDateObject()) {
switch (conversionType) {
case QMetaType::QDateTime:
return 0;
@@ -1236,14 +1245,14 @@ static int MatchScore(const QV4::ValueRef actual, int conversionType)
default:
return 10;
}
- } else if (actual->as<QV4::RegExpObject>()) {
+ } else if (actual.as<QV4::RegExpObject>()) {
switch (conversionType) {
case QMetaType::QRegExp:
return 0;
default:
return 10;
}
- } else if (actual->asArrayObject()) {
+ } else if (actual.asArrayObject()) {
switch (conversionType) {
case QMetaType::QJsonArray:
return 3;
@@ -1258,7 +1267,7 @@ static int MatchScore(const QV4::ValueRef actual, int conversionType)
default:
return 10;
}
- } else if (actual->isNull()) {
+ } else if (actual.isNull()) {
switch (conversionType) {
case QMetaType::VoidStar:
case QMetaType::QObjectStar:
@@ -1272,13 +1281,11 @@ static int MatchScore(const QV4::ValueRef actual, int conversionType)
return 10;
}
}
- } else if (QV4::Object *obj = actual->asObject()) {
- QV8Engine *engine = obj->engine()->v8Engine;
-
+ } else if (QV4::Object *obj = actual.asObject()) {
if (obj->as<QV4::VariantObject>()) {
if (conversionType == qMetaTypeId<QVariant>())
return 0;
- if (engine->toVariant(actual, -1).userType() == conversionType)
+ if (obj->engine()->toVariant(actual, -1).userType() == conversionType)
return 0;
else
return 10;
@@ -1293,8 +1300,8 @@ static int MatchScore(const QV4::ValueRef actual, int conversionType)
}
}
- if (obj->as<QV4::QmlValueTypeWrapper>()) {
- if (engine->toVariant(actual, -1).userType() == conversionType)
+ if (obj->as<QV4::QQmlValueTypeWrapper>()) {
+ if (obj->engine()->toVariant(actual, -1).userType() == conversionType)
return 0;
return 10;
} else if (conversionType == QMetaType::QJsonObject) {
@@ -1324,20 +1331,20 @@ static inline int QMetaObject_methods(const QMetaObject *metaObject)
/*!
Returns the next related method, if one, or 0.
*/
-static const QQmlPropertyData * RelatedMethod(QObject *object,
- const QQmlPropertyData *current,
- QQmlPropertyData &dummy)
+static const QQmlPropertyData * RelatedMethod(const QQmlObjectOrGadget &object,
+ const QQmlPropertyData *current,
+ QQmlPropertyData &dummy,
+ const QQmlPropertyCache *propertyCache)
{
- QQmlPropertyCache *cache = QQmlData::get(object)->propertyCache;
if (!current->isOverload())
return 0;
Q_ASSERT(!current->overrideIndexIsProperty);
- if (cache) {
- return cache->method(current->overrideIndex);
+ if (propertyCache) {
+ return propertyCache->method(current->overrideIndex);
} else {
- const QMetaObject *mo = object->metaObject();
+ const QMetaObject *mo = object.metaObject();
int methodOffset = mo->methodCount() - QMetaObject_methods(mo);
while (methodOffset > current->overrideIndex) {
@@ -1368,17 +1375,17 @@ static const QQmlPropertyData * RelatedMethod(QObject *object,
}
}
-static QV4::ReturnedValue CallPrecise(QObject *object, const QQmlPropertyData &data,
- QV8Engine *engine, QV4::CallData *callArgs)
+static QV4::ReturnedValue CallPrecise(const QQmlObjectOrGadget &object, const QQmlPropertyData &data,
+ QV4::ExecutionEngine *engine, QV4::CallData *callArgs)
{
QByteArray unknownTypeError;
- int returnType = QQmlPropertyCache::methodReturnType(object, data, &unknownTypeError);
+ int returnType = object.methodReturnType(data, &unknownTypeError);
if (returnType == QMetaType::UnknownType) {
QString typeName = QString::fromLatin1(unknownTypeError);
QString error = QString::fromLatin1("Unknown method return type: %1").arg(typeName);
- return QV8Engine::getV4(engine)->currentContext()->throwError(error);
+ return engine->throwError(error);
}
if (data.hasArguments()) {
@@ -1386,18 +1393,17 @@ static QV4::ReturnedValue CallPrecise(QObject *object, const QQmlPropertyData &d
int *args = 0;
QVarLengthArray<int, 9> dummy;
- args = QQmlPropertyCache::methodParameterTypes(object, data.coreIndex, dummy,
- &unknownTypeError);
+ args = object.methodParameterTypes(data.coreIndex, dummy, &unknownTypeError);
if (!args) {
QString typeName = QString::fromLatin1(unknownTypeError);
QString error = QString::fromLatin1("Unknown method parameter type: %1").arg(typeName);
- return QV8Engine::getV4(engine)->currentContext()->throwError(error);
+ return engine->throwError(error);
}
if (args[0] > callArgs->argc) {
QString error = QLatin1String("Insufficient arguments");
- return QV8Engine::getV4(engine)->currentContext()->throwError(error);
+ return engine->throwError(error);
}
return CallMethod(object, data.coreIndex, returnType, args[0], args + 1, engine, callArgs);
@@ -1422,8 +1428,8 @@ Resolve the overloaded method to call. The algorithm works conceptually like th
If two or more overloads have the same match score, call the last one. The match
score is constructed by adding the matchScore() result for each of the parameters.
*/
-static QV4::ReturnedValue CallOverloaded(QObject *object, const QQmlPropertyData &data,
- QV8Engine *engine, QV4::CallData *callArgs)
+static QV4::ReturnedValue CallOverloaded(const QQmlObjectOrGadget &object, const QQmlPropertyData &data,
+ QV4::ExecutionEngine *engine, QV4::CallData *callArgs, const QQmlPropertyCache *propertyCache)
{
int argumentCount = callArgs->argc;
@@ -1431,20 +1437,10 @@ static QV4::ReturnedValue CallOverloaded(QObject *object, const QQmlPropertyData
int bestParameterScore = INT_MAX;
int bestMatchScore = INT_MAX;
- // Special handling is required for value types.
- // We need to save the current value in a temporary,
- // and reapply it after converting all arguments.
- // This avoids the "overwriting copy-value-type-value"
- // problem during Q_INVOKABLE function invocation.
- QQmlValueType *valueTypeObject = qobject_cast<QQmlValueType*>(object);
- QVariant valueTypeValue;
- if (valueTypeObject)
- valueTypeValue = valueTypeObject->value();
-
QQmlPropertyData dummy;
const QQmlPropertyData *attempt = &data;
- QV4::Scope scope(QV8Engine::getV4(engine));
+ QV4::Scope scope(engine);
QV4::ScopedValue v(scope);
do {
@@ -1452,8 +1448,7 @@ static QV4::ReturnedValue CallOverloaded(QObject *object, const QQmlPropertyData
int methodArgumentCount = 0;
int *methodArgTypes = 0;
if (attempt->hasArguments()) {
- typedef QQmlPropertyCache PC;
- int *args = PC::methodParameterTypes(object, attempt->coreIndex, dummy, 0);
+ int *args = object.methodParameterTypes(attempt->coreIndex, dummy, 0);
if (!args) // Must be an unknown argument
continue;
@@ -1481,22 +1476,20 @@ static QV4::ReturnedValue CallOverloaded(QObject *object, const QQmlPropertyData
if (bestParameterScore == 0 && bestMatchScore == 0)
break; // We can't get better than that
- } while((attempt = RelatedMethod(object, attempt, dummy)) != 0);
+ } while ((attempt = RelatedMethod(object, attempt, dummy, propertyCache)) != 0);
if (best.isValid()) {
- if (valueTypeObject)
- valueTypeObject->setValue(valueTypeValue);
return CallPrecise(object, best, engine, callArgs);
} else {
QString error = QLatin1String("Unable to determine callable overload. Candidates are:");
const QQmlPropertyData *candidate = &data;
while (candidate) {
error += QLatin1String("\n ") +
- QString::fromUtf8(object->metaObject()->method(candidate->coreIndex).methodSignature().constData());
- candidate = RelatedMethod(object, candidate, dummy);
+ QString::fromUtf8(object.metaObject()->method(candidate->coreIndex).methodSignature().constData());
+ candidate = RelatedMethod(object, candidate, dummy, propertyCache);
}
- return QV8Engine::getV4(engine)->currentContext()->throwError(error);
+ return engine->throwError(error);
}
}
@@ -1582,50 +1575,49 @@ void CallArgument::initAsType(int callType)
}
}
-void CallArgument::fromValue(int callType, QV8Engine *engine, const QV4::ValueRef value)
+void CallArgument::fromValue(int callType, QV4::ExecutionEngine *engine, const QV4::Value &value)
{
if (type != 0) {
cleanup();
type = 0;
}
- QV4::Scope scope(QV8Engine::getV4(engine));
+ QV4::Scope scope(engine);
bool queryEngine = false;
if (callType == qMetaTypeId<QJSValue>()) {
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine);
- qjsValuePtr = new (&allocData) QJSValue(new QJSValuePrivate(v4, value));
+ qjsValuePtr = new (&allocData) QJSValue(scope.engine, value.asReturnedValue());
type = qMetaTypeId<QJSValue>();
} else if (callType == QMetaType::Int) {
- intValue = quint32(value->toInt32());
+ intValue = quint32(value.toInt32());
type = callType;
} else if (callType == QMetaType::UInt) {
- intValue = quint32(value->toUInt32());
+ intValue = quint32(value.toUInt32());
type = callType;
} else if (callType == QMetaType::Bool) {
- boolValue = value->toBoolean();
+ boolValue = value.toBoolean();
type = callType;
} else if (callType == QMetaType::Double) {
- doubleValue = double(value->toNumber());
+ doubleValue = double(value.toNumber());
type = callType;
} else if (callType == QMetaType::Float) {
- floatValue = float(value->toNumber());
+ floatValue = float(value.toNumber());
type = callType;
} else if (callType == QMetaType::QString) {
- if (value->isNull() || value->isUndefined())
+ if (value.isNull() || value.isUndefined())
qstringPtr = new (&allocData) QString();
else
- qstringPtr = new (&allocData) QString(value->toQStringNoThrow());
+ qstringPtr = new (&allocData) QString(value.toQStringNoThrow());
type = callType;
} else if (callType == QMetaType::QObjectStar) {
qobjectPtr = 0;
- if (QV4::QObjectWrapper *qobjectWrapper = value->as<QV4::QObjectWrapper>())
+ if (QV4::QObjectWrapper *qobjectWrapper = value.as<QV4::QObjectWrapper>())
qobjectPtr = qobjectWrapper->object();
- else if (QV4::QmlTypeWrapper *qmlTypeWrapper = value->as<QV4::QmlTypeWrapper>())
+ else if (QV4::QmlTypeWrapper *qmlTypeWrapper = value.as<QV4::QmlTypeWrapper>())
queryEngine = qmlTypeWrapper->isSingleton();
type = callType;
} else if (callType == qMetaTypeId<QVariant>()) {
- qvariantPtr = new (&allocData) QVariant(engine->toVariant(value, -1));
+ qvariantPtr = new (&allocData) QVariant(scope.engine->toVariant(value, -1));
type = callType;
} else if (callType == qMetaTypeId<QList<QObject*> >()) {
qlistPtr = new (&allocData) QList<QObject *>();
@@ -1633,8 +1625,8 @@ void CallArgument::fromValue(int callType, QV8Engine *engine, const QV4::ValueRe
if (array) {
Scoped<QV4::QObjectWrapper> qobjectWrapper(scope);
- uint32_t length = array->getLength();
- for (uint32_t ii = 0; ii < length; ++ii) {
+ uint length = array->getLength();
+ for (uint ii = 0; ii < length; ++ii) {
QObject *o = 0;
qobjectWrapper = array->getIndexed(ii);
if (!!qobjectWrapper)
@@ -1643,13 +1635,13 @@ void CallArgument::fromValue(int callType, QV8Engine *engine, const QV4::ValueRe
}
} else {
QObject *o = 0;
- if (QV4::QObjectWrapper *qobjectWrapper = value->as<QV4::QObjectWrapper>())
+ if (QV4::QObjectWrapper *qobjectWrapper = value.as<QV4::QObjectWrapper>())
o = qobjectWrapper->object();
qlistPtr->append(o);
}
type = callType;
} else if (callType == qMetaTypeId<QQmlV4Handle>()) {
- handlePtr = new (&allocData) QQmlV4Handle(value->asReturnedValue());
+ handlePtr = new (&allocData) QQmlV4Handle(value.asReturnedValue());
type = callType;
} else if (callType == QMetaType::QJsonArray) {
QV4::ScopedArrayObject a(scope, value);
@@ -1672,8 +1664,8 @@ void CallArgument::fromValue(int callType, QV8Engine *engine, const QV4::ValueRe
qvariantPtr = new (&allocData) QVariant();
type = -1;
- QQmlEnginePrivate *ep = engine->engine() ? QQmlEnginePrivate::get(engine->engine()) : 0;
- QVariant v = engine->toVariant(value, callType);
+ QQmlEnginePrivate *ep = engine->qmlEngine() ? QQmlEnginePrivate::get(engine->qmlEngine()) : 0;
+ QVariant v = scope.engine->toVariant(value, callType);
if (v.userType() == callType) {
*qvariantPtr = v;
@@ -1696,13 +1688,12 @@ void CallArgument::fromValue(int callType, QV8Engine *engine, const QV4::ValueRe
}
}
-QV4::ReturnedValue CallArgument::toValue(QV8Engine *engine)
+QV4::ReturnedValue CallArgument::toValue(QV4::ExecutionEngine *engine)
{
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine);
- QV4::Scope scope(v4);
+ QV4::Scope scope(engine);
if (type == qMetaTypeId<QJSValue>()) {
- return QJSValuePrivate::get(*qjsValuePtr)->getValue(v4);
+ return QJSValuePrivate::convertedToValue(scope.engine, *qjsValuePtr);
} else if (type == QMetaType::Int) {
return QV4::Encode(int(intValue));
} else if (type == QMetaType::UInt) {
@@ -1714,74 +1705,99 @@ QV4::ReturnedValue CallArgument::toValue(QV8Engine *engine)
} else if (type == QMetaType::Float) {
return QV4::Encode(floatValue);
} else if (type == QMetaType::QString) {
- return engine->toString(*qstringPtr);
+ return QV4::Encode(engine->newString(*qstringPtr));
} else if (type == QMetaType::QObjectStar) {
QObject *object = qobjectPtr;
if (object)
QQmlData::get(object, true)->setImplicitDestructible();
- return QV4::QObjectWrapper::wrap(v4, object);
+ return QV4::QObjectWrapper::wrap(scope.engine, object);
} else if (type == qMetaTypeId<QList<QObject *> >()) {
// XXX Can this be made more by using Array as a prototype and implementing
// directly against QList<QObject*>?
QList<QObject *> &list = *qlistPtr;
- QV4::Scoped<ArrayObject> array(scope, v4->newArrayObject());
+ QV4::ScopedArrayObject array(scope, scope.engine->newArrayObject());
array->arrayReserve(list.count());
QV4::ScopedValue v(scope);
for (int ii = 0; ii < list.count(); ++ii)
- array->arrayPut(ii, (v = QV4::QObjectWrapper::wrap(v4, list.at(ii))));
+ array->arrayPut(ii, (v = QV4::QObjectWrapper::wrap(scope.engine, list.at(ii))));
array->setArrayLengthUnchecked(list.count());
return array.asReturnedValue();
} else if (type == qMetaTypeId<QQmlV4Handle>()) {
return *handlePtr;
} else if (type == QMetaType::QJsonArray) {
- return QV4::JsonObject::fromJsonArray(v4, *jsonArrayPtr);
+ return QV4::JsonObject::fromJsonArray(scope.engine, *jsonArrayPtr);
} else if (type == QMetaType::QJsonObject) {
- return QV4::JsonObject::fromJsonObject(v4, *jsonObjectPtr);
+ return QV4::JsonObject::fromJsonObject(scope.engine, *jsonObjectPtr);
} else if (type == QMetaType::QJsonValue) {
- return QV4::JsonObject::fromJsonValue(v4, *jsonValuePtr);
+ return QV4::JsonObject::fromJsonValue(scope.engine, *jsonValuePtr);
} else if (type == -1 || type == qMetaTypeId<QVariant>()) {
QVariant value = *qvariantPtr;
- QV4::ScopedValue rv(scope, engine->fromVariant(value));
+ QV4::ScopedValue rv(scope, scope.engine->fromVariant(value));
QV4::Scoped<QV4::QObjectWrapper> qobjectWrapper(scope, rv);
if (!!qobjectWrapper) {
if (QObject *object = qobjectWrapper->object())
QQmlData::get(object, true)->setImplicitDestructible();
}
- return rv.asReturnedValue();
+ return rv->asReturnedValue();
} else {
return QV4::Encode::undefined();
}
}
-ReturnedValue QObjectMethod::create(ExecutionContext *scope, QObject *object, int index, const ValueRef qmlGlobal)
+ReturnedValue QObjectMethod::create(ExecutionContext *scope, QObject *object, int index, const Value &qmlGlobal)
{
- return (scope->d()->engine->memoryManager->alloc<QObjectMethod>(scope, object, index, qmlGlobal))->asReturnedValue();
+ Scope valueScope(scope);
+ Scoped<QObjectMethod> method(valueScope, scope->d()->engine->memoryManager->alloc<QObjectMethod>(scope));
+ method->d()->object = object;
+
+ if (QQmlData *ddata = QQmlData::get(object))
+ method->d()->propertyCache = ddata->propertyCache;
+
+ method->d()->index = index;
+ method->d()->qmlGlobal = qmlGlobal;
+ method->d()->valueTypeWrapper = Primitive::undefinedValue();
+ return method.asReturnedValue();
}
-QObjectMethod::Data::Data(ExecutionContext *scope, QObject *object, int index, const ValueRef qmlGlobal)
- : FunctionObject::Data(scope)
- , object(object)
- , index(index)
- , qmlGlobal(qmlGlobal)
+ReturnedValue QObjectMethod::create(ExecutionContext *scope, QQmlValueTypeWrapper *valueType, int index, const Value &qmlGlobal)
+{
+ Scope valueScope(scope);
+ Scoped<QObjectMethod> method(valueScope, scope->d()->engine->memoryManager->alloc<QObjectMethod>(scope));
+ method->d()->propertyCache = valueType->d()->propertyCache;
+ method->d()->index = index;
+ method->d()->qmlGlobal = qmlGlobal;
+ method->d()->valueTypeWrapper = valueType;
+ return method.asReturnedValue();
+}
+
+Heap::QObjectMethod::QObjectMethod(QV4::ExecutionContext *scope)
+ : Heap::FunctionObject(scope)
+{
+}
+
+const QMetaObject *Heap::QObjectMethod::metaObject()
{
- setVTable(staticVTable());
- subtype = WrappedQtMethod;
+ if (propertyCache)
+ return propertyCache->createMetaObject();
+ return object->metaObject();
}
QV4::ReturnedValue QObjectMethod::method_toString(QV4::ExecutionContext *ctx)
{
QString result;
- if (d()->object) {
- QString objectName = d()->object->objectName();
+ if (const QMetaObject *metaObject = d()->metaObject()) {
- result += QString::fromUtf8(d()->object->metaObject()->className());
+ result += QString::fromUtf8(metaObject->className());
result += QLatin1String("(0x");
result += QString::number((quintptr)d()->object.data(),16);
- if (!objectName.isEmpty()) {
- result += QLatin1String(", \"");
- result += objectName;
- result += QLatin1Char('\"');
+ if (d()->object) {
+ QString objectName = d()->object->objectName();
+ if (!objectName.isEmpty()) {
+ result += QLatin1String(", \"");
+ result += objectName;
+ result += QLatin1Char('\"');
+ }
}
result += QLatin1Char(')');
@@ -1792,12 +1808,12 @@ QV4::ReturnedValue QObjectMethod::method_toString(QV4::ExecutionContext *ctx)
return ctx->d()->engine->newString(result)->asReturnedValue();
}
-QV4::ReturnedValue QObjectMethod::method_destroy(QV4::ExecutionContext *ctx, const ValueRef args, int argc)
+QV4::ReturnedValue QObjectMethod::method_destroy(QV4::ExecutionContext *ctx, const Value *args, int argc)
{
if (!d()->object)
return Encode::undefined();
if (QQmlData::keepAliveDuringGarbageCollection(d()->object))
- return ctx->throwError(QStringLiteral("Invalid attempt to destroy() an indestructible object"));
+ return ctx->engine()->throwError(QStringLiteral("Invalid attempt to destroy() an indestructible object"));
int delay = 0;
if (argc > 0)
@@ -1819,37 +1835,31 @@ ReturnedValue QObjectMethod::call(Managed *m, CallData *callData)
ReturnedValue QObjectMethod::callInternal(CallData *callData)
{
- ExecutionContext *context = engine()->currentContext();
+ Scope scope(engine());
+ ScopedContext context(scope, scope.engine->currentContext());
if (d()->index == DestroyMethod)
return method_destroy(context, callData->args, callData->argc);
else if (d()->index == ToStringMethod)
return method_toString(context);
- QObject *object = d()->object.data();
- if (!object)
- return Encode::undefined();
-
- QQmlData *ddata = QQmlData::get(object);
- if (!ddata)
- return Encode::undefined();
+ QQmlObjectOrGadget object(d()->object.data());
+ if (!d()->object) {
+ Scoped<QQmlValueTypeWrapper> wrapper(scope, d()->valueTypeWrapper);
+ if (!wrapper)
+ return Encode::undefined();
- QV8Engine *v8Engine = context->d()->engine->v8Engine;
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(v8Engine);
- QV4::Scope scope(v4);
+ object = QQmlObjectOrGadget(d()->propertyCache.data(), wrapper->d()->gadgetPtr);
+ }
QQmlPropertyData method;
- if (QQmlData *ddata = static_cast<QQmlData *>(QObjectPrivate::get(object)->declarativeData)) {
- if (ddata->propertyCache) {
- QQmlPropertyData *data = ddata->propertyCache->method(d()->index);
- if (!data)
- return QV4::Encode::undefined();
- method = *data;
- }
- }
-
- if (method.coreIndex == -1) {
- const QMetaObject *mo = object->metaObject();
+ if (d()->propertyCache) {
+ QQmlPropertyData *data = d()->propertyCache->method(d()->index);
+ if (!data)
+ return QV4::Encode::undefined();
+ method = *data;
+ } else {
+ const QMetaObject *mo = d()->object->metaObject();
const QMetaMethod moMethod = mo->method(d()->index);
method.load(moMethod);
@@ -1872,47 +1882,59 @@ ReturnedValue QObjectMethod::callInternal(CallData *callData)
if (method.isV4Function()) {
QV4::ScopedValue rv(scope, QV4::Primitive::undefinedValue());
- QV4::ScopedValue qmlGlobal(scope, d()->qmlGlobal.value());
+ QV4::ScopedValue qmlGlobal(scope, d()->qmlGlobal);
QQmlV4Function func(callData, rv, qmlGlobal,
QmlContextWrapper::getContext(qmlGlobal),
- v8Engine);
+ scope.engine);
QQmlV4Function *funcptr = &func;
void *args[] = { 0, &funcptr };
- QMetaObject::metacall(object, QMetaObject::InvokeMetaMethod, method.coreIndex, args);
+ object.metacall(QMetaObject::InvokeMetaMethod, method.coreIndex, args);
- return rv.asReturnedValue();
+ return rv->asReturnedValue();
}
if (!method.isOverload()) {
- return CallPrecise(object, method, v8Engine, callData);
+ return CallPrecise(object, method, scope.engine, callData);
} else {
- return CallOverloaded(object, method, v8Engine, callData);
+ return CallOverloaded(object, method, scope.engine, callData, d()->propertyCache);
}
}
+void QObjectMethod::markObjects(Heap::Base *that, ExecutionEngine *e)
+{
+ QObjectMethod::Data *This = static_cast<QObjectMethod::Data*>(that);
+ This->qmlGlobal.mark(e);
+ This->valueTypeWrapper.mark(e);
+
+ FunctionObject::markObjects(that, e);
+}
+
DEFINE_OBJECT_VTABLE(QObjectMethod);
-QmlSignalHandler::Data::Data(ExecutionEngine *engine, QObject *object, int signalIndex)
- : Object::Data(engine)
+Heap::QmlSignalHandler::QmlSignalHandler(QV4::ExecutionEngine *engine, QObject *object, int signalIndex)
+ : Heap::Object(engine)
, object(object)
, signalIndex(signalIndex)
{
- setVTable(staticVTable());
}
DEFINE_OBJECT_VTABLE(QmlSignalHandler);
-void MultiplyWrappedQObjectMap::insert(QObject *key, Object *value)
+void MultiplyWrappedQObjectMap::insert(QObject *key, Heap::Object *value)
{
- QHash<QObject*, Object*>::insert(key, value);
+ QV4::WeakValue v;
+ v.set(value->internalClass->engine, value);
+ QHash<QObject*, QV4::WeakValue>::insert(key, v);
connect(key, SIGNAL(destroyed(QObject*)), this, SLOT(removeDestroyedObject(QObject*)));
}
+
+
MultiplyWrappedQObjectMap::Iterator MultiplyWrappedQObjectMap::erase(MultiplyWrappedQObjectMap::Iterator it)
{
disconnect(it.key(), SIGNAL(destroyed(QObject*)), this, SLOT(removeDestroyedObject(QObject*)));
- return QHash<QObject*, Object*>::erase(it);
+ return QHash<QObject*, QV4::WeakValue>::erase(it);
}
void MultiplyWrappedQObjectMap::remove(QObject *key)
@@ -1923,9 +1945,17 @@ void MultiplyWrappedQObjectMap::remove(QObject *key)
erase(it);
}
+void MultiplyWrappedQObjectMap::mark(QObject *key, ExecutionEngine *engine)
+{
+ Iterator it = find(key);
+ if (it == end())
+ return;
+ it->markOnce(engine);
+}
+
void MultiplyWrappedQObjectMap::removeDestroyedObject(QObject *object)
{
- QHash<QObject*, Object*>::remove(object);
+ QHash<QObject*, QV4::WeakValue>::remove(object);
}
QT_END_NAMESPACE
diff --git a/src/qml/jsruntime/qv4qobjectwrapper_p.h b/src/qml/jsruntime/qv4qobjectwrapper_p.h
index 1a31b5af4b..24e8b29e08 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper_p.h
+++ b/src/qml/jsruntime/qv4qobjectwrapper_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -67,13 +67,36 @@ class QQmlPropertyData;
namespace QV4 {
struct QObjectSlotDispatcher;
-struct Q_QML_EXPORT QObjectWrapper : public QV4::Object
+namespace Heap {
+
+struct QObjectWrapper : Object {
+ QObjectWrapper(QV4::ExecutionEngine *engine, QObject *object);
+ QPointer<QObject> object;
+};
+
+struct QObjectMethod : FunctionObject {
+ QObjectMethod(QV4::ExecutionContext *scope);
+ QPointer<QObject> object;
+ QQmlRefPointer<QQmlPropertyCache> propertyCache;
+ int index;
+ Value qmlGlobal;
+
+ Value valueTypeWrapper;
+
+ const QMetaObject *metaObject();
+};
+
+struct QmlSignalHandler : Object {
+ QmlSignalHandler(QV4::ExecutionEngine *engine, QObject *object, int signalIndex);
+ QPointer<QObject> object;
+ int signalIndex;
+};
+
+}
+
+struct Q_QML_EXPORT QObjectWrapper : public Object
{
- struct Data : QV4::Object::Data {
- Data(ExecutionEngine *engine, QObject *object);
- QPointer<QObject> object;
- };
- V4_OBJECT(QV4::Object)
+ V4_OBJECT2(QObjectWrapper, Object)
enum RevisionMode { IgnoreRevision, CheckRevision };
@@ -81,108 +104,93 @@ struct Q_QML_EXPORT QObjectWrapper : public QV4::Object
QObject *object() const { return d()->object.data(); }
- ReturnedValue getQmlProperty(ExecutionContext *ctx, QQmlContextData *qmlContext, String *name, RevisionMode revisionMode, bool *hasProperty = 0, bool includeImports = false);
- static ReturnedValue getQmlProperty(ExecutionContext *ctx, QQmlContextData *qmlContext, QObject *object, String *name, RevisionMode revisionMode, bool *hasProperty = 0);
+ ReturnedValue getQmlProperty(QQmlContextData *qmlContext, String *name, RevisionMode revisionMode, bool *hasProperty = 0, bool includeImports = false);
+ static ReturnedValue getQmlProperty(ExecutionEngine *engine, QQmlContextData *qmlContext, QObject *object, String *name, RevisionMode revisionMode, bool *hasProperty = 0);
- static bool setQmlProperty(ExecutionContext *ctx, QQmlContextData *qmlContext, QObject *object, String *name, RevisionMode revisionMode, const ValueRef value);
+ static bool setQmlProperty(ExecutionEngine *engine, QQmlContextData *qmlContext, QObject *object, String *name, RevisionMode revisionMode, const Value &value);
static ReturnedValue wrap(ExecutionEngine *engine, QObject *object);
+ static void markWrapper(QObject *object, ExecutionEngine *engine);
using Object::get;
static ReturnedValue getProperty(QObject *object, ExecutionContext *ctx, int propertyIndex, bool captureRequired);
- void setProperty(ExecutionContext *ctx, int propertyIndex, const ValueRef value);
+ void setProperty(ExecutionContext *ctx, int propertyIndex, const Value &value);
protected:
static bool isEqualTo(Managed *that, Managed *o);
private:
static ReturnedValue getProperty(QObject *object, ExecutionContext *ctx, QQmlPropertyData *property, bool captureRequired = true);
- static void setProperty(QObject *object, ExecutionContext *ctx, QQmlPropertyData *property, const ValueRef value);
+ static void setProperty(QObject *object, ExecutionContext *ctx, QQmlPropertyData *property, const Value &value);
static ReturnedValue create(ExecutionEngine *engine, QObject *object);
QQmlPropertyData *findProperty(ExecutionEngine *engine, QQmlContextData *qmlContext, String *name, RevisionMode revisionMode, QQmlPropertyData *local) const;
static ReturnedValue get(Managed *m, String *name, bool *hasProperty);
- static void put(Managed *m, String *name, const ValueRef value);
+ static void put(Managed *m, String *name, const Value &value);
static PropertyAttributes query(const Managed *, String *name);
- static void advanceIterator(Managed *m, ObjectIterator *it, String *&name, uint *index, Property *p, PropertyAttributes *attributes);
- static void markObjects(Managed *that, QV4::ExecutionEngine *e);
- static void destroy(Managed *that);
+ static void advanceIterator(Managed *m, ObjectIterator *it, Heap::String **name, uint *index, Property *p, PropertyAttributes *attributes);
+ static void markObjects(Heap::Base *that, QV4::ExecutionEngine *e);
+ static void destroy(Heap::Base *that);
static ReturnedValue method_connect(CallContext *ctx);
static ReturnedValue method_disconnect(CallContext *ctx);
};
+struct QQmlValueTypeWrapper;
+
struct Q_QML_EXPORT QObjectMethod : public QV4::FunctionObject
{
- struct Data : QV4::FunctionObject::Data {
- Data(QV4::ExecutionContext *scope, QObject *object, int index, const ValueRef qmlGlobal);
- QPointer<QObject> object;
- int index;
- QV4::PersistentValue qmlGlobal;
- };
- V4_OBJECT(QV4::FunctionObject)
+ V4_OBJECT2(QObjectMethod, QV4::FunctionObject)
+ V4_NEEDS_DESTROY
enum { DestroyMethod = -1, ToStringMethod = -2 };
- static ReturnedValue create(QV4::ExecutionContext *scope, QObject *object, int index, const ValueRef qmlGlobal = Primitive::undefinedValue());
+ static ReturnedValue create(QV4::ExecutionContext *scope, QObject *object, int index, const Value &qmlGlobal = Primitive::undefinedValue());
+ static ReturnedValue create(QV4::ExecutionContext *scope, QQmlValueTypeWrapper *valueType, int index, const Value &qmlGlobal = Primitive::undefinedValue());
int methodIndex() const { return d()->index; }
QObject *object() const { return d()->object.data(); }
QV4::ReturnedValue method_toString(QV4::ExecutionContext *ctx);
- QV4::ReturnedValue method_destroy(QV4::ExecutionContext *ctx, const ValueRef args, int argc);
+ QV4::ReturnedValue method_destroy(QV4::ExecutionContext *ctx, const Value *args, int argc);
static ReturnedValue call(Managed *, CallData *callData);
ReturnedValue callInternal(CallData *callData);
- static void destroy(Managed *that)
- {
- static_cast<QObjectMethod *>(that)->d()->~Data();
- }
+ static void markObjects(Heap::Base *that, QV4::ExecutionEngine *e);
};
struct QmlSignalHandler : public QV4::Object
{
- struct Data : QV4::Object::Data {
- Data(ExecutionEngine *engine, QObject *object, int signalIndex);
- QPointer<QObject> object;
- int signalIndex;
- };
- V4_OBJECT(QV4::Object)
-
+ V4_OBJECT2(QmlSignalHandler, QV4::Object)
+ V4_NEEDS_DESTROY
int signalIndex() const { return d()->signalIndex; }
QObject *object() const { return d()->object.data(); }
-
-private:
-
- static void destroy(Managed *that)
- {
- static_cast<QmlSignalHandler *>(that)->d()->~Data();
- }
};
class MultiplyWrappedQObjectMap : public QObject,
- private QHash<QObject*, Object*>
+ private QHash<QObject*, QV4::WeakValue>
{
Q_OBJECT
public:
- typedef QHash<QObject*, Object*>::ConstIterator ConstIterator;
- typedef QHash<QObject*, Object*>::Iterator Iterator;
+ typedef QHash<QObject*, QV4::WeakValue>::ConstIterator ConstIterator;
+ typedef QHash<QObject*, QV4::WeakValue>::Iterator Iterator;
- ConstIterator begin() const { return QHash<QObject*, Object*>::constBegin(); }
- Iterator begin() { return QHash<QObject*, Object*>::begin(); }
- ConstIterator end() const { return QHash<QObject*, Object*>::constEnd(); }
- Iterator end() { return QHash<QObject*, Object*>::end(); }
+ ConstIterator begin() const { return QHash<QObject*, QV4::WeakValue>::constBegin(); }
+ Iterator begin() { return QHash<QObject*, QV4::WeakValue>::begin(); }
+ ConstIterator end() const { return QHash<QObject*, QV4::WeakValue>::constEnd(); }
+ Iterator end() { return QHash<QObject*, QV4::WeakValue>::end(); }
- void insert(QObject *key, Object *value);
- Object *value(QObject *key) const { return QHash<QObject*, Object*>::value(key, 0); }
+ void insert(QObject *key, Heap::Object *value);
+ ReturnedValue value(QObject *key) const { return QHash<QObject*, QV4::WeakValue>::value(key).value(); }
Iterator erase(Iterator it);
void remove(QObject *key);
+ void mark(QObject *key, ExecutionEngine *engine);
private Q_SLOTS:
void removeDestroyedObject(QObject*);
diff --git a/src/qml/jsruntime/qv4regexp.cpp b/src/qml/jsruntime/qv4regexp.cpp
index e84c96f417..8e18a5fbdd 100644
--- a/src/qml/jsruntime/qv4regexp.cpp
+++ b/src/qml/jsruntime/qv4regexp.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -42,7 +42,7 @@ RegExpCache::~RegExpCache()
{
for (RegExpCache::Iterator it = begin(), e = end();
it != e; ++it)
- it.value()->d()->cache = 0;
+ it.value()->cache = 0;
clear();
}
@@ -57,40 +57,39 @@ uint RegExp::match(const QString &string, int start, uint *matchOffsets)
#if ENABLE(YARR_JIT)
if (!jitCode().isFallBack() && jitCode().has16BitCode())
- return jitCode().execute(s.characters16(), start, s.length(), (int*)matchOffsets).start;
+ return uint(jitCode().execute(s.characters16(), start, s.length(), (int*)matchOffsets).start);
#endif
return JSC::Yarr::interpret(byteCode().get(), s.characters16(), string.length(), start, matchOffsets);
}
-RegExp* RegExp::create(ExecutionEngine* engine, const QString& pattern, bool ignoreCase, bool multiline)
+Heap::RegExp *RegExp::create(ExecutionEngine* engine, const QString& pattern, bool ignoreCase, bool multiline)
{
RegExpCacheKey key(pattern, ignoreCase, multiline);
RegExpCache *cache = engine->regExpCache;
if (cache) {
- if (RegExp *result = cache->value(key))
+ if (Heap::RegExp *result = cache->value(key))
return result;
}
- RegExp *result = engine->memoryManager->alloc<RegExp>(engine, pattern, ignoreCase, multiline);
+ Scope scope(engine);
+ Scoped<RegExp> result(scope, engine->memoryManager->alloc<RegExp>(engine, pattern, ignoreCase, multiline));
if (!cache)
cache = engine->regExpCache = new RegExpCache;
result->d()->cache = cache;
- cache->insert(key, result);
+ cache->insert(key, result->d());
- return result;
+ return result->d();
}
-RegExp::Data::Data(ExecutionEngine* engine, const QString &pattern, bool ignoreCase, bool multiline)
- : Managed::Data(engine->regExpValueClass)
- , pattern(pattern)
+Heap::RegExp::RegExp(ExecutionEngine* engine, const QString &pattern, bool ignoreCase, bool multiline)
+ : pattern(pattern)
, ignoreCase(ignoreCase)
, multiLine(multiline)
{
- setVTable(staticVTable());
const char* error = 0;
JSC::Yarr::YarrPattern yarrPattern(WTF::String(pattern), ignoreCase, multiline, &error);
if (error)
@@ -105,7 +104,7 @@ RegExp::Data::Data(ExecutionEngine* engine, const QString &pattern, bool ignoreC
#endif
}
-RegExp::Data::~Data()
+Heap::RegExp::~RegExp()
{
if (cache) {
RegExpCacheKey key(this);
@@ -113,12 +112,7 @@ RegExp::Data::~Data()
}
}
-void RegExp::destroy(Managed *that)
-{
- static_cast<RegExp*>(that)->d()->~Data();
-}
-
-void RegExp::markObjects(Managed *that, ExecutionEngine *e)
+void RegExp::markObjects(Heap::Base *that, ExecutionEngine *e)
{
Q_UNUSED(that);
Q_UNUSED(e);
diff --git a/src/qml/jsruntime/qv4regexp_p.h b/src/qml/jsruntime/qv4regexp_p.h
index e2f43bf7d7..819e31e5f1 100644
--- a/src/qml/jsruntime/qv4regexp_p.h
+++ b/src/qml/jsruntime/qv4regexp_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -56,24 +56,31 @@ namespace QV4 {
struct ExecutionEngine;
struct RegExpCacheKey;
-struct RegExp : public Managed
-{
- struct Data : Managed::Data {
- Data(ExecutionEngine* engine, const QString& pattern, bool ignoreCase, bool multiline);
- ~Data();
- QString pattern;
- OwnPtr<JSC::Yarr::BytecodePattern> byteCode;
+namespace Heap {
+
+struct RegExp : Base {
+ RegExp(ExecutionEngine* engine, const QString& pattern, bool ignoreCase, bool multiline);
+ ~RegExp();
+ QString pattern;
+ OwnPtr<JSC::Yarr::BytecodePattern> byteCode;
#if ENABLE(YARR_JIT)
- JSC::Yarr::YarrCodeBlock jitCode;
+ JSC::Yarr::YarrCodeBlock jitCode;
#endif
- RegExpCache *cache;
- int subPatternCount;
- bool ignoreCase;
- bool multiLine;
- };
- V4_MANAGED(Managed)
- Q_MANAGED_TYPE(RegExp)
+ RegExpCache *cache;
+ int subPatternCount;
+ bool ignoreCase;
+ bool multiLine;
+
+ int captureCount() const { return subPatternCount + 1; }
+};
+
+}
+struct RegExp : public Managed
+{
+ V4_MANAGED(RegExp, Managed)
+ Q_MANAGED_TYPE(RegExp)
+ V4_NEEDS_DESTROY
QString pattern() const { return d()->pattern; }
OwnPtr<JSC::Yarr::BytecodePattern> &byteCode() { return d()->byteCode; }
@@ -85,7 +92,7 @@ struct RegExp : public Managed
bool ignoreCase() const { return d()->ignoreCase; }
bool multiLine() const { return d()->multiLine; }
- static RegExp* create(ExecutionEngine* engine, const QString& pattern, bool ignoreCase = false, bool multiline = false);
+ static Heap::RegExp *create(ExecutionEngine* engine, const QString& pattern, bool ignoreCase = false, bool multiline = false);
bool isValid() const { return d()->byteCode.get(); }
@@ -93,8 +100,7 @@ struct RegExp : public Managed
int captureCount() const { return subPatternCount() + 1; }
- static void destroy(Managed *that);
- static void markObjects(Managed *that, QV4::ExecutionEngine *e);
+ static void markObjects(Heap::Base *that, QV4::ExecutionEngine *e);
friend class RegExpCache;
};
@@ -127,7 +133,8 @@ inline RegExpCacheKey::RegExpCacheKey(const RegExp::Data *re)
inline uint qHash(const RegExpCacheKey& key, uint seed = 0) Q_DECL_NOTHROW
{ return qHash(key.pattern, seed); }
-class RegExpCache : public QHash<RegExpCacheKey, RegExp*>
+// ### GC
+class RegExpCache : public QHash<RegExpCacheKey, Heap::RegExp*>
{
public:
~RegExpCache();
diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp
index e7f30c6671..f6e88e62b7 100644
--- a/src/qml/jsruntime/qv4regexpobject.cpp
+++ b/src/qml/jsruntime/qv4regexpobject.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -35,6 +35,7 @@
#include "qv4jsir_p.h"
#include "qv4isel_p.h"
#include "qv4objectproto_p.h"
+#include "qv4regexp_p.h"
#include "qv4stringobject_p.h"
#include "qv4mm_p.h"
#include "qv4scopedvalue_p.h"
@@ -47,7 +48,6 @@
#include <qv4codegen_p.h>
#include "private/qlocale_tools_p.h"
-#include <QtCore/qmath.h>
#include <QtCore/QDebug>
#include <QtCore/qregexp.h>
#include <cassert>
@@ -64,38 +64,32 @@ using namespace QV4;
DEFINE_OBJECT_VTABLE(RegExpObject);
DEFINE_OBJECT_VTABLE(RegExpPrototype);
-RegExpObject::Data::Data(InternalClass *ic)
- : Object::Data(ic)
+Heap::RegExpObject::RegExpObject(InternalClass *ic, QV4::Object *prototype)
+ : Heap::Object(ic, prototype)
{
- setVTable(staticVTable());
-
Scope scope(ic->engine);
- Scoped<RegExpObject> o(scope, this);
- o->d()->value = reinterpret_cast<RegExp *>(RegExp::create(ic->engine, QString(), false, false));
+ Scoped<QV4::RegExpObject> o(scope, this);
+ o->d()->value = QV4::RegExp::create(ic->engine, QString(), false, false);
o->d()->global = false;
o->init(ic->engine);
}
-RegExpObject::Data::Data(ExecutionEngine *engine, RegExp *value, bool global)
- : Object::Data(engine->regExpClass)
- , value(value)
+Heap::RegExpObject::RegExpObject(QV4::ExecutionEngine *engine, QV4::RegExp *value, bool global)
+ : Heap::Object(engine->emptyClass, engine->regExpPrototype.asObject())
+ , value(value->d())
, global(global)
{
- setVTable(staticVTable());
-
Scope scope(engine);
- Scoped<RegExpObject> o(scope, this);
+ Scoped<QV4::RegExpObject> o(scope, this);
o->init(engine);
}
// Converts a QRegExp to a JS RegExp.
// The conversion is not 100% exact since ECMA regexp and QRegExp
// have different semantics/flags, but we try to do our best.
-RegExpObject::Data::Data(ExecutionEngine *engine, const QRegExp &re)
- : Object::Data(engine->regExpClass)
+Heap::RegExpObject::RegExpObject(QV4::ExecutionEngine *engine, const QRegExp &re)
+ : Heap::Object(engine->emptyClass, engine->regExpPrototype.asObject())
{
- setVTable(staticVTable());
-
value = 0;
global = false;
@@ -137,9 +131,9 @@ RegExpObject::Data::Data(ExecutionEngine *engine, const QRegExp &re)
}
Scope scope(engine);
- Scoped<RegExpObject> o(scope, this);
+ Scoped<QV4::RegExpObject> o(scope, this);
- o->d()->value = reinterpret_cast<RegExp *>(RegExp::create(engine, pattern, re.caseSensitivity() == Qt::CaseInsensitive, false));
+ o->d()->value = QV4::RegExp::create(engine, pattern, re.caseSensitivity() == Qt::CaseInsensitive, false);
o->init(engine);
}
@@ -151,11 +145,11 @@ void RegExpObject::init(ExecutionEngine *engine)
ScopedString lastIndex(scope, engine->newIdentifier(QStringLiteral("lastIndex")));
ScopedValue v(scope, Primitive::fromInt32(0));
- insertMember(lastIndex.getPointer(), v, Attr_NotEnumerable|Attr_NotConfigurable);
+ insertMember(lastIndex, v, Attr_NotEnumerable|Attr_NotConfigurable);
if (!this->value())
return;
- QString p = this->value()->pattern();
+ QString p = this->value()->pattern;
if (p.isEmpty()) {
p = QStringLiteral("(?:)");
} else {
@@ -165,23 +159,22 @@ void RegExpObject::init(ExecutionEngine *engine)
defineReadonlyProperty(QStringLiteral("source"), (v = engine->newString(p)));
defineReadonlyProperty(QStringLiteral("global"), Primitive::fromBoolean(global()));
- defineReadonlyProperty(QStringLiteral("ignoreCase"), Primitive::fromBoolean(this->value()->ignoreCase()));
- defineReadonlyProperty(QStringLiteral("multiline"), Primitive::fromBoolean(this->value()->multiLine()));
+ defineReadonlyProperty(QStringLiteral("ignoreCase"), Primitive::fromBoolean(this->value()->ignoreCase));
+ defineReadonlyProperty(QStringLiteral("multiline"), Primitive::fromBoolean(this->value()->multiLine));
}
-void RegExpObject::markObjects(Managed *that, ExecutionEngine *e)
+void RegExpObject::markObjects(Heap::Base *that, ExecutionEngine *e)
{
- RegExpObject *re = static_cast<RegExpObject*>(that);
- if (re->value())
- re->value()->mark(e);
+ RegExpObject::Data *re = static_cast<RegExpObject::Data *>(that);
+ if (re->value)
+ re->value->mark(e);
Object::markObjects(that, e);
}
-Property *RegExpObject::lastIndexProperty(ExecutionContext *ctx)
+Property *RegExpObject::lastIndexProperty()
{
- Q_UNUSED(ctx);
- Q_ASSERT(0 == internalClass()->find(ctx->d()->engine->newIdentifier(QStringLiteral("lastIndex"))));
+ Q_ASSERT(0 == internalClass()->find(engine()->id_lastIndex));
return propertyAt(0);
}
@@ -190,8 +183,8 @@ Property *RegExpObject::lastIndexProperty(ExecutionContext *ctx)
// have different semantics/flags, but we try to do our best.
QRegExp RegExpObject::toQRegExp() const
{
- Qt::CaseSensitivity caseSensitivity = value()->ignoreCase() ? Qt::CaseInsensitive : Qt::CaseSensitive;
- return QRegExp(value()->pattern(), caseSensitivity, QRegExp::RegExp2);
+ Qt::CaseSensitivity caseSensitivity = value()->ignoreCase ? Qt::CaseInsensitive : Qt::CaseSensitive;
+ return QRegExp(value()->pattern, caseSensitivity, QRegExp::RegExp2);
}
QString RegExpObject::toString() const
@@ -200,9 +193,9 @@ QString RegExpObject::toString() const
result += QLatin1Char('/');
if (global())
result += QLatin1Char('g');
- if (value()->ignoreCase())
+ if (value()->ignoreCase)
result += QLatin1Char('i');
- if (value()->multiLine())
+ if (value()->multiLine)
result += QLatin1Char('m');
return result;
}
@@ -211,7 +204,7 @@ QString RegExpObject::source() const
{
Scope scope(engine());
ScopedString source(scope, scope.engine->newIdentifier(QStringLiteral("source")));
- ScopedValue s(scope, const_cast<RegExpObject *>(this)->get(source.getPointer()));
+ ScopedValue s(scope, const_cast<RegExpObject *>(this)->get(source));
return s->toQString();
}
@@ -220,23 +213,22 @@ uint RegExpObject::flags() const
uint f = 0;
if (global())
f |= QV4::RegExpObject::RegExp_Global;
- if (value()->ignoreCase())
+ if (value()->ignoreCase)
f |= QV4::RegExpObject::RegExp_IgnoreCase;
- if (value()->multiLine())
+ if (value()->multiLine)
f |= QV4::RegExpObject::RegExp_Multiline;
return f;
}
DEFINE_OBJECT_VTABLE(RegExpCtor);
-RegExpCtor::Data::Data(ExecutionContext *scope)
- : FunctionObject::Data(scope, QStringLiteral("RegExp"))
+Heap::RegExpCtor::RegExpCtor(QV4::ExecutionContext *scope)
+ : Heap::FunctionObject(scope, QStringLiteral("RegExp"))
{
- setVTable(staticVTable());
clearLastMatch();
}
-void RegExpCtor::Data::clearLastMatch()
+void Heap::RegExpCtor::clearLastMatch()
{
lastMatch = Primitive::nullValue();
lastInput = internalClass->engine->id_empty;
@@ -246,22 +238,23 @@ void RegExpCtor::Data::clearLastMatch()
ReturnedValue RegExpCtor::construct(Managed *m, CallData *callData)
{
- ExecutionContext *ctx = m->engine()->currentContext();
- Scope scope(ctx);
+ Scope scope(static_cast<Object *>(m)->engine());
+ ScopedContext ctx(scope, scope.engine->currentContext());
ScopedValue r(scope, callData->argument(0));
ScopedValue f(scope, callData->argument(1));
Scoped<RegExpObject> re(scope, r);
if (re) {
if (!f->isUndefined())
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
- return Encode(ctx->d()->engine->newRegExpObject(re->value(), re->global()));
+ Scoped<RegExp> regexp(scope, re->value());
+ return Encode(ctx->d()->engine->newRegExpObject(regexp, re->global()));
}
QString pattern;
if (!r->isUndefined())
- pattern = r->toString(ctx)->toQString();
+ pattern = r->toQString();
if (scope.hasException())
return Encode::undefined();
@@ -269,7 +262,7 @@ ReturnedValue RegExpCtor::construct(Managed *m, CallData *callData)
bool ignoreCase = false;
bool multiLine = false;
if (!f->isUndefined()) {
- f = RuntimeHelpers::toString(ctx, f);
+ f = RuntimeHelpers::toString(scope.engine, f);
if (scope.hasException())
return Encode::undefined();
QString str = f->stringValue()->toQString();
@@ -281,14 +274,14 @@ ReturnedValue RegExpCtor::construct(Managed *m, CallData *callData)
} else if (str.at(i) == QLatin1Char('m') && !multiLine) {
multiLine = true;
} else {
- return ctx->throwSyntaxError(QStringLiteral("Invalid flags supplied to RegExp constructor"));
+ return ctx->engine()->throwSyntaxError(QStringLiteral("Invalid flags supplied to RegExp constructor"));
}
}
}
Scoped<RegExp> regexp(scope, RegExp::create(ctx->d()->engine, pattern, ignoreCase, multiLine));
if (!regexp->isValid())
- return ctx->throwSyntaxError(QStringLiteral("Invalid regular expression"));
+ return ctx->engine()->throwSyntaxError(QStringLiteral("Invalid regular expression"));
return Encode(ctx->d()->engine->newRegExpObject(regexp, global));
}
@@ -303,11 +296,11 @@ ReturnedValue RegExpCtor::call(Managed *that, CallData *callData)
return construct(that, callData);
}
-void RegExpCtor::markObjects(Managed *that, ExecutionEngine *e)
+void RegExpCtor::markObjects(Heap::Base *that, ExecutionEngine *e)
{
- RegExpCtor *This = static_cast<RegExpCtor*>(that);
- This->lastMatch().mark(e);
- This->lastInput().mark(e);
+ RegExpCtor::Data *This = static_cast<RegExpCtor::Data *>(that);
+ This->lastMatch.mark(e);
+ This->lastInput.mark(e);
FunctionObject::markObjects(that, e);
}
@@ -351,47 +344,47 @@ void RegExpPrototype::init(ExecutionEngine *engine, Object *constructor)
ReturnedValue RegExpPrototype::method_exec(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<RegExpObject> r(scope, ctx->d()->callData->thisObject.as<RegExpObject>());
+ Scoped<RegExpObject> r(scope, ctx->thisObject().as<RegExpObject>());
if (!r)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
ScopedValue arg(scope, ctx->argument(0));
- arg = RuntimeHelpers::toString(ctx, arg);
+ arg = RuntimeHelpers::toString(scope.engine, arg);
if (scope.hasException())
return Encode::undefined();
QString s = arg->stringValue()->toQString();
- int offset = r->global() ? r->lastIndexProperty(ctx)->value.toInt32() : 0;
+ int offset = r->global() ? r->lastIndexProperty()->value.toInt32() : 0;
if (offset < 0 || offset > s.length()) {
- r->lastIndexProperty(ctx)->value = Primitive::fromInt32(0);
+ r->lastIndexProperty()->value = Primitive::fromInt32(0);
return Encode::null();
}
uint* matchOffsets = (uint*)alloca(r->value()->captureCount() * 2 * sizeof(uint));
- const int result = r->value()->match(s, offset, matchOffsets);
+ const int result = Scoped<RegExp>(scope, r->value())->match(s, offset, matchOffsets);
Scoped<RegExpCtor> regExpCtor(scope, ctx->d()->engine->regExpCtor);
regExpCtor->d()->clearLastMatch();
if (result == -1) {
- r->lastIndexProperty(ctx)->value = Primitive::fromInt32(0);
+ r->lastIndexProperty()->value = Primitive::fromInt32(0);
return Encode::null();
}
// fill in result data
- Scoped<ArrayObject> array(scope, ctx->d()->engine->newArrayObject(ctx->d()->engine->regExpExecArrayClass));
+ ScopedArrayObject array(scope, scope.engine->newArrayObject(scope.engine->regExpExecArrayClass, scope.engine->arrayPrototype.asObject()));
int len = r->value()->captureCount();
array->arrayReserve(len);
ScopedValue v(scope);
for (int i = 0; i < len; ++i) {
int start = matchOffsets[i * 2];
int end = matchOffsets[i * 2 + 1];
- v = (start != -1 && end != -1) ? ctx->d()->engine->newString(s.mid(start, end - start))->asReturnedValue() : Encode::undefined();
+ v = (start != -1) ? ctx->d()->engine->newString(s.mid(start, end - start))->asReturnedValue() : Encode::undefined();
array->arrayPut(i, v);
}
array->setArrayLengthUnchecked(len);
- array->memberData()[Index_ArrayIndex] = Primitive::fromInt32(result);
- array->memberData()[Index_ArrayInput] = arg.asReturnedValue();
+ array->memberData()->data[Index_ArrayIndex] = Primitive::fromInt32(result);
+ array->memberData()->data[Index_ArrayInput] = arg;
RegExpCtor::Data *dd = regExpCtor->d();
dd->lastMatch = array;
@@ -400,7 +393,7 @@ ReturnedValue RegExpPrototype::method_exec(CallContext *ctx)
dd->lastMatchEnd = matchOffsets[1];
if (r->global())
- r->lastIndexProperty(ctx)->value = Primitive::fromInt32(matchOffsets[1]);
+ r->lastIndexProperty()->value = Primitive::fromInt32(matchOffsets[1]);
return array.asReturnedValue();
}
@@ -415,9 +408,9 @@ ReturnedValue RegExpPrototype::method_test(CallContext *ctx)
ReturnedValue RegExpPrototype::method_toString(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<RegExpObject> r(scope, ctx->d()->callData->thisObject.as<RegExpObject>());
+ Scoped<RegExpObject> r(scope, ctx->thisObject().as<RegExpObject>());
if (!r)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
return ctx->d()->engine->newString(r->toString())->asReturnedValue();
}
@@ -425,12 +418,12 @@ ReturnedValue RegExpPrototype::method_toString(CallContext *ctx)
ReturnedValue RegExpPrototype::method_compile(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<RegExpObject> r(scope, ctx->d()->callData->thisObject.as<RegExpObject>());
+ Scoped<RegExpObject> r(scope, ctx->thisObject().as<RegExpObject>());
if (!r)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
- ScopedCallData callData(scope, ctx->d()->callData->argc);
- memcpy(callData->args, ctx->d()->callData->args, ctx->d()->callData->argc*sizeof(Value));
+ ScopedCallData callData(scope, ctx->argc());
+ memcpy(callData->args, ctx->args(), ctx->argc()*sizeof(Value));
Scoped<RegExpObject> re(scope, ctx->d()->engine->regExpCtor.asFunctionObject()->construct(callData));
@@ -446,8 +439,8 @@ ReturnedValue RegExpPrototype::method_get_lastMatch_n(CallContext *ctx)
ScopedArrayObject lastMatch(scope, static_cast<RegExpCtor*>(ctx->d()->engine->regExpCtor.objectValue())->lastMatch());
ScopedValue result(scope, lastMatch ? lastMatch->getIndexed(index) : Encode::undefined());
if (result->isUndefined())
- return ctx->d()->engine->newString(QString())->asReturnedValue();
- return result.asReturnedValue();
+ return ctx->d()->engine->newString()->asReturnedValue();
+ return result->asReturnedValue();
}
ReturnedValue RegExpPrototype::method_get_lastParen(CallContext *ctx)
@@ -456,8 +449,8 @@ ReturnedValue RegExpPrototype::method_get_lastParen(CallContext *ctx)
ScopedArrayObject lastMatch(scope, static_cast<RegExpCtor*>(ctx->d()->engine->regExpCtor.objectValue())->lastMatch());
ScopedValue result(scope, lastMatch ? lastMatch->getIndexed(lastMatch->getLength() - 1) : Encode::undefined());
if (result->isUndefined())
- return ctx->d()->engine->newString(QString())->asReturnedValue();
- return result.asReturnedValue();
+ return ctx->d()->engine->newString()->asReturnedValue();
+ return result->asReturnedValue();
}
ReturnedValue RegExpPrototype::method_get_input(CallContext *ctx)
diff --git a/src/qml/jsruntime/qv4regexpobject_p.h b/src/qml/jsruntime/qv4regexpobject_p.h
index e2f8049157..f5f255faf5 100644
--- a/src/qml/jsruntime/qv4regexpobject_p.h
+++ b/src/qml/jsruntime/qv4regexpobject_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -43,7 +43,6 @@
#include "qv4managed_p.h"
#include "qv4property_p.h"
#include "qv4objectiterator_p.h"
-#include "qv4regexp_p.h"
#include <QtCore/QString>
#include <QtCore/QHash>
@@ -55,16 +54,35 @@ QT_BEGIN_NAMESPACE
namespace QV4 {
-struct RegExpObject: Object {
- struct Data : Object::Data {
- Data(ExecutionEngine *engine, RegExp *value, bool global);
- Data(ExecutionEngine *engine, const QRegExp &re);
- Data(InternalClass *ic);
+namespace Heap {
- RegExp *value;
- bool global;
- };
- V4_OBJECT(Object)
+struct RegExpObject : Object {
+ RegExpObject(InternalClass *ic, QV4::Object *prototype);
+ RegExpObject(QV4::ExecutionEngine *engine, QV4::RegExp *value, bool global);
+ RegExpObject(QV4::ExecutionEngine *engine, const QRegExp &re);
+
+ RegExp *value;
+ bool global;
+};
+
+struct RegExpCtor : FunctionObject {
+ RegExpCtor(QV4::ExecutionContext *scope);
+ Value lastMatch;
+ StringValue lastInput;
+ int lastMatchStart;
+ int lastMatchEnd;
+ void clearLastMatch();
+};
+
+struct RegExpPrototype : RegExpObject
+{
+ inline RegExpPrototype(ExecutionEngine *e);
+};
+
+}
+
+struct RegExpObject: Object {
+ V4_OBJECT2(RegExpObject, Object)
Q_MANAGED_TYPE(RegExpObject)
// needs to be compatible with the flags in qv4jsir_p.h
@@ -75,36 +93,28 @@ struct RegExpObject: Object {
};
enum {
- Index_ArrayIndex = ArrayObject::LengthPropertyIndex + 1,
+ Index_ArrayIndex = Heap::ArrayObject::LengthPropertyIndex + 1,
Index_ArrayInput = Index_ArrayIndex + 1
};
- RegExp *value() const { return d()->value; }
+ Heap::RegExp *value() const { return d()->value; }
bool global() const { return d()->global; }
void init(ExecutionEngine *engine);
- Property *lastIndexProperty(ExecutionContext *ctx);
+ Property *lastIndexProperty();
QRegExp toQRegExp() const;
QString toString() const;
QString source() const;
uint flags() const;
protected:
- static void markObjects(Managed *that, ExecutionEngine *e);
+ static void markObjects(Heap::Base *that, ExecutionEngine *e);
};
struct RegExpCtor: FunctionObject
{
- struct Data : FunctionObject::Data {
- Data(ExecutionContext *scope);
- Value lastMatch;
- StringValue lastInput;
- int lastMatchStart;
- int lastMatchEnd;
- void clearLastMatch();
- };
- V4_OBJECT(FunctionObject)
+ V4_OBJECT2(RegExpCtor, FunctionObject)
Value lastMatch() { return d()->lastMatch; }
StringValue lastInput() { return d()->lastInput; }
@@ -113,19 +123,12 @@ struct RegExpCtor: FunctionObject
static ReturnedValue construct(Managed *m, CallData *callData);
static ReturnedValue call(Managed *that, CallData *callData);
- static void markObjects(Managed *that, ExecutionEngine *e);
+ static void markObjects(Heap::Base *that, ExecutionEngine *e);
};
struct RegExpPrototype: RegExpObject
{
- struct Data : RegExpObject::Data
- {
- Data(InternalClass *ic): RegExpObject::Data(ic)
- {
- setVTable(staticVTable());
- }
- };
- V4_OBJECT(RegExpObject)
+ V4_OBJECT2(RegExpPrototype, RegExpObject)
void init(ExecutionEngine *engine, Object *ctor);
@@ -142,6 +145,11 @@ struct RegExpPrototype: RegExpObject
static ReturnedValue method_get_rightContext(CallContext *ctx);
};
+inline Heap::RegExpPrototype::RegExpPrototype(ExecutionEngine *e)
+ : RegExpObject(e->emptyClass, e->objectPrototype.asObject())
+{
+}
+
}
QT_END_NAMESPACE
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index b019d4db14..b66e917b87 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -35,11 +35,11 @@
#include "qv4runtime_p.h"
#ifndef V4_BOOTSTRAP
#include "qv4object_p.h"
-#include "qv4jsir_p.h"
#include "qv4objectproto_p.h"
#include "qv4globalobject_p.h"
#include "qv4stringobject_p.h"
#include "qv4argumentsobject_p.h"
+#include "qv4objectiterator_p.h"
#include "qv4lookup_p.h"
#include "qv4function_p.h"
#include "private/qlocale_tools_p.h"
@@ -50,16 +50,20 @@
#include <private/qv8engine_p.h>
#endif
-#include <QtCore/qmath.h>
-#include <QtCore/qnumeric.h>
#include <QtCore/QDebug>
-#include <cstdio>
#include <cassert>
-#include <typeinfo>
+#include <cstdio>
#include <stdlib.h>
+#include <wtf/MathExtras.h>
+
#include "../../3rdparty/double-conversion/double-conversion.h"
+#ifdef QV4_COUNT_RUNTIME_FUNCTIONS
+# include <QtCore/QBuffer>
+# include <QtCore/QDebug>
+#endif // QV4_COUNT_RUNTIME_FUNCTIONS
+
QT_BEGIN_NAMESPACE
namespace QV4 {
@@ -144,7 +148,9 @@ struct RuntimeCounters::Data {
};
void dump() const {
- QTextStream outs(stderr, QIODevice::WriteOnly);
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ QTextStream outs(&buf);
QList<Line> lines;
foreach (const char *func, counters.keys()) {
const Counters &fCount = counters[func];
@@ -159,7 +165,7 @@ struct RuntimeCounters::Data {
lines.append(line);
}
}
- qSort(lines.begin(), lines.end(), Line::less);
+ std::sort(lines.begin(), lines.end(), Line::less);
outs << lines.size() << " counters:" << endl;
foreach (const Line &line, lines)
outs << qSetFieldWidth(10) << line.count << qSetFieldWidth(0)
@@ -167,6 +173,7 @@ struct RuntimeCounters::Data {
<< " | " << pretty(line.tag1)
<< " | " << pretty(line.tag2)
<< endl;
+ qDebug("%s", buf.data().constData());
}
};
@@ -256,84 +263,92 @@ void RuntimeHelpers::numberToString(QString *result, double num, int radix)
result->prepend(QLatin1Char('-'));
}
-ReturnedValue Runtime::closure(ExecutionContext *ctx, int functionId)
+ReturnedValue Runtime::closure(ExecutionEngine *engine, int functionId)
{
- QV4::Function *clos = ctx->d()->compilationUnit->runtimeFunctions[functionId];
+ QV4::Function *clos = engine->currentContext()->compilationUnit->runtimeFunctions[functionId];
Q_ASSERT(clos);
- return FunctionObject::createScriptFunction(ctx, clos)->asReturnedValue();
+ Scope scope(engine);
+ return FunctionObject::createScriptFunction(ScopedContext(scope, engine->currentContext()), clos)->asReturnedValue();
}
-ReturnedValue Runtime::deleteElement(ExecutionContext *ctx, const ValueRef base, const ValueRef index)
+ReturnedValue Runtime::deleteElement(ExecutionEngine *engine, const Value &base, const Value &index)
{
- Scope scope(ctx);
+ Scope scope(engine);
ScopedObject o(scope, base);
if (o) {
- uint n = index->asArrayIndex();
+ uint n = index.asArrayIndex();
if (n < UINT_MAX) {
return Encode((bool)o->deleteIndexedProperty(n));
}
}
- ScopedString name(scope, index->toString(ctx));
- return Runtime::deleteMember(ctx, base, name.getPointer());
+ ScopedString name(scope, index.toString(engine));
+ return Runtime::deleteMemberString(engine, base, name);
}
-ReturnedValue Runtime::deleteMember(ExecutionContext *ctx, const ValueRef base, String *name)
+ReturnedValue Runtime::deleteMember(ExecutionEngine *engine, const Value &base, int nameIndex)
{
- Scope scope(ctx);
- ScopedObject obj(scope, base->toObject(ctx));
+ Scope scope(engine);
+ ScopedString name(scope, engine->currentContext()->compilationUnit->runtimeStrings[nameIndex]);
+ return deleteMemberString(engine, base, name);
+}
+
+ReturnedValue Runtime::deleteMemberString(ExecutionEngine *engine, const Value &base, String *name)
+{
+ Scope scope(engine);
+ ScopedObject obj(scope, base.toObject(engine));
if (scope.engine->hasException)
return Encode::undefined();
return Encode(obj->deleteProperty(name));
}
-ReturnedValue Runtime::deleteName(ExecutionContext *ctx, String *name)
+ReturnedValue Runtime::deleteName(ExecutionEngine *engine, int nameIndex)
{
- Scope scope(ctx);
+ Scope scope(engine);
+ ScopedString name(scope, engine->currentContext()->compilationUnit->runtimeStrings[nameIndex]);
+ ScopedContext ctx(scope, engine->currentContext());
return Encode(ctx->deleteProperty(name));
}
-QV4::ReturnedValue Runtime::instanceof(ExecutionContext *ctx, const ValueRef left, const ValueRef right)
+QV4::ReturnedValue Runtime::instanceof(ExecutionEngine *engine, const Value &left, const Value &right)
{
- // As nothing in this method can call into the memory manager, avoid using a Scope
- // for performance reasons
-
- FunctionObject *f = right->asFunctionObject();
+ Scope scope(engine);
+ ScopedFunctionObject f(scope, right.asFunctionObject());
if (!f)
- return ctx->throwTypeError();
+ return engine->throwTypeError();
- if (f->subtype() == FunctionObject::BoundFunction)
- f = static_cast<BoundFunction *>(f)->target();
+ if (f->isBoundFunction())
+ f = static_cast<BoundFunction *>(f.getPointer())->target();
- Object *v = left->asObject();
+ ScopedObject v(scope, left.asObject());
if (!v)
return Encode(false);
- Object *o = QV4::Value::fromReturnedValue(f->protoProperty()).asObject();
+ ScopedObject o(scope, f->protoProperty());
if (!o)
- return ctx->throwTypeError();
+ return engine->throwTypeError();
while (v) {
v = v->prototype();
if (!v)
break;
- else if (o == v)
+ else if (o->d() == v->d())
return Encode(true);
}
return Encode(false);
}
-QV4::ReturnedValue Runtime::in(ExecutionContext *ctx, const ValueRef left, const ValueRef right)
+QV4::ReturnedValue Runtime::in(ExecutionEngine *engine, const Value &left, const Value &right)
{
- if (!right->isObject())
- return ctx->throwTypeError();
- Scope scope(ctx);
- ScopedString s(scope, left->toString(ctx));
+ if (!right.isObject())
+ return engine->throwTypeError();
+ Scope scope(engine);
+ ScopedString s(scope, left.toString(engine));
if (scope.hasException())
return Encode::undefined();
- bool r = right->objectValue()->hasProperty(s.getPointer());
+ bool r = right.objectValue()->hasProperty(s);
return Encode(r);
}
@@ -358,11 +373,11 @@ double RuntimeHelpers::stringToNumber(const QString &string)
return d;
}
-Returned<String> *RuntimeHelpers::stringFromNumber(ExecutionContext *ctx, double number)
+Heap::String *RuntimeHelpers::stringFromNumber(ExecutionEngine *engine, double number)
{
QString qstr;
RuntimeHelpers::numberToString(&qstr, number, 10);
- return ctx->engine()->newString(qstr);
+ return engine->newString(qstr);
}
ReturnedValue RuntimeHelpers::objectDefaultValue(Object *object, int typeHint)
@@ -384,8 +399,7 @@ ReturnedValue RuntimeHelpers::objectDefaultValue(Object *object, int typeHint)
if (typeHint == NUMBER_HINT)
qSwap(meth1, meth2);
- ExecutionContext *ctx = engine->currentContext();
- Scope scope(ctx);
+ Scope scope(engine);
ScopedCallData callData(scope, 0);
callData->thisObject = object;
@@ -406,161 +420,165 @@ ReturnedValue RuntimeHelpers::objectDefaultValue(Object *object, int typeHint)
return r->asReturnedValue();
}
- return ctx->throwTypeError();
+ return engine->throwTypeError();
}
-Returned<Object> *RuntimeHelpers::convertToObject(ExecutionContext *ctx, const ValueRef value)
+Heap::Object *RuntimeHelpers::convertToObject(ExecutionEngine *engine, const Value &value)
{
- assert(!value->isObject());
- switch (value->type()) {
+ Q_ASSERT(!value.isObject());
+ switch (value.type()) {
case Value::Undefined_Type:
case Value::Null_Type:
- ctx->throwTypeError();
+ engine->throwTypeError();
return 0;
case Value::Boolean_Type:
- return ctx->engine()->newBooleanObject(value);
+ return engine->newBooleanObject(value.booleanValue());
case Value::Managed_Type:
- Q_ASSERT(value->isString());
- return ctx->engine()->newStringObject(value);
+ Q_ASSERT(value.isString());
+ return engine->newStringObject(value);
case Value::Integer_Type:
default: // double
- return ctx->engine()->newNumberObject(value);
+ return engine->newNumberObject(value.asDouble());
}
}
-Returned<String> *RuntimeHelpers::convertToString(ExecutionContext *ctx, const ValueRef value)
+Heap::String *RuntimeHelpers::convertToString(ExecutionEngine *engine, const Value &value)
{
- switch (value->type()) {
+ switch (value.type()) {
case Value::Empty_Type:
Q_ASSERT(!"empty Value encountered");
case Value::Undefined_Type:
- return ctx->engine()->id_undefined.ret();
+ return engine->id_undefined->d();
case Value::Null_Type:
- return ctx->engine()->id_null.ret();
+ return engine->id_null->d();
case Value::Boolean_Type:
- if (value->booleanValue())
- return ctx->engine()->id_true.ret();
+ if (value.booleanValue())
+ return engine->id_true->d();
else
- return ctx->engine()->id_false.ret();
+ return engine->id_false->d();
case Value::Managed_Type:
- if (value->isString())
- return value->stringValue()->asReturned<String>();
+ if (value.isString())
+ return value.stringValue()->d();
{
- Scope scope(ctx);
+ Scope scope(engine);
ScopedValue prim(scope, RuntimeHelpers::toPrimitive(value, STRING_HINT));
- return RuntimeHelpers::convertToString(ctx, prim);
+ return RuntimeHelpers::convertToString(engine, prim);
}
case Value::Integer_Type:
- return RuntimeHelpers::stringFromNumber(ctx, value->int_32);
+ return RuntimeHelpers::stringFromNumber(engine, value.int_32);
default: // double
- return RuntimeHelpers::stringFromNumber(ctx, value->doubleValue());
+ return RuntimeHelpers::stringFromNumber(engine, value.doubleValue());
} // switch
}
// This is slightly different from the method above, as
// the + operator requires a slightly different conversion
-static Returned<String> *convert_to_string_add(ExecutionContext *ctx, const ValueRef value)
+static Heap::String *convert_to_string_add(ExecutionEngine *engine, const Value &value)
{
- switch (value->type()) {
+ switch (value.type()) {
case Value::Empty_Type:
Q_ASSERT(!"empty Value encountered");
case Value::Undefined_Type:
- return ctx->engine()->id_undefined.ret();
+ return engine->id_undefined->d();
case Value::Null_Type:
- return ctx->engine()->id_null.ret();
+ return engine->id_null->d();
case Value::Boolean_Type:
- if (value->booleanValue())
- return ctx->engine()->id_true.ret();
+ if (value.booleanValue())
+ return engine->id_true->d();
else
- return ctx->engine()->id_false.ret();
+ return engine->id_false->d();
case Value::Managed_Type:
- if (value->isString())
- return value->stringValue()->asReturned<String>();
+ if (value.isString())
+ return value.stringValue()->d();
{
- Scope scope(ctx);
+ Scope scope(engine);
ScopedValue prim(scope, RuntimeHelpers::toPrimitive(value, PREFERREDTYPE_HINT));
- return RuntimeHelpers::convertToString(ctx, prim);
+ return RuntimeHelpers::convertToString(engine, prim);
}
case Value::Integer_Type:
- return RuntimeHelpers::stringFromNumber(ctx, value->int_32);
+ return RuntimeHelpers::stringFromNumber(engine, value.int_32);
default: // double
- return RuntimeHelpers::stringFromNumber(ctx, value->doubleValue());
+ return RuntimeHelpers::stringFromNumber(engine, value.doubleValue());
} // switch
}
-QV4::ReturnedValue RuntimeHelpers::addHelper(ExecutionContext *ctx, const ValueRef left, const ValueRef right)
+QV4::ReturnedValue RuntimeHelpers::addHelper(ExecutionEngine *engine, const Value &left, const Value &right)
{
- Scope scope(ctx);
+ Scope scope(engine);
ScopedValue pleft(scope, RuntimeHelpers::toPrimitive(left, PREFERREDTYPE_HINT));
ScopedValue pright(scope, RuntimeHelpers::toPrimitive(right, PREFERREDTYPE_HINT));
if (pleft->isString() || pright->isString()) {
if (!pleft->isString())
- pleft = convert_to_string_add(ctx, pleft);
+ pleft = convert_to_string_add(engine, pleft);
if (!pright->isString())
- pright = convert_to_string_add(ctx, pright);
+ pright = convert_to_string_add(engine, pright);
if (scope.engine->hasException)
return Encode::undefined();
if (!pleft->stringValue()->d()->length())
return pright->asReturnedValue();
if (!pright->stringValue()->d()->length())
return pleft->asReturnedValue();
- return (ctx->engine()->memoryManager->alloc<String>(ctx->d()->engine, pleft->stringValue(), pright->stringValue()))->asReturnedValue();
+ MemoryManager *mm = engine->memoryManager;
+ return (mm->alloc<String>(mm, pleft->stringValue()->d(), pright->stringValue()->d()))->asReturnedValue();
}
double x = RuntimeHelpers::toNumber(pleft);
double y = RuntimeHelpers::toNumber(pright);
return Encode(x + y);
}
-QV4::ReturnedValue Runtime::addString(QV4::ExecutionContext *ctx, const QV4::ValueRef left, const QV4::ValueRef right)
+QV4::ReturnedValue Runtime::addString(ExecutionEngine *engine, const Value &left, const Value &right)
{
- Q_ASSERT(left->isString() || right->isString());
+ Q_ASSERT(left.isString() || right.isString());
- if (left->isString() && right->isString()) {
- if (!left->stringValue()->d()->length())
- return right->asReturnedValue();
- if (!right->stringValue()->d()->length())
- return left->asReturnedValue();
- return (ctx->engine()->memoryManager->alloc<String>(ctx->d()->engine, left->stringValue(), right->stringValue()))->asReturnedValue();
+ if (left.isString() && right.isString()) {
+ if (!left.stringValue()->d()->length())
+ return right.asReturnedValue();
+ if (!right.stringValue()->d()->length())
+ return left.asReturnedValue();
+ MemoryManager *mm = engine->memoryManager;
+ return (mm->alloc<String>(mm, left.stringValue()->d(), right.stringValue()->d()))->asReturnedValue();
}
- Scope scope(ctx);
- ScopedValue pleft(scope, *left);
- ScopedValue pright(scope, *right);
+ Scope scope(engine);
+ ScopedValue pleft(scope, left);
+ ScopedValue pright(scope, right);
if (!pleft->isString())
- pleft = convert_to_string_add(ctx, left);
+ pleft = convert_to_string_add(engine, left);
if (!pright->isString())
- pright = convert_to_string_add(ctx, right);
+ pright = convert_to_string_add(engine, right);
if (scope.engine->hasException)
return Encode::undefined();
if (!pleft->stringValue()->d()->length())
return pright->asReturnedValue();
if (!pright->stringValue()->d()->length())
return pleft->asReturnedValue();
- return (ctx->engine()->memoryManager->alloc<String>(ctx->d()->engine, pleft->stringValue(), pright->stringValue()))->asReturnedValue();
+ MemoryManager *mm = engine->memoryManager;
+ return (mm->alloc<String>(mm, pleft->stringValue()->d(), pright->stringValue()->d()))->asReturnedValue();
}
-void Runtime::setProperty(ExecutionContext *ctx, const ValueRef object, String *name, const ValueRef value)
+void Runtime::setProperty(ExecutionEngine *engine, const Value &object, int nameIndex, const Value &value)
{
- Scope scope(ctx);
- ScopedObject o(scope, object->toObject(ctx));
+ Scope scope(engine);
+ ScopedString name(scope, engine->currentContext()->compilationUnit->runtimeStrings[nameIndex]);
+ ScopedObject o(scope, object.toObject(engine));
if (!o)
return;
o->put(name, value);
}
-ReturnedValue Runtime::getElement(ExecutionContext *ctx, const ValueRef object, const ValueRef index)
+ReturnedValue Runtime::getElement(ExecutionEngine *engine, const Value &object, const Value &index)
{
- Scope scope(ctx);
- uint idx = index->asArrayIndex();
+ Scope scope(engine);
+ uint idx = index.asArrayIndex();
- Scoped<Object> o(scope, object);
+ ScopedObject o(scope, object);
if (!o) {
if (idx < UINT_MAX) {
- if (String *str = object->asString()) {
+ if (String *str = object.asString()) {
if (idx >= (uint)str->toQString().length()) {
return Encode::undefined();
}
@@ -569,18 +587,18 @@ ReturnedValue Runtime::getElement(ExecutionContext *ctx, const ValueRef object,
}
}
- if (object->isNullOrUndefined()) {
- QString message = QStringLiteral("Cannot read property '%1' of %2").arg(index->toQStringNoThrow()).arg(object->toQStringNoThrow());
- return ctx->throwTypeError(message);
+ if (object.isNullOrUndefined()) {
+ QString message = QStringLiteral("Cannot read property '%1' of %2").arg(index.toQStringNoThrow()).arg(object.toQStringNoThrow());
+ return engine->throwTypeError(message);
}
- o = RuntimeHelpers::convertToObject(ctx, object);
+ o = RuntimeHelpers::convertToObject(scope.engine, object);
if (!o) // type error
return Encode::undefined();
}
if (idx < UINT_MAX) {
- if (o->arrayData() && !o->arrayData()->hasAttributes()) {
+ if (o->arrayData() && !o->arrayData()->attrs) {
ScopedValue v(scope, o->arrayData()->get(idx));
if (!v->isEmpty())
return v->asReturnedValue();
@@ -589,24 +607,24 @@ ReturnedValue Runtime::getElement(ExecutionContext *ctx, const ValueRef object,
return o->getIndexed(idx);
}
- ScopedString name(scope, index->toString(ctx));
+ ScopedString name(scope, index.toString(engine));
if (scope.hasException())
return Encode::undefined();
- return o->get(name.getPointer());
+ return o->get(name);
}
-void Runtime::setElement(ExecutionContext *ctx, const ValueRef object, const ValueRef index, const ValueRef value)
+void Runtime::setElement(ExecutionEngine *engine, const Value &object, const Value &index, const Value &value)
{
- Scope scope(ctx);
- ScopedObject o(scope, object->toObject(ctx));
+ Scope scope(engine);
+ ScopedObject o(scope, object.toObject(engine));
if (scope.engine->hasException)
return;
- uint idx = index->asArrayIndex();
+ uint idx = index.asArrayIndex();
if (idx < UINT_MAX) {
- if (o->arrayType() == ArrayData::Simple) {
- SimpleArrayData *s = static_cast<SimpleArrayData *>(o->arrayData());
- if (s && idx < s->len() && !s->data(idx).isEmpty()) {
+ if (o->arrayType() == Heap::ArrayData::Simple) {
+ Heap::SimpleArrayData *s = static_cast<Heap::SimpleArrayData *>(o->arrayData());
+ if (s && idx < s->len && !s->data(idx).isEmpty()) {
s->data(idx) = value;
return;
}
@@ -615,92 +633,98 @@ void Runtime::setElement(ExecutionContext *ctx, const ValueRef object, const Val
return;
}
- ScopedString name(scope, index->toString(ctx));
- o->put(name.getPointer(), value);
+ ScopedString name(scope, index.toString(engine));
+ o->put(name, value);
}
-ReturnedValue Runtime::foreachIterator(ExecutionContext *ctx, const ValueRef in)
+ReturnedValue Runtime::foreachIterator(ExecutionEngine *engine, const Value &in)
{
- Scope scope(ctx);
- Scoped<Object> o(scope, (Object *)0);
- if (!in->isNullOrUndefined())
- o = in->toObject(ctx);
- Scoped<Object> it(scope, ctx->engine()->newForEachIteratorObject(ctx, o));
- return it.asReturnedValue();
+ Scope scope(engine);
+ ScopedObject o(scope, (Object *)0);
+ if (!in.isNullOrUndefined())
+ o = in.toObject(engine);
+ return engine->newForEachIteratorObject(o)->asReturnedValue();
}
-ReturnedValue Runtime::foreachNextPropertyName(const ValueRef foreach_iterator)
+ReturnedValue Runtime::foreachNextPropertyName(const Value &foreach_iterator)
{
- Q_ASSERT(foreach_iterator->isObject());
+ Q_ASSERT(foreach_iterator.isObject());
- ForEachIteratorObject *it = static_cast<ForEachIteratorObject *>(foreach_iterator->objectValue());
+ ForEachIteratorObject *it = static_cast<ForEachIteratorObject *>(foreach_iterator.objectValue());
Q_ASSERT(it->as<ForEachIteratorObject>());
return it->nextPropertyName();
}
-void Runtime::setActivationProperty(ExecutionContext *ctx, String *name, const ValueRef value)
+void Runtime::setActivationProperty(ExecutionEngine *engine, int nameIndex, const Value &value)
{
+ Scope scope(engine);
+ ScopedString name(scope, engine->currentContext()->compilationUnit->runtimeStrings[nameIndex]);
+ ScopedContext ctx(scope, engine->currentContext());
ctx->setProperty(name, value);
}
-ReturnedValue Runtime::getProperty(ExecutionContext *ctx, const ValueRef object, String *name)
+ReturnedValue Runtime::getProperty(ExecutionEngine *engine, const Value &object, int nameIndex)
{
- Scope scope(ctx);
+ Scope scope(engine);
+ ScopedString name(scope, engine->currentContext()->compilationUnit->runtimeStrings[nameIndex]);
- Scoped<Object> o(scope, object);
+ ScopedObject o(scope, object);
if (o)
return o->get(name);
- if (object->isNullOrUndefined()) {
- QString message = QStringLiteral("Cannot read property '%1' of %2").arg(name->toQString()).arg(object->toQStringNoThrow());
- return ctx->throwTypeError(message);
+ if (object.isNullOrUndefined()) {
+ QString message = QStringLiteral("Cannot read property '%1' of %2").arg(name->toQString()).arg(object.toQStringNoThrow());
+ return engine->throwTypeError(message);
}
- o = RuntimeHelpers::convertToObject(ctx, object);
+ o = RuntimeHelpers::convertToObject(scope.engine, object);
if (!o) // type error
return Encode::undefined();
return o->get(name);
}
-ReturnedValue Runtime::getActivationProperty(ExecutionContext *ctx, String *name)
+ReturnedValue Runtime::getActivationProperty(ExecutionEngine *engine, int nameIndex)
{
+ Scope scope(engine);
+ ScopedString name(scope, engine->currentContext()->compilationUnit->runtimeStrings[nameIndex]);
+ ScopedContext ctx(scope, engine->currentContext());
return ctx->getProperty(name);
}
#endif // V4_BOOTSTRAP
-uint RuntimeHelpers::equalHelper(const ValueRef x, const ValueRef y)
+uint RuntimeHelpers::equalHelper(const Value &x, const Value &y)
{
- Q_ASSERT(x->type() != y->type() || (x->isManaged() && (x->isString() != y->isString())));
+ Q_ASSERT(x.type() != y.type() || (x.isManaged() && (x.isString() != y.isString())));
- if (x->isNumber() && y->isNumber())
- return x->asDouble() == y->asDouble();
- if (x->isNull() && y->isUndefined()) {
+ if (x.isNumber() && y.isNumber())
+ return x.asDouble() == y.asDouble();
+ if (x.isNull() && y.isUndefined()) {
return true;
- } else if (x->isUndefined() && y->isNull()) {
+ } else if (x.isUndefined() && y.isNull()) {
return true;
- } else if (x->isNumber() && y->isString()) {
+ } else if (x.isNumber() && y.isString()) {
double dy = RuntimeHelpers::toNumber(y);
- return x->asDouble() == dy;
- } else if (x->isString() && y->isNumber()) {
+ return x.asDouble() == dy;
+ } else if (x.isString() && y.isNumber()) {
double dx = RuntimeHelpers::toNumber(x);
- return dx == y->asDouble();
- } else if (x->isBoolean()) {
- return Runtime::compareEqual(Primitive::fromDouble((double) x->booleanValue()), y);
- } else if (y->isBoolean()) {
- return Runtime::compareEqual(x, Primitive::fromDouble((double) y->booleanValue()));
+ return dx == y.asDouble();
+ } else if (x.isBoolean()) {
+ return Runtime::compareEqual(Primitive::fromDouble((double) x.booleanValue()), y);
+ } else if (y.isBoolean()) {
+ return Runtime::compareEqual(x, Primitive::fromDouble((double) y.booleanValue()));
} else {
#ifdef V4_BOOTSTRAP
Q_UNIMPLEMENTED();
#else
- if ((x->isNumber() || x->isString()) && y->isObject()) {
- Scope scope(y->objectValue()->engine());
+ if ((x.isNumber() || x.isString()) && y.isObject()) {
+ Scope scope(y.objectValue()->engine());
ScopedValue py(scope, RuntimeHelpers::toPrimitive(y, PREFERREDTYPE_HINT));
return Runtime::compareEqual(x, py);
- } else if (x->isObject() && (y->isNumber() || y->isString())) {
- Scope scope(x->objectValue()->engine());
+ } else if (x.isObject() && (y.isNumber() || y.isString())) {
+ Scope scope(x.objectValue()->engine());
ScopedValue px(scope, RuntimeHelpers::toPrimitive(x, PREFERREDTYPE_HINT));
return Runtime::compareEqual(px, y);
}
@@ -710,42 +734,42 @@ uint RuntimeHelpers::equalHelper(const ValueRef x, const ValueRef y)
return false;
}
-Bool RuntimeHelpers::strictEqual(const ValueRef x, const ValueRef y)
+Bool RuntimeHelpers::strictEqual(const Value &x, const Value &y)
{
TRACE2(x, y);
- if (x->rawValue() == y->rawValue())
+ if (x.rawValue() == y.rawValue())
// NaN != NaN
- return !x->isNaN();
+ return !x.isNaN();
- if (x->isNumber())
- return y->isNumber() && x->asDouble() == y->asDouble();
- if (x->isManaged())
- return y->isManaged() && x->managed()->isEqualTo(y->managed());
+ if (x.isNumber())
+ return y.isNumber() && x.asDouble() == y.asDouble();
+ if (x.isManaged())
+ return y.isManaged() && x.cast<Managed>()->isEqualTo(y.cast<Managed>());
return false;
}
-QV4::Bool Runtime::compareGreaterThan(const QV4::ValueRef l, const QV4::ValueRef r)
+QV4::Bool Runtime::compareGreaterThan(const Value &l, const Value &r)
{
TRACE2(l, r);
- if (l->isInteger() && r->isInteger())
- return l->integerValue() > r->integerValue();
- if (l->isNumber() && r->isNumber())
- return l->asDouble() > r->asDouble();
- if (l->isString() && r->isString()) {
+ if (l.isInteger() && r.isInteger())
+ return l.integerValue() > r.integerValue();
+ if (l.isNumber() && r.isNumber())
+ return l.asDouble() > r.asDouble();
+ if (l.isString() && r.isString()) {
#ifdef V4_BOOTSTRAP
Q_UNIMPLEMENTED();
return false;
#else
- return r->stringValue()->compare(l->stringValue());
+ return r.stringValue()->compare(l.stringValue());
#endif
}
- if (l->isObject() || r->isObject()) {
+ if (l.isObject() || r.isObject()) {
#ifdef V4_BOOTSTRAP
Q_UNIMPLEMENTED();
#else
- QV4::ExecutionEngine *e = (l->isObject() ? l->objectValue() : r->objectValue())->engine();
+ QV4::ExecutionEngine *e = (l.isObject() ? l.objectValue() : r.objectValue())->engine();
QV4::Scope scope(e);
QV4::ScopedValue pl(scope, RuntimeHelpers::toPrimitive(l, QV4::NUMBER_HINT));
QV4::ScopedValue pr(scope, RuntimeHelpers::toPrimitive(r, QV4::NUMBER_HINT));
@@ -758,27 +782,27 @@ QV4::Bool Runtime::compareGreaterThan(const QV4::ValueRef l, const QV4::ValueRef
return dl > dr;
}
-QV4::Bool Runtime::compareLessThan(const QV4::ValueRef l, const QV4::ValueRef r)
+QV4::Bool Runtime::compareLessThan(const Value &l, const Value &r)
{
TRACE2(l, r);
- if (l->isInteger() && r->isInteger())
- return l->integerValue() < r->integerValue();
- if (l->isNumber() && r->isNumber())
- return l->asDouble() < r->asDouble();
- if (l->isString() && r->isString()) {
+ if (l.isInteger() && r.isInteger())
+ return l.integerValue() < r.integerValue();
+ if (l.isNumber() && r.isNumber())
+ return l.asDouble() < r.asDouble();
+ if (l.isString() && r.isString()) {
#ifdef V4_BOOTSTRAP
Q_UNIMPLEMENTED();
return false;
#else
- return l->stringValue()->compare(r->stringValue());
+ return l.stringValue()->compare(r.stringValue());
#endif
}
- if (l->isObject() || r->isObject()) {
+ if (l.isObject() || r.isObject()) {
#ifdef V4_BOOTSTRAP
Q_UNIMPLEMENTED();
#else
- QV4::ExecutionEngine *e = (l->isObject() ? l->objectValue() : r->objectValue())->engine();
+ QV4::ExecutionEngine *e = (l.isObject() ? l.objectValue() : r.objectValue())->engine();
QV4::Scope scope(e);
QV4::ScopedValue pl(scope, RuntimeHelpers::toPrimitive(l, QV4::NUMBER_HINT));
QV4::ScopedValue pr(scope, RuntimeHelpers::toPrimitive(r, QV4::NUMBER_HINT));
@@ -791,27 +815,27 @@ QV4::Bool Runtime::compareLessThan(const QV4::ValueRef l, const QV4::ValueRef r)
return dl < dr;
}
-QV4::Bool Runtime::compareGreaterEqual(const QV4::ValueRef l, const QV4::ValueRef r)
+QV4::Bool Runtime::compareGreaterEqual(const Value &l, const Value &r)
{
TRACE2(l, r);
- if (l->isInteger() && r->isInteger())
- return l->integerValue() >= r->integerValue();
- if (l->isNumber() && r->isNumber())
- return l->asDouble() >= r->asDouble();
- if (l->isString() && r->isString()) {
+ if (l.isInteger() && r.isInteger())
+ return l.integerValue() >= r.integerValue();
+ if (l.isNumber() && r.isNumber())
+ return l.asDouble() >= r.asDouble();
+ if (l.isString() && r.isString()) {
#ifdef V4_BOOTSTRAP
Q_UNIMPLEMENTED();
return false;
#else
- return !l->stringValue()->compare(r->stringValue());
+ return !l.stringValue()->compare(r.stringValue());
#endif
}
- if (l->isObject() || r->isObject()) {
+ if (l.isObject() || r.isObject()) {
#ifdef V4_BOOTSTRAP
Q_UNIMPLEMENTED();
#else
- QV4::ExecutionEngine *e = (l->isObject() ? l->objectValue() : r->objectValue())->engine();
+ QV4::ExecutionEngine *e = (l.isObject() ? l.objectValue() : r.objectValue())->engine();
QV4::Scope scope(e);
QV4::ScopedValue pl(scope, RuntimeHelpers::toPrimitive(l, QV4::NUMBER_HINT));
QV4::ScopedValue pr(scope, RuntimeHelpers::toPrimitive(r, QV4::NUMBER_HINT));
@@ -824,27 +848,27 @@ QV4::Bool Runtime::compareGreaterEqual(const QV4::ValueRef l, const QV4::ValueRe
return dl >= dr;
}
-QV4::Bool Runtime::compareLessEqual(const QV4::ValueRef l, const QV4::ValueRef r)
+QV4::Bool Runtime::compareLessEqual(const Value &l, const Value &r)
{
TRACE2(l, r);
- if (l->isInteger() && r->isInteger())
- return l->integerValue() <= r->integerValue();
- if (l->isNumber() && r->isNumber())
- return l->asDouble() <= r->asDouble();
- if (l->isString() && r->isString()) {
+ if (l.isInteger() && r.isInteger())
+ return l.integerValue() <= r.integerValue();
+ if (l.isNumber() && r.isNumber())
+ return l.asDouble() <= r.asDouble();
+ if (l.isString() && r.isString()) {
#ifdef V4_BOOTSTRAP
Q_UNIMPLEMENTED();
return false;
#else
- return !r->stringValue()->compare(l->stringValue());
+ return !r.stringValue()->compare(l.stringValue());
#endif
}
- if (l->isObject() || r->isObject()) {
+ if (l.isObject() || r.isObject()) {
#ifdef V4_BOOTSTRAP
Q_UNIMPLEMENTED();
#else
- QV4::ExecutionEngine *e = (l->isObject() ? l->objectValue() : r->objectValue())->engine();
+ QV4::ExecutionEngine *e = (l.isObject() ? l.objectValue() : r.objectValue())->engine();
QV4::Scope scope(e);
QV4::ScopedValue pl(scope, RuntimeHelpers::toPrimitive(l, QV4::NUMBER_HINT));
QV4::ScopedValue pr(scope, RuntimeHelpers::toPrimitive(r, QV4::NUMBER_HINT));
@@ -858,30 +882,52 @@ QV4::Bool Runtime::compareLessEqual(const QV4::ValueRef l, const QV4::ValueRef r
}
#ifndef V4_BOOTSTRAP
-ReturnedValue Runtime::callGlobalLookup(ExecutionContext *context, uint index, CallData *callData)
+Bool Runtime::compareInstanceof(ExecutionEngine *engine, const Value &left, const Value &right)
{
- Scope scope(context);
+ TRACE2(left, right);
+
+ Scope scope(engine);
+ ScopedValue v(scope, Runtime::instanceof(engine, left, right));
+ return v->booleanValue();
+}
+
+uint Runtime::compareIn(ExecutionEngine *engine, const Value &left, const Value &right)
+{
+ TRACE2(left, right);
+
+ Scope scope(engine);
+ ScopedValue v(scope, Runtime::in(engine, left, right));
+ return v->booleanValue();
+}
+
+
+ReturnedValue Runtime::callGlobalLookup(ExecutionEngine *engine, uint index, CallData *callData)
+{
+ Scope scope(engine);
Q_ASSERT(callData->thisObject.isUndefined());
- Lookup *l = context->d()->lookups + index;
- Scoped<FunctionObject> o(scope, l->globalGetter(l, context));
+ Lookup *l = engine->currentContext()->lookups + index;
+ ScopedFunctionObject o(scope, l->globalGetter(l, engine));
if (!o)
- return context->throwTypeError();
+ return engine->throwTypeError();
- if (o.getPointer() == scope.engine->evalFunction && l->name->equals(scope.engine->id_eval))
+ ScopedString name(scope, engine->currentContext()->compilationUnit->runtimeStrings[l->nameIndex]);
+ if (o->d() == scope.engine->evalFunction && name->equals(scope.engine->id_eval))
return static_cast<EvalFunction *>(o.getPointer())->evalCall(callData, true);
return o->call(callData);
}
-ReturnedValue Runtime::callActivationProperty(ExecutionContext *context, String *name, CallData *callData)
+ReturnedValue Runtime::callActivationProperty(ExecutionEngine *engine, int nameIndex, CallData *callData)
{
Q_ASSERT(callData->thisObject.isUndefined());
- Scope scope(context);
+ Scope scope(engine);
+ ScopedString name(scope, engine->currentContext()->compilationUnit->runtimeStrings[nameIndex]);
ScopedObject base(scope);
- ScopedValue func(scope, context->getPropertyAndBase(name, base.ptr->o));
+ ScopedContext ctx(scope, engine->currentContext());
+ ScopedValue func(scope, ctx->getPropertyAndBase(name, base.getRef()));
if (scope.engine->hasException)
return Encode::undefined();
@@ -894,242 +940,255 @@ ReturnedValue Runtime::callActivationProperty(ExecutionContext *context, String
if (base)
objectAsString = ScopedValue(scope, base.asReturnedValue())->toQStringNoThrow();
QString msg = QStringLiteral("Property '%1' of object %2 is not a function").arg(name->toQString()).arg(objectAsString);
- return context->throwTypeError(msg);
+ return engine->throwTypeError(msg);
}
- if (o == scope.engine->evalFunction && name->equals(scope.engine->id_eval)) {
+ if (o->d() == scope.engine->evalFunction && name->equals(scope.engine->id_eval)) {
return static_cast<EvalFunction *>(o)->evalCall(callData, true);
}
return o->call(callData);
}
-ReturnedValue Runtime::callProperty(ExecutionContext *context, String *name, CallData *callData)
+ReturnedValue Runtime::callProperty(ExecutionEngine *engine, int nameIndex, CallData *callData)
{
- Scope scope(context);
- Scoped<Object> baseObject(scope, callData->thisObject);
+ Scope scope(engine);
+ ScopedString name(scope, engine->currentContext()->compilationUnit->runtimeStrings[nameIndex]);
+ ScopedObject baseObject(scope, callData->thisObject);
if (!baseObject) {
Q_ASSERT(!callData->thisObject.isEmpty());
if (callData->thisObject.isNullOrUndefined()) {
QString message = QStringLiteral("Cannot call method '%1' of %2").arg(name->toQString()).arg(callData->thisObject.toQStringNoThrow());
- return context->throwTypeError(message);
+ return engine->throwTypeError(message);
}
- baseObject = RuntimeHelpers::convertToObject(context, ValueRef(&callData->thisObject));
+ baseObject = RuntimeHelpers::convertToObject(scope.engine, callData->thisObject);
if (!baseObject) // type error
return Encode::undefined();
callData->thisObject = baseObject.asReturnedValue();
}
- Scoped<FunctionObject> o(scope, baseObject->get(name));
+ ScopedFunctionObject o(scope, baseObject->get(name));
if (!o) {
QString error = QStringLiteral("Property '%1' of object %2 is not a function").arg(name->toQString(), callData->thisObject.toQStringNoThrow());
- return context->throwTypeError(error);
+ return engine->throwTypeError(error);
}
return o->call(callData);
}
-ReturnedValue Runtime::callPropertyLookup(ExecutionContext *context, uint index, CallData *callData)
+ReturnedValue Runtime::callPropertyLookup(ExecutionEngine *engine, uint index, CallData *callData)
{
- Lookup *l = context->d()->lookups + index;
+ Lookup *l = engine->currentContext()->lookups + index;
Value v;
- v = l->getter(l, callData->thisObject);
+ v = l->getter(l, engine, callData->thisObject);
if (!v.isObject())
- return context->throwTypeError();
+ return engine->throwTypeError();
return v.objectValue()->call(callData);
}
-ReturnedValue Runtime::callElement(ExecutionContext *context, const ValueRef index, CallData *callData)
+ReturnedValue Runtime::callElement(ExecutionEngine *engine, const Value &index, CallData *callData)
{
- Scope scope(context);
- ScopedObject baseObject(scope, callData->thisObject.toObject(context));
- ScopedString s(scope, index->toString(context));
+ Scope scope(engine);
+ ScopedObject baseObject(scope, callData->thisObject.toObject(engine));
+ ScopedString s(scope, index.toString(engine));
if (scope.engine->hasException)
return Encode::undefined();
callData->thisObject = baseObject;
- ScopedObject o(scope, baseObject->get(s.getPointer()));
+ ScopedObject o(scope, baseObject->get(s));
if (!o)
- return context->throwTypeError();
+ return engine->throwTypeError();
return o->call(callData);
}
-ReturnedValue Runtime::callValue(ExecutionContext *context, const ValueRef func, CallData *callData)
+ReturnedValue Runtime::callValue(ExecutionEngine *engine, const Value &func, CallData *callData)
{
- if (!func->isObject())
- return context->throwTypeError(QStringLiteral("%1 is not a function").arg(func->toQStringNoThrow()));
+ if (!func.isObject())
+ return engine->throwTypeError(QStringLiteral("%1 is not a function").arg(func.toQStringNoThrow()));
- return func->objectValue()->call(callData);
+ return func.objectValue()->call(callData);
}
-ReturnedValue Runtime::constructGlobalLookup(ExecutionContext *context, uint index, CallData *callData)
+ReturnedValue Runtime::constructGlobalLookup(ExecutionEngine *engine, uint index, CallData *callData)
{
- Scope scope(context);
+ Scope scope(engine);
Q_ASSERT(callData->thisObject.isUndefined());
- Lookup *l = context->d()->lookups + index;
- Scoped<Object> f(scope, l->globalGetter(l, context));
+ Lookup *l = engine->currentContext()->lookups + index;
+ ScopedObject f(scope, l->globalGetter(l, engine));
if (!f)
- return context->throwTypeError();
+ return engine->throwTypeError();
return f->construct(callData);
}
-ReturnedValue Runtime::constructActivationProperty(ExecutionContext *context, String *name, CallData *callData)
+ReturnedValue Runtime::constructActivationProperty(ExecutionEngine *engine, int nameIndex, CallData *callData)
{
- Scope scope(context);
- ScopedValue func(scope, context->getProperty(name));
+ Scope scope(engine);
+ ScopedContext ctx(scope, engine->currentContext());
+ ScopedString name(scope, engine->currentContext()->compilationUnit->runtimeStrings[nameIndex]);
+ ScopedValue func(scope, ctx->getProperty(name));
if (scope.engine->hasException)
return Encode::undefined();
Object *f = func->asObject();
if (!f)
- return context->throwTypeError();
+ return engine->throwTypeError();
return f->construct(callData);
}
-ReturnedValue Runtime::constructValue(ExecutionContext *context, const ValueRef func, CallData *callData)
+ReturnedValue Runtime::constructValue(ExecutionEngine *engine, const Value &func, CallData *callData)
{
- Object *f = func->asObject();
+ Object *f = func.asObject();
if (!f)
- return context->throwTypeError();
+ return engine->throwTypeError();
return f->construct(callData);
}
-ReturnedValue Runtime::constructProperty(ExecutionContext *context, String *name, CallData *callData)
+ReturnedValue Runtime::constructProperty(ExecutionEngine *engine, int nameIndex, CallData *callData)
{
- Scope scope(context);
- ScopedObject thisObject(scope, callData->thisObject.toObject(context));
+ Scope scope(engine);
+ ScopedObject thisObject(scope, callData->thisObject.toObject(engine));
+ ScopedString name(scope, engine->currentContext()->compilationUnit->runtimeStrings[nameIndex]);
if (scope.engine->hasException)
return Encode::undefined();
- Scoped<Object> f(scope, thisObject->get(name));
+ ScopedObject f(scope, thisObject->get(name));
if (!f)
- return context->throwTypeError();
+ return engine->throwTypeError();
return f->construct(callData);
}
-ReturnedValue Runtime::constructPropertyLookup(ExecutionContext *context, uint index, CallData *callData)
+ReturnedValue Runtime::constructPropertyLookup(ExecutionEngine *engine, uint index, CallData *callData)
{
- Lookup *l = context->d()->lookups + index;
+ Lookup *l = engine->currentContext()->lookups + index;
Value v;
- v = l->getter(l, callData->thisObject);
+ v = l->getter(l, engine, callData->thisObject);
if (!v.isObject())
- return context->throwTypeError();
+ return engine->throwTypeError();
return v.objectValue()->construct(callData);
}
-void Runtime::throwException(ExecutionContext *context, const ValueRef value)
+void Runtime::throwException(ExecutionEngine *engine, const Value &value)
{
- if (!value->isEmpty())
- context->throwError(value);
+ if (!value.isEmpty())
+ engine->throwError(value);
}
-ReturnedValue Runtime::typeofValue(ExecutionContext *ctx, const ValueRef value)
+ReturnedValue Runtime::typeofValue(ExecutionEngine *engine, const Value &value)
{
- Scope scope(ctx);
+ Scope scope(engine);
ScopedString res(scope);
- switch (value->type()) {
+ switch (value.type()) {
case Value::Undefined_Type:
- res = ctx->engine()->id_undefined;
+ res = engine->id_undefined;
break;
case Value::Null_Type:
- res = ctx->engine()->id_object;
+ res = engine->id_object;
break;
case Value::Boolean_Type:
- res = ctx->engine()->id_boolean;
+ res = engine->id_boolean;
break;
case Value::Managed_Type:
- if (value->isString())
- res = ctx->engine()->id_string;
- else if (value->objectValue()->asFunctionObject())
- res = ctx->engine()->id_function;
+ if (value.isString())
+ res = engine->id_string;
+ else if (value.objectValue()->asFunctionObject())
+ res = engine->id_function;
else
- res = ctx->engine()->id_object; // ### implementation-defined
+ res = engine->id_object; // ### implementation-defined
break;
default:
- res = ctx->engine()->id_number;
+ res = engine->id_number;
break;
}
return res.asReturnedValue();
}
-QV4::ReturnedValue Runtime::typeofName(ExecutionContext *context, String *name)
+QV4::ReturnedValue Runtime::typeofName(ExecutionEngine *engine, int nameIndex)
{
- Scope scope(context);
- ScopedValue prop(scope, context->getProperty(name));
+ Scope scope(engine);
+ ScopedString name(scope, engine->currentContext()->compilationUnit->runtimeStrings[nameIndex]);
+ ScopedContext ctx(scope, engine->currentContext());
+ ScopedValue prop(scope, ctx->getProperty(name));
// typeof doesn't throw. clear any possible exception
scope.engine->hasException = false;
- return Runtime::typeofValue(context, prop);
+ return Runtime::typeofValue(engine, prop);
}
-QV4::ReturnedValue Runtime::typeofMember(ExecutionContext *context, const ValueRef base, String *name)
+QV4::ReturnedValue Runtime::typeofMember(ExecutionEngine *engine, const Value &base, int nameIndex)
{
- Scope scope(context);
- ScopedObject obj(scope, base->toObject(context));
+ Scope scope(engine);
+ ScopedString name(scope, engine->currentContext()->compilationUnit->runtimeStrings[nameIndex]);
+ ScopedObject obj(scope, base.toObject(engine));
if (scope.engine->hasException)
return Encode::undefined();
ScopedValue prop(scope, obj->get(name));
- return Runtime::typeofValue(context, prop);
+ return Runtime::typeofValue(engine, prop);
}
-QV4::ReturnedValue Runtime::typeofElement(ExecutionContext *context, const ValueRef base, const ValueRef index)
+QV4::ReturnedValue Runtime::typeofElement(ExecutionEngine *engine, const Value &base, const Value &index)
{
- Scope scope(context);
- ScopedString name(scope, index->toString(context));
- ScopedObject obj(scope, base->toObject(context));
+ Scope scope(engine);
+ ScopedString name(scope, index.toString(engine));
+ ScopedObject obj(scope, base.toObject(engine));
if (scope.engine->hasException)
return Encode::undefined();
- ScopedValue prop(scope, obj->get(name.getPointer()));
- return Runtime::typeofValue(context, prop);
+ ScopedValue prop(scope, obj->get(name));
+ return Runtime::typeofValue(engine, prop);
}
-ExecutionContext *Runtime::pushWithScope(const ValueRef o, ExecutionContext *ctx)
+void Runtime::pushWithScope(const Value &o, ExecutionEngine *engine)
{
- Scope scope(ctx);
- ScopedObject obj(scope, o->toObject(ctx));
- return reinterpret_cast<ExecutionContext *>(ctx->newWithContext(obj));
+ Scope scope(engine);
+ ScopedObject obj(scope, o.toObject(engine));
+ ScopedContext ctx(scope, engine->currentContext());
+ ctx->newWithContext(obj);
}
-ReturnedValue Runtime::unwindException(ExecutionContext *ctx)
+ReturnedValue Runtime::unwindException(ExecutionEngine *engine)
{
- if (!ctx->engine()->hasException)
+ if (!engine->hasException)
return Primitive::emptyValue().asReturnedValue();
- return ctx->engine()->catchException(ctx, 0);
+ return engine->catchException(0);
}
-ExecutionContext *Runtime::pushCatchScope(ExecutionContext *ctx, String *exceptionVarName)
+void Runtime::pushCatchScope(NoThrowEngine *engine, int exceptionVarNameIndex)
{
- Scope scope(ctx);
- ScopedValue v(scope, ctx->engine()->catchException(ctx, 0));
- return reinterpret_cast<ExecutionContext *>(ctx->newCatchContext(exceptionVarName, v));
+ Scope scope(engine);
+ ScopedValue v(scope, engine->catchException(0));
+ ScopedString exceptionVarName(scope, engine->currentContext()->compilationUnit->runtimeStrings[exceptionVarNameIndex]);
+ ScopedContext ctx(scope, engine->currentContext());
+ ctx->newCatchContext(exceptionVarName, v);
}
-ExecutionContext *Runtime::popScope(ExecutionContext *ctx)
+void Runtime::popScope(ExecutionEngine *engine)
{
- return ctx->engine()->popContext();
+ engine->popContext();
}
-void Runtime::declareVar(ExecutionContext *ctx, bool deletable, String *name)
+void Runtime::declareVar(ExecutionEngine *engine, bool deletable, int nameIndex)
{
+ Scope scope(engine);
+ ScopedString name(scope, engine->currentContext()->compilationUnit->runtimeStrings[nameIndex]);
+ ScopedContext ctx(scope, engine->currentContext());
ctx->createMutableBinding(name, deletable);
}
-ReturnedValue Runtime::arrayLiteral(ExecutionContext *ctx, Value *values, uint length)
+ReturnedValue Runtime::arrayLiteral(ExecutionEngine *engine, Value *values, uint length)
{
- Scope scope(ctx);
- Scoped<ArrayObject> a(scope, ctx->engine()->newArrayObject());
+ Scope scope(engine);
+ ScopedArrayObject a(scope, engine->newArrayObject());
if (length) {
a->arrayReserve(length);
@@ -1139,11 +1198,11 @@ ReturnedValue Runtime::arrayLiteral(ExecutionContext *ctx, Value *values, uint l
return a.asReturnedValue();
}
-ReturnedValue Runtime::objectLiteral(QV4::ExecutionContext *ctx, const QV4::Value *args, int classId, int arrayValueCount, int arrayGetterSetterCountAndFlags)
+ReturnedValue Runtime::objectLiteral(ExecutionEngine *engine, const QV4::Value *args, int classId, int arrayValueCount, int arrayGetterSetterCountAndFlags)
{
- Scope scope(ctx);
- QV4::InternalClass *klass = ctx->d()->compilationUnit->runtimeClasses[classId];
- Scoped<Object> o(scope, ctx->engine()->newObject(klass));
+ Scope scope(engine);
+ QV4::InternalClass *klass = engine->currentContext()->compilationUnit->runtimeClasses[classId];
+ ScopedObject o(scope, engine->newObject(klass, engine->objectPrototype.asObject()));
{
bool needSparseArray = arrayGetterSetterCountAndFlags >> 30;
@@ -1152,7 +1211,7 @@ ReturnedValue Runtime::objectLiteral(QV4::ExecutionContext *ctx, const QV4::Valu
}
for (uint i = 0; i < klass->size; ++i)
- o->memberData()[i] = *args++;
+ o->memberData()->data[i] = *args++;
if (arrayValueCount > 0) {
ScopedValue entry(scope);
@@ -1181,54 +1240,55 @@ ReturnedValue Runtime::objectLiteral(QV4::ExecutionContext *ctx, const QV4::Valu
return o.asReturnedValue();
}
-QV4::ReturnedValue Runtime::setupArgumentsObject(ExecutionContext *ctx)
+QV4::ReturnedValue Runtime::setupArgumentsObject(ExecutionEngine *engine)
{
- Q_ASSERT(ctx->d()->type >= ExecutionContext::Type_CallContext);
- CallContext *c = static_cast<CallContext *>(ctx);
- return (c->engine()->memoryManager->alloc<ArgumentsObject>(c))->asReturnedValue();
+ Q_ASSERT(engine->currentContext()->type >= Heap::ExecutionContext::Type_CallContext);
+ Scope scope(engine);
+ Scoped<CallContext> c(scope, static_cast<Heap::CallContext *>(engine->currentContext()));
+ return (engine->memoryManager->alloc<ArgumentsObject>(c))->asReturnedValue();
}
#endif // V4_BOOTSTRAP
-QV4::ReturnedValue Runtime::increment(const QV4::ValueRef value)
+QV4::ReturnedValue Runtime::increment(const Value &value)
{
TRACE1(value);
- if (value->isInteger() && value->integerValue() < INT_MAX)
- return Encode(value->integerValue() + 1);
+ if (value.isInteger() && value.integerValue() < INT_MAX)
+ return Encode(value.integerValue() + 1);
else {
- double d = value->toNumber();
+ double d = value.toNumber();
return Encode(d + 1.);
}
}
-QV4::ReturnedValue Runtime::decrement(const QV4::ValueRef value)
+QV4::ReturnedValue Runtime::decrement(const Value &value)
{
TRACE1(value);
- if (value->isInteger() && value->integerValue() > INT_MIN)
- return Encode(value->integerValue() - 1);
+ if (value.isInteger() && value.integerValue() > INT_MIN)
+ return Encode(value.integerValue() - 1);
else {
- double d = value->toNumber();
+ double d = value.toNumber();
return Encode(d - 1.);
}
}
#ifndef V4_BOOTSTRAP
-QV4::ReturnedValue RuntimeHelpers::toString(QV4::ExecutionContext *ctx, const QV4::ValueRef value)
+QV4::ReturnedValue RuntimeHelpers::toString(ExecutionEngine *engine, const Value &value)
{
- if (value->isString())
+ if (value.isString())
return value.asReturnedValue();
- return RuntimeHelpers::convertToString(ctx, value)->asReturnedValue();
+ return RuntimeHelpers::convertToString(engine, value)->asReturnedValue();
}
-QV4::ReturnedValue RuntimeHelpers::toObject(QV4::ExecutionContext *ctx, const QV4::ValueRef value)
+QV4::ReturnedValue RuntimeHelpers::toObject(ExecutionEngine *engine, const Value &value)
{
- if (value->isObject())
+ if (value.isObject())
return value.asReturnedValue();
- Returned<Object> *o = RuntimeHelpers::convertToObject(ctx, value);
+ Heap::Object *o = RuntimeHelpers::convertToObject(engine, value);
if (!o) // type error
return Encode::undefined();
@@ -1237,16 +1297,16 @@ QV4::ReturnedValue RuntimeHelpers::toObject(QV4::ExecutionContext *ctx, const QV
#endif // V4_BOOTSTRAP
-ReturnedValue Runtime::toDouble(const ValueRef value)
+ReturnedValue Runtime::toDouble(const Value &value)
{
TRACE1(value);
- return Encode(value->toNumber());
+ return Encode(value.toNumber());
}
-int Runtime::toInt(const ValueRef value)
+int Runtime::toInt(const Value &value)
{
TRACE1(value);
- return value->toInt32();
+ return value.toInt32();
}
int Runtime::doubleToInt(const double &d)
@@ -1255,10 +1315,10 @@ int Runtime::doubleToInt(const double &d)
return Primitive::toInt32(d);
}
-unsigned Runtime::toUInt(const ValueRef value)
+unsigned Runtime::toUInt(const Value &value)
{
TRACE1(value);
- return value->toUInt32();
+ return value.toUInt32();
}
unsigned Runtime::doubleToUInt(const double &d)
@@ -1269,99 +1329,108 @@ unsigned Runtime::doubleToUInt(const double &d)
#ifndef V4_BOOTSTRAP
-ReturnedValue Runtime::regexpLiteral(ExecutionContext *ctx, int id)
+ReturnedValue Runtime::regexpLiteral(ExecutionEngine *engine, int id)
{
- return ctx->d()->compilationUnit->runtimeRegularExpressions[id].asReturnedValue();
+ return engine->currentContext()->compilationUnit->runtimeRegularExpressions[id].asReturnedValue();
}
-ReturnedValue Runtime::getQmlIdArray(NoThrowContext *ctx)
+ReturnedValue Runtime::getQmlIdArray(NoThrowEngine *engine)
{
- Q_ASSERT(ctx->engine()->qmlContextObject()->getPointer()->as<QmlContextWrapper>());
- return static_cast<QmlContextWrapper *>(ctx->engine()->qmlContextObject()->getPointer())->idObjectsArray();
+ Q_ASSERT(engine->qmlContextObject());
+ Scope scope(engine);
+ Scoped<QmlContextWrapper> wrapper(scope, engine->qmlContextObject());
+ return wrapper->idObjectsArray();
}
-ReturnedValue Runtime::getQmlContextObject(NoThrowContext *ctx)
+ReturnedValue Runtime::getQmlContextObject(NoThrowEngine *engine)
{
- QQmlContextData *context = QmlContextWrapper::callingContext(ctx->engine());
+ QQmlContextData *context = QmlContextWrapper::callingContext(engine);
if (!context)
return Encode::undefined();
- return QObjectWrapper::wrap(ctx->d()->engine, context->contextObject);
+ return QObjectWrapper::wrap(engine, context->contextObject);
}
-ReturnedValue Runtime::getQmlScopeObject(NoThrowContext *ctx)
+ReturnedValue Runtime::getQmlScopeObject(NoThrowEngine *engine)
{
- Scope scope(ctx);
- QV4::Scoped<QmlContextWrapper> c(scope, ctx->engine()->qmlContextObject(), Scoped<QmlContextWrapper>::Cast);
- return QObjectWrapper::wrap(ctx->d()->engine, c->getScopeObject());
+ Scope scope(engine);
+ QV4::Scoped<QmlContextWrapper> c(scope, engine->qmlContextObject());
+ return QObjectWrapper::wrap(engine, c->getScopeObject());
}
-ReturnedValue Runtime::getQmlQObjectProperty(ExecutionContext *ctx, const ValueRef object, int propertyIndex, bool captureRequired)
+ReturnedValue Runtime::getQmlQObjectProperty(ExecutionEngine *engine, const Value &object, int propertyIndex, bool captureRequired)
{
- Scope scope(ctx);
+ Scope scope(engine);
QV4::Scoped<QObjectWrapper> wrapper(scope, object);
if (!wrapper) {
- ctx->throwTypeError(QStringLiteral("Cannot read property of null"));
+ engine->throwTypeError(QStringLiteral("Cannot read property of null"));
return Encode::undefined();
}
+ ScopedContext ctx(scope, engine->currentContext());
return QV4::QObjectWrapper::getProperty(wrapper->object(), ctx, propertyIndex, captureRequired);
}
-QV4::ReturnedValue Runtime::getQmlAttachedProperty(ExecutionContext *ctx, int attachedPropertiesId, int propertyIndex)
+QV4::ReturnedValue Runtime::getQmlAttachedProperty(ExecutionEngine *engine, int attachedPropertiesId, int propertyIndex)
{
- Scope scope(ctx);
- QV4::Scoped<QmlContextWrapper> c(scope, ctx->engine()->qmlContextObject(), Scoped<QmlContextWrapper>::Cast);
+ Scope scope(engine);
+ QV4::Scoped<QmlContextWrapper> c(scope, engine->qmlContextObject());
QObject *scopeObject = c->getScopeObject();
QObject *attachedObject = qmlAttachedPropertiesObjectById(attachedPropertiesId, scopeObject);
- QQmlEngine *qmlEngine = ctx->engine()->v8Engine->engine();
- QQmlData::ensurePropertyCache(qmlEngine, attachedObject);
+ QJSEngine *jsEngine = engine->jsEngine();
+ QQmlData::ensurePropertyCache(jsEngine, attachedObject);
+ ScopedContext ctx(scope, engine->currentContext());
return QV4::QObjectWrapper::getProperty(attachedObject, ctx, propertyIndex, /*captureRequired*/true);
}
-ReturnedValue Runtime::getQmlSingletonQObjectProperty(ExecutionContext *ctx, const ValueRef object, int propertyIndex, bool captureRequired)
+ReturnedValue Runtime::getQmlSingletonQObjectProperty(ExecutionEngine *engine, const Value &object, int propertyIndex, bool captureRequired)
{
- Scope scope(ctx);
+ Scope scope(engine);
QV4::Scoped<QmlTypeWrapper> wrapper(scope, object);
if (!wrapper) {
- ctx->throwTypeError(QStringLiteral("Cannot read property of null"));
+ scope.engine->throwTypeError(QStringLiteral("Cannot read property of null"));
return Encode::undefined();
}
+ ScopedContext ctx(scope, engine->currentContext());
return QV4::QObjectWrapper::getProperty(wrapper->singletonObject(), ctx, propertyIndex, captureRequired);
}
-void Runtime::setQmlQObjectProperty(ExecutionContext *ctx, const ValueRef object, int propertyIndex, const ValueRef value)
+void Runtime::setQmlQObjectProperty(ExecutionEngine *engine, const Value &object, int propertyIndex, const Value &value)
{
- Scope scope(ctx);
+ Scope scope(engine);
QV4::Scoped<QObjectWrapper> wrapper(scope, object);
if (!wrapper) {
- ctx->throwTypeError(QStringLiteral("Cannot write property of null"));
+ engine->throwTypeError(QStringLiteral("Cannot write property of null"));
return;
}
+ ScopedContext ctx(scope, engine->currentContext());
wrapper->setProperty(ctx, propertyIndex, value);
}
-ReturnedValue Runtime::getQmlImportedScripts(NoThrowContext *ctx)
+ReturnedValue Runtime::getQmlImportedScripts(NoThrowEngine *engine)
{
- QQmlContextData *context = QmlContextWrapper::callingContext(ctx->engine());
+ QQmlContextData *context = QmlContextWrapper::callingContext(engine);
if (!context)
return Encode::undefined();
return context->importedScripts.value();
}
-QV4::ReturnedValue Runtime::getQmlSingleton(QV4::NoThrowContext *ctx, String *name)
+QV4::ReturnedValue Runtime::getQmlSingleton(QV4::NoThrowEngine *engine, int nameIndex)
{
- return static_cast<QmlContextWrapper *>(ctx->engine()->qmlContextObject()->getPointer())->qmlSingletonWrapper(ctx->engine()->v8Engine, name);
+ Scope scope(engine);
+ ScopedString name(scope, engine->currentContext()->compilationUnit->runtimeStrings[nameIndex]);
+ Scoped<QmlContextWrapper> wrapper(scope, engine->qmlContextObject());
+ return wrapper->qmlSingletonWrapper(engine, name);
}
-void Runtime::convertThisToObject(ExecutionContext *ctx)
+void Runtime::convertThisToObject(ExecutionEngine *engine)
{
- Value *t = &ctx->d()->callData->thisObject;
+ Value *t = &engine->currentContext()->callData->thisObject;
if (t->isObject())
return;
if (t->isNullOrUndefined()) {
- *t = ctx->engine()->globalObject->asReturnedValue();
+ *t = engine->globalObject()->asReturnedValue();
} else {
- *t = t->toObject(ctx)->asReturnedValue();
+ *t = t->toObject(engine)->asReturnedValue();
}
}
diff --git a/src/qml/jsruntime/qv4runtime_p.h b/src/qml/jsruntime/qv4runtime_p.h
index 6042420291..f2f90bbc15 100644
--- a/src/qml/jsruntime/qv4runtime_p.h
+++ b/src/qml/jsruntime/qv4runtime_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -35,20 +35,11 @@
#include "qv4global_p.h"
#include "qv4value_inl_p.h"
-#include "qv4math_p.h"
-#include "qv4scopedvalue_p.h"
#include "qv4context_p.h"
+#include "qv4math_p.h"
-#include <QtCore/QString>
#include <QtCore/qnumeric.h>
-#include <QtCore/QDebug>
-#include <QtCore/qurl.h>
-#include <cmath>
-#include <cassert>
-#include <limits>
-
-//#include <wtf/MathExtras.h>
QT_BEGIN_NAMESPACE
@@ -91,304 +82,305 @@ enum TypeHint {
// This is a trick to tell the code generators that functions taking a NoThrowContext won't
// throw exceptions and therefore don't need a check after the call.
-struct NoThrowContext : public ExecutionContext
+struct NoThrowEngine : public ExecutionEngine
{
};
struct Q_QML_PRIVATE_EXPORT Runtime {
// call
- static ReturnedValue callGlobalLookup(ExecutionContext *context, uint index, CallData *callData);
- static ReturnedValue callActivationProperty(ExecutionContext *, String *name, CallData *callData);
- static ReturnedValue callProperty(ExecutionContext *context, String *name, CallData *callData);
- static ReturnedValue callPropertyLookup(ExecutionContext *context, uint index, CallData *callData);
- static ReturnedValue callElement(ExecutionContext *context, const ValueRef index, CallData *callData);
- static ReturnedValue callValue(ExecutionContext *context, const ValueRef func, CallData *callData);
+ static ReturnedValue callGlobalLookup(ExecutionEngine *engine, uint index, CallData *callData);
+ static ReturnedValue callActivationProperty(ExecutionEngine *engine, int nameIndex, CallData *callData);
+ static ReturnedValue callProperty(ExecutionEngine *engine, int nameIndex, CallData *callData);
+ static ReturnedValue callPropertyLookup(ExecutionEngine *engine, uint index, CallData *callData);
+ static ReturnedValue callElement(ExecutionEngine *engine, const Value &index, CallData *callData);
+ static ReturnedValue callValue(ExecutionEngine *engine, const Value &func, CallData *callData);
// construct
- static ReturnedValue constructGlobalLookup(ExecutionContext *context, uint index, CallData *callData);
- static ReturnedValue constructActivationProperty(ExecutionContext *, String *name, CallData *callData);
- static ReturnedValue constructProperty(ExecutionContext *context, String *name, CallData *callData);
- static ReturnedValue constructPropertyLookup(ExecutionContext *context, uint index, CallData *callData);
- static ReturnedValue constructValue(ExecutionContext *context, const ValueRef func, CallData *callData);
+ static ReturnedValue constructGlobalLookup(ExecutionEngine *engine, uint index, CallData *callData);
+ static ReturnedValue constructActivationProperty(ExecutionEngine *engine, int nameIndex, CallData *callData);
+ static ReturnedValue constructProperty(ExecutionEngine *engine, int nameIndex, CallData *callData);
+ static ReturnedValue constructPropertyLookup(ExecutionEngine *engine, uint index, CallData *callData);
+ static ReturnedValue constructValue(ExecutionEngine *engine, const Value &func, CallData *callData);
// set & get
- static void setActivationProperty(ExecutionContext *ctx, String *name, const ValueRef value);
- static void setProperty(ExecutionContext *ctx, const ValueRef object, String *name, const ValueRef value);
- static void setElement(ExecutionContext *ctx, const ValueRef object, const ValueRef index, const ValueRef value);
- static ReturnedValue getProperty(ExecutionContext *ctx, const ValueRef object, String *name);
- static ReturnedValue getActivationProperty(ExecutionContext *ctx, String *name);
- static ReturnedValue getElement(ExecutionContext *ctx, const ValueRef object, const ValueRef index);
+ static void setActivationProperty(ExecutionEngine *engine, int nameIndex, const Value &value);
+ static void setProperty(ExecutionEngine *engine, const Value &object, int nameIndex, const Value &value);
+ static void setElement(ExecutionEngine *engine, const Value &object, const Value &index, const Value &value);
+ static ReturnedValue getProperty(ExecutionEngine *engine, const Value &object, int nameIndex);
+ static ReturnedValue getActivationProperty(ExecutionEngine *engine, int nameIndex);
+ static ReturnedValue getElement(ExecutionEngine *engine, const Value &object, const Value &index);
// typeof
- static ReturnedValue typeofValue(ExecutionContext *ctx, const ValueRef val);
- static ReturnedValue typeofName(ExecutionContext *context, String *name);
- static ReturnedValue typeofMember(ExecutionContext* context, const ValueRef base, String *name);
- static ReturnedValue typeofElement(ExecutionContext* context, const ValueRef base, const ValueRef index);
+ static ReturnedValue typeofValue(ExecutionEngine *engine, const Value &val);
+ static ReturnedValue typeofName(ExecutionEngine *engine, int nameIndex);
+ static ReturnedValue typeofMember(ExecutionEngine *engine, const Value &base, int nameIndex);
+ static ReturnedValue typeofElement(ExecutionEngine *engine, const Value &base, const Value &index);
// delete
- static ReturnedValue deleteElement(ExecutionContext *ctx, const ValueRef base, const ValueRef index);
- static ReturnedValue deleteMember(ExecutionContext *ctx, const ValueRef base, String *name);
- static ReturnedValue deleteName(ExecutionContext *ctx, String *name);
+ static ReturnedValue deleteElement(ExecutionEngine *engine, const Value &base, const Value &index);
+ static ReturnedValue deleteMember(ExecutionEngine *engine, const Value &base, int nameIndex);
+ static ReturnedValue deleteMemberString(ExecutionEngine *engine, const Value &base, String *name);
+ static ReturnedValue deleteName(ExecutionEngine *engine, int nameIndex);
// exceptions & scopes
- static void throwException(ExecutionContext*, const ValueRef value);
- static ReturnedValue unwindException(ExecutionContext *ctx);
- static ExecutionContext *pushWithScope(const ValueRef o, ExecutionContext *ctx);
- static ExecutionContext *pushCatchScope(ExecutionContext *ctx, String *exceptionVarName);
- static ExecutionContext *popScope(ExecutionContext *ctx);
+ static void throwException(ExecutionEngine *engine, const Value &value);
+ static ReturnedValue unwindException(ExecutionEngine *engine);
+ static void pushWithScope(const Value &o, ExecutionEngine *engine);
+ static void pushCatchScope(NoThrowEngine *engine, int exceptionVarNameIndex);
+ static void popScope(ExecutionEngine *engine);
// closures
- static ReturnedValue closure(ExecutionContext *ctx, int functionId);
+ static ReturnedValue closure(ExecutionEngine *engine, int functionId);
// function header
- static void declareVar(ExecutionContext *ctx, bool deletable, String *name);
- static ReturnedValue setupArgumentsObject(ExecutionContext *ctx);
- static void convertThisToObject(ExecutionContext *ctx);
+ static void declareVar(ExecutionEngine *engine, bool deletable, int nameIndex);
+ static ReturnedValue setupArgumentsObject(ExecutionEngine *engine);
+ static void convertThisToObject(ExecutionEngine *engine);
// literals
- static ReturnedValue arrayLiteral(ExecutionContext *ctx, Value *values, uint length);
- static ReturnedValue objectLiteral(ExecutionContext *ctx, const Value *args, int classId, int arrayValueCount, int arrayGetterSetterCountAndFlags);
- static ReturnedValue regexpLiteral(ExecutionContext *ctx, int id);
+ static ReturnedValue arrayLiteral(ExecutionEngine *engine, Value *values, uint length);
+ static ReturnedValue objectLiteral(ExecutionEngine *engine, const Value *args, int classId, int arrayValueCount, int arrayGetterSetterCountAndFlags);
+ static ReturnedValue regexpLiteral(ExecutionEngine *engine, int id);
// foreach
- static ReturnedValue foreachIterator(ExecutionContext *ctx, const ValueRef in);
- static ReturnedValue foreachNextPropertyName(const ValueRef foreach_iterator);
+ static ReturnedValue foreachIterator(ExecutionEngine *engine, const Value &in);
+ static ReturnedValue foreachNextPropertyName(const Value &foreach_iterator);
// unary operators
- typedef ReturnedValue (*UnaryOperation)(const ValueRef);
- static ReturnedValue uPlus(const ValueRef value);
- static ReturnedValue uMinus(const ValueRef value);
- static ReturnedValue uNot(const ValueRef value);
- static ReturnedValue complement(const ValueRef value);
- static ReturnedValue increment(const ValueRef value);
- static ReturnedValue decrement(const ValueRef value);
+ typedef ReturnedValue (*UnaryOperation)(const Value &value);
+ static ReturnedValue uPlus(const Value &value);
+ static ReturnedValue uMinus(const Value &value);
+ static ReturnedValue uNot(const Value &value);
+ static ReturnedValue complement(const Value &value);
+ static ReturnedValue increment(const Value &value);
+ static ReturnedValue decrement(const Value &value);
// binary operators
- typedef ReturnedValue (*BinaryOperation)(const ValueRef left, const ValueRef right);
- typedef ReturnedValue (*BinaryOperationContext)(ExecutionContext *ctx, const ValueRef left, const ValueRef right);
-
- static ReturnedValue instanceof(ExecutionContext *ctx, const ValueRef left, const ValueRef right);
- static ReturnedValue in(ExecutionContext *ctx, const ValueRef left, const ValueRef right);
- static ReturnedValue add(ExecutionContext *ctx, const ValueRef left, const ValueRef right);
- static ReturnedValue addString(ExecutionContext *ctx, const ValueRef left, const ValueRef right);
- static ReturnedValue bitOr(const ValueRef left, const ValueRef right);
- static ReturnedValue bitXor(const ValueRef left, const ValueRef right);
- static ReturnedValue bitAnd(const ValueRef left, const ValueRef right);
- static ReturnedValue sub(const ValueRef left, const ValueRef right);
- static ReturnedValue mul(const ValueRef left, const ValueRef right);
- static ReturnedValue div(const ValueRef left, const ValueRef right);
- static ReturnedValue mod(const ValueRef left, const ValueRef right);
- static ReturnedValue shl(const ValueRef left, const ValueRef right);
- static ReturnedValue shr(const ValueRef left, const ValueRef right);
- static ReturnedValue ushr(const ValueRef left, const ValueRef right);
- static ReturnedValue greaterThan(const ValueRef left, const ValueRef right);
- static ReturnedValue lessThan(const ValueRef left, const ValueRef right);
- static ReturnedValue greaterEqual(const ValueRef left, const ValueRef right);
- static ReturnedValue lessEqual(const ValueRef left, const ValueRef right);
- static ReturnedValue equal(const ValueRef left, const ValueRef right);
- static ReturnedValue notEqual(const ValueRef left, const ValueRef right);
- static ReturnedValue strictEqual(const ValueRef left, const ValueRef right);
- static ReturnedValue strictNotEqual(const ValueRef left, const ValueRef right);
+ typedef ReturnedValue (*BinaryOperation)(const Value &left, const Value &right);
+ typedef ReturnedValue (*BinaryOperationContext)(ExecutionEngine *engine, const Value &left, const Value &right);
+
+ static ReturnedValue instanceof(ExecutionEngine *engine, const Value &left, const Value &right);
+ static ReturnedValue in(ExecutionEngine *engine, const Value &left, const Value &right);
+ static ReturnedValue add(ExecutionEngine *engine, const Value &left, const Value &right);
+ static ReturnedValue addString(ExecutionEngine *engine, const Value &left, const Value &right);
+ static ReturnedValue bitOr(const Value &left, const Value &right);
+ static ReturnedValue bitXor(const Value &left, const Value &right);
+ static ReturnedValue bitAnd(const Value &left, const Value &right);
+ static ReturnedValue sub(const Value &left, const Value &right);
+ static ReturnedValue mul(const Value &left, const Value &right);
+ static ReturnedValue div(const Value &left, const Value &right);
+ static ReturnedValue mod(const Value &left, const Value &right);
+ static ReturnedValue shl(const Value &left, const Value &right);
+ static ReturnedValue shr(const Value &left, const Value &right);
+ static ReturnedValue ushr(const Value &left, const Value &right);
+ static ReturnedValue greaterThan(const Value &left, const Value &right);
+ static ReturnedValue lessThan(const Value &left, const Value &right);
+ static ReturnedValue greaterEqual(const Value &left, const Value &right);
+ static ReturnedValue lessEqual(const Value &left, const Value &right);
+ static ReturnedValue equal(const Value &left, const Value &right);
+ static ReturnedValue notEqual(const Value &left, const Value &right);
+ static ReturnedValue strictEqual(const Value &left, const Value &right);
+ static ReturnedValue strictNotEqual(const Value &left, const Value &right);
// comparisons
- typedef Bool (*CompareOperation)(const ValueRef left, const ValueRef right);
- static Bool compareGreaterThan(const ValueRef l, const ValueRef r);
- static Bool compareLessThan(const ValueRef l, const ValueRef r);
- static Bool compareGreaterEqual(const ValueRef l, const ValueRef r);
- static Bool compareLessEqual(const ValueRef l, const ValueRef r);
- static Bool compareEqual(const ValueRef left, const ValueRef right);
- static Bool compareNotEqual(const ValueRef left, const ValueRef right);
- static Bool compareStrictEqual(const ValueRef left, const ValueRef right);
- static Bool compareStrictNotEqual(const ValueRef left, const ValueRef right);
-
- typedef Bool (*CompareOperationContext)(ExecutionContext *ctx, const ValueRef left, const ValueRef right);
- static Bool compareInstanceof(ExecutionContext *ctx, const ValueRef left, const ValueRef right);
- static Bool compareIn(ExecutionContext *ctx, const ValueRef left, const ValueRef right);
+ typedef Bool (*CompareOperation)(const Value &left, const Value &right);
+ static Bool compareGreaterThan(const Value &l, const Value &r);
+ static Bool compareLessThan(const Value &l, const Value &r);
+ static Bool compareGreaterEqual(const Value &l, const Value &r);
+ static Bool compareLessEqual(const Value &l, const Value &r);
+ static Bool compareEqual(const Value &left, const Value &right);
+ static Bool compareNotEqual(const Value &left, const Value &right);
+ static Bool compareStrictEqual(const Value &left, const Value &right);
+ static Bool compareStrictNotEqual(const Value &left, const Value &right);
+
+ typedef Bool (*CompareOperationContext)(ExecutionEngine *engine, const Value &left, const Value &right);
+ static Bool compareInstanceof(ExecutionEngine *engine, const Value &left, const Value &right);
+ static Bool compareIn(ExecutionEngine *engine, const Value &left, const Value &right);
// conversions
- static Bool toBoolean(const ValueRef value);
- static ReturnedValue toDouble(const ValueRef value);
- static int toInt(const ValueRef value);
+ static Bool toBoolean(const Value &value);
+ static ReturnedValue toDouble(const Value &value);
+ static int toInt(const Value &value);
static int doubleToInt(const double &d);
- static unsigned toUInt(const ValueRef value);
+ static unsigned toUInt(const Value &value);
static unsigned doubleToUInt(const double &d);
// qml
- static ReturnedValue getQmlIdArray(NoThrowContext *ctx);
- static ReturnedValue getQmlImportedScripts(NoThrowContext *ctx);
- static ReturnedValue getQmlContextObject(NoThrowContext *ctx);
- static ReturnedValue getQmlScopeObject(NoThrowContext *ctx);
- static ReturnedValue getQmlSingleton(NoThrowContext *ctx, String *name);
- static ReturnedValue getQmlAttachedProperty(ExecutionContext *ctx, int attachedPropertiesId, int propertyIndex);
- static ReturnedValue getQmlQObjectProperty(ExecutionContext *ctx, const ValueRef object, int propertyIndex, bool captureRequired);
- static ReturnedValue getQmlSingletonQObjectProperty(ExecutionContext *ctx, const ValueRef object, int propertyIndex, bool captureRequired);
- static void setQmlQObjectProperty(ExecutionContext *ctx, const ValueRef object, int propertyIndex, const ValueRef value);
+ static ReturnedValue getQmlIdArray(NoThrowEngine *ctx);
+ static ReturnedValue getQmlImportedScripts(NoThrowEngine *ctx);
+ static ReturnedValue getQmlContextObject(NoThrowEngine *ctx);
+ static ReturnedValue getQmlScopeObject(NoThrowEngine *ctx);
+ static ReturnedValue getQmlSingleton(NoThrowEngine *ctx, int nameIndex);
+ static ReturnedValue getQmlAttachedProperty(ExecutionEngine *engine, int attachedPropertiesId, int propertyIndex);
+ static ReturnedValue getQmlQObjectProperty(ExecutionEngine *engine, const Value &object, int propertyIndex, bool captureRequired);
+ static ReturnedValue getQmlSingletonQObjectProperty(ExecutionEngine *engine, const Value &object, int propertyIndex, bool captureRequired);
+ static void setQmlQObjectProperty(ExecutionEngine *engine, const Value &object, int propertyIndex, const Value &value);
};
struct Q_QML_PRIVATE_EXPORT RuntimeHelpers {
static ReturnedValue objectDefaultValue(Object *object, int typeHint);
- static ReturnedValue toPrimitive(const ValueRef value, int typeHint);
+ static ReturnedValue toPrimitive(const Value &value, int typeHint);
static double stringToNumber(const QString &s);
- static Returned<String> *stringFromNumber(ExecutionContext *ctx, double number);
- static double toNumber(const ValueRef value);
+ static Heap::String *stringFromNumber(ExecutionEngine *engine, double number);
+ static double toNumber(const Value &value);
static void numberToString(QString *result, double num, int radix = 10);
- static ReturnedValue toString(ExecutionContext *ctx, const ValueRef value);
- static Returned<String> *convertToString(ExecutionContext *ctx, const ValueRef value);
+ static ReturnedValue toString(ExecutionEngine *engine, const Value &value);
+ static Heap::String *convertToString(ExecutionEngine *engine, const Value &value);
- static ReturnedValue toObject(ExecutionContext *ctx, const ValueRef value);
- static Returned<Object> *convertToObject(ExecutionContext *ctx, const ValueRef value);
+ static ReturnedValue toObject(ExecutionEngine *engine, const Value &value);
+ static Heap::Object *convertToObject(ExecutionEngine *engine, const Value &value);
- static Bool equalHelper(const ValueRef x, const ValueRef y);
- static Bool strictEqual(const ValueRef x, const ValueRef y);
+ static Bool equalHelper(const Value &x, const Value &y);
+ static Bool strictEqual(const Value &x, const Value &y);
- static ReturnedValue addHelper(ExecutionContext *ctx, const ValueRef left, const ValueRef right);
+ static ReturnedValue addHelper(ExecutionEngine *engine, const Value &left, const Value &right);
};
// type conversion and testing
#ifndef V4_BOOTSTRAP
-inline ReturnedValue RuntimeHelpers::toPrimitive(const ValueRef value, int typeHint)
+inline ReturnedValue RuntimeHelpers::toPrimitive(const Value &value, int typeHint)
{
- Object *o = value->asObject();
+ Object *o = value.asObject();
if (!o)
return value.asReturnedValue();
return RuntimeHelpers::objectDefaultValue(o, typeHint);
}
#endif
-inline double RuntimeHelpers::toNumber(const ValueRef value)
+inline double RuntimeHelpers::toNumber(const Value &value)
{
- return value->toNumber();
+ return value.toNumber();
}
-inline ReturnedValue Runtime::uPlus(const ValueRef value)
+inline ReturnedValue Runtime::uPlus(const Value &value)
{
TRACE1(value);
- if (value->isNumber())
+ if (value.isNumber())
return value.asReturnedValue();
- if (value->integerCompatible())
- return Encode(value->int_32);
+ if (value.integerCompatible())
+ return Encode(value.int_32);
- double n = value->toNumberImpl();
+ double n = value.toNumberImpl();
return Encode(n);
}
-inline ReturnedValue Runtime::uMinus(const ValueRef value)
+inline ReturnedValue Runtime::uMinus(const Value &value)
{
TRACE1(value);
// +0 != -0, so we need to convert to double when negating 0
- if (value->isInteger() && value->integerValue())
- return Encode(-value->integerValue());
+ if (value.isInteger() && value.integerValue())
+ return Encode(-value.integerValue());
else {
double n = RuntimeHelpers::toNumber(value);
return Encode(-n);
}
}
-inline ReturnedValue Runtime::complement(const ValueRef value)
+inline ReturnedValue Runtime::complement(const Value &value)
{
TRACE1(value);
- int n = value->toInt32();
+ int n = value.toInt32();
return Encode((int)~n);
}
-inline ReturnedValue Runtime::uNot(const ValueRef value)
+inline ReturnedValue Runtime::uNot(const Value &value)
{
TRACE1(value);
- bool b = value->toBoolean();
+ bool b = value.toBoolean();
return Encode(!b);
}
// binary operators
-inline ReturnedValue Runtime::bitOr(const ValueRef left, const ValueRef right)
+inline ReturnedValue Runtime::bitOr(const Value &left, const Value &right)
{
TRACE2(left, right);
- int lval = left->toInt32();
- int rval = right->toInt32();
+ int lval = left.toInt32();
+ int rval = right.toInt32();
return Encode(lval | rval);
}
-inline ReturnedValue Runtime::bitXor(const ValueRef left, const ValueRef right)
+inline ReturnedValue Runtime::bitXor(const Value &left, const Value &right)
{
TRACE2(left, right);
- int lval = left->toInt32();
- int rval = right->toInt32();
+ int lval = left.toInt32();
+ int rval = right.toInt32();
return Encode(lval ^ rval);
}
-inline ReturnedValue Runtime::bitAnd(const ValueRef left, const ValueRef right)
+inline ReturnedValue Runtime::bitAnd(const Value &left, const Value &right)
{
TRACE2(left, right);
- int lval = left->toInt32();
- int rval = right->toInt32();
+ int lval = left.toInt32();
+ int rval = right.toInt32();
return Encode(lval & rval);
}
#ifndef V4_BOOTSTRAP
-inline ReturnedValue Runtime::add(ExecutionContext *ctx, const ValueRef left, const ValueRef right)
+inline ReturnedValue Runtime::add(ExecutionEngine *engine, const Value &left, const Value &right)
{
TRACE2(left, right);
- if (Q_LIKELY(left->isInteger() && right->isInteger()))
- return add_int32(left->integerValue(), right->integerValue());
- if (left->isNumber() && right->isNumber())
- return Primitive::fromDouble(left->asDouble() + right->asDouble()).asReturnedValue();
+ if (Q_LIKELY(left.isInteger() && right.isInteger()))
+ return add_int32(left.integerValue(), right.integerValue());
+ if (left.isNumber() && right.isNumber())
+ return Primitive::fromDouble(left.asDouble() + right.asDouble()).asReturnedValue();
- return RuntimeHelpers::addHelper(ctx, left, right);
+ return RuntimeHelpers::addHelper(engine, left, right);
}
#endif // V4_BOOTSTRAP
-inline ReturnedValue Runtime::sub(const ValueRef left, const ValueRef right)
+inline ReturnedValue Runtime::sub(const Value &left, const Value &right)
{
TRACE2(left, right);
- if (Q_LIKELY(left->isInteger() && right->isInteger()))
- return sub_int32(left->integerValue(), right->integerValue());
+ if (Q_LIKELY(left.isInteger() && right.isInteger()))
+ return sub_int32(left.integerValue(), right.integerValue());
- double lval = left->isNumber() ? left->asDouble() : left->toNumberImpl();
- double rval = right->isNumber() ? right->asDouble() : right->toNumberImpl();
+ double lval = left.isNumber() ? left.asDouble() : left.toNumberImpl();
+ double rval = right.isNumber() ? right.asDouble() : right.toNumberImpl();
return Primitive::fromDouble(lval - rval).asReturnedValue();
}
-inline ReturnedValue Runtime::mul(const ValueRef left, const ValueRef right)
+inline ReturnedValue Runtime::mul(const Value &left, const Value &right)
{
TRACE2(left, right);
- if (Q_LIKELY(left->isInteger() && right->isInteger()))
- return mul_int32(left->integerValue(), right->integerValue());
+ if (Q_LIKELY(left.isInteger() && right.isInteger()))
+ return mul_int32(left.integerValue(), right.integerValue());
- double lval = left->isNumber() ? left->asDouble() : left->toNumberImpl();
- double rval = right->isNumber() ? right->asDouble() : right->toNumberImpl();
+ double lval = left.isNumber() ? left.asDouble() : left.toNumberImpl();
+ double rval = right.isNumber() ? right.asDouble() : right.toNumberImpl();
return Primitive::fromDouble(lval * rval).asReturnedValue();
}
-inline ReturnedValue Runtime::div(const ValueRef left, const ValueRef right)
+inline ReturnedValue Runtime::div(const Value &left, const Value &right)
{
TRACE2(left, right);
- double lval = left->toNumber();
- double rval = right->toNumber();
+ double lval = left.toNumber();
+ double rval = right.toNumber();
return Primitive::fromDouble(lval / rval).asReturnedValue();
}
-inline ReturnedValue Runtime::mod(const ValueRef left, const ValueRef right)
+inline ReturnedValue Runtime::mod(const Value &left, const Value &right)
{
TRACE2(left, right);
- if (Value::integerCompatible(*left, *right) && right->integerValue() != 0) {
- int intRes = left->integerValue() % right->integerValue();
- if (intRes != 0 || left->integerValue() >= 0)
+ if (Value::integerCompatible(left, right) && right.integerValue() != 0) {
+ int intRes = left.integerValue() % right.integerValue();
+ if (intRes != 0 || left.integerValue() >= 0)
return Encode(intRes);
}
@@ -397,36 +389,36 @@ inline ReturnedValue Runtime::mod(const ValueRef left, const ValueRef right)
return Primitive::fromDouble(std::fmod(lval, rval)).asReturnedValue();
}
-inline ReturnedValue Runtime::shl(const ValueRef left, const ValueRef right)
+inline ReturnedValue Runtime::shl(const Value &left, const Value &right)
{
TRACE2(left, right);
- int lval = left->toInt32();
- int rval = right->toInt32() & 0x1f;
+ int lval = left.toInt32();
+ int rval = right.toInt32() & 0x1f;
return Encode((int)(lval << rval));
}
-inline ReturnedValue Runtime::shr(const ValueRef left, const ValueRef right)
+inline ReturnedValue Runtime::shr(const Value &left, const Value &right)
{
TRACE2(left, right);
- int lval = left->toInt32();
- unsigned rval = right->toUInt32() & 0x1f;
+ int lval = left.toInt32();
+ unsigned rval = right.toUInt32() & 0x1f;
return Encode((int)(lval >> rval));
}
-inline ReturnedValue Runtime::ushr(const ValueRef left, const ValueRef right)
+inline ReturnedValue Runtime::ushr(const Value &left, const Value &right)
{
TRACE2(left, right);
- unsigned lval = left->toUInt32();
- unsigned rval = right->toUInt32() & 0x1f;
+ unsigned lval = left.toUInt32();
+ unsigned rval = right.toUInt32() & 0x1f;
uint res = lval >> rval;
return Encode(res);
}
-inline ReturnedValue Runtime::greaterThan(const ValueRef left, const ValueRef right)
+inline ReturnedValue Runtime::greaterThan(const Value &left, const Value &right)
{
TRACE2(left, right);
@@ -434,7 +426,7 @@ inline ReturnedValue Runtime::greaterThan(const ValueRef left, const ValueRef ri
return Encode(r);
}
-inline ReturnedValue Runtime::lessThan(const ValueRef left, const ValueRef right)
+inline ReturnedValue Runtime::lessThan(const Value &left, const Value &right)
{
TRACE2(left, right);
@@ -442,7 +434,7 @@ inline ReturnedValue Runtime::lessThan(const ValueRef left, const ValueRef right
return Encode(r);
}
-inline ReturnedValue Runtime::greaterEqual(const ValueRef left, const ValueRef right)
+inline ReturnedValue Runtime::greaterEqual(const Value &left, const Value &right)
{
TRACE2(left, right);
@@ -450,7 +442,7 @@ inline ReturnedValue Runtime::greaterEqual(const ValueRef left, const ValueRef r
return Encode(r);
}
-inline ReturnedValue Runtime::lessEqual(const ValueRef left, const ValueRef right)
+inline ReturnedValue Runtime::lessEqual(const Value &left, const Value &right)
{
TRACE2(left, right);
@@ -458,25 +450,25 @@ inline ReturnedValue Runtime::lessEqual(const ValueRef left, const ValueRef righ
return Encode(r);
}
-inline Bool Runtime::compareEqual(const ValueRef left, const ValueRef right)
+inline Bool Runtime::compareEqual(const Value &left, const Value &right)
{
TRACE2(left, right);
- if (left->rawValue() == right->rawValue())
+ if (left.rawValue() == right.rawValue())
// NaN != NaN
- return !left->isNaN();
+ return !left.isNaN();
- if (left->type() == right->type()) {
- if (!left->isManaged())
+ if (left.type() == right.type()) {
+ if (!left.isManaged())
return false;
- if (left->isString() == right->isString())
- return left->managed()->isEqualTo(right->managed());
+ if (left.isString() == right.isString())
+ return left.cast<Managed>()->isEqualTo(right.cast<Managed>());
}
return RuntimeHelpers::equalHelper(left, right);
}
-inline ReturnedValue Runtime::equal(const ValueRef left, const ValueRef right)
+inline ReturnedValue Runtime::equal(const Value &left, const Value &right)
{
TRACE2(left, right);
@@ -484,7 +476,7 @@ inline ReturnedValue Runtime::equal(const ValueRef left, const ValueRef right)
return Encode(r);
}
-inline ReturnedValue Runtime::notEqual(const ValueRef left, const ValueRef right)
+inline ReturnedValue Runtime::notEqual(const Value &left, const Value &right)
{
TRACE2(left, right);
@@ -492,7 +484,7 @@ inline ReturnedValue Runtime::notEqual(const ValueRef left, const ValueRef right
return Encode(r);
}
-inline ReturnedValue Runtime::strictEqual(const ValueRef left, const ValueRef right)
+inline ReturnedValue Runtime::strictEqual(const Value &left, const Value &right)
{
TRACE2(left, right);
@@ -500,7 +492,7 @@ inline ReturnedValue Runtime::strictEqual(const ValueRef left, const ValueRef ri
return Encode(r);
}
-inline ReturnedValue Runtime::strictNotEqual(const ValueRef left, const ValueRef right)
+inline ReturnedValue Runtime::strictNotEqual(const Value &left, const Value &right)
{
TRACE2(left, right);
@@ -508,51 +500,30 @@ inline ReturnedValue Runtime::strictNotEqual(const ValueRef left, const ValueRef
return Encode(r);
}
-inline Bool Runtime::compareNotEqual(const ValueRef left, const ValueRef right)
+inline Bool Runtime::compareNotEqual(const Value &left, const Value &right)
{
TRACE2(left, right);
return !Runtime::compareEqual(left, right);
}
-inline Bool Runtime::compareStrictEqual(const ValueRef left, const ValueRef right)
+inline Bool Runtime::compareStrictEqual(const Value &left, const Value &right)
{
TRACE2(left, right);
return RuntimeHelpers::strictEqual(left, right);
}
-inline Bool Runtime::compareStrictNotEqual(const ValueRef left, const ValueRef right)
+inline Bool Runtime::compareStrictNotEqual(const Value &left, const Value &right)
{
TRACE2(left, right);
return ! RuntimeHelpers::strictEqual(left, right);
}
-#ifndef V4_BOOTSTRAP
-inline Bool Runtime::compareInstanceof(ExecutionContext *ctx, const ValueRef left, const ValueRef right)
-{
- TRACE2(left, right);
-
- Scope scope(ctx);
- ScopedValue v(scope, Runtime::instanceof(ctx, left, right));
- return v->booleanValue();
-}
-
-inline uint Runtime::compareIn(ExecutionContext *ctx, const ValueRef left, const ValueRef right)
-{
- TRACE2(left, right);
-
- Scope scope(ctx);
- ScopedValue v(scope, Runtime::in(ctx, left, right));
- return v->booleanValue();
-}
-
-#endif // V4_BOOTSTRAP
-
-inline Bool Runtime::toBoolean(const ValueRef value)
+inline Bool Runtime::toBoolean(const Value &value)
{
- return value->toBoolean();
+ return value.toBoolean();
}
} // namespace QV4
diff --git a/src/qml/jsruntime/qv4scopedvalue_p.h b/src/qml/jsruntime/qv4scopedvalue_p.h
index b1b4d5da8d..908248f0f0 100644
--- a/src/qml/jsruntime/qv4scopedvalue_p.h
+++ b/src/qml/jsruntime/qv4scopedvalue_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -36,6 +36,11 @@
#include "qv4engine_p.h"
#include "qv4value_p.h"
#include "qv4persistent_p.h"
+#include "qv4property_p.h"
+
+#ifdef V4_USE_VALGRIND
+#include <valgrind/memcheck.h>
+#endif
QT_BEGIN_NAMESPACE
@@ -47,7 +52,15 @@ namespace QV4 {
struct ScopedValue;
struct Scope {
- inline explicit Scope(ExecutionContext *ctx);
+ inline Scope(ExecutionContext *ctx)
+ : engine(ctx->d()->engine)
+#ifndef QT_NO_DEBUG
+ , size(0)
+#endif
+ {
+ mark = engine->jsStackTop;
+ }
+
explicit Scope(ExecutionEngine *e)
: engine(e)
#ifndef QT_NO_DEBUG
@@ -62,15 +75,19 @@ struct Scope {
Q_ASSERT(engine->jsStackTop >= mark);
memset(mark, 0, (engine->jsStackTop - mark)*sizeof(Value));
#endif
+#ifdef V4_USE_VALGRIND
+ VALGRIND_MAKE_MEM_UNDEFINED(mark, engine->jsStackLimit - mark);
+#endif
engine->jsStackTop = mark;
}
Value *alloc(int nValues) {
- Value *ptr = engine->jsStackTop;
- engine->jsStackTop += nValues;
#ifndef QT_NO_DEBUG
size += nValues;
#endif
+ Value *ptr = engine->jsStackTop;
+ engine->jsStackTop = ptr + nValues;
+ memset(ptr, 0, nValues*sizeof(Value));
return ptr;
}
@@ -88,13 +105,12 @@ private:
Q_DISABLE_COPY(Scope)
};
-struct ValueRef;
-
struct ScopedValue
{
ScopedValue(const Scope &scope)
{
ptr = scope.engine->jsStackTop++;
+ ptr->val = 0;
#ifndef QT_NO_DEBUG
++scope.size;
#endif
@@ -109,10 +125,10 @@ struct ScopedValue
#endif
}
- ScopedValue(const Scope &scope, HeapObject *o)
+ ScopedValue(const Scope &scope, Heap::Base *o)
{
ptr = scope.engine->jsStackTop++;
- ptr->m = reinterpret_cast<Managed *>(o);
+ ptr->m = o;
#if QT_POINTER_SIZE == 4
ptr->tag = QV4::Value::Managed_Type;
#endif
@@ -139,23 +155,13 @@ struct ScopedValue
#endif
}
- template<typename T>
- ScopedValue(const Scope &scope, Returned<T> *t)
- {
- ptr = scope.engine->jsStackTop++;
- *ptr = t->getPointer() ? Value::fromManaged(t->getPointer()) : Primitive::undefinedValue();
-#ifndef QT_NO_DEBUG
- ++scope.size;
-#endif
- }
-
ScopedValue &operator=(const Value &v) {
*ptr = v;
return *this;
}
- ScopedValue &operator=(HeapObject *o) {
- ptr->m = reinterpret_cast<Managed *>(o);
+ ScopedValue &operator=(Heap::Base *o) {
+ ptr->m = o;
#if QT_POINTER_SIZE == 4
ptr->tag = QV4::Value::Managed_Type;
#endif
@@ -163,7 +169,7 @@ struct ScopedValue
}
ScopedValue &operator=(Managed *m) {
- ptr->val = m->asReturnedValue();
+ *ptr = *m;
return *this;
}
@@ -172,12 +178,6 @@ struct ScopedValue
return *this;
}
- template<typename T>
- ScopedValue &operator=(Returned<T> *t) {
- *ptr = t->getPointer() ? Value::fromManaged(t->getPointer()) : Primitive::undefinedValue();
- return *this;
- }
-
ScopedValue &operator=(const ScopedValue &other) {
*ptr = *other.ptr;
return *this;
@@ -191,7 +191,8 @@ struct ScopedValue
return ptr;
}
- ReturnedValue asReturnedValue() const { return ptr->val; }
+ operator Value *() { return ptr; }
+ operator const Value &() const { return *ptr; }
Value *ptr;
};
@@ -200,19 +201,21 @@ template<typename T>
struct Scoped
{
enum _Convert { Convert };
- enum _Cast { Cast };
inline void setPointer(Managed *p) {
-#if QT_POINTER_SIZE == 8
- ptr->val = (quint64)p;
-#else
- *ptr = p ? QV4::Value::fromManaged(p) : QV4::Primitive::undefinedValue();
+ ptr->m = p ? p->m : 0;
+#if QT_POINTER_SIZE == 4
+ ptr->tag = QV4::Value::Managed_Type;
#endif
}
Scoped(const Scope &scope)
{
ptr = scope.engine->jsStackTop++;
+ ptr->m = 0;
+#if QT_POINTER_SIZE == 4
+ ptr->tag = QV4::Value::Managed_Type;
+#endif
#ifndef QT_NO_DEBUG
++scope.size;
#endif
@@ -227,13 +230,10 @@ struct Scoped
++scope.size;
#endif
}
- Scoped(const Scope &scope, HeapObject *o)
+ Scoped(const Scope &scope, Heap::Base *o)
{
Value v;
- v.m = reinterpret_cast<Managed *>(o);
-#if QT_POINTER_SIZE == 4
- v.tag = QV4::Value::Managed_Type;
-#endif
+ v = o;
ptr = scope.engine->jsStackTop++;
setPointer(value_cast<T>(v));
#ifndef QT_NO_DEBUG
@@ -258,41 +258,27 @@ struct Scoped
#endif
}
- Scoped(const Scope &scope, const ValueRef &v);
-
- Scoped(const Scope &scope, T *t)
- {
- ptr = scope.engine->jsStackTop++;
- setPointer(t);
-#ifndef QT_NO_DEBUG
- ++scope.size;
-#endif
- }
- template<typename X>
- Scoped(const Scope &scope, X *t, _Cast)
+ Scoped(const Scope &scope, const Value *v)
{
ptr = scope.engine->jsStackTop++;
- setPointer(managed_cast<T>(t));
+ setPointer(v ? value_cast<T>(*v) : 0);
#ifndef QT_NO_DEBUG
++scope.size;
#endif
}
- template<typename X>
- Scoped(const Scope &scope, Returned<X> *x)
+ Scoped(const Scope &scope, T *t)
{
ptr = scope.engine->jsStackTop++;
- setPointer(Returned<T>::getPointer(x));
+ setPointer(t);
#ifndef QT_NO_DEBUG
++scope.size;
#endif
}
-
- template<typename X>
- Scoped(const Scope &scope, Returned<X> *x, _Cast)
+ Scoped(const Scope &scope, typename T::Data *t)
{
ptr = scope.engine->jsStackTop++;
- setPointer(managed_cast<T>(x->getPointer()));
+ *ptr = t;
#ifndef QT_NO_DEBUG
++scope.size;
#endif
@@ -315,21 +301,24 @@ struct Scoped
#endif
}
- Scoped<T> &operator=(HeapObject *o) {
+ Scoped<T> &operator=(Heap::Base *o) {
Value v;
- v.m = reinterpret_cast<Managed *>(o);
-#if QT_POINTER_SIZE == 4
- v.tag = QV4::Value::Managed_Type;
-#endif
+ v = o;
setPointer(value_cast<T>(v));
return *this;
}
+ Scoped<T> &operator=(typename T::Data *t) {
+ *ptr = t;
+ return *this;
+ }
Scoped<T> &operator=(const Value &v) {
setPointer(value_cast<T>(v));
return *this;
}
-
- Scoped<T> &operator=(const ValueRef &v);
+ Scoped<T> &operator=(Value *v) {
+ setPointer(v ? value_cast<T>(*v) : 0);
+ return *this;
+ }
Scoped<T> &operator=(const ReturnedValue &v) {
setPointer(value_cast<T>(QV4::Value::fromReturnedValue(v)));
@@ -346,72 +335,45 @@ struct Scoped
return *this;
}
- template<typename X>
- Scoped<T> &operator=(Returned<X> *x) {
- setPointer(Returned<T>::getPointer(x));
- return *this;
- }
-
operator T *() {
return static_cast<T *>(ptr->managed());
}
+ operator const Value &() const {
+ return *ptr;
+ }
T *operator->() {
- return static_cast<T *>(ptr->managed());
+ return ptr->cast<T>();
}
bool operator!() const {
- return !ptr->managed();
+ return !ptr->m;
}
operator void *() const {
- return ptr->managed();
+ return ptr->m;
}
T *getPointer() {
- return static_cast<T *>(ptr->managed());
+ return ptr->cast<T>();
+ }
+ typename T::Data **getRef() {
+ return reinterpret_cast<typename T::Data **>(&ptr->m);
}
ReturnedValue asReturnedValue() const {
-#if QT_POINTER_SIZE == 8
- return ptr->val ? ptr->val : Primitive::undefinedValue().asReturnedValue();
-#else
- return ptr->val;
-#endif
+ return ptr->m ? ptr->val : Encode::undefined();
}
Value *ptr;
};
-struct CallData
-{
- // below is to be compatible with Value. Initialize tag to 0
-#if Q_BYTE_ORDER != Q_LITTLE_ENDIAN
- uint tag;
-#endif
- int argc;
-#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
- uint tag;
-#endif
- inline ReturnedValue argument(int i) {
- return i < argc ? args[i].asReturnedValue() : Primitive::undefinedValue().asReturnedValue();
- }
-
- Value thisObject;
- Value args[1];
-};
-
struct ScopedCallData {
- ScopedCallData(Scope &scope, int argc)
+ ScopedCallData(Scope &scope, int argc = 0)
{
int size = qMax(argc, (int)QV4::Global::ReservedArgumentCount) + qOffsetOf(QV4::CallData, args)/sizeof(QV4::Value);
- ptr = reinterpret_cast<CallData *>(scope.engine->stackPush(size));
+ ptr = reinterpret_cast<CallData *>(scope.alloc(size));
ptr->tag = QV4::Value::Integer_Type;
ptr->argc = argc;
-#ifndef QT_NO_DEBUG
- scope.size += size;
- for (int ii = 0; ii < qMax(argc, (int)QV4::Global::ReservedArgumentCount); ++ii)
- ptr->args[ii] = QV4::Primitive::undefinedValue();
-#endif
}
CallData *operator->() {
@@ -426,30 +388,6 @@ struct ScopedCallData {
};
-template<typename T>
-inline Scoped<T>::Scoped(const Scope &scope, const ValueRef &v)
-{
- ptr = scope.engine->jsStackTop++;
- setPointer(value_cast<T>(*v.operator ->()));
-#ifndef QT_NO_DEBUG
- ++scope.size;
-#endif
-}
-
-template<typename T>
-inline Scoped<T> &Scoped<T>::operator=(const ValueRef &v)
-{
- setPointer(value_cast<T>(*v.operator ->()));
- return *this;
-}
-
-template <typename T>
-inline Value &Value::operator=(Returned<T> *t)
-{
- val = t->getPointer()->asReturnedValue();
- return *this;
-}
-
inline Value &Value::operator =(const ScopedValue &v)
{
val = v.ptr->val;
@@ -463,22 +401,10 @@ inline Value &Value::operator=(const Scoped<T> &t)
return *this;
}
-inline Value &Value::operator=(const ValueRef v)
-{
- val = v.asReturnedValue();
- return *this;
-}
-
-template<typename T>
-inline Returned<T> *Value::as()
-{
- return Returned<T>::create(value_cast<T>(*this));
-}
-
template<typename T>
inline TypedValue<T> &TypedValue<T>::operator =(T *t)
{
- m = t;
+ m = t ? t->m : 0;
#if QT_POINTER_SIZE == 4
tag = Managed_Type;
#endif
@@ -488,7 +414,7 @@ inline TypedValue<T> &TypedValue<T>::operator =(T *t)
template<typename T>
inline TypedValue<T> &TypedValue<T>::operator =(const Scoped<T> &v)
{
- m = v.ptr->managed();
+ m = v.ptr->m;
#if QT_POINTER_SIZE == 4
tag = Managed_Type;
#endif
@@ -496,103 +422,58 @@ inline TypedValue<T> &TypedValue<T>::operator =(const Scoped<T> &v)
}
template<typename T>
-inline TypedValue<T> &TypedValue<T>::operator=(Returned<T> *t)
-{
- val = t->getPointer()->asReturnedValue();
- return *this;
-}
-
-//template<typename T>
-//inline TypedValue<T> &TypedValue<T>::operator =(const ManagedRef<T> &v)
-//{
-// val = v.asReturnedValue();
-// return *this;
-//}
-
-template<typename T>
inline TypedValue<T> &TypedValue<T>::operator=(const TypedValue<T> &t)
{
val = t.val;
return *this;
}
-template<typename T>
-inline Returned<T> * TypedValue<T>::ret() const
-{
- return Returned<T>::create(static_cast<T *>(managed()));
-}
-
-inline Primitive::operator ValueRef()
-{
- return ValueRef(this);
-}
-
-
-template<typename T>
-PersistentValue::PersistentValue(Returned<T> *obj)
- : d(new PersistentValuePrivate(QV4::Value::fromManaged(obj->getPointer())))
-{
-}
-
-template<typename T>
-inline PersistentValue &PersistentValue::operator=(Returned<T> *obj)
-{
- return operator=(QV4::Value::fromManaged(obj->getPointer()).asReturnedValue());
-}
-
-inline PersistentValue &PersistentValue::operator=(const ScopedValue &other)
-{
- return operator=(other.asReturnedValue());
-}
-
-template<typename T>
-inline WeakValue::WeakValue(Returned<T> *obj)
- : d(new PersistentValuePrivate(QV4::Value::fromManaged(obj->getPointer()), /*engine*/0, /*weak*/true))
-{
-}
-
-template<typename T>
-inline WeakValue &WeakValue::operator=(Returned<T> *obj)
-{
- return operator=(QV4::Value::fromManaged(obj->getPointer()).asReturnedValue());
-}
-
-inline ValueRef::ValueRef(const ScopedValue &v)
- : ptr(v.ptr)
-{}
-
-template <typename T>
-inline ValueRef::ValueRef(const Scoped<T> &v)
- : ptr(v.ptr)
-{}
-
-inline ValueRef::ValueRef(const PersistentValue &v)
- : ptr(&v.d->value)
-{}
-
-inline ValueRef::ValueRef(PersistentValuePrivate *p)
- : ptr(&p->value)
-{}
-
-inline ValueRef &ValueRef::operator=(const ScopedValue &o)
-{
- *ptr = *o.ptr;
- return *this;
-}
-
struct ScopedProperty
{
ScopedProperty(Scope &scope)
{
property = reinterpret_cast<Property*>(scope.alloc(sizeof(Property) / sizeof(Value)));
+ property->value = Encode::undefined();
+ property->set = Encode::undefined();
}
Property *operator->() { return property; }
- operator const Property &() { return *property; }
+ operator const Property *() const { return property; }
+ operator Property *() { return property; }
Property *property;
};
+struct ExecutionContextSaver
+{
+ ExecutionEngine *engine;
+ Value *savedContext;
+
+ ExecutionContextSaver(Scope &scope, ExecutionContext *context)
+ : engine(context->d()->engine)
+ , savedContext(scope.alloc(1))
+ {
+ savedContext->m = context->d();
+#if QT_POINTER_SIZE == 4
+ savedContext->tag = QV4::Value::Managed_Type;
+#endif
+ }
+ ExecutionContextSaver(Scope &scope, Heap::ExecutionContext *context)
+ : engine(context->engine)
+ , savedContext(scope.alloc(1))
+ {
+ savedContext->m = context;
+#if QT_POINTER_SIZE == 4
+ savedContext->tag = QV4::Value::Managed_Type;
+#endif
+ }
+ ~ExecutionContextSaver()
+ {
+ engine->current = static_cast<Heap::ExecutionContext *>(savedContext->heapObject());
+ }
+};
+
+
}
QT_END_NAMESPACE
diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp
index fa4b4b1894..4fde0e2445 100644
--- a/src/qml/jsruntime/qv4script.cpp
+++ b/src/qml/jsruntime/qv4script.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -51,50 +51,80 @@
#include <QtCore/QDebug>
#include <QtCore/QString>
+QT_BEGIN_NAMESPACE
+
+namespace QV4 {
+namespace Heap {
+
+struct CompilationUnitHolder : Object {
+ inline CompilationUnitHolder(ExecutionEngine *engine, CompiledData::CompilationUnit *unit);
+
+ QQmlRefPointer<CompiledData::CompilationUnit> unit;
+};
+
+}
+
+struct CompilationUnitHolder : public Object
+{
+ V4_OBJECT2(CompilationUnitHolder, Object)
+ V4_NEEDS_DESTROY
+};
+
+inline
+Heap::CompilationUnitHolder::CompilationUnitHolder(ExecutionEngine *engine, CompiledData::CompilationUnit *unit)
+ : Heap::Object(engine)
+ , unit(unit)
+{
+}
+
+}
+
+QT_END_NAMESPACE
+
using namespace QV4;
-QmlBindingWrapper::Data::Data(ExecutionContext *scope, Function *f, Object *qml)
- : FunctionObject::Data(scope, scope->d()->engine->id_eval, /*createProto = */ false)
- , qml(qml)
+DEFINE_OBJECT_VTABLE(QmlBindingWrapper);
+DEFINE_OBJECT_VTABLE(CompilationUnitHolder);
+
+Heap::QmlBindingWrapper::QmlBindingWrapper(QV4::ExecutionContext *scope, Function *f, QV4::Object *qml)
+ : Heap::FunctionObject(scope, scope->d()->engine->id_eval, /*createProto = */ false)
+ , qml(qml->d())
{
Q_ASSERT(scope->inUse());
- setVTable(staticVTable());
function = f;
if (function)
function->compilationUnit->addref();
- needsActivation = function ? function->needsActivation() : false;
Scope s(scope);
- Scoped<QmlBindingWrapper> o(s, this);
+ Scoped<QV4::QmlBindingWrapper> o(s, this);
o->defineReadonlyProperty(scope->d()->engine->id_length, Primitive::fromInt32(1));
- o->d()->qmlContext = reinterpret_cast<CallContext *>(s.engine->currentContext()->newQmlContext(o, qml));
+ ScopedContext ctx(s, s.engine->currentContext());
+ o->d()->qmlContext = ctx->newQmlContext(o, qml);
s.engine->popContext();
}
-QmlBindingWrapper::Data::Data(ExecutionContext *scope, Object *qml)
- : FunctionObject::Data(scope, scope->d()->engine->id_eval, /*createProto = */ false)
- , qml(qml)
+Heap::QmlBindingWrapper::QmlBindingWrapper(QV4::ExecutionContext *scope, QV4::Object *qml)
+ : Heap::FunctionObject(scope, scope->d()->engine->id_eval, /*createProto = */ false)
+ , qml(qml->d())
{
Q_ASSERT(scope->inUse());
- setVTable(staticVTable());
- needsActivation = false;
-
Scope s(scope);
- Scoped<QmlBindingWrapper> o(s, this);
+ Scoped<QV4::QmlBindingWrapper> o(s, this);
o->defineReadonlyProperty(scope->d()->engine->id_length, Primitive::fromInt32(1));
- o->d()->qmlContext = reinterpret_cast<CallContext *>(s.engine->currentContext()->newQmlContext(o, qml));
+ ScopedContext ctx(s, s.engine->currentContext());
+ o->d()->qmlContext = ctx->newQmlContext(o, qml);
s.engine->popContext();
}
ReturnedValue QmlBindingWrapper::call(Managed *that, CallData *)
{
- ExecutionEngine *engine = that->engine();
+ ExecutionEngine *engine = static_cast<Object *>(that)->engine();
CHECK_STACK_LIMITS(engine);
Scope scope(engine);
@@ -102,97 +132,73 @@ ReturnedValue QmlBindingWrapper::call(Managed *that, CallData *)
if (!This->function())
return QV4::Encode::undefined();
- CallContext *ctx = This->d()->qmlContext;
+ Scoped<CallContext> ctx(scope, This->d()->qmlContext);
std::fill(ctx->d()->locals, ctx->d()->locals + ctx->d()->function->varCount(), Primitive::undefinedValue());
engine->pushContext(ctx);
- ScopedValue result(scope, This->function()->code(ctx, This->function()->codeData));
+ ScopedValue result(scope, This->function()->code(engine, This->function()->codeData));
engine->popContext();
- return result.asReturnedValue();
+ return result->asReturnedValue();
}
-void QmlBindingWrapper::markObjects(Managed *m, ExecutionEngine *e)
+void QmlBindingWrapper::markObjects(Heap::Base *m, ExecutionEngine *e)
{
- QmlBindingWrapper *wrapper = static_cast<QmlBindingWrapper*>(m);
- if (wrapper->d()->qml)
- wrapper->d()->qml->mark(e);
+ QmlBindingWrapper::Data *wrapper = static_cast<QmlBindingWrapper::Data *>(m);
+ if (wrapper->qml)
+ wrapper->qml->mark(e);
FunctionObject::markObjects(m, e);
- if (wrapper->d()->qmlContext)
- wrapper->d()->qmlContext->mark(e);
+ if (wrapper->qmlContext)
+ wrapper->qmlContext->mark(e);
}
static ReturnedValue signalParameterGetter(QV4::CallContext *ctx, uint parameterIndex)
{
- QV4::CallContext *signalEmittingContext = ctx->d()->parent->asCallContext();
- Q_ASSERT(signalEmittingContext);
+ QV4::Scope scope(ctx);
+ QV4::Scoped<CallContext> signalEmittingContext(scope, static_cast<Heap::CallContext *>(ctx->d()->parent));
+ Q_ASSERT(signalEmittingContext && signalEmittingContext->d()->type >= QV4::Heap::ExecutionContext::Type_SimpleCallContext);
return signalEmittingContext->argument(parameterIndex);
}
-Returned<FunctionObject> *QmlBindingWrapper::createQmlCallableForFunction(QQmlContextData *qmlContext, QObject *scopeObject, Function *runtimeFunction, const QList<QByteArray> &signalParameters, QString *error)
+Heap::FunctionObject *QmlBindingWrapper::createQmlCallableForFunction(QQmlContextData *qmlContext, QObject *scopeObject, Function *runtimeFunction, const QList<QByteArray> &signalParameters, QString *error)
{
ExecutionEngine *engine = QQmlEnginePrivate::getV4Engine(qmlContext->engine);
QV4::Scope valueScope(engine);
- QV4::ScopedObject qmlScopeObject(valueScope, QV4::QmlContextWrapper::qmlScope(engine->v8Engine, qmlContext, scopeObject));
- QV4::Scoped<QV4::QmlBindingWrapper> wrapper(valueScope, engine->memoryManager->alloc<QV4::QmlBindingWrapper>(engine->rootContext, qmlScopeObject));
+ QV4::ScopedObject qmlScopeObject(valueScope, QV4::QmlContextWrapper::qmlScope(engine, qmlContext, scopeObject));
+ ScopedContext global(valueScope, valueScope.engine->rootContext());
+ QV4::Scoped<QV4::QmlBindingWrapper> wrapper(valueScope, engine->memoryManager->alloc<QV4::QmlBindingWrapper>(global, qmlScopeObject));
+ QV4::Scoped<CallContext> wrapperContext(valueScope, wrapper->context());
if (!signalParameters.isEmpty()) {
if (error)
- QQmlPropertyCache::signalParameterStringForJS(qmlContext->engine, signalParameters, error);
+ QQmlPropertyCache::signalParameterStringForJS(engine, signalParameters, error);
QV4::ScopedProperty p(valueScope);
QV4::ScopedString s(valueScope);
int index = 0;
foreach (const QByteArray &param, signalParameters) {
- QV4::ScopedFunctionObject g(valueScope, engine->memoryManager->alloc<QV4::IndexedBuiltinFunction>(wrapper->context(), index++, signalParameterGetter));
+ QV4::ScopedFunctionObject g(valueScope, engine->memoryManager->alloc<QV4::IndexedBuiltinFunction>(wrapperContext, index++, signalParameterGetter));
p->setGetter(g);
p->setSetter(0);
s = engine->newString(QString::fromUtf8(param));
- qmlScopeObject->insertMember(s.getPointer(), p, QV4::Attr_Accessor|QV4::Attr_NotEnumerable|QV4::Attr_NotConfigurable);
+ qmlScopeObject->insertMember(s, p, QV4::Attr_Accessor|QV4::Attr_NotEnumerable|QV4::Attr_NotConfigurable);
}
}
- QV4::ScopedFunctionObject function(valueScope, QV4::FunctionObject::createScriptFunction(wrapper->context(), runtimeFunction));
- return function->asReturned<FunctionObject>();
+ QV4::ScopedFunctionObject function(valueScope, QV4::FunctionObject::createScriptFunction(wrapperContext, runtimeFunction));
+ return function->d();
}
-DEFINE_OBJECT_VTABLE(QmlBindingWrapper);
-
-struct CompilationUnitHolder : public Object
-{
- struct Data : Object::Data {
- Data(ExecutionEngine *engine, CompiledData::CompilationUnit *unit)
- : Object::Data(engine)
- , unit(unit)
- {
- setVTable(staticVTable());
- }
- QQmlRefPointer<QV4::CompiledData::CompilationUnit> unit;
- };
- V4_OBJECT(Object)
-
-
- static void destroy(Managed *that)
- {
- static_cast<CompilationUnitHolder*>(that)->d()->~Data();
- }
-
-};
-
-DEFINE_OBJECT_VTABLE(CompilationUnitHolder);
-
Script::Script(ExecutionEngine *v4, Object *qml, CompiledData::CompilationUnit *compilationUnit)
- : line(0), column(0), scope(v4->rootContext), strictMode(false), inheritContext(true), parsed(false)
- , qml(qml->asReturnedValue()), vmFunction(0), parseAsBinding(true)
+ : line(0), column(0), scope(v4->rootContext()), strictMode(false), inheritContext(true), parsed(false)
+ , qml(v4, qml), vmFunction(0), parseAsBinding(true)
{
parsed = true;
- if (compilationUnit) {
- vmFunction = compilationUnit->linkToEngine(v4);
- Q_ASSERT(vmFunction);
+ vmFunction = compilationUnit ? compilationUnit->linkToEngine(v4) : 0;
+ if (vmFunction) {
Scope valueScope(v4);
ScopedObject holder(valueScope, v4->memoryManager->alloc<CompilationUnitHolder>(v4, compilationUnit));
- compilationUnitHolder = holder.asReturnedValue();
- } else
- vmFunction = 0;
+ compilationUnitHolder.set(v4, holder);
+ }
}
Script::~Script()
@@ -208,7 +214,7 @@ void Script::parse()
parsed = true;
- ExecutionEngine *v4 = scope->d()->engine;
+ ExecutionEngine *v4 = scope->engine;
Scope valueScope(v4);
MemoryManager::GCBlocker gcBlocker(v4->memoryManager);
@@ -224,7 +230,7 @@ void Script::parse()
foreach (const QQmlJS::DiagnosticMessage &m, parser.diagnosticMessages()) {
if (m.isError()) {
- scope->throwSyntaxError(m.message, sourceFile, m.loc.startLine, m.loc.startColumn);
+ valueScope.engine->throwSyntaxError(m.message, sourceFile, m.loc.startLine, m.loc.startColumn);
return;
} else {
qWarning() << sourceFile << ':' << m.loc.startLine << ':' << m.loc.startColumn
@@ -243,14 +249,14 @@ void Script::parse()
QStringList inheritedLocals;
if (inheritContext) {
- CallContext *ctx = scope->asCallContext();
+ Scoped<CallContext> ctx(valueScope, scope);
if (ctx) {
- for (String * const *i = ctx->variables(), * const *ei = i + ctx->variableCount(); i < ei; ++i)
- inheritedLocals.append(*i ? (*i)->toQString() : QString());
+ for (Identifier * const *i = ctx->variables(), * const *ei = i + ctx->variableCount(); i < ei; ++i)
+ inheritedLocals.append(*i ? (*i)->string : QString());
}
}
- RuntimeCodegen cg(scope, strictMode);
+ RuntimeCodegen cg(v4, strictMode);
cg.generateFromProgram(sourceFile, sourceCode, program, &module, QQmlJS::Codegen::EvalCode, inheritedLocals);
if (v4->hasException)
return;
@@ -262,13 +268,13 @@ void Script::parse()
QQmlRefPointer<QV4::CompiledData::CompilationUnit> compilationUnit = isel->compile();
vmFunction = compilationUnit->linkToEngine(v4);
ScopedObject holder(valueScope, v4->memoryManager->alloc<CompilationUnitHolder>(v4, compilationUnit));
- compilationUnitHolder = holder.asReturnedValue();
+ compilationUnitHolder.set(v4, holder);
}
if (!vmFunction) {
// ### FIX file/line number
- Scoped<Object> error(valueScope, v4->newSyntaxErrorObject(QStringLiteral("Syntax error")));
- v4->currentContext()->throwError(error);
+ ScopedObject error(valueScope, v4->newSyntaxErrorObject(QStringLiteral("Syntax error")));
+ v4->throwError(error);
}
}
@@ -279,23 +285,24 @@ ReturnedValue Script::run()
if (!vmFunction)
return Encode::undefined();
- QV4::ExecutionEngine *engine = scope->d()->engine;
+ QV4::ExecutionEngine *engine = scope->engine;
QV4::Scope valueScope(engine);
if (qml.isUndefined()) {
TemporaryAssignment<Function*> savedGlobalCode(engine->globalCode, vmFunction);
- ExecutionContextSaver ctxSaver(scope);
- ContextStateSaver stateSaver(scope);
- scope->d()->strictMode = vmFunction->isStrict();
- scope->d()->lookups = vmFunction->compilationUnit->runtimeLookups;
- scope->d()->compilationUnit = vmFunction->compilationUnit;
+ ExecutionContextSaver ctxSaver(valueScope, scope);
+ ContextStateSaver stateSaver(valueScope, scope);
+ scope->strictMode = vmFunction->isStrict();
+ scope->lookups = vmFunction->compilationUnit->runtimeLookups;
+ scope->compilationUnit = vmFunction->compilationUnit;
- return vmFunction->code(scope, vmFunction->codeData);
+ return vmFunction->code(engine, vmFunction->codeData);
} else {
ScopedObject qmlObj(valueScope, qml.value());
- ScopedFunctionObject f(valueScope, engine->memoryManager->alloc<QmlBindingWrapper>(scope, vmFunction, qmlObj));
- ScopedCallData callData(valueScope, 0);
+ ScopedContext ctx(valueScope, scope);
+ ScopedFunctionObject f(valueScope, engine->memoryManager->alloc<QmlBindingWrapper>(ctx, vmFunction, qmlObj));
+ ScopedCallData callData(valueScope);
callData->thisObject = Primitive::undefinedValue();
return f->call(callData);
}
@@ -308,12 +315,14 @@ Function *Script::function()
return vmFunction;
}
-QQmlRefPointer<QV4::CompiledData::CompilationUnit> Script::precompile(IR::Module *module, Compiler::JSUnitGenerator *unitGenerator, ExecutionEngine *engine, const QUrl &url, const QString &source, QList<QQmlError> *reportedErrors)
+QQmlRefPointer<QV4::CompiledData::CompilationUnit> Script::precompile(IR::Module *module, Compiler::JSUnitGenerator *unitGenerator, ExecutionEngine *engine, const QUrl &url, const QString &source, QList<QQmlError> *reportedErrors, QQmlJS::Directives *directivesCollector)
{
using namespace QQmlJS;
using namespace QQmlJS::AST;
QQmlJS::Engine ee;
+ if (directivesCollector)
+ ee.setDirectives(directivesCollector);
QQmlJS::Lexer lexer(&ee);
lexer.setCode(source, /*line*/1, /*qml mode*/false);
QQmlJS::Parser parser(&ee);
@@ -367,10 +376,11 @@ ReturnedValue Script::qmlBinding()
{
if (!parsed)
parse();
- ExecutionEngine *v4 = scope->d()->engine;
+ ExecutionEngine *v4 = scope->engine;
Scope valueScope(v4);
ScopedObject qmlObj(valueScope, qml.value());
- ScopedObject v(valueScope, v4->memoryManager->alloc<QmlBindingWrapper>(scope, vmFunction, qmlObj));
+ ScopedContext ctx(valueScope, scope);
+ ScopedObject v(valueScope, v4->memoryManager->alloc<QmlBindingWrapper>(ctx, vmFunction, qmlObj));
return v.asReturnedValue();
}
@@ -379,14 +389,13 @@ QV4::ReturnedValue Script::evaluate(ExecutionEngine *engine, const QString &scr
QV4::Scope scope(engine);
QV4::Script qmlScript(engine, scopeObject, script, QString());
- QV4::ExecutionContext *ctx = engine->currentContext();
qmlScript.parse();
QV4::ScopedValue result(scope);
if (!scope.engine->hasException)
result = qmlScript.run();
if (scope.engine->hasException) {
- ctx->catchException();
+ scope.engine->catchException();
return Encode::undefined();
}
- return result.asReturnedValue();
+ return result->asReturnedValue();
}
diff --git a/src/qml/jsruntime/qv4script_p.h b/src/qml/jsruntime/qv4script_p.h
index ed93ce49ae..05a9e45f45 100644
--- a/src/qml/jsruntime/qv4script_p.h
+++ b/src/qml/jsruntime/qv4script_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -43,51 +43,69 @@ QT_BEGIN_NAMESPACE
class QQmlContextData;
-namespace QV4 {
+namespace QQmlJS {
+class Directives;
+}
-struct ExecutionContext;
+namespace QV4 {
struct ContextStateSaver {
- ExecutionContext *savedContext;
+ Value *savedContext;
bool strictMode;
Lookup *lookups;
CompiledData::CompilationUnit *compilationUnit;
int lineNumber;
- ContextStateSaver(ExecutionContext *context)
- : savedContext(context)
+ ContextStateSaver(Scope &scope, ExecutionContext *context)
+ : savedContext(scope.alloc(1))
, strictMode(context->d()->strictMode)
, lookups(context->d()->lookups)
, compilationUnit(context->d()->compilationUnit)
, lineNumber(context->d()->lineNumber)
- {}
+ {
+ savedContext->m = context->d();
+ }
+ ContextStateSaver(Scope &scope, Heap::ExecutionContext *context)
+ : savedContext(scope.alloc(1))
+ , strictMode(context->strictMode)
+ , lookups(context->lookups)
+ , compilationUnit(context->compilationUnit)
+ , lineNumber(context->lineNumber)
+ {
+ savedContext->m = context;
+ }
~ContextStateSaver()
{
- savedContext->d()->strictMode = strictMode;
- savedContext->d()->lookups = lookups;
- savedContext->d()->compilationUnit = compilationUnit;
- savedContext->d()->lineNumber = lineNumber;
+ Heap::ExecutionContext *ctx = static_cast<Heap::ExecutionContext *>(savedContext->m);
+ ctx->strictMode = strictMode;
+ ctx->lookups = lookups;
+ ctx->compilationUnit = compilationUnit;
+ ctx->lineNumber = lineNumber;
}
};
+namespace Heap {
+struct QmlBindingWrapper : Heap::FunctionObject {
+ QmlBindingWrapper(QV4::ExecutionContext *scope, Function *f, QV4::Object *qml);
+ // Constructor for QML functions and signal handlers, resulting binding wrapper is not callable!
+ QmlBindingWrapper(QV4::ExecutionContext *scope, QV4::Object *qml);
+ Object *qml;
+ CallContext *qmlContext;
+};
+
+}
+
struct Q_QML_EXPORT QmlBindingWrapper : FunctionObject {
- struct Data : FunctionObject::Data {
- Data(ExecutionContext *scope, Function *f, Object *qml);
- // Constructor for QML functions and signal handlers, resulting binding wrapper is not callable!
- Data(ExecutionContext *scope, Object *qml);
- Object *qml;
- CallContext *qmlContext;
- };
- V4_OBJECT(FunctionObject)
+ V4_OBJECT2(QmlBindingWrapper, FunctionObject)
static ReturnedValue call(Managed *that, CallData *);
- static void markObjects(Managed *m, ExecutionEngine *e);
+ static void markObjects(Heap::Base *m, ExecutionEngine *e);
- CallContext *context() const { return d()->qmlContext; }
+ Heap::CallContext *context() const { return d()->qmlContext; }
- static Returned<FunctionObject> *createQmlCallableForFunction(QQmlContextData *qmlContext, QObject *scopeObject, QV4::Function *runtimeFunction,
- const QList<QByteArray> &signalParameters = QList<QByteArray>(), QString *error = 0);
+ static Heap::FunctionObject *createQmlCallableForFunction(QQmlContextData *qmlContext, QObject *scopeObject, QV4::Function *runtimeFunction,
+ const QList<QByteArray> &signalParameters = QList<QByteArray>(), QString *error = 0);
private:
};
@@ -95,19 +113,20 @@ private:
struct Q_QML_EXPORT Script {
Script(ExecutionContext *scope, const QString &sourceCode, const QString &source = QString(), int line = 1, int column = 0)
: sourceFile(source), line(line), column(column), sourceCode(sourceCode)
- , scope(scope), strictMode(false), inheritContext(false), parsed(false)
+ , scope(scope->d()), strictMode(false), inheritContext(false), parsed(false)
, vmFunction(0), parseAsBinding(false) {}
Script(ExecutionEngine *engine, Object *qml, const QString &sourceCode, const QString &source = QString(), int line = 1, int column = 0)
: sourceFile(source), line(line), column(column), sourceCode(sourceCode)
- , scope(engine->rootContext), strictMode(false), inheritContext(true), parsed(false)
- , qml(qml->asReturnedValue()), vmFunction(0), parseAsBinding(true) {}
+ , scope(engine->rootContext()), strictMode(false), inheritContext(true), parsed(false)
+ , qml(engine, qml), vmFunction(0), parseAsBinding(true) {}
Script(ExecutionEngine *engine, Object *qml, CompiledData::CompilationUnit *compilationUnit);
~Script();
QString sourceFile;
int line;
int column;
QString sourceCode;
- ExecutionContext *scope;
+ // ### GC
+ Heap::ExecutionContext *scope;
bool strictMode;
bool inheritContext;
bool parsed;
@@ -122,7 +141,8 @@ struct Q_QML_EXPORT Script {
Function *function();
- static QQmlRefPointer<CompiledData::CompilationUnit> precompile(IR::Module *module, Compiler::JSUnitGenerator *unitGenerator, ExecutionEngine *engine, const QUrl &url, const QString &source, QList<QQmlError> *reportedErrors = 0);
+ static QQmlRefPointer<CompiledData::CompilationUnit> precompile(IR::Module *module, Compiler::JSUnitGenerator *unitGenerator, ExecutionEngine *engine, const QUrl &url, const QString &source,
+ QList<QQmlError> *reportedErrors = 0, QQmlJS::Directives *directivesCollector = 0);
static ReturnedValue evaluate(ExecutionEngine *engine, const QString &script, Object *scopeObject);
};
diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp
index 83bfb65658..f1f546bece 100644
--- a/src/qml/jsruntime/qv4sequenceobject.cpp
+++ b/src/qml/jsruntime/qv4sequenceobject.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -39,7 +39,11 @@
#include <private/qv4arrayobject_p.h>
#include <private/qqmlengine_p.h>
#include <private/qv4scopedvalue_p.h>
-#include <private/qv4internalclass_p.h>
+#include "qv4runtime_p.h"
+#include "qv4objectiterator_p.h"
+#include <private/qqmlvaluetypewrapper_p.h>
+#include <private/qqmlmodelindexvaluetype_p.h>
+#include <QtCore/qabstractitemmodel.h>
#include <algorithm>
@@ -48,15 +52,15 @@ QT_BEGIN_NAMESPACE
using namespace QV4;
// helper function to generate valid warnings if errors occur during sequence operations.
-static void generateWarning(QV4::ExecutionContext *ctx, const QString& description)
+static void generateWarning(QV4::ExecutionEngine *v4, const QString& description)
{
- QQmlEngine *engine = ctx->d()->engine->v8Engine->engine();
+ QQmlEngine *engine = v4->qmlEngine();
if (!engine)
return;
QQmlError retn;
retn.setDescription(description);
- QV4::StackFrame frame = ctx->d()->engine->currentStackFrame();
+ QV4::StackFrame frame = v4->currentStackFrame();
retn.setLine(frame.line);
retn.setUrl(QUrl(frame.source));
@@ -70,7 +74,9 @@ static void generateWarning(QV4::ExecutionContext *ctx, const QString& descripti
F(bool, Bool, QList<bool>, false) \
F(QString, String, QList<QString>, QString()) \
F(QString, QString, QStringList, QString()) \
- F(QUrl, Url, QList<QUrl>, QUrl())
+ F(QUrl, Url, QList<QUrl>, QUrl()) \
+ F(QModelIndex, QModelIndex, QModelIndexList, QModelIndex()) \
+ F(QItemSelectionRange, QItemSelectionRange, QItemSelection, QItemSelectionRange())
static QV4::ReturnedValue convertElementToValue(QV4::ExecutionEngine *engine, const QString &element)
{
@@ -87,6 +93,19 @@ static QV4::ReturnedValue convertElementToValue(QV4::ExecutionEngine *engine, co
return engine->newString(element.toString())->asReturnedValue();
}
+static QV4::ReturnedValue convertElementToValue(QV4::ExecutionEngine *engine, const QModelIndex &element)
+{
+ const QMetaObject *vtmo = QQmlValueTypeFactory::metaObjectForMetaType(QMetaType::QModelIndex);
+ return QV4::QQmlValueTypeWrapper::create(engine, QVariant(element), vtmo, QMetaType::QModelIndex);
+}
+
+static QV4::ReturnedValue convertElementToValue(QV4::ExecutionEngine *engine, const QItemSelectionRange &element)
+{
+ int metaTypeId = qMetaTypeId<QItemSelectionRange>();
+ const QMetaObject *vtmo = QQmlValueTypeFactory::metaObjectForMetaType(metaTypeId);
+ return QV4::QQmlValueTypeWrapper::create(engine, QVariant::fromValue(element), vtmo, metaTypeId);
+}
+
static QV4::ReturnedValue convertElementToValue(QV4::ExecutionEngine *, qreal element)
{
return QV4::Encode(element);
@@ -112,6 +131,16 @@ static QString convertElementToString(const QUrl &element)
return element.toString();
}
+static QString convertElementToString(const QModelIndex &element)
+{
+ return reinterpret_cast<const QQmlModelIndexValueType *>(&element)->toString();
+}
+
+static QString convertElementToString(const QItemSelectionRange &element)
+{
+ return reinterpret_cast<const QQmlItemSelectionRangeValueType *>(&element)->toString();
+}
+
static QString convertElementToString(qreal element)
{
QString qstr;
@@ -127,68 +156,74 @@ static QString convertElementToString(bool element)
return QStringLiteral("false");
}
-template <typename ElementType> ElementType convertValueToElement(const QV4::ValueRef value);
+template <typename ElementType> ElementType convertValueToElement(const Value &value);
+
+template <> QString convertValueToElement(const Value &value)
+{
+ return value.toQString();
+}
+
+template <> int convertValueToElement(const Value &value)
+{
+ return value.toInt32();
+}
-template <> QString convertValueToElement(const QV4::ValueRef value)
+template <> QUrl convertValueToElement(const Value &value)
{
- return value->toQString();
+ return QUrl(value.toQString());
}
-template <> int convertValueToElement(const QV4::ValueRef value)
+template <> QModelIndex convertValueToElement(const Value &value)
{
- return value->toInt32();
+ const QQmlValueTypeWrapper *v = value_cast<QQmlValueTypeWrapper>(value);
+ if (v)
+ return v->toVariant().toModelIndex();
+ return QModelIndex();
}
-template <> QUrl convertValueToElement(const QV4::ValueRef value)
+template <> QItemSelectionRange convertValueToElement(const Value &value)
{
- return QUrl(value->toQString());
+ const QQmlValueTypeWrapper *v = value_cast<QQmlValueTypeWrapper>(value);
+ if (v)
+ return v->toVariant().value<QItemSelectionRange>();
+ return QItemSelectionRange();
}
-template <> qreal convertValueToElement(const QV4::ValueRef value)
+template <> qreal convertValueToElement(const Value &value)
{
- return value->toNumber();
+ return value.toNumber();
}
-template <> bool convertValueToElement(const ValueRef value)
+template <> bool convertValueToElement(const Value &value)
{
- return value->toBoolean();
+ return value.toBoolean();
+}
+
+namespace QV4 {
+
+template <typename Container> struct QQmlSequence;
+
+namespace Heap {
+
+template <typename Container>
+struct QQmlSequence : Object {
+ QQmlSequence(QV4::ExecutionEngine *engine, const Container &container);
+ QQmlSequence(QV4::ExecutionEngine *engine, QObject *object, int propertyIndex);
+
+ mutable Container container;
+ QPointer<QObject> object;
+ int propertyIndex;
+ bool isReference;
+};
+
}
template <typename Container>
struct QQmlSequence : public QV4::Object
{
- struct Data : Object::Data {
- Data(QV4::ExecutionEngine *engine, const Container &container)
- : Object::Data(InternalClass::create(engine, staticVTable(), engine->sequencePrototype.asObject()))
- , container(container)
- , propertyIndex(-1)
- , isReference(false)
- {
- QV4::Scope scope(engine);
- QV4::Scoped<QQmlSequence<Container> > o(scope, this);
- o->setArrayType(ArrayData::Custom);
- o->init();
- }
-
- Data(QV4::ExecutionEngine *engine, QObject *object, int propertyIndex)
- : Object::Data(InternalClass::create(engine, staticVTable(), engine->sequencePrototype.asObject()))
- , object(object)
- , propertyIndex(propertyIndex)
- , isReference(true)
- {
- QV4::Scope scope(engine);
- QV4::Scoped<QQmlSequence<Container> > o(scope, this);
- o->setArrayType(ArrayData::Custom);
- o->loadReference();
- o->init();
- }
- mutable Container container;
- QPointer<QObject> object;
- int propertyIndex;
- bool isReference;
- };
- V4_OBJECT(QV4::Object)
+ V4_OBJECT2(QQmlSequence<Container>, QV4::Object)
Q_MANAGED_TYPE(QmlSequence)
+ V4_NEEDS_DESTROY
public:
void init()
@@ -200,7 +235,7 @@ public:
{
/* Qt containers have int (rather than uint) allowable indexes. */
if (index > INT_MAX) {
- generateWarning(engine()->currentContext(), QLatin1String("Index out of range during indexed get"));
+ generateWarning(engine(), QLatin1String("Index out of range during indexed get"));
if (hasProperty)
*hasProperty = false;
return Encode::undefined();
@@ -224,14 +259,14 @@ public:
return Encode::undefined();
}
- void containerPutIndexed(uint index, const QV4::ValueRef value)
+ void containerPutIndexed(uint index, const QV4::Value &value)
{
if (internalClass()->engine->hasException)
return;
/* Qt containers have int (rather than uint) allowable indexes. */
if (index > INT_MAX) {
- generateWarning(engine()->currentContext(), QLatin1String("Index out of range during indexed set"));
+ generateWarning(engine(), QLatin1String("Index out of range during indexed set"));
return;
}
@@ -269,7 +304,7 @@ public:
{
/* Qt containers have int (rather than uint) allowable indexes. */
if (index > INT_MAX) {
- generateWarning(engine()->currentContext(), QLatin1String("Index out of range during indexed query"));
+ generateWarning(engine(), QLatin1String("Index out of range during indexed query"));
return QV4::Attr_Invalid;
}
if (d()->isReference) {
@@ -281,9 +316,9 @@ public:
return (signedIdx < d()->container.count()) ? QV4::Attr_Data : QV4::Attr_Invalid;
}
- void containerAdvanceIterator(ObjectIterator *it, String *&name, uint *index, Property *p, PropertyAttributes *attrs)
+ void containerAdvanceIterator(ObjectIterator *it, Heap::String **name, uint *index, Property *p, PropertyAttributes *attrs)
{
- name = (String *)0;
+ *name = (Heap::String *)0;
*index = UINT_MAX;
if (d()->isReference) {
@@ -354,8 +389,8 @@ public:
struct CompareFunctor
{
- CompareFunctor(QV4::ExecutionContext *ctx, const QV4::ValueRef compareFn)
- : m_ctx(ctx), m_compareFn(compareFn)
+ CompareFunctor(QV4::ExecutionContext *ctx, const QV4::Value &compareFn)
+ : m_ctx(ctx), m_compareFn(&compareFn)
{}
bool operator()(typename Container::value_type lhs, typename Container::value_type rhs)
@@ -365,14 +400,14 @@ public:
ScopedCallData callData(scope, 2);
callData->args[0] = convertElementToValue(this->m_ctx->d()->engine, lhs);
callData->args[1] = convertElementToValue(this->m_ctx->d()->engine, rhs);
- callData->thisObject = this->m_ctx->d()->engine->globalObject;
+ callData->thisObject = this->m_ctx->d()->engine->globalObject();
QV4::ScopedValue result(scope, compare->call(callData));
return result->toNumber() < 0;
}
private:
QV4::ExecutionContext *m_ctx;
- QV4::ValueRef m_compareFn;
+ const QV4::Value *m_compareFn;
};
void sort(QV4::CallContext *ctx)
@@ -384,8 +419,8 @@ public:
}
QV4::Scope scope(ctx);
- if (ctx->d()->callData->argc == 1 && ctx->d()->callData->args[0].asFunctionObject()) {
- CompareFunctor cf(ctx, ctx->d()->callData->args[0]);
+ if (ctx->argc() == 1 && ctx->args()[0].asFunctionObject()) {
+ CompareFunctor cf(ctx, ctx->args()[0]);
std::sort(d()->container.begin(), d()->container.end(), cf);
} else {
DefaultCompareFunctor cf;
@@ -399,9 +434,9 @@ public:
static QV4::ReturnedValue method_get_length(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlSequence<Container> > This(scope, ctx->d()->callData->thisObject.as<QQmlSequence<Container> >());
+ QV4::Scoped<QQmlSequence<Container> > This(scope, ctx->thisObject().as<QQmlSequence<Container> >());
if (!This)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
if (This->d()->isReference) {
if (!This->d()->object)
@@ -414,14 +449,14 @@ public:
static QV4::ReturnedValue method_set_length(QV4::CallContext* ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlSequence<Container> > This(scope, ctx->d()->callData->thisObject.as<QQmlSequence<Container> >());
+ QV4::Scoped<QQmlSequence<Container> > This(scope, ctx->thisObject().as<QQmlSequence<Container> >());
if (!This)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
- quint32 newLength = ctx->d()->callData->args[0].toUInt32();
+ quint32 newLength = ctx->args()[0].toUInt32();
/* Qt containers have int (rather than uint) allowable indexes. */
if (newLength > INT_MAX) {
- generateWarning(ctx, QLatin1String("Index out of range during length set"));
+ generateWarning(scope.engine, QLatin1String("Index out of range during length set"));
return QV4::Encode::undefined();
}
/* Read the sequence from the QObject property if we're a reference */
@@ -473,7 +508,6 @@ public:
return QVariant::fromValue(result);
}
-private:
void loadReference() const
{
Q_ASSERT(d()->object);
@@ -494,7 +528,7 @@ private:
static QV4::ReturnedValue getIndexed(QV4::Managed *that, uint index, bool *hasProperty)
{ return static_cast<QQmlSequence<Container> *>(that)->containerGetIndexed(index, hasProperty); }
- static void putIndexed(Managed *that, uint index, const QV4::ValueRef value)
+ static void putIndexed(Managed *that, uint index, const QV4::Value &value)
{ static_cast<QQmlSequence<Container> *>(that)->containerPutIndexed(index, value); }
static QV4::PropertyAttributes queryIndexed(const QV4::Managed *that, uint index)
{ return static_cast<const QQmlSequence<Container> *>(that)->containerQueryIndexed(index); }
@@ -502,15 +536,43 @@ private:
{ return static_cast<QQmlSequence<Container> *>(that)->containerDeleteIndexedProperty(index); }
static bool isEqualTo(Managed *that, Managed *other)
{ return static_cast<QQmlSequence<Container> *>(that)->containerIsEqualTo(other); }
- static void advanceIterator(Managed *that, ObjectIterator *it, String *&name, uint *index, Property *p, PropertyAttributes *attrs)
+ static void advanceIterator(Managed *that, ObjectIterator *it, Heap::String **name, uint *index, Property *p, PropertyAttributes *attrs)
{ return static_cast<QQmlSequence<Container> *>(that)->containerAdvanceIterator(it, name, index, p, attrs); }
- static void destroy(Managed *that)
- {
- static_cast<QQmlSequence<Container> *>(that)->d()->~Data();
- }
};
+
+template <typename Container>
+Heap::QQmlSequence<Container>::QQmlSequence(QV4::ExecutionEngine *engine, const Container &container)
+ : Heap::Object(engine->emptyClass, engine->sequencePrototype.asObject())
+ , container(container)
+ , propertyIndex(-1)
+ , isReference(false)
+{
+ QV4::Scope scope(engine);
+ QV4::Scoped<QV4::QQmlSequence<Container> > o(scope, this);
+ o->setArrayType(Heap::ArrayData::Custom);
+ o->init();
+}
+
+template <typename Container>
+Heap::QQmlSequence<Container>::QQmlSequence(QV4::ExecutionEngine *engine, QObject *object, int propertyIndex)
+ : Heap::Object(engine->emptyClass, engine->sequencePrototype.asObject())
+ , object(object)
+ , propertyIndex(propertyIndex)
+ , isReference(true)
+{
+ QV4::Scope scope(engine);
+ QV4::Scoped<QV4::QQmlSequence<Container> > o(scope, this);
+ o->setArrayType(Heap::ArrayData::Custom);
+ o->loadReference();
+ o->init();
+}
+
+}
+
+namespace QV4 {
+
typedef QQmlSequence<QStringList> QQmlQStringList;
template<>
DEFINE_OBJECT_VTABLE(QQmlQStringList);
@@ -523,6 +585,12 @@ DEFINE_OBJECT_VTABLE(QQmlIntList);
typedef QQmlSequence<QList<QUrl> > QQmlUrlList;
template<>
DEFINE_OBJECT_VTABLE(QQmlUrlList);
+typedef QQmlSequence<QModelIndexList> QQmlQModelIndexList;
+template<>
+DEFINE_OBJECT_VTABLE(QQmlQModelIndexList);
+typedef QQmlSequence<QItemSelection> QQmlQItemSelectionRangeList;
+template<>
+DEFINE_OBJECT_VTABLE(QQmlQItemSelectionRangeList);
typedef QQmlSequence<QList<bool> > QQmlBoolList;
template<>
DEFINE_OBJECT_VTABLE(QQmlBoolList);
@@ -530,6 +598,8 @@ typedef QQmlSequence<QList<qreal> > QQmlRealList;
template<>
DEFINE_OBJECT_VTABLE(QQmlRealList);
+}
+
#define REGISTER_QML_SEQUENCE_METATYPE(unused, unused2, SequenceType, unused3) qRegisterMetaType<SequenceType>(#SequenceType);
void SequencePrototype::init()
{
@@ -542,11 +612,11 @@ void SequencePrototype::init()
QV4::ReturnedValue SequencePrototype::method_sort(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::ScopedObject o(scope, ctx->d()->callData->thisObject);
+ QV4::ScopedObject o(scope, ctx->thisObject());
if (!o || !o->isListType())
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
- if (ctx->d()->callData->argc >= 2)
+ if (ctx->argc() >= 2)
return o.asReturnedValue();
#define CALL_SORT(SequenceElementType, SequenceElementTypeName, SequenceType, DefaultValue) \
@@ -574,7 +644,7 @@ bool SequencePrototype::isSequenceType(int sequenceTypeId)
#define NEW_REFERENCE_SEQUENCE(ElementType, ElementTypeName, SequenceType, unused) \
if (sequenceType == qMetaTypeId<SequenceType>()) { \
- QV4::Scoped<QV4::Object> obj(scope, engine->memoryManager->alloc<QQml##ElementTypeName##List>(engine, object, propertyIndex)); \
+ QV4::ScopedObject obj(scope, engine->memoryManager->alloc<QQml##ElementTypeName##List>(engine, object, propertyIndex)); \
return obj.asReturnedValue(); \
} else
@@ -592,7 +662,7 @@ ReturnedValue SequencePrototype::newSequence(QV4::ExecutionEngine *engine, int s
#define NEW_COPY_SEQUENCE(ElementType, ElementTypeName, SequenceType, unused) \
if (sequenceType == qMetaTypeId<SequenceType>()) { \
- QV4::Scoped<QV4::Object> obj(scope, engine->memoryManager->alloc<QQml##ElementTypeName##List>(engine, v.value<SequenceType >())); \
+ QV4::ScopedObject obj(scope, engine->memoryManager->alloc<QQml##ElementTypeName##List>(engine, v.value<SequenceType >())); \
return obj.asReturnedValue(); \
} else
@@ -626,15 +696,15 @@ QVariant SequencePrototype::toVariant(Object *object)
return QQml##ElementTypeName##List::toVariant(a); \
} else
-QVariant SequencePrototype::toVariant(const QV4::ValueRef array, int typeHint, bool *succeeded)
+QVariant SequencePrototype::toVariant(const QV4::Value &array, int typeHint, bool *succeeded)
{
*succeeded = true;
- if (!array->asArrayObject()) {
+ if (!array.asArrayObject()) {
*succeeded = false;
return QVariant();
}
- QV4::Scope scope(array->engine());
+ QV4::Scope scope(array.asObject()->engine());
QV4::ScopedArrayObject a(scope, array);
FOREACH_QML_SEQUENCE_TYPE(SEQUENCE_TO_VARIANT) { /* else */ *succeeded = false; return QVariant(); }
diff --git a/src/qml/jsruntime/qv4sequenceobject_p.h b/src/qml/jsruntime/qv4sequenceobject_p.h
index be348e524c..9949278a89 100644
--- a/src/qml/jsruntime/qv4sequenceobject_p.h
+++ b/src/qml/jsruntime/qv4sequenceobject_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -50,6 +50,7 @@
#include "qv4value_inl_p.h"
#include "qv4object_p.h"
+#include "qv4context_p.h"
QT_BEGIN_NAMESPACE
@@ -61,7 +62,7 @@ struct SequencePrototype : public QV4::Object
static ReturnedValue method_valueOf(QV4::CallContext *ctx)
{
- return ctx->d()->callData->thisObject.toString(ctx)->asReturnedValue();
+ return ctx->thisObject().toString(ctx->engine())->asReturnedValue();
}
static ReturnedValue method_sort(QV4::CallContext *ctx);
@@ -71,7 +72,7 @@ struct SequencePrototype : public QV4::Object
static ReturnedValue fromVariant(QV4::ExecutionEngine *engine, const QVariant& v, bool *succeeded);
static int metaTypeForSequence(Object *object);
static QVariant toVariant(Object *object);
- static QVariant toVariant(const ValueRef array, int typeHint, bool *succeeded);
+ static QVariant toVariant(const Value &array, int typeHint, bool *succeeded);
};
}
diff --git a/src/qml/jsruntime/qv4serialize.cpp b/src/qml/jsruntime/qv4serialize.cpp
index 4b93afbc3a..31d85df13e 100644
--- a/src/qml/jsruntime/qv4serialize.cpp
+++ b/src/qml/jsruntime/qv4serialize.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -116,21 +116,21 @@ static inline void reserve(QByteArray &data, int extra)
static inline quint32 popUint32(const char *&data)
{
- quint32 rv = *((quint32 *)data);
+ quint32 rv = *((const quint32 *)data);
data += sizeof(quint32);
return rv;
}
static inline double popDouble(const char *&data)
{
- double rv = *((double *)data);
+ double rv = *((const double *)data);
data += sizeof(double);
return rv;
}
static inline void *popPtr(const char *&data)
{
- void *rv = *((void **)data);
+ void *rv = *((void *const *)data);
data += sizeof(void *);
return rv;
}
@@ -139,27 +139,26 @@ static inline void *popPtr(const char *&data)
// serialization/deserialization failures
#define ALIGN(size) (((size) + 3) & ~3)
-void Serialize::serialize(QByteArray &data, const QV4::ValueRef v, QV8Engine *engine)
+void Serialize::serialize(QByteArray &data, const QV4::Value &v, ExecutionEngine *engine)
{
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine);
- QV4::Scope scope(v4);
+ QV4::Scope scope(engine);
- if (v->isEmpty()) {
+ if (v.isEmpty()) {
Q_ASSERT(!"Serialize: got empty value");
- } else if (v->isUndefined()) {
+ } else if (v.isUndefined()) {
push(data, valueheader(WorkerUndefined));
- } else if (v->isNull()) {
+ } else if (v.isNull()) {
push(data, valueheader(WorkerNull));
- } else if (v->isBoolean()) {
- push(data, valueheader(v->booleanValue() == true ? WorkerTrue : WorkerFalse));
- } else if (v->isString()) {
- const QString &qstr = v->toQString();
+ } 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(uint16_t));
+ int utf16size = ALIGN(length * sizeof(quint16));
reserve(data, utf16size + sizeof(quint32));
push(data, valueheader(WorkerString, length));
@@ -169,13 +168,12 @@ void Serialize::serialize(QByteArray &data, const QV4::ValueRef v, QV8Engine *en
char *buffer = data.data() + offset;
memcpy(buffer, qstr.constData(), length*sizeof(QChar));
- } else if (v->asFunctionObject()) {
+ } else if (v.asFunctionObject()) {
// XXX TODO: Implement passing function objects between the main and
// worker scripts
push(data, valueheader(WorkerUndefined));
- } else if (v->asArrayObject()) {
- QV4::ScopedArrayObject array(scope, v);
- uint32_t length = array->getLength();
+ } else if (QV4::ArrayObject *array = v.asArrayObject()) {
+ uint length = array->getLength();
if (length > 0xFFFFFF) {
push(data, valueheader(WorkerUndefined));
return;
@@ -183,26 +181,25 @@ void Serialize::serialize(QByteArray &data, const QV4::ValueRef v, QV8Engine *en
reserve(data, sizeof(quint32) + length * sizeof(quint32));
push(data, valueheader(WorkerArray, length));
ScopedValue val(scope);
- for (uint32_t ii = 0; ii < length; ++ii)
+ for (uint ii = 0; ii < length; ++ii)
serialize(data, (val = array->getIndexed(ii)), engine);
- } else if (v->isInteger()) {
+ } else if (v.isInteger()) {
reserve(data, 2 * sizeof(quint32));
push(data, valueheader(WorkerInt32));
- push(data, (quint32)v->integerValue());
-// } else if (v->IsUint32()) {
+ push(data, (quint32)v.integerValue());
+// } else if (v.IsUint32()) {
// reserve(data, 2 * sizeof(quint32));
// push(data, valueheader(WorkerUint32));
-// push(data, v->Uint32Value());
- } else if (v->isNumber()) {
+// push(data, v.Uint32Value());
+ } else if (v.isNumber()) {
reserve(data, sizeof(quint32) + sizeof(double));
push(data, valueheader(WorkerNumber));
- push(data, v->asDouble());
- } else if (QV4::DateObject *d = v->asDateObject()) {
+ push(data, v.asDouble());
+ } else if (QV4::DateObject *d = v.asDateObject()) {
reserve(data, sizeof(quint32) + sizeof(double));
push(data, valueheader(WorkerDate));
push(data, d->date().asDouble());
- } else if (v->as<RegExpObject>()) {
- Scoped<RegExpObject> re(scope, v);
+ } else if (RegExpObject *re = v.as<RegExpObject>()) {
quint32 flags = re->flags();
QString pattern = re->source();
int length = pattern.length() + 1;
@@ -210,7 +207,7 @@ void Serialize::serialize(QByteArray &data, const QV4::ValueRef v, QV8Engine *en
push(data, valueheader(WorkerUndefined));
return;
}
- int utf16size = ALIGN(length * sizeof(uint16_t));
+ int utf16size = ALIGN(length * sizeof(quint16));
reserve(data, sizeof(quint32) + utf16size);
push(data, valueheader(WorkerRegexp, flags));
@@ -221,8 +218,7 @@ void Serialize::serialize(QByteArray &data, const QV4::ValueRef v, QV8Engine *en
char *buffer = data.data() + offset;
memcpy(buffer, pattern.constData(), length*sizeof(QChar));
- } else if (v->as<QV4::QObjectWrapper>()) {
- Scoped<QObjectWrapper> qobjectWrapper(scope, v);
+ } else if (QObjectWrapper *qobjectWrapper = v.as<QV4::QObjectWrapper>()) {
// XXX TODO: Generalize passing objects between the main thread and worker scripts so
// that others can trivially plug in their elements.
QQmlListModel *lm = qobject_cast<QQmlListModel *>(qobjectWrapper->object());
@@ -235,12 +231,11 @@ void Serialize::serialize(QByteArray &data, const QV4::ValueRef v, QV8Engine *en
}
// No other QObject's are allowed to be sent
push(data, valueheader(WorkerUndefined));
- } else if (v->asObject()) {
- ScopedObject o(scope, v);
+ } else if (Object *o = v.asObject()) {
if (o->isListType()) {
// valid sequence. we generate a length (sequence length + 1 for the sequence type)
- uint32_t seqLength = ScopedValue(scope, o->get(v4->id_length))->toUInt32();
- uint32_t length = seqLength + 1;
+ uint seqLength = ScopedValue(scope, o->get(engine->id_length))->toUInt32();
+ uint length = seqLength + 1;
if (length > 0xFFFFFF) {
push(data, valueheader(WorkerUndefined));
return;
@@ -249,15 +244,15 @@ void Serialize::serialize(QByteArray &data, const QV4::ValueRef v, QV8Engine *en
push(data, valueheader(WorkerSequence, length));
serialize(data, QV4::Primitive::fromInt32(QV4::SequencePrototype::metaTypeForSequence(o)), engine); // sequence type
ScopedValue val(scope);
- for (uint32_t ii = 0; ii < seqLength; ++ii)
+ for (uint ii = 0; ii < seqLength; ++ii)
serialize(data, (val = o->getIndexed(ii)), engine); // sequence elements
return;
}
// regular object
- QV4::ScopedValue val(scope, *v);
- QV4::ScopedArrayObject properties(scope, QV4::ObjectPrototype::getOwnPropertyNames(v4, val));
+ QV4::ScopedValue val(scope, v);
+ QV4::ScopedArrayObject properties(scope, QV4::ObjectPrototype::getOwnPropertyNames(engine, val));
quint32 length = properties->getLength();
if (length > 0xFFFFFF) {
push(data, valueheader(WorkerUndefined));
@@ -266,16 +261,14 @@ void Serialize::serialize(QByteArray &data, const QV4::ValueRef v, QV8Engine *en
push(data, valueheader(WorkerObject, length));
QV4::ScopedValue s(scope);
- QV4::ScopedString str(scope);
for (quint32 ii = 0; ii < length; ++ii) {
s = properties->getIndexed(ii);
serialize(data, s, engine);
- QV4::ExecutionContext *ctx = v4->currentContext();
- str = s;
- val = o->get(str.getPointer());
+ QV4::String *str = s->asString();
+ val = o->get(str);
if (scope.hasException())
- ctx->catchException();
+ scope.engine->catchException();
serialize(data, val, engine);
}
@@ -285,13 +278,12 @@ void Serialize::serialize(QByteArray &data, const QV4::ValueRef v, QV8Engine *en
}
}
-ReturnedValue Serialize::deserialize(const char *&data, QV8Engine *engine)
+ReturnedValue Serialize::deserialize(const char *&data, ExecutionEngine *engine)
{
quint32 header = popUint32(data);
Type type = headertype(header);
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine);
- Scope scope(v4);
+ Scope scope(engine);
switch (type) {
case WorkerUndefined:
@@ -305,9 +297,9 @@ ReturnedValue Serialize::deserialize(const char *&data, QV8Engine *engine)
case WorkerString:
{
quint32 size = headersize(header);
- QString qstr((QChar *)data, size);
- data += ALIGN(size * sizeof(uint16_t));
- return QV4::Encode(v4->newString(qstr));
+ QString qstr((const QChar *)data, size);
+ data += ALIGN(size * sizeof(quint16));
+ return QV4::Encode(engine->newString(qstr));
}
case WorkerFunction:
Q_ASSERT(!"Unreachable");
@@ -315,7 +307,7 @@ ReturnedValue Serialize::deserialize(const char *&data, QV8Engine *engine)
case WorkerArray:
{
quint32 size = headersize(header);
- Scoped<ArrayObject> a(scope, v4->newArrayObject());
+ ScopedArrayObject a(scope, engine->newArrayObject());
ScopedValue v(scope);
for (quint32 ii = 0; ii < size; ++ii) {
v = deserialize(data, engine);
@@ -326,15 +318,15 @@ ReturnedValue Serialize::deserialize(const char *&data, QV8Engine *engine)
case WorkerObject:
{
quint32 size = headersize(header);
- Scoped<Object> o(scope, v4->newObject());
+ ScopedObject o(scope, engine->newObject());
ScopedValue name(scope);
ScopedString n(scope);
ScopedValue value(scope);
for (quint32 ii = 0; ii < size; ++ii) {
name = deserialize(data, engine);
value = deserialize(data, engine);
- n = name.asReturnedValue();
- o->put(n.getPointer(), value);
+ n = name->asReturnedValue();
+ o->put(n, value);
}
return o.asReturnedValue();
}
@@ -345,30 +337,30 @@ ReturnedValue Serialize::deserialize(const char *&data, QV8Engine *engine)
case WorkerNumber:
return QV4::Encode(popDouble(data));
case WorkerDate:
- return QV4::Encode(v4->newDateObject(QV4::Primitive::fromDouble(popDouble(data))));
+ return QV4::Encode(engine->newDateObject(QV4::Primitive::fromDouble(popDouble(data))));
case WorkerRegexp:
{
quint32 flags = headersize(header);
quint32 length = popUint32(data);
- QString pattern = QString((QChar *)data, length - 1);
- data += ALIGN(length * sizeof(uint16_t));
- return Encode(v4->newRegExpObject(pattern, flags));
+ QString pattern = QString((const QChar *)data, length - 1);
+ data += ALIGN(length * sizeof(quint16));
+ return Encode(engine->newRegExpObject(pattern, flags));
}
case WorkerListModel:
{
void *ptr = popPtr(data);
QQmlListModelWorkerAgent *agent = (QQmlListModelWorkerAgent *)ptr;
- QV4::ScopedValue rv(scope, QV4::QObjectWrapper::wrap(v4, agent));
+ QV4::ScopedValue rv(scope, QV4::QObjectWrapper::wrap(engine, agent));
// ### Find a better solution then the ugly property
QQmlListModelWorkerAgent::VariantRef ref(agent);
QVariant var = qVariantFromValue(ref);
- QV4::ScopedValue v(scope, engine->fromVariant((var)));
- QV4::ScopedString s(scope, v4->newString(QStringLiteral("__qml:hidden:ref")));
- rv->asObject()->defineReadonlyProperty(s.getPointer(), v);
+ QV4::ScopedValue v(scope, scope.engine->fromVariant(var));
+ QV4::ScopedString s(scope, engine->newString(QStringLiteral("__qml:hidden:ref")));
+ rv->asObject()->defineReadonlyProperty(s, v);
agent->release();
- agent->setV8Engine(engine);
- return rv.asReturnedValue();
+ agent->setEngine(engine);
+ return rv->asReturnedValue();
}
case WorkerSequence:
{
@@ -378,7 +370,7 @@ ReturnedValue Serialize::deserialize(const char *&data, QV8Engine *engine)
quint32 seqLength = length - 1;
value = deserialize(data, engine);
int sequenceType = value->integerValue();
- Scoped<ArrayObject> array(scope, v4->newArrayObject());
+ ScopedArrayObject array(scope, engine->newArrayObject());
array->arrayReserve(seqLength);
for (quint32 ii = 0; ii < seqLength; ++ii) {
value = deserialize(data, engine);
@@ -386,21 +378,21 @@ ReturnedValue Serialize::deserialize(const char *&data, QV8Engine *engine)
}
array->setArrayLengthUnchecked(seqLength);
QVariant seqVariant = QV4::SequencePrototype::toVariant(array, sequenceType, &succeeded);
- return QV4::SequencePrototype::fromVariant(v4, seqVariant, &succeeded);
+ return QV4::SequencePrototype::fromVariant(engine, seqVariant, &succeeded);
}
}
Q_ASSERT(!"Unreachable");
return QV4::Encode::undefined();
}
-QByteArray Serialize::serialize(const QV4::ValueRef value, QV8Engine *engine)
+QByteArray Serialize::serialize(const QV4::Value &value, ExecutionEngine *engine)
{
QByteArray rv;
serialize(rv, value, engine);
return rv;
}
-ReturnedValue Serialize::deserialize(const QByteArray &data, QV8Engine *engine)
+ReturnedValue Serialize::deserialize(const QByteArray &data, ExecutionEngine *engine)
{
const char *stream = data.constData();
return deserialize(stream, engine);
diff --git a/src/qml/jsruntime/qv4serialize_p.h b/src/qml/jsruntime/qv4serialize_p.h
index f46c30cd24..06eaffe4c4 100644
--- a/src/qml/jsruntime/qv4serialize_p.h
+++ b/src/qml/jsruntime/qv4serialize_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -57,12 +57,12 @@ namespace QV4 {
class Serialize {
public:
- static QByteArray serialize(const ValueRef, QV8Engine *);
- static ReturnedValue deserialize(const QByteArray &, QV8Engine *);
+ static QByteArray serialize(const Value &, ExecutionEngine *);
+ static ReturnedValue deserialize(const QByteArray &, ExecutionEngine *);
private:
- static void serialize(QByteArray &, const ValueRef, QV8Engine *);
- static ReturnedValue deserialize(const char *&, QV8Engine *);
+ static void serialize(QByteArray &, const Value &, ExecutionEngine *);
+ static ReturnedValue deserialize(const char *&, ExecutionEngine *);
};
}
diff --git a/src/qml/jsruntime/qv4sparsearray.cpp b/src/qml/jsruntime/qv4sparsearray.cpp
index da5cae3046..01f94eeac6 100644
--- a/src/qml/jsruntime/qv4sparsearray.cpp
+++ b/src/qml/jsruntime/qv4sparsearray.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/jsruntime/qv4sparsearray_p.h b/src/qml/jsruntime/qv4sparsearray_p.h
index 3c24995575..861c7dd28d 100644
--- a/src/qml/jsruntime/qv4sparsearray_p.h
+++ b/src/qml/jsruntime/qv4sparsearray_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/jsruntime/qv4string.cpp b/src/qml/jsruntime/qv4string.cpp
index bd8a5ffccb..6d55eb2c18 100644
--- a/src/qml/jsruntime/qv4string.cpp
+++ b/src/qml/jsruntime/qv4string.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -43,9 +43,8 @@
using namespace QV4;
-static uint toArrayIndex(const QChar *ch, const QChar *end, bool *ok)
+static uint toArrayIndex(const QChar *ch, const QChar *end)
{
- *ok = false;
uint i = ch->unicode() - '0';
if (i > 9)
return UINT_MAX;
@@ -65,15 +64,13 @@ static uint toArrayIndex(const QChar *ch, const QChar *end, bool *ok)
i = n;
++ch;
}
- *ok = true;
return i;
}
#ifndef V4_BOOTSTRAP
-static uint toArrayIndex(const char *ch, const char *end, bool *ok)
+static uint toArrayIndex(const char *ch, const char *end)
{
- *ok = false;
uint i = *ch - '0';
if (i > 9)
return UINT_MAX;
@@ -93,133 +90,19 @@ static uint toArrayIndex(const char *ch, const char *end, bool *ok)
i = n;
++ch;
}
- *ok = true;
return i;
}
-const ObjectVTable String::static_vtbl =
-{
- DEFINE_MANAGED_VTABLE_INT(String, 0),
- 0,
- 0,
- get,
- getIndexed,
- put,
- putIndexed,
- query,
- queryIndexed,
- deleteProperty,
- deleteIndexedProperty,
- 0 /*getLookup*/,
- 0 /*setLookup*/,
- 0,
- 0 /*advanceIterator*/,
-};
-
-void String::destroy(Managed *that)
-{
- static_cast<String*>(that)->d()->~Data();
-}
-
-void String::markObjects(Managed *that, ExecutionEngine *e)
-{
- String *s = static_cast<String *>(that);
- if (s->d()->largestSubLength) {
- s->d()->left->mark(e);
- s->d()->right->mark(e);
- }
-}
-
-ReturnedValue String::get(Managed *m, String *name, bool *hasProperty)
-{
- ExecutionEngine *v4 = m->engine();
- Scope scope(v4);
- ScopedString that(scope, static_cast<String *>(m));
-
- if (name->equals(v4->id_length)) {
- if (hasProperty)
- *hasProperty = true;
- return Primitive::fromInt32(that->d()->text->size).asReturnedValue();
- }
- PropertyAttributes attrs;
- Property *pd = v4->stringObjectClass->prototype->__getPropertyDescriptor__(name, &attrs);
- if (!pd || attrs.isGeneric()) {
- if (hasProperty)
- *hasProperty = false;
- return Primitive::undefinedValue().asReturnedValue();
- }
- if (hasProperty)
- *hasProperty = true;
- return v4->stringObjectClass->prototype->getValue(that, pd, attrs);
-}
+DEFINE_MANAGED_VTABLE(String);
-ReturnedValue String::getIndexed(Managed *m, uint index, bool *hasProperty)
+void String::markObjects(Heap::Base *that, ExecutionEngine *e)
{
- ExecutionEngine *engine = m->engine();
- Scope scope(engine);
- ScopedString that(scope, static_cast<String *>(m));
-
- if (index < static_cast<uint>(that->d()->text->size)) {
- if (hasProperty)
- *hasProperty = true;
- return Encode(engine->newString(that->toQString().mid(index, 1)));
- }
- PropertyAttributes attrs;
- Property *pd = engine->stringObjectClass->prototype->__getPropertyDescriptor__(index, &attrs);
- if (!pd || attrs.isGeneric()) {
- if (hasProperty)
- *hasProperty = false;
- return Primitive::undefinedValue().asReturnedValue();
+ String::Data *s = static_cast<String::Data *>(that);
+ if (s->largestSubLength) {
+ s->left->mark(e);
+ s->right->mark(e);
}
- if (hasProperty)
- *hasProperty = true;
- return engine->stringObjectClass->prototype->getValue(that, pd, attrs);
-}
-
-void String::put(Managed *m, String *name, const ValueRef value)
-{
- Scope scope(m->engine());
- if (scope.hasException())
- return;
- ScopedString that(scope, static_cast<String *>(m));
- Scoped<Object> o(scope, that->engine()->newStringObject(that));
- o->put(name, value);
-}
-
-void String::putIndexed(Managed *m, uint index, const ValueRef value)
-{
- Scope scope(m->engine());
- if (scope.hasException())
- return;
-
- ScopedString that(scope, static_cast<String *>(m));
- Scoped<Object> o(scope, that->engine()->newStringObject(that));
- o->putIndexed(index, value);
-}
-
-PropertyAttributes String::query(const Managed *m, String *name)
-{
- uint idx = name->asArrayIndex();
- if (idx != UINT_MAX)
- return queryIndexed(m, idx);
- return Attr_Invalid;
-}
-
-PropertyAttributes String::queryIndexed(const Managed *m, uint index)
-{
- const String *that = static_cast<const String *>(m);
- return (index < static_cast<uint>(that->d()->text->size)) ? Attr_NotConfigurable|Attr_NotWritable : Attr_Invalid;
-}
-
-bool String::deleteProperty(Managed *, String *)
-{
- return false;
-}
-
-bool String::deleteIndexedProperty(Managed *, uint)
-{
- return false;
}
bool String::isEqualTo(Managed *t, Managed *o)
@@ -227,26 +110,17 @@ bool String::isEqualTo(Managed *t, Managed *o)
if (t == o)
return true;
- if (!o->internalClass()->vtable->isString)
- return false;
-
- String *that = static_cast<String *>(t);
- String *other = static_cast<String *>(o);
- if (that->hashValue() != other->hashValue())
+ if (!o->d()->vtable->isString)
return false;
- if (that->identifier() && that->identifier() == other->identifier())
- return true;
- if (that->subtype() >= StringType_UInt && that->subtype() == other->subtype())
- return true;
- return that->toQString() == other->toQString();
+ return static_cast<String *>(t)->isEqualTo(static_cast<String *>(o));
}
-String::Data::Data(ExecutionEngine *engine, const QString &t)
- : Managed::Data(engine->stringClass)
+Heap::String::String(MemoryManager *mm, const QString &t)
+ : mm(mm)
{
- subtype = StringType_Unknown;
+ subtype = String::StringType_Unknown;
text = const_cast<QString &>(t).data_ptr();
text->ref.ref();
@@ -256,21 +130,21 @@ String::Data::Data(ExecutionEngine *engine, const QString &t)
len = text->size;
}
-String::Data::Data(ExecutionEngine *engine, String *l, String *r)
- : Managed::Data(engine->stringClass)
+Heap::String::String(MemoryManager *mm, String *l, String *r)
+ : mm(mm)
{
- subtype = StringType_Unknown;
+ subtype = String::StringType_Unknown;
left = l;
right = r;
stringHash = UINT_MAX;
- largestSubLength = qMax(l->d()->largestSubLength, r->d()->largestSubLength);
- len = l->d()->len + r->d()->len;
+ largestSubLength = qMax(l->largestSubLength, r->largestSubLength);
+ len = l->len + r->len;
- if (!l->d()->largestSubLength && l->d()->len > largestSubLength)
- largestSubLength = l->d()->len;
- if (!r->d()->largestSubLength && r->d()->len > largestSubLength)
- largestSubLength = r->d()->len;
+ if (!l->largestSubLength && l->len > largestSubLength)
+ largestSubLength = l->len;
+ if (!r->largestSubLength && r->len > largestSubLength)
+ largestSubLength = r->len;
// make sure we don't get excessive depth in our strings
if (len > 256 && len >= 2*largestSubLength)
@@ -281,12 +155,12 @@ uint String::toUInt(bool *ok) const
{
*ok = true;
- if (subtype() == StringType_Unknown)
- createHashValue();
- if (subtype() >= StringType_UInt)
+ if (subtype() == Heap::String::StringType_Unknown)
+ d()->createHashValue();
+ if (subtype() == Heap::String::StringType_ArrayIndex)
return d()->stringHash;
- // ### this conversion shouldn't be required
+ // required for UINT_MAX or numbers starting with a leading 0
double d = RuntimeHelpers::stringToNumber(toQString());
uint l = (uint)d;
if (d == l)
@@ -295,29 +169,15 @@ uint String::toUInt(bool *ok) const
return UINT_MAX;
}
-bool String::equals(String *other) const
-{
- if (this == other)
- return true;
- if (hashValue() != other->hashValue())
- return false;
- if (identifier() && identifier() == other->identifier())
- return true;
- if (subtype() >= StringType_UInt && subtype() == other->subtype())
- return true;
-
- return toQString() == other->toQString();
-}
-
-void String::makeIdentifierImpl() const
+void String::makeIdentifierImpl(ExecutionEngine *e) const
{
if (d()->largestSubLength)
d()->simplifyString();
Q_ASSERT(!d()->largestSubLength);
- engine()->identifierTable->identifier(this);
+ e->identifierTable->identifier(this);
}
-void String::Data::simplifyString() const
+void Heap::String::simplifyString() const
{
Q_ASSERT(largestSubLength);
@@ -329,21 +189,47 @@ void String::Data::simplifyString() const
text->ref.ref();
identifier = 0;
largestSubLength = 0;
+ mm->growUnmanagedHeapSizeUsage(size_t(text->size) * sizeof(QChar));
+}
+
+void Heap::String::createHashValue() const
+{
+ if (largestSubLength)
+ simplifyString();
+ Q_ASSERT(!largestSubLength);
+ const QChar *ch = reinterpret_cast<const QChar *>(text->data());
+ const QChar *end = ch + text->size;
+
+ // array indices get their number as hash value
+ stringHash = ::toArrayIndex(ch, end);
+ if (stringHash != UINT_MAX) {
+ subtype = Heap::String::StringType_ArrayIndex;
+ return;
+ }
+
+ uint h = 0xffffffff;
+ while (ch < end) {
+ h = 31 * h + ch->unicode();
+ ++ch;
+ }
+
+ stringHash = h;
+ subtype = Heap::String::StringType_Regular;
}
-void String::Data::append(const String::Data *data, QChar *ch)
+void Heap::String::append(const String *data, QChar *ch)
{
- std::vector<const String::Data *> worklist;
+ std::vector<const String *> worklist;
worklist.reserve(32);
worklist.push_back(data);
while (!worklist.empty()) {
- const String::Data *item = worklist.back();
+ const String *item = worklist.back();
worklist.pop_back();
if (item->largestSubLength) {
- worklist.push_back(item->right->d());
- worklist.push_back(item->left->d());
+ worklist.push_back(item->right);
+ worklist.push_back(item->left);
} else {
memcpy(ch, item->text->data(), item->text->size * sizeof(QChar));
ch += item->text->size;
@@ -352,40 +238,15 @@ void String::Data::append(const String::Data *data, QChar *ch)
}
-void String::createHashValue() const
-{
- if (d()->largestSubLength)
- d()->simplifyString();
- Q_ASSERT(!d()->largestSubLength);
- const QChar *ch = reinterpret_cast<const QChar *>(d()->text->data());
- const QChar *end = ch + d()->text->size;
-
- // array indices get their number as hash value
- bool ok;
- d()->stringHash = ::toArrayIndex(ch, end, &ok);
- if (ok) {
- setSubtype((d()->stringHash == UINT_MAX) ? StringType_UInt : StringType_ArrayIndex);
- return;
- }
-
- uint h = 0xffffffff;
- while (ch < end) {
- h = 31 * h + ch->unicode();
- ++ch;
- }
- d()->stringHash = h;
- setSubtype(StringType_Regular);
-}
uint String::createHashValue(const QChar *ch, int length)
{
const QChar *end = ch + length;
// array indices get their number as hash value
- bool ok;
- uint stringHash = ::toArrayIndex(ch, end, &ok);
- if (ok)
+ uint stringHash = ::toArrayIndex(ch, end);
+ if (stringHash != UINT_MAX)
return stringHash;
uint h = 0xffffffff;
@@ -402,9 +263,8 @@ uint String::createHashValue(const char *ch, int length)
const char *end = ch + length;
// array indices get their number as hash value
- bool ok;
- uint stringHash = ::toArrayIndex(ch, end, &ok);
- if (ok)
+ uint stringHash = ::toArrayIndex(ch, end);
+ if (stringHash != UINT_MAX)
return stringHash;
uint h = 0xffffffff;
@@ -427,7 +287,6 @@ uint String::getLength(const Managed *m)
uint String::toArrayIndex(const QString &str)
{
- bool ok;
- return ::toArrayIndex(str.constData(), str.constData() + str.length(), &ok);
+ return ::toArrayIndex(str.constData(), str.constData() + str.length());
}
diff --git a/src/qml/jsruntime/qv4string_p.h b/src/qml/jsruntime/qv4string_p.h
index ce0e1f9d73..1cf8f51a29 100644
--- a/src/qml/jsruntime/qv4string_p.h
+++ b/src/qml/jsruntime/qv4string_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -43,126 +43,143 @@ namespace QV4 {
struct ExecutionEngine;
struct Identifier;
-struct Q_QML_PRIVATE_EXPORT String : public Managed {
-#ifndef V4_BOOTSTRAP
- struct Q_QML_PRIVATE_EXPORT Data : Managed::Data {
- Data(ExecutionEngine *engine, const QString &text);
- Data(ExecutionEngine *engine, String *l, String *n);
- ~Data() {
- if (!largestSubLength && !text->ref.deref())
- QStringData::deallocate(text);
- }
- void simplifyString() const;
- int length() const {
- Q_ASSERT((largestSubLength &&
- (len == left->d()->len + right->d()->len)) ||
- len == (uint)text->size);
- return len;
- }
- union {
- mutable QStringData *text;
- mutable String *left;
- };
- union {
- mutable Identifier *identifier;
- mutable String *right;
- };
- mutable uint stringHash;
- mutable uint largestSubLength;
- uint len;
- private:
- static void append(const Data *data, QChar *ch);
- };
- // ### FIXME: Should this be a V4_OBJECT
- V4_OBJECT(QV4::Managed)
- Q_MANAGED_TYPE(String)
- enum {
- IsString = true
- };
+namespace Heap {
+#ifndef V4_BOOTSTRAP
+struct Q_QML_PRIVATE_EXPORT String : Base {
enum StringType {
StringType_Unknown,
StringType_Regular,
- StringType_UInt,
StringType_ArrayIndex
};
- bool equals(String *other) const;
+ String(MemoryManager *mm, const QString &text);
+ String(MemoryManager *mm, String *l, String *n);
+ ~String() {
+ if (!largestSubLength && !text->ref.deref())
+ QStringData::deallocate(text);
+ }
+ void simplifyString() const;
+ int length() const {
+ Q_ASSERT((largestSubLength &&
+ (len == left->len + right->len)) ||
+ len == (uint)text->size);
+ return len;
+ }
+ std::size_t retainedTextSize() const {
+ return largestSubLength ? 0 : (std::size_t(text->size) * sizeof(QChar));
+ }
+ void createHashValue() const;
+ inline unsigned hashValue() const {
+ if (subtype == StringType_Unknown)
+ createHashValue();
+ Q_ASSERT(!largestSubLength);
+
+ return stringHash;
+ }
+ inline QString toQString() const {
+ if (largestSubLength)
+ simplifyString();
+ QStringDataPtr ptr = { text };
+ text->ref.ref();
+ return QString(ptr);
+ }
inline bool isEqualTo(const String *other) const {
if (this == other)
return true;
if (hashValue() != other->hashValue())
return false;
- Q_ASSERT(!d()->largestSubLength);
- if (d()->identifier && d()->identifier == other->d()->identifier)
+ Q_ASSERT(!largestSubLength);
+ if (identifier && identifier == other->identifier)
return true;
- if (subtype() >= StringType_UInt && subtype() == other->subtype())
+ if (subtype == Heap::String::StringType_ArrayIndex && other->subtype == Heap::String::StringType_ArrayIndex)
return true;
return toQString() == other->toQString();
}
+ union {
+ mutable QStringData *text;
+ mutable String *left;
+ };
+ union {
+ mutable Identifier *identifier;
+ mutable String *right;
+ };
+ mutable uint subtype;
+ mutable uint stringHash;
+ mutable uint largestSubLength;
+ uint len;
+ MemoryManager *mm;
+private:
+ static void append(const String *data, QChar *ch);
+};
+#endif
+
+}
+
+struct Q_QML_PRIVATE_EXPORT String : public Managed {
+#ifndef V4_BOOTSTRAP
+ V4_MANAGED(String, Managed)
+ Q_MANAGED_TYPE(String)
+ V4_NEEDS_DESTROY
+ enum {
+ IsString = true
+ };
+
+ uchar subtype() const { return d()->subtype; }
+ void setSubtype(uchar subtype) const { d()->subtype = subtype; }
+
+ bool equals(String *other) const {
+ return d()->isEqualTo(other->d());
+ }
+ inline bool isEqualTo(const String *other) const {
+ return d()->isEqualTo(other->d());
+ }
+
inline bool compare(const String *other) {
return toQString() < other->toQString();
}
inline QString toQString() const {
- if (d()->largestSubLength)
- d()->simplifyString();
- QStringDataPtr ptr = { d()->text };
- d()->text->ref.ref();
- return QString(ptr);
+ return d()->toQString();
}
inline unsigned hashValue() const {
- if (subtype() == StringType_Unknown)
- createHashValue();
- Q_ASSERT(!d()->largestSubLength);
-
- return d()->stringHash;
+ return d()->hashValue();
}
uint asArrayIndex() const {
- if (subtype() == StringType_Unknown)
- createHashValue();
+ if (subtype() == Heap::String::StringType_Unknown)
+ d()->createHashValue();
Q_ASSERT(!d()->largestSubLength);
- if (subtype() == StringType_ArrayIndex)
+ if (subtype() == Heap::String::StringType_ArrayIndex)
return d()->stringHash;
return UINT_MAX;
}
uint toUInt(bool *ok) const;
- void makeIdentifier() const {
+ void makeIdentifier(ExecutionEngine *e) const {
if (d()->identifier)
return;
- makeIdentifierImpl();
+ makeIdentifierImpl(e);
}
- void makeIdentifierImpl() const;
+ void makeIdentifierImpl(ExecutionEngine *e) const;
- void createHashValue() const;
static uint createHashValue(const QChar *ch, int length);
static uint createHashValue(const char *ch, int length);
bool startsWithUpper() const {
- const String *l = this;
- while (l->d()->largestSubLength)
- l = l->d()->left;
- return l->d()->text->size && QChar::isUpper(l->d()->text->data()[0]);
+ const String::Data *l = d();
+ while (l->largestSubLength)
+ l = l->left;
+ return l->text->size && QChar::isUpper(l->text->data()[0]);
}
Identifier *identifier() const { return d()->identifier; }
protected:
- static void destroy(Managed *);
- static void markObjects(Managed *that, ExecutionEngine *e);
- static ReturnedValue get(Managed *m, String *name, bool *hasProperty);
- static ReturnedValue getIndexed(Managed *m, uint index, bool *hasProperty);
- static void put(Managed *m, String *name, const ValueRef value);
- static void putIndexed(Managed *m, uint index, const ValueRef value);
- static PropertyAttributes query(const Managed *m, String *name);
- static PropertyAttributes queryIndexed(const Managed *m, uint index);
- static bool deleteProperty(Managed *, String *);
- static bool deleteIndexedProperty(Managed *m, uint index);
+ static void markObjects(Heap::Base *that, ExecutionEngine *e);
static bool isEqualTo(Managed *that, Managed *o);
static uint getLength(const Managed *m);
#endif
@@ -171,20 +188,6 @@ public:
static uint toArrayIndex(const QString &str);
};
-#ifndef V4_BOOTSTRAP
-template<>
-inline String *value_cast(const Value &v) {
- return v.asString();
-}
-
-template<>
-inline ReturnedValue value_convert<String>(ExecutionEngine *e, const Value &v)
-{
- return v.toString(e)->asReturnedValue();
-}
-
-#endif
-
}
QT_END_NAMESPACE
diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp
index 8bf9a096c5..e0b84f6da3 100644
--- a/src/qml/jsruntime/qv4stringobject.cpp
+++ b/src/qml/jsruntime/qv4stringobject.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -33,20 +33,15 @@
#include "qv4stringobject_p.h"
+#include "qv4regexp_p.h"
#include "qv4regexpobject_p.h"
#include "qv4objectproto_p.h"
#include "qv4mm_p.h"
#include "qv4scopedvalue_p.h"
#include "qv4alloca_p.h"
-#include <QtCore/qnumeric.h>
-#include <QtCore/qmath.h>
#include <QtCore/QDateTime>
-#include <QtCore/QStringList>
#include <QtCore/QDebug>
-#include <cmath>
-#include <qmath.h>
-#include <qnumeric.h>
-#include <cassert>
+#include <QtCore/QStringList>
#include <private/qqmljsengine_p.h>
#include <private/qqmljslexer_p.h>
@@ -55,6 +50,8 @@
#include <qv4jsir_p.h>
#include <qv4codegen_p.h>
+#include <cassert>
+
#ifndef Q_OS_WIN
# include <time.h>
# ifndef Q_OS_VXWORKS
@@ -70,11 +67,11 @@ using namespace QV4;
DEFINE_OBJECT_VTABLE(StringObject);
-StringObject::Data::Data(InternalClass *ic)
- : Object::Data(ic)
+Heap::StringObject::StringObject(InternalClass *ic, QV4::Object *prototype)
+ : Heap::Object(ic, prototype)
{
- Q_ASSERT(internalClass->vtable == staticVTable());
- value = ic->engine->newString(QStringLiteral(""))->asReturnedValue();
+ Q_ASSERT(vtable == QV4::StringObject::staticVTable());
+ value = ic->engine->newString()->asReturnedValue();
tmpProperty.value = Primitive::undefinedValue();
Scope scope(ic->engine);
@@ -82,49 +79,45 @@ StringObject::Data::Data(InternalClass *ic)
s->defineReadonlyProperty(ic->engine->id_length, Primitive::fromInt32(0));
}
-StringObject::Data::Data(ExecutionEngine *engine, const ValueRef val)
- : Object::Data(engine->stringObjectClass)
+Heap::StringObject::StringObject(ExecutionEngine *engine, const Value &val)
+ : Heap::Object(engine->emptyClass, engine->stringPrototype.asObject())
{
value = val;
Q_ASSERT(value.isString());
tmpProperty.value = Primitive::undefinedValue();
- setVTable(staticVTable());
Scope scope(engine);
ScopedObject s(scope, this);
s->defineReadonlyProperty(engine->id_length, Primitive::fromUInt32(value.stringValue()->toQString().length()));
}
-Property *StringObject::getIndex(uint index) const
+Property *Heap::StringObject::getIndex(uint index) const
{
- QString str = d()->value.stringValue()->toQString();
+ QString str = value.stringValue()->toQString();
if (index >= (uint)str.length())
return 0;
- d()->tmpProperty.value = Encode(internalClass()->engine->newString(str.mid(index, 1)));
- return &d()->tmpProperty;
+ tmpProperty.value = Encode(internalClass->engine->newString(str.mid(index, 1)));
+ return &tmpProperty;
}
bool StringObject::deleteIndexedProperty(Managed *m, uint index)
{
- ExecutionEngine *v4 = m->engine();
+ ExecutionEngine *v4 = static_cast<StringObject *>(m)->engine();
Scope scope(v4);
Scoped<StringObject> o(scope, m->asStringObject());
- if (!o) {
- v4->currentContext()->throwTypeError();
- return false;
- }
+ Q_ASSERT(!!o);
if (index < static_cast<uint>(o->d()->value.stringValue()->toQString().length())) {
- if (v4->currentContext()->d()->strictMode)
- v4->currentContext()->throwTypeError();
+ if (v4->currentContext()->strictMode)
+ v4->throwTypeError();
return false;
}
return true;
}
-void StringObject::advanceIterator(Managed *m, ObjectIterator *it, String *&name, uint *index, Property *p, PropertyAttributes *attrs)
+void StringObject::advanceIterator(Managed *m, ObjectIterator *it, Heap::String **name, uint *index, Property *p, PropertyAttributes *attrs)
{
- name = (String *)0;
+ *name = (Heap::String *)0;
StringObject *s = static_cast<StringObject *>(m);
uint slen = s->d()->value.stringValue()->toQString().length();
if (it->arrayIndex <= slen) {
@@ -135,7 +128,7 @@ void StringObject::advanceIterator(Managed *m, ObjectIterator *it, String *&name
Property *pd = s->__getOwnProperty__(*index, &a);
if (!(it->flags & ObjectIterator::EnumerableOnly) || a.isEnumerable()) {
*attrs = a;
- p->copy(*pd, a);
+ p->copy(pd, a);
return;
}
}
@@ -150,44 +143,43 @@ void StringObject::advanceIterator(Managed *m, ObjectIterator *it, String *&name
return Object::advanceIterator(m, it, name, index, p, attrs);
}
-void StringObject::markObjects(Managed *that, ExecutionEngine *e)
+void StringObject::markObjects(Heap::Base *that, ExecutionEngine *e)
{
- StringObject *o = static_cast<StringObject *>(that);
- o->d()->value.stringValue()->mark(e);
- o->d()->tmpProperty.value.mark(e);
+ StringObject::Data *o = static_cast<StringObject::Data *>(that);
+ o->value.stringValue()->mark(e);
+ o->tmpProperty.value.mark(e);
Object::markObjects(that, e);
}
DEFINE_OBJECT_VTABLE(StringCtor);
-StringCtor::Data::Data(ExecutionContext *scope)
- : FunctionObject::Data(scope, QStringLiteral("String"))
+Heap::StringCtor::StringCtor(QV4::ExecutionContext *scope)
+ : Heap::FunctionObject(scope, QStringLiteral("String"))
{
- setVTable(staticVTable());
}
ReturnedValue StringCtor::construct(Managed *m, CallData *callData)
{
- ExecutionEngine *v4 = m->engine();
+ ExecutionEngine *v4 = static_cast<Object *>(m)->engine();
Scope scope(v4);
ScopedValue value(scope);
if (callData->argc)
- value = callData->args[0].toString(v4->currentContext());
+ value = callData->args[0].toString(v4);
else
- value = v4->newString(QString());
+ value = v4->newString();
return Encode(v4->newStringObject(value));
}
ReturnedValue StringCtor::call(Managed *m, CallData *callData)
{
- ExecutionEngine *v4 = m->engine();
+ ExecutionEngine *v4 = static_cast<Object *>(m)->engine();
Scope scope(v4);
ScopedValue value(scope);
if (callData->argc)
- value = callData->args[0].toString(v4->currentContext());
+ value = callData->args[0].toString(v4);
else
- value = v4->newString(QString());
- return value.asReturnedValue();
+ value = v4->newString();
+ return value->asReturnedValue();
}
void StringPrototype::init(ExecutionEngine *engine, Object *ctor)
@@ -225,13 +217,13 @@ void StringPrototype::init(ExecutionEngine *engine, Object *ctor)
static QString getThisString(ExecutionContext *ctx)
{
Scope scope(ctx);
- ScopedValue t(scope, ctx->d()->callData->thisObject);
+ ScopedValue t(scope, ctx->thisObject());
if (t->isString())
return t->stringValue()->toQString();
if (StringObject *thisString = t->asStringObject())
return thisString->d()->value.stringValue()->toQString();
if (t->isUndefined() || t->isNull()) {
- ctx->throwTypeError();
+ scope.engine->throwTypeError();
return QString();
}
return t->toQString();
@@ -239,12 +231,12 @@ static QString getThisString(ExecutionContext *ctx)
ReturnedValue StringPrototype::method_toString(CallContext *context)
{
- if (context->d()->callData->thisObject.isString())
- return context->d()->callData->thisObject.asReturnedValue();
+ if (context->thisObject().isString())
+ return context->thisObject().asReturnedValue();
- StringObject *o = context->d()->callData->thisObject.asStringObject();
+ StringObject *o = context->thisObject().asStringObject();
if (!o)
- return context->throwTypeError();
+ return context->engine()->throwTypeError();
return o->d()->value.asReturnedValue();
}
@@ -255,8 +247,8 @@ ReturnedValue StringPrototype::method_charAt(CallContext *context)
return Encode::undefined();
int pos = 0;
- if (context->d()->callData->argc > 0)
- pos = (int) context->d()->callData->args[0].toInteger();
+ if (context->argc() > 0)
+ pos = (int) context->args()[0].toInteger();
QString result;
if (pos >= 0 && pos < str.length())
@@ -272,8 +264,8 @@ ReturnedValue StringPrototype::method_charCodeAt(CallContext *context)
return Encode::undefined();
int pos = 0;
- if (context->d()->callData->argc > 0)
- pos = (int) context->d()->callData->args[0].toInteger();
+ if (context->argc() > 0)
+ pos = (int) context->args()[0].toInteger();
if (pos >= 0 && pos < str.length())
@@ -291,8 +283,8 @@ ReturnedValue StringPrototype::method_concat(CallContext *context)
return Encode::undefined();
ScopedValue v(scope);
- for (int i = 0; i < context->d()->callData->argc; ++i) {
- v = RuntimeHelpers::toString(context, ValueRef(&context->d()->callData->args[i]));
+ for (int i = 0; i < context->argc(); ++i) {
+ v = RuntimeHelpers::toString(scope.engine, context->args()[i]);
if (scope.hasException())
return Encode::undefined();
Q_ASSERT(v->isString());
@@ -309,12 +301,12 @@ ReturnedValue StringPrototype::method_indexOf(CallContext *context)
return Encode::undefined();
QString searchString;
- if (context->d()->callData->argc)
- searchString = context->d()->callData->args[0].toString(context)->toQString();
+ if (context->argc())
+ searchString = context->args()[0].toQString();
int pos = 0;
- if (context->d()->callData->argc > 1)
- pos = (int) context->d()->callData->args[1].toInteger();
+ if (context->argc() > 1)
+ pos = (int) context->args()[1].toInteger();
int index = -1;
if (! value.isEmpty())
@@ -332,8 +324,8 @@ ReturnedValue StringPrototype::method_lastIndexOf(CallContext *context)
return Encode::undefined();
QString searchString;
- if (context->d()->callData->argc)
- searchString = context->d()->callData->args[0].toQString();
+ if (context->argc())
+ searchString = context->args()[0].toQString();
ScopedValue posArg(scope, context->argument(1));
double position = RuntimeHelpers::toNumber(posArg);
@@ -358,20 +350,20 @@ ReturnedValue StringPrototype::method_localeCompare(CallContext *context)
if (scope.engine->hasException)
return Encode::undefined();
- ScopedValue v(scope, context->d()->callData->argument(0));
+ ScopedValue v(scope, context->argument(0));
const QString that = v->toQString();
return Encode(QString::localeAwareCompare(value, that));
}
ReturnedValue StringPrototype::method_match(CallContext *context)
{
- if (context->d()->callData->thisObject.isUndefined() || context->d()->callData->thisObject.isNull())
- return context->throwTypeError();
+ if (context->thisObject().isUndefined() || context->thisObject().isNull())
+ return context->engine()->throwTypeError();
Scope scope(context);
- ScopedString s(scope, context->d()->callData->thisObject.toString(context));
+ ScopedString s(scope, context->thisObject().toString(scope.engine));
- ScopedValue regexp(scope, context->d()->callData->argument(0));
+ ScopedValue regexp(scope, context->argument(0));
Scoped<RegExpObject> rx(scope, regexp);
if (!rx) {
ScopedCallData callData(scope, 1);
@@ -381,13 +373,13 @@ ReturnedValue StringPrototype::method_match(CallContext *context)
if (!rx)
// ### CHECK
- return context->throwTypeError();
+ return context->engine()->throwTypeError();
bool global = rx->global();
// ### use the standard builtin function, not the one that might be redefined in the proto
- ScopedString execString(scope, context->d()->engine->newString(QStringLiteral("exec")));
- Scoped<FunctionObject> exec(scope, context->d()->engine->regExpClass->prototype->get(execString.getPointer()));
+ ScopedString execString(scope, scope.engine->newString(QStringLiteral("exec")));
+ ScopedFunctionObject exec(scope, scope.engine->regExpPrototype.asObject()->get(execString));
ScopedCallData callData(scope, 1);
callData->thisObject = rx;
@@ -396,8 +388,8 @@ ReturnedValue StringPrototype::method_match(CallContext *context)
return exec->call(callData);
ScopedString lastIndex(scope, context->d()->engine->newString(QStringLiteral("lastIndex")));
- rx->put(lastIndex.getPointer(), ScopedValue(scope, Primitive::fromInt32(0)));
- Scoped<ArrayObject> a(scope, context->d()->engine->newArrayObject());
+ rx->put(lastIndex, ScopedValue(scope, Primitive::fromInt32(0)));
+ ScopedArrayObject a(scope, context->d()->engine->newArrayObject());
double previousLastIndex = 0;
uint n = 0;
@@ -409,11 +401,11 @@ ReturnedValue StringPrototype::method_match(CallContext *context)
if (result->isNull())
break;
assert(result->isObject());
- index = rx->get(lastIndex.getPointer(), 0);
+ index = rx->get(lastIndex, 0);
double thisIndex = index->toInteger();
if (previousLastIndex == thisIndex) {
previousLastIndex = thisIndex + 1;
- rx->put(lastIndex.getPointer(), ScopedValue(scope, Primitive::fromDouble(previousLastIndex)));
+ rx->put(lastIndex, ScopedValue(scope, Primitive::fromDouble(previousLastIndex)));
} else {
previousLastIndex = thisIndex;
}
@@ -478,10 +470,10 @@ ReturnedValue StringPrototype::method_replace(CallContext *ctx)
{
Scope scope(ctx);
QString string;
- if (StringObject *thisString = ctx->d()->callData->thisObject.asStringObject())
+ if (StringObject *thisString = ctx->thisObject().asStringObject())
string = thisString->d()->value.stringValue()->toQString();
else
- string = ctx->d()->callData->thisObject.toString(ctx)->toQString();
+ string = ctx->thisObject().toQString();
int numCaptures = 0;
int numStringMatches = 0;
@@ -518,12 +510,12 @@ ReturnedValue StringPrototype::method_replace(CallContext *ctx)
offset = qMax(offset + 1, matchOffsets[oldSize + 1]);
}
if (regExp->global())
- regExp->lastIndexProperty(ctx)->value = Primitive::fromUInt32(0);
+ regExp->lastIndexProperty()->value = Primitive::fromUInt32(0);
numStringMatches = nMatchOffsets / (regExp->value()->captureCount() * 2);
numCaptures = regExp->value()->captureCount();
} else {
numCaptures = 1;
- QString searchString = searchValue->toString(ctx)->toQString();
+ QString searchString = searchValue->toQString();
int idx = string.indexOf(searchString);
if (idx != -1) {
numStringMatches = 1;
@@ -536,7 +528,7 @@ ReturnedValue StringPrototype::method_replace(CallContext *ctx)
QString result;
ScopedValue replacement(scope);
ScopedValue replaceValue(scope, ctx->argument(1));
- Scoped<FunctionObject> searchCallback(scope, replaceValue);
+ ScopedFunctionObject searchCallback(scope, replaceValue);
if (!!searchCallback) {
result.reserve(string.length() + 10*numStringMatches);
ScopedCallData callData(scope, numCaptures + 2);
@@ -561,12 +553,12 @@ ReturnedValue StringPrototype::method_replace(CallContext *ctx)
replacement = searchCallback->call(callData);
result += string.midRef(lastEnd, matchStart - lastEnd);
- result += replacement->toString(ctx)->toQString();
+ result += replacement->toQString();
lastEnd = matchEnd;
}
result += string.midRef(lastEnd);
} else {
- QString newString = replaceValue->toString(ctx)->toQString();
+ QString newString = replaceValue->toQString();
result.reserve(string.length() + numStringMatches*newString.size());
int lastEnd = 0;
@@ -607,8 +599,9 @@ ReturnedValue StringPrototype::method_search(CallContext *ctx)
regExp = regExpValue->as<RegExpObject>();
Q_ASSERT(regExp);
}
+ Scoped<RegExp> re(scope, regExp->value());
uint* matchOffsets = (uint*)alloca(regExp->value()->captureCount() * 2 * sizeof(uint));
- uint result = regExp->value()->match(string, /*offset*/0, matchOffsets);
+ uint result = re->match(string, /*offset*/0, matchOffsets);
if (result == JSC::Yarr::offsetNoMatch)
return Encode(-1);
return Encode(result);
@@ -622,9 +615,9 @@ ReturnedValue StringPrototype::method_slice(CallContext *ctx)
const double length = text.length();
- double start = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toInteger() : 0;
- double end = (ctx->d()->callData->argc < 2 || ctx->d()->callData->args[1].isUndefined())
- ? length : ctx->d()->callData->args[1].toInteger();
+ double start = ctx->argc() ? ctx->args()[0].toInteger() : 0;
+ double end = (ctx->argc() < 2 || ctx->args()[1].isUndefined())
+ ? length : ctx->args()[1].toInteger();
if (start < 0)
start = qMax(length + start, 0.);
@@ -671,9 +664,9 @@ ReturnedValue StringPrototype::method_split(CallContext *ctx)
Scoped<RegExpObject> re(scope, separatorValue);
if (re) {
- if (re->value()->pattern().isEmpty()) {
+ if (re->value()->pattern.isEmpty()) {
re = (RegExpObject *)0;
- separatorValue = ctx->d()->engine->newString(QString());
+ separatorValue = ctx->d()->engine->newString();
}
}
@@ -682,7 +675,8 @@ ReturnedValue StringPrototype::method_split(CallContext *ctx)
uint offset = 0;
uint* matchOffsets = (uint*)alloca(re->value()->captureCount() * 2 * sizeof(uint));
while (true) {
- uint result = re->value()->match(text, offset, matchOffsets);
+ Scoped<RegExp> regexp(scope, re->value());
+ uint result = regexp->match(text, offset, matchOffsets);
if (result == JSC::Yarr::offsetNoMatch)
break;
@@ -703,7 +697,7 @@ ReturnedValue StringPrototype::method_split(CallContext *ctx)
if (array->getLength() < limit)
array->push_back((s = ctx->d()->engine->newString(text.mid(offset))));
} else {
- QString separator = separatorValue->toString(ctx)->toQString();
+ QString separator = separatorValue->toQString();
if (separator.isEmpty()) {
for (uint i = 0; i < qMin(limit, uint(text.length())); ++i)
array->push_back((s = ctx->d()->engine->newString(text.mid(i, 1))));
@@ -731,12 +725,12 @@ ReturnedValue StringPrototype::method_substr(CallContext *context)
return Encode::undefined();
double start = 0;
- if (context->d()->callData->argc > 0)
- start = context->d()->callData->args[0].toInteger();
+ if (context->argc() > 0)
+ start = context->args()[0].toInteger();
double length = +qInf();
- if (context->d()->callData->argc > 1)
- length = context->d()->callData->args[1].toInteger();
+ if (context->argc() > 1)
+ length = context->args()[1].toInteger();
double count = value.length();
if (start < 0)
@@ -759,8 +753,8 @@ ReturnedValue StringPrototype::method_substring(CallContext *context)
double start = 0;
double end = length;
- if (context->d()->callData->argc > 0)
- start = context->d()->callData->args[0].toInteger();
+ if (context->argc() > 0)
+ start = context->args()[0].toInteger();
Scope scope(context);
ScopedValue endValue(scope, context->argument(1));
@@ -818,10 +812,10 @@ ReturnedValue StringPrototype::method_toLocaleUpperCase(CallContext *ctx)
ReturnedValue StringPrototype::method_fromCharCode(CallContext *context)
{
- QString str(context->d()->callData->argc, Qt::Uninitialized);
+ QString str(context->argc(), Qt::Uninitialized);
QChar *ch = str.data();
- for (int i = 0; i < context->d()->callData->argc; ++i) {
- *ch = QChar(context->d()->callData->args[i].toUInt16());
+ for (int i = 0; i < context->argc(); ++i) {
+ *ch = QChar(context->args()[i].toUInt16());
++ch;
}
return context->d()->engine->newString(str)->asReturnedValue();
diff --git a/src/qml/jsruntime/qv4stringobject_p.h b/src/qml/jsruntime/qv4stringobject_p.h
index 5d3c0c9ccb..459dc1322e 100644
--- a/src/qml/jsruntime/qv4stringobject_p.h
+++ b/src/qml/jsruntime/qv4stringobject_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -41,33 +41,42 @@ QT_BEGIN_NAMESPACE
namespace QV4 {
-struct StringObject: Object {
- struct Data : Object::Data {
- Data(ExecutionEngine *engine, const ValueRef value);
- Data(InternalClass *ic);
- Value value;
- // ### get rid of tmpProperty
- mutable Property tmpProperty;
- };
- V4_OBJECT(Object)
- Q_MANAGED_TYPE(StringObject)
+namespace Heap {
+struct StringObject : Object {
+ StringObject(InternalClass *ic, QV4::Object *prototype);
+ StringObject(ExecutionEngine *engine, const Value &value);
+ Value value;
Property *getIndex(uint index) const;
+ // ### get rid of tmpProperty
+ mutable Property tmpProperty;
+};
+
+struct StringCtor : FunctionObject {
+ StringCtor(QV4::ExecutionContext *scope);
+};
+
+}
+
+struct StringObject: Object {
+ V4_OBJECT2(StringObject, Object)
+ Q_MANAGED_TYPE(StringObject)
+
+ Property *getIndex(uint index) const {
+ return d()->getIndex(index);
+ }
static bool deleteIndexedProperty(Managed *m, uint index);
protected:
- static void advanceIterator(Managed *m, ObjectIterator *it, String *&name, uint *index, Property *p, PropertyAttributes *attrs);
- static void markObjects(Managed *that, ExecutionEngine *e);
+ static void advanceIterator(Managed *m, ObjectIterator *it, Heap::String **name, uint *index, Property *p, PropertyAttributes *attrs);
+ static void markObjects(Heap::Base *that, ExecutionEngine *e);
};
struct StringCtor: FunctionObject
{
- struct Data : FunctionObject::Data {
- Data(ExecutionContext *scope);
- };
- V4_OBJECT(FunctionObject)
+ V4_OBJECT2(StringCtor, FunctionObject)
static ReturnedValue construct(Managed *m, CallData *callData);
static ReturnedValue call(Managed *that, CallData *callData);
diff --git a/src/qml/jsruntime/qv4typedarray.cpp b/src/qml/jsruntime/qv4typedarray.cpp
new file mode 100644
index 0000000000..19e541dba8
--- /dev/null
+++ b/src/qml/jsruntime/qv4typedarray.cpp
@@ -0,0 +1,575 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "qv4typedarray_p.h"
+#include "qv4arraybuffer_p.h"
+
+#include <cmath>
+
+using namespace QV4;
+
+DEFINE_OBJECT_VTABLE(TypedArrayCtor);
+DEFINE_OBJECT_VTABLE(TypedArrayPrototype);
+DEFINE_OBJECT_VTABLE(TypedArray);
+
+Q_STATIC_ASSERT((int)ExecutionEngine::NTypedArrayTypes == (int)Heap::TypedArray::NTypes);
+
+ReturnedValue Int8ArrayRead(const char *data, int index)
+{
+ return Encode((int)(signed char)data[index]);
+}
+
+void Int8ArrayWrite(ExecutionEngine *e, char *data, int index, const Value &value)
+{
+ signed char v = (signed char)value.toUInt32();
+ if (e->hasException)
+ return;
+ data[index] = v;
+}
+
+ReturnedValue UInt8ArrayRead(const char *data, int index)
+{
+ return Encode((int)(unsigned char)data[index]);
+}
+
+void UInt8ArrayWrite(ExecutionEngine *e, char *data, int index, const Value &value)
+{
+ unsigned char v = (unsigned char)value.toUInt32();
+ if (e->hasException)
+ return;
+ data[index] = v;
+}
+
+void UInt8ClampedArrayWrite(ExecutionEngine *e, char *data, int index, const Value &value)
+{
+ if (value.isInteger()) {
+ data[index] = (char)(unsigned char)qBound(0, value.integerValue(), 255);
+ return;
+ }
+ double d = value.toNumber();
+ if (e->hasException)
+ return;
+ // ### is there a way to optimise this?
+ if (d <= 0 || std::isnan(d)) {
+ data[index] = 0;
+ return;
+ }
+ if (d >= 255) {
+ data[index] = (char)(255);
+ return;
+ }
+ double f = std::floor(d);
+ if (f + 0.5 < d) {
+ data[index] = (unsigned char)(f + 1);
+ return;
+ }
+ if (d < f + 0.5) {
+ data[index] = (unsigned char)(f);
+ return;
+ }
+ if (int(f) % 2) {
+ // odd number
+ data[index] = (unsigned char)(f + 1);
+ return;
+ }
+ data[index] = (unsigned char)(f);
+}
+
+ReturnedValue Int16ArrayRead(const char *data, int index)
+{
+ return Encode((int)*(const short *)(data + index));
+}
+
+void Int16ArrayWrite(ExecutionEngine *e, char *data, int index, const Value &value)
+{
+ short v = (short)value.toInt32();
+ if (e->hasException)
+ return;
+ *(short *)(data + index) = v;
+}
+
+ReturnedValue UInt16ArrayRead(const char *data, int index)
+{
+ return Encode((int)*(const unsigned short *)(data + index));
+}
+
+void UInt16ArrayWrite(ExecutionEngine *e, char *data, int index, const Value &value)
+{
+ unsigned short v = (unsigned short)value.toInt32();
+ if (e->hasException)
+ return;
+ *(unsigned short *)(data + index) = v;
+}
+
+ReturnedValue Int32ArrayRead(const char *data, int index)
+{
+ return Encode(*(const int *)(data + index));
+}
+
+void Int32ArrayWrite(ExecutionEngine *e, char *data, int index, const Value &value)
+{
+ int v = (int)value.toInt32();
+ if (e->hasException)
+ return;
+ *(int *)(data + index) = v;
+}
+
+ReturnedValue UInt32ArrayRead(const char *data, int index)
+{
+ return Encode(*(const unsigned int *)(data + index));
+}
+
+void UInt32ArrayWrite(ExecutionEngine *e, char *data, int index, const Value &value)
+{
+ unsigned int v = (unsigned int)value.toUInt32();
+ if (e->hasException)
+ return;
+ *(unsigned int *)(data + index) = v;
+}
+
+ReturnedValue Float32ArrayRead(const char *data, int index)
+{
+ return Encode(*(const float *)(data + index));
+}
+
+void Float32ArrayWrite(ExecutionEngine *e, char *data, int index, const Value &value)
+{
+ float v = value.toNumber();
+ if (e->hasException)
+ return;
+ *(float *)(data + index) = v;
+}
+
+ReturnedValue Float64ArrayRead(const char *data, int index)
+{
+ return Encode(*(const double *)(data + index));
+}
+
+void Float64ArrayWrite(ExecutionEngine *e, char *data, int index, const Value &value)
+{
+ double v = value.toNumber();
+ if (e->hasException)
+ return;
+ *(double *)(data + index) = v;
+}
+
+const TypedArrayOperations operations[Heap::TypedArray::NTypes] = {
+ { 1, "Int8Array", Int8ArrayRead, Int8ArrayWrite },
+ { 1, "Uint8Array", UInt8ArrayRead, UInt8ArrayWrite },
+ { 1, "Uint8ClampedArray", UInt8ArrayRead, UInt8ClampedArrayWrite },
+ { 2, "Int16Array", Int16ArrayRead, Int16ArrayWrite },
+ { 2, "Uint16Array", UInt16ArrayRead, UInt16ArrayWrite },
+ { 4, "Int32Array", Int32ArrayRead, Int32ArrayWrite },
+ { 4, "Uint32Array", UInt32ArrayRead, UInt32ArrayWrite },
+ { 4, "Float32Array", Float32ArrayRead, Float32ArrayWrite },
+ { 8, "Float64Array", Float64ArrayRead, Float64ArrayWrite },
+};
+
+
+Heap::TypedArrayCtor::TypedArrayCtor(QV4::ExecutionContext *scope, TypedArray::Type t)
+ : Heap::FunctionObject(scope, QLatin1String(operations[t].name))
+ , type(t)
+{
+}
+
+ReturnedValue TypedArrayCtor::construct(Managed *m, CallData *callData)
+{
+ Scope scope(static_cast<Object *>(m)->engine());
+ Scoped<TypedArrayCtor> that(scope, static_cast<TypedArrayCtor *>(m));
+
+ if (!callData->argc || !callData->args[0].isObject()) {
+ // ECMA 6 22.2.1.1
+ double l = callData->argc ? callData->args[0].toNumber() : 0;
+ if (scope.engine->hasException)
+ return Encode::undefined();
+ uint len = (uint)l;
+ if (l != len)
+ scope.engine->throwRangeError(QStringLiteral("Non integer length for typed array."));
+ uint byteLength = len * operations[that->d()->type].bytesPerElement;
+ Scoped<ArrayBuffer> buffer(scope, scope.engine->memoryManager->alloc<ArrayBuffer>(scope.engine, byteLength));
+ if (scope.engine->hasException)
+ return Encode::undefined();
+
+ Scoped<TypedArray > array(scope, scope.engine->memoryManager->alloc<TypedArray>(scope.engine, that->d()->type));
+ array->d()->buffer = buffer->d();
+ array->d()->byteLength = byteLength;
+ array->d()->byteOffset = 0;
+
+ return array.asReturnedValue();
+ }
+ Scoped<TypedArray> typedArray(scope, callData->argument(0));
+ if (!!typedArray) {
+ // ECMA 6 22.2.1.2
+ Scoped<ArrayBuffer> buffer(scope, typedArray->d()->buffer);
+ uint srcElementSize = typedArray->d()->type->bytesPerElement;
+ uint destElementSize = operations[that->d()->type].bytesPerElement;
+ uint byteLength = typedArray->d()->byteLength;
+ uint destByteLength = byteLength*destElementSize/srcElementSize;
+
+ Scoped<ArrayBuffer> newBuffer(scope, scope.engine->memoryManager->alloc<ArrayBuffer>(scope.engine, destByteLength));
+ if (scope.engine->hasException)
+ return Encode::undefined();
+
+ Scoped<TypedArray > array(scope, scope.engine->memoryManager->alloc<TypedArray>(scope.engine, that->d()->type));
+ array->d()->buffer = newBuffer->d();
+ array->d()->byteLength = destByteLength;
+ array->d()->byteOffset = 0;
+
+ 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) {
+ memcpy(dest, src, byteLength);
+ } else {
+ // not same size, we need to loop
+ uint l = typedArray->length();
+ TypedArrayRead read = typedArray->d()->type->read;
+ TypedArrayWrite write =array->d()->type->write;
+ for (uint i = 0; i < l; ++i) {
+ Primitive val;
+ val.val = read(src, i*srcElementSize);
+ write(scope.engine, dest, i*destElementSize, val);
+ }
+ }
+
+ return array.asReturnedValue();
+ }
+ Scoped<ArrayBuffer> buffer(scope, callData->argument(0));
+ if (!!buffer) {
+ // ECMA 6 22.2.1.4
+
+ double dbyteOffset = callData->argc > 1 ? callData->args[1].toInteger() : 0;
+ uint byteOffset = (uint)dbyteOffset;
+ uint elementSize = operations[that->d()->type].bytesPerElement;
+ if (dbyteOffset < 0 || (byteOffset % elementSize) || dbyteOffset > buffer->byteLength())
+ return scope.engine->throwRangeError(QStringLiteral("new TypedArray: invalid byteOffset"));
+
+ uint byteLength;
+ if (callData->argc < 3 || callData->args[2].isUndefined()) {
+ byteLength = buffer->byteLength() - byteOffset;
+ if (buffer->byteLength() < byteOffset || byteLength % elementSize)
+ return scope.engine->throwRangeError(QStringLiteral("new TypedArray: invalid length"));
+ } else {
+ double l = qBound(0., callData->args[2].toInteger(), (double)UINT_MAX);
+ if (scope.engine->hasException)
+ return Encode::undefined();
+ l *= elementSize;
+ if (buffer->byteLength() - byteOffset < l)
+ return scope.engine->throwRangeError(QStringLiteral("new TypedArray: invalid length"));
+ byteLength = (uint)l;
+ }
+
+ Scoped<TypedArray > array(scope, scope.engine->memoryManager->alloc<TypedArray>(scope.engine, that->d()->type));
+ array->d()->buffer = buffer->d();
+ array->d()->byteLength = byteLength;
+ array->d()->byteOffset = byteOffset;
+ return array.asReturnedValue();
+ }
+
+ // ECMA 6 22.2.1.3
+
+ ScopedObject o(scope, callData->argument(0));
+ uint l = (uint) qBound(0., ScopedValue(scope, o->get(scope.engine->id_length))->toInteger(), (double)UINT_MAX);
+ if (scope.engine->hasException)
+ return scope.engine->throwTypeError();
+
+ uint elementSize = operations[that->d()->type].bytesPerElement;
+ Scoped<ArrayBuffer> newBuffer(scope, scope.engine->memoryManager->alloc<ArrayBuffer>(scope.engine, l * elementSize));
+ if (scope.engine->hasException)
+ return Encode::undefined();
+
+ Scoped<TypedArray > array(scope, scope.engine->memoryManager->alloc<TypedArray>(scope.engine, that->d()->type));
+ array->d()->buffer = newBuffer->d();
+ array->d()->byteLength = l * elementSize;
+ array->d()->byteOffset = 0;
+
+ uint idx = 0;
+ char *b = newBuffer->d()->data->data();
+ ScopedValue val(scope);
+ while (idx < l) {
+ val = o->getIndexed(idx);
+ array->d()->type->write(scope.engine, b, 0, val);
+ if (scope.engine->hasException)
+ return Encode::undefined();
+ ++idx;
+ b += elementSize;
+ }
+
+
+ return array.asReturnedValue();
+}
+
+ReturnedValue TypedArrayCtor::call(Managed *that, CallData *callData)
+{
+ return construct(that, callData);
+}
+
+Heap::TypedArray::TypedArray(ExecutionEngine *e, Type t)
+ : Heap::Object(e->emptyClass, e->typedArrayPrototype[t].asObject()),
+ type(operations + t),
+ arrayType(t)
+{
+}
+
+void TypedArray::markObjects(Heap::Base *that, ExecutionEngine *e)
+{
+ static_cast<TypedArray::Data *>(that)->buffer->mark(e);
+ Object::markObjects(that, e);
+}
+
+ReturnedValue TypedArray::getIndexed(Managed *m, uint index, bool *hasProperty)
+{
+ Scope scope(static_cast<Object *>(m)->engine());
+ Scoped<TypedArray> a(scope, static_cast<TypedArray *>(m));
+
+ uint bytesPerElement = a->d()->type->bytesPerElement;
+ uint byteOffset = a->d()->byteOffset + index * bytesPerElement;
+ if (byteOffset + bytesPerElement > (uint)a->d()->buffer->byteLength()) {
+ if (hasProperty)
+ *hasProperty = false;
+ return Encode::undefined();
+ }
+ if (hasProperty)
+ *hasProperty = true;
+ return a->d()->type->read(a->d()->buffer->data->data(), byteOffset);
+}
+
+void TypedArray::putIndexed(Managed *m, uint index, const Value &value)
+{
+ ExecutionEngine *v4 = static_cast<Object *>(m)->engine();
+ if (v4->hasException)
+ return;
+
+ Scope scope(v4);
+ Scoped<TypedArray> a(scope, static_cast<TypedArray *>(m));
+
+ uint bytesPerElement = a->d()->type->bytesPerElement;
+ uint byteOffset = a->d()->byteOffset + index * bytesPerElement;
+ if (byteOffset + bytesPerElement > (uint)a->d()->buffer->byteLength())
+ goto reject;
+
+ a->d()->type->write(scope.engine, a->d()->buffer->data->data(), byteOffset, value);
+ return;
+
+reject:
+ if (scope.engine->currentContext()->strictMode)
+ scope.engine->throwTypeError();
+}
+
+void TypedArrayPrototype::init(ExecutionEngine *engine, TypedArrayCtor *ctor)
+{
+ Scope scope(engine);
+ ScopedObject o(scope);
+ ctor->defineReadonlyProperty(engine->id_length, Primitive::fromInt32(3));
+ ctor->defineReadonlyProperty(engine->id_prototype, (o = this));
+ ctor->defineReadonlyProperty(QStringLiteral("BYTES_PER_ELEMENT"), Primitive::fromInt32(operations[ctor->d()->type].bytesPerElement));
+ defineDefaultProperty(engine->id_constructor, (o = ctor));
+ defineAccessorProperty(QStringLiteral("buffer"), method_get_buffer, 0);
+ defineAccessorProperty(QStringLiteral("byteLength"), method_get_byteLength, 0);
+ defineAccessorProperty(QStringLiteral("byteOffset"), method_get_byteOffset, 0);
+ defineAccessorProperty(QStringLiteral("length"), method_get_length, 0);
+ defineReadonlyProperty(QStringLiteral("BYTES_PER_ELEMENT"), Primitive::fromInt32(operations[ctor->d()->type].bytesPerElement));
+
+ defineDefaultProperty(QStringLiteral("set"), method_set, 1);
+ defineDefaultProperty(QStringLiteral("subarray"), method_subarray, 0);
+}
+
+ReturnedValue TypedArrayPrototype::method_get_buffer(CallContext *ctx)
+{
+ Scope scope(ctx);
+ Scoped<TypedArray> v(scope, ctx->thisObject());
+ if (!v)
+ return scope.engine->throwTypeError();
+
+ return Encode(v->d()->buffer->asReturnedValue());
+}
+
+ReturnedValue TypedArrayPrototype::method_get_byteLength(CallContext *ctx)
+{
+ Scope scope(ctx);
+ Scoped<TypedArray> v(scope, ctx->thisObject());
+ if (!v)
+ return scope.engine->throwTypeError();
+
+ return Encode(v->d()->byteLength);
+}
+
+ReturnedValue TypedArrayPrototype::method_get_byteOffset(CallContext *ctx)
+{
+ Scope scope(ctx);
+ Scoped<TypedArray> v(scope, ctx->thisObject());
+ if (!v)
+ return scope.engine->throwTypeError();
+
+ return Encode(v->d()->byteOffset);
+}
+
+ReturnedValue TypedArrayPrototype::method_get_length(CallContext *ctx)
+{
+ Scope scope(ctx);
+ Scoped<TypedArray> v(scope, ctx->thisObject());
+ if (!v)
+ return scope.engine->throwTypeError();
+
+ return Encode(v->d()->byteLength/v->d()->type->bytesPerElement);
+}
+
+ReturnedValue TypedArrayPrototype::method_set(CallContext *ctx)
+{
+ Scope scope(ctx);
+ Scoped<TypedArray> a(scope, ctx->thisObject());
+ if (!a)
+ return scope.engine->throwTypeError();
+ Scoped<ArrayBuffer> buffer(scope, a->d()->buffer);
+ if (!buffer)
+ scope.engine->throwTypeError();
+
+ double doffset = ctx->argc() >= 2 ? ctx->args()[1].toInteger() : 0;
+ if (scope.engine->hasException)
+ return Encode::undefined();
+
+ if (doffset < 0 || doffset >= UINT_MAX)
+ return scope.engine->throwRangeError(QStringLiteral("TypedArray.set: out of range"));
+ uint offset = (uint)doffset;
+ uint elementSize = a->d()->type->bytesPerElement;
+
+ Scoped<TypedArray> srcTypedArray(scope, ctx->args()[0]);
+ if (!srcTypedArray) {
+ // src is a regular object
+ ScopedObject o(scope, ctx->args()[0].toObject(scope.engine));
+ if (scope.engine->hasException || !o)
+ return scope.engine->throwTypeError();
+
+ double len = ScopedValue(scope, o->get(scope.engine->id_length))->toNumber();
+ uint l = (uint)len;
+ if (scope.engine->hasException || l != len)
+ return scope.engine->throwTypeError();
+
+ if (offset + l > a->length())
+ return scope.engine->throwRangeError(QStringLiteral("TypedArray.set: out of range"));
+
+ uint idx = 0;
+ char *b = buffer->d()->data->data() + a->d()->byteOffset + offset*elementSize;
+ ScopedValue val(scope);
+ while (idx < l) {
+ val = o->getIndexed(idx);
+ a->d()->type->write(scope.engine, b, 0, val);
+ if (scope.engine->hasException)
+ return Encode::undefined();
+ ++idx;
+ b += elementSize;
+ }
+ return Encode::undefined();
+ }
+
+ // src is a typed array
+ Scoped<ArrayBuffer> srcBuffer(scope, srcTypedArray->d()->buffer);
+ if (!srcBuffer)
+ return scope.engine->throwTypeError();
+
+ uint l = srcTypedArray->length();
+ if (offset + l > a->length())
+ return 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;
+ 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);
+ return Encode::undefined();
+ }
+
+ char *srcCopy = 0;
+ if (buffer->d() == srcBuffer->d()) {
+ // same buffer, need to take a temporary copy, to not run into problems
+ srcCopy = new char[srcTypedArray->d()->byteLength];
+ memcpy(srcCopy, src, srcTypedArray->d()->byteLength);
+ src = srcCopy;
+ }
+
+ // typed arrays of different kind, need to manually loop
+ uint srcElementSize = srcTypedArray->d()->type->bytesPerElement;
+ TypedArrayRead read = srcTypedArray->d()->type->read;
+ TypedArrayWrite write = a->d()->type->write;
+ for (uint i = 0; i < l; ++i) {
+ Primitive val;
+ val.val = read(src, i*srcElementSize);
+ write(scope.engine, dest, i*elementSize, val);
+ }
+
+ if (srcCopy)
+ delete [] srcCopy;
+
+ return Encode::undefined();
+}
+
+ReturnedValue TypedArrayPrototype::method_subarray(CallContext *ctx)
+{
+ Scope scope(ctx);
+ Scoped<TypedArray> a(scope, ctx->thisObject());
+
+ if (!a)
+ return scope.engine->throwTypeError();
+
+ Scoped<ArrayBuffer> buffer(scope, a->d()->buffer);
+ if (!buffer)
+ return scope.engine->throwTypeError();
+
+ int len = a->length();
+ double b = ctx->argc() > 0 ? ctx->args()[0].toInteger() : 0;
+ if (b < 0)
+ b = len + b;
+ uint begin = (uint)qBound(0., b, (double)len);
+
+ double e = ctx->argc() < 2 || ctx->args()[1].isUndefined() ? len : ctx->args()[1].toInteger();
+ if (e < 0)
+ e = len + e;
+ uint end = (uint)qBound(0., e, (double)len);
+ if (end < begin)
+ end = begin;
+
+ if (scope.engine->hasException)
+ return Encode::undefined();
+
+ int newLen = end - begin;
+
+ ScopedFunctionObject constructor(scope, a->get(scope.engine->id_constructor));
+ if (!constructor)
+ return scope.engine->throwTypeError();
+
+ ScopedCallData callData(scope, 3);
+ callData->args[0] = buffer;
+ callData->args[1] = Encode(a->d()->byteOffset + begin*a->d()->type->bytesPerElement);
+ callData->args[2] = Encode(newLen);
+ return constructor->construct(callData);
+}
diff --git a/src/qml/jsruntime/qv4typedarray_p.h b/src/qml/jsruntime/qv4typedarray_p.h
new file mode 100644
index 0000000000..afd1bb97e7
--- /dev/null
+++ b/src/qml/jsruntime/qv4typedarray_p.h
@@ -0,0 +1,155 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QV4TYPEDARRAY_H
+#define QV4TYPEDARRAY_H
+
+#include "qv4object_p.h"
+#include "qv4functionobject_p.h"
+#include "qv4arraybuffer_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace QV4 {
+
+struct ArrayBuffer;
+
+typedef ReturnedValue (*TypedArrayRead)(const char *data, int index);
+typedef void (*TypedArrayWrite)(ExecutionEngine *engine, char *data, int index, const Value &value);
+
+struct TypedArrayOperations {
+ int bytesPerElement;
+ const char *name;
+ TypedArrayRead read;
+ TypedArrayWrite write;
+};
+
+namespace Heap {
+
+struct TypedArray : Object {
+ enum Type {
+ Int8Array,
+ UInt8Array,
+ UInt8ClampedArray,
+ Int16Array,
+ UInt16Array,
+ Int32Array,
+ UInt32Array,
+ Float32Array,
+ Float64Array,
+ NTypes
+ };
+
+ TypedArray(ExecutionEngine *e, Type t);
+
+ const TypedArrayOperations *type;
+ ArrayBuffer *buffer;
+ uint byteLength;
+ uint byteOffset;
+ Type arrayType;
+};
+
+struct TypedArrayCtor : FunctionObject {
+ TypedArrayCtor(QV4::ExecutionContext *scope, TypedArray::Type t);
+
+ TypedArray::Type type;
+};
+
+struct TypedArrayPrototype : Object {
+ inline TypedArrayPrototype(ExecutionEngine *e, TypedArray::Type t);
+ TypedArray::Type type;
+};
+
+
+}
+
+struct Q_QML_PRIVATE_EXPORT TypedArray : Object
+{
+ V4_OBJECT2(TypedArray, Object)
+
+ uint byteLength() const {
+ return d()->byteLength;
+ }
+
+ uint length() const {
+ return d()->byteLength/d()->type->bytesPerElement;
+ }
+
+ QTypedArrayData<char> *arrayData() {
+ return d()->buffer->data;
+ }
+
+ Heap::TypedArray::Type arrayType() const {
+ return d()->arrayType;
+ }
+
+ static void markObjects(Heap::Base *that, ExecutionEngine *e);
+ static ReturnedValue getIndexed(Managed *m, uint index, bool *hasProperty);
+ static void putIndexed(Managed *m, uint index, const Value &value);
+};
+
+struct TypedArrayCtor: FunctionObject
+{
+ V4_OBJECT2(TypedArrayCtor, FunctionObject)
+
+ static ReturnedValue construct(Managed *m, CallData *callData);
+ static ReturnedValue call(Managed *that, CallData *callData);
+};
+
+
+struct TypedArrayPrototype : Object
+{
+ V4_OBJECT2(TypedArrayPrototype, Object)
+
+ void init(ExecutionEngine *engine, TypedArrayCtor *ctor);
+
+ static ReturnedValue method_get_buffer(CallContext *ctx);
+ static ReturnedValue method_get_byteLength(CallContext *ctx);
+ static ReturnedValue method_get_byteOffset(CallContext *ctx);
+ static ReturnedValue method_get_length(CallContext *ctx);
+
+ static ReturnedValue method_set(CallContext *ctx);
+ static ReturnedValue method_subarray(CallContext *ctx);
+};
+
+inline
+Heap::TypedArrayPrototype::TypedArrayPrototype(ExecutionEngine *e, TypedArray::Type t)
+ : Heap::Object(e)
+ , type(t)
+{
+}
+
+} // namespace QV4
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/qml/jsruntime/qv4util_p.h b/src/qml/jsruntime/qv4util_p.h
index 4dd67c4398..f9ae37855e 100644
--- a/src/qml/jsruntime/qv4util_p.h
+++ b/src/qml/jsruntime/qv4util_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/jsruntime/qv4value.cpp b/src/qml/jsruntime/qv4value.cpp
index 0293054457..68228f06bb 100644
--- a/src/qml/jsruntime/qv4value.cpp
+++ b/src/qml/jsruntime/qv4value.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,14 +23,15 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <qv4engine_p.h>
+#include <qv4runtime_p.h>
#ifndef V4_BOOTSTRAP
#include <qv4object_p.h>
#include <qv4objectproto_p.h>
@@ -87,9 +88,11 @@ double Value::toNumberImpl() const
if (isString())
return RuntimeHelpers::stringToNumber(stringValue()->toQString());
{
- ExecutionContext *ctx = objectValue()->internalClass()->engine->currentContext();
- Scope scope(ctx);
- ScopedValue prim(scope, RuntimeHelpers::toPrimitive(ValueRef::fromRawValue(this), NUMBER_HINT));
+ Q_ASSERT(isObject());
+ Scope scope(objectValue()->engine());
+ ScopedValue prim(scope, RuntimeHelpers::toPrimitive(*this, NUMBER_HINT));
+ if (scope.engine->hasException)
+ return 0;
return prim->toNumber();
}
#endif
@@ -121,13 +124,13 @@ QString Value::toQStringNoThrow() const
if (isString())
return stringValue()->toQString();
{
- ExecutionContext *ctx = objectValue()->internalClass()->engine->currentContext();
- Scope scope(ctx);
+ Q_ASSERT(isObject());
+ Scope scope(objectValue()->engine());
ScopedValue ex(scope);
bool caughtException = false;
- ScopedValue prim(scope, RuntimeHelpers::toPrimitive(ValueRef::fromRawValue(this), STRING_HINT));
+ ScopedValue prim(scope, RuntimeHelpers::toPrimitive(*this, STRING_HINT));
if (scope.hasException()) {
- ex = ctx->catchException();
+ ex = scope.engine->catchException();
caughtException = true;
} else if (prim->isPrimitive()) {
return prim->toQStringNoThrow();
@@ -136,7 +139,7 @@ QString Value::toQStringNoThrow() const
if (caughtException) {
ScopedValue prim(scope, RuntimeHelpers::toPrimitive(ex, STRING_HINT));
if (scope.hasException()) {
- ex = ctx->catchException();
+ ex = scope.engine->catchException();
} else if (prim->isPrimitive()) {
return prim->toQStringNoThrow();
}
@@ -174,9 +177,9 @@ QString Value::toQString() const
if (isString())
return stringValue()->toQString();
{
- ExecutionContext *ctx = objectValue()->internalClass()->engine->currentContext();
- Scope scope(ctx);
- ScopedValue prim(scope, RuntimeHelpers::toPrimitive(ValueRef::fromRawValue(this), STRING_HINT));
+ Q_ASSERT(isObject());
+ Scope scope(objectValue()->engine());
+ ScopedValue prim(scope, RuntimeHelpers::toPrimitive(*this, STRING_HINT));
return prim->toQString();
}
case Value::Integer_Type: {
@@ -264,23 +267,18 @@ double Primitive::toInteger(double number)
}
#ifndef V4_BOOTSTRAP
-String *Value::toString(ExecutionEngine *e) const
-{
- return toString(e->currentContext());
-}
-
-String *Value::toString(ExecutionContext *ctx) const
+Heap::String *Value::toString(ExecutionEngine *e) const
{
if (isString())
- return stringValue();
- return RuntimeHelpers::convertToString(ctx, ValueRef::fromRawValue(this))->getPointer();
+ return stringValue()->d();
+ return RuntimeHelpers::convertToString(e, *this);
}
-Object *Value::toObject(ExecutionContext *ctx) const
+Heap::Object *Value::toObject(ExecutionEngine *e) const
{
if (isObject())
- return objectValue();
- return RuntimeHelpers::convertToObject(ctx, ValueRef::fromRawValue(this))->getPointer();
+ return objectValue()->d();
+ return RuntimeHelpers::convertToObject(e, *this);
}
#endif // V4_BOOTSTRAP
diff --git a/src/qml/jsruntime/qv4value_inl_p.h b/src/qml/jsruntime/qv4value_inl_p.h
index 045eaccfaf..f3026900d6 100644
--- a/src/qml/jsruntime/qv4value_inl_p.h
+++ b/src/qml/jsruntime/qv4value_inl_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -35,18 +35,11 @@
#include <cmath> // this HAS to come
-#include <QtCore/QString>
-#include <QtCore/qnumeric.h>
-#include "qv4global_p.h"
+#include "qv4value_p.h"
+
#include "qv4string_p.h"
-#include <QtCore/QDebug>
#include "qv4managed_p.h"
#include "qv4engine_p.h"
-#include <private/qtqmlglobal_p.h>
-
-//#include <wtf/MathExtras.h>
-
-#include "qv4value_p.h"
QT_BEGIN_NAMESPACE
@@ -56,13 +49,13 @@ inline bool Value::isString() const
{
if (!isManaged())
return false;
- return managed() && managed()->internalClass()->vtable->isString;
+ return m && m->vtable->isString;
}
inline bool Value::isObject() const
{
if (!isManaged())
return false;
- return managed() && managed()->internalClass()->vtable->isObject;
+ return m && m->vtable->isObject;
}
inline bool Value::isPrimitive() const
@@ -70,10 +63,11 @@ inline bool Value::isPrimitive() const
return !isObject();
}
-inline ExecutionEngine *Value::engine() const
+inline String *Value::asString() const
{
- Managed *m = asManaged();
- return m ? m->engine() : 0;
+ if (isString())
+ return stringValue();
+ return 0;
}
inline void Value::mark(ExecutionEngine *e) const
@@ -88,7 +82,7 @@ inline void Value::mark(ExecutionEngine *e) const
inline Primitive Primitive::nullValue()
{
Primitive v;
-#if QT_POINTER_SIZE == 8
+#ifdef QV4_USE_64_BIT_VALUE_ENCODING
v.val = quint64(_Null_Type) << Tag_Shift;
#else
v.tag = _Null_Type;
@@ -187,7 +181,7 @@ inline bool Value::toBoolean() const
#ifndef V4_BOOTSTRAP
inline uint Value::asArrayIndex() const
{
-#if QT_POINTER_SIZE == 8
+#ifdef QV4_USE_64_BIT_VALUE_ENCODING
if (!isNumber())
return UINT_MAX;
if (isInteger())
@@ -275,6 +269,21 @@ inline ErrorObject *Value::asErrorObject() const
template<typename T>
inline T *Value::as() const { Managed *m = isObject() ? managed() : 0; return m ? m->as<T>() : 0; }
+#ifndef V4_BOOTSTRAP
+
+template<>
+inline String *value_cast(const Value &v) {
+ return v.asString();
+}
+
+template<>
+inline ReturnedValue value_convert<String>(ExecutionEngine *e, const Value &v)
+{
+ return v.toString(e)->asReturnedValue();
+}
+
+#endif
+
#endif
} // namespace QV4
diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h
index 59a4543538..628950784a 100644
--- a/src/qml/jsruntime/qv4value_p.h
+++ b/src/qml/jsruntime/qv4value_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -38,33 +38,75 @@
#include <QtCore/QString>
#include "qv4global_p.h"
+/* We cannot rely on QT_POINTER_SIZE to be set correctly on host builds. In qmldevtools the Value objects
+ are only used to store primitives, never object pointers. So we can use the 64-bit encoding. */
+#ifdef V4_BOOTSTRAP
+#define QV4_USE_64_BIT_VALUE_ENCODING
+#elif QT_POINTER_SIZE == 8
+#define QV4_USE_64_BIT_VALUE_ENCODING
+#endif
+
QT_BEGIN_NAMESPACE
namespace QV4 {
typedef uint Bool;
-template <typename T>
-struct Returned : private T
-{
- static Returned<T> *create(T *t) { return static_cast<Returned<T> *>(t); }
- T *getPointer() { return this; }
- template<typename X>
- static T *getPointer(Returned<X> *x) { return x->getPointer(); }
- template<typename X>
- Returned<X> *as() { return Returned<X>::create(Returned<X>::getPointer(this)); }
- using T::asReturnedValue;
+namespace Heap {
+
+struct Q_QML_EXPORT Base {
+ union {
+ const ManagedVTable *vtable;
+ quintptr mm_data;
+ };
+
+ inline ReturnedValue asReturnedValue() const;
+ inline void mark(QV4::ExecutionEngine *engine);
+
+ enum {
+ MarkBit = 0x1,
+ NotInUse = 0x2,
+ PointerMask = ~0x3
+ };
+
+ ManagedVTable *gcGetVtable() const {
+ return reinterpret_cast<ManagedVTable *>(mm_data & PointerMask);
+ }
+ inline bool isMarked() const {
+ return mm_data & MarkBit;
+ }
+ inline void setMarkBit() {
+ mm_data |= MarkBit;
+ }
+ inline void clearMarkBit() {
+ mm_data &= ~MarkBit;
+ }
+
+ inline bool inUse() const {
+ return !(mm_data & NotInUse);
+ }
+
+ Base *nextFree() {
+ return reinterpret_cast<Base *>(mm_data & PointerMask);
+ }
+ void setNextFree(Base *m) {
+ mm_data = (reinterpret_cast<quintptr>(m) | NotInUse);
+ }
+
+ void *operator new(size_t, Managed *m) { return m; }
+ void *operator new(size_t, Heap::Base *m) { return m; }
+ void operator delete(void *, Heap::Base *) {}
};
-struct HeapObject {};
+}
struct Q_QML_PRIVATE_EXPORT Value
{
/*
We use two different ways of encoding JS values. One for 32bit and one for 64bit systems.
- In both cases, we 8 bytes for a value and different variant of NaN boxing. A Double NaN (actually -qNaN)
- is indicated by a number that has the top 13 bits set. THe other values are usually set to 0 by the
+ In both cases, we use 8 bytes for a value and a different variant of NaN boxing. A Double NaN (actually -qNaN)
+ is indicated by a number that has the top 13 bits set. The other values are usually set to 0 by the
processor, and are thus free for us to store other data. We keep pointers in there for managed objects,
and encode the other types using the free space given to use by the unused bits for NaN values. This also
works for pointers on 64 bit systems, as they all currently only have 48 bits of addressable memory.
@@ -72,7 +114,7 @@ struct Q_QML_PRIVATE_EXPORT Value
On 32bit, we store doubles as doubles. All other values, have the high 32bits set to a value that
will make the number a NaN. The Masks below are used for encoding the other types.
- On 64 bit, we xor Doubles with (0xffff8000 << 32). Thas has the effect that no doubles will get encoded
+ On 64 bit, we xor Doubles with (0xffff8000 << 32). That has the effect that no doubles will get encoded
with the 13 highest bits all 0. We are now using special values for bits 14-17 to encode our values. These
can be used, as the highest valid pointer on a 64 bit system is 2^48-1.
@@ -85,10 +127,8 @@ struct Q_QML_PRIVATE_EXPORT Value
union {
quint64 val;
-#if QT_POINTER_SIZE == 8
- Managed *m;
- Object *o;
- String *s;
+#ifdef QV4_USE_64_BIT_VALUE_ENCODING
+ Heap::Base *m;
#else
double dbl;
#endif
@@ -99,10 +139,8 @@ struct Q_QML_PRIVATE_EXPORT Value
union {
uint uint_32;
int int_32;
-#if QT_POINTER_SIZE == 4
- Managed *m;
- Object *o;
- String *s;
+#ifndef QV4_USE_64_BIT_VALUE_ENCODING
+ Heap::Base *m;
#endif
};
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
@@ -111,7 +149,7 @@ struct Q_QML_PRIVATE_EXPORT Value
};
};
-#if QT_POINTER_SIZE == 4
+#ifndef QV4_USE_64_BIT_VALUE_ENCODING
enum Masks {
SilentNaNBit = 0x00040000,
NaN_Mask = 0x7ff80000,
@@ -191,7 +229,7 @@ struct Q_QML_PRIVATE_EXPORT Value
inline bool isUndefined() const { return tag == Undefined_Type; }
inline bool isNull() const { return tag == _Null_Type; }
inline bool isBoolean() const { return tag == _Boolean_Type; }
-#if QT_POINTER_SIZE == 8
+#ifdef QV4_USE_64_BIT_VALUE_ENCODING
inline bool isInteger() const { return (val >> IsNumber_Shift) == 1; }
inline bool isDouble() const { return (val >> IsDouble_Shift); }
inline bool isNumber() const { return (val >> IsNumber_Shift); }
@@ -222,7 +260,7 @@ struct Q_QML_PRIVATE_EXPORT Value
val = v.i ^ NaNEncodeMask;
Q_ASSERT(isDouble());
}
- bool isNaN() const { return (tag & 0x7fff8000) == 0x00078000; }
+ inline bool isNaN() const { return (tag & 0x7fff8000) == 0x00078000; }
#else
inline bool isInteger() const { return tag == _Integer_Type; }
inline bool isDouble() const { return (tag & NotDouble_Mask) != NotDouble_Mask; }
@@ -238,7 +276,7 @@ struct Q_QML_PRIVATE_EXPORT Value
}
double doubleValue() const { Q_ASSERT(isDouble()); return dbl; }
void setDouble(double d) { dbl = d; Q_ASSERT(isDouble()); }
- bool isNaN() const { return (tag & QV4::Value::NotDouble_Mask) == QV4::Value::NaN_Mask; }
+ inline bool isNaN() const { return (tag & QV4::Value::NotDouble_Mask) == QV4::Value::NaN_Mask; }
#endif
inline bool isString() const;
inline bool isObject() const;
@@ -270,12 +308,15 @@ struct Q_QML_PRIVATE_EXPORT Value
}
String *stringValue() const {
- return s;
+ return m ? reinterpret_cast<String*>(const_cast<Value *>(this)) : 0;
}
Object *objectValue() const {
- return o;
+ return m ? reinterpret_cast<Object*>(const_cast<Value *>(this)) : 0;
}
Managed *managed() const {
+ return m ? reinterpret_cast<Managed*>(const_cast<Value *>(this)) : 0;
+ }
+ Heap::Base *heapObject() const {
return m;
}
@@ -283,7 +324,17 @@ struct Q_QML_PRIVATE_EXPORT Value
return val;
}
- static inline Value fromManaged(Managed *o);
+ static inline Value fromHeapObject(Heap::Base *m)
+ {
+ Value v;
+ v.m = m;
+#ifndef QV4_USE_64_BIT_VALUE_ENCODING
+ v.tag = Managed_Type;
+#endif
+ return v;
+ }
+
+ static inline Value fromManaged(Managed *m);
int toUInt16() const;
inline int toInt32() const;
@@ -295,9 +346,8 @@ struct Q_QML_PRIVATE_EXPORT Value
double toNumberImpl() const;
QString toQStringNoThrow() const;
QString toQString() const;
- String *toString(ExecutionEngine *e) const;
- String *toString(ExecutionContext *ctx) const;
- Object *toObject(ExecutionContext *ctx) const;
+ Heap::String *toString(ExecutionEngine *e) const;
+ Heap::Object *toObject(ExecutionEngine *e) const;
inline bool isPrimitive() const;
inline bool tryIntegerConversion() {
@@ -318,12 +368,16 @@ struct Q_QML_PRIVATE_EXPORT Value
inline ErrorObject *asErrorObject() const;
template<typename T> inline T *as() const;
+ template<typename T> inline T *cast() {
+ return static_cast<T *>(managed());
+ }
+ template<typename T> inline const T *cast() const {
+ return static_cast<const T *>(managed());
+ }
inline uint asArrayIndex() const;
inline uint asArrayLength(bool *ok) const;
- inline ExecutionEngine *engine() const;
-
ReturnedValue asReturnedValue() const { return val; }
static Value fromReturnedValue(ReturnedValue val) { Value v; v.val = val; return v; }
@@ -334,27 +388,24 @@ struct Q_QML_PRIVATE_EXPORT Value
Value &operator =(const ScopedValue &v);
Value &operator=(ReturnedValue v) { val = v; return *this; }
- template<typename T>
- Value &operator=(Returned<T> *t);
- template<typename T>
- Value &operator=(T *t) {
- val = Value::fromManaged(t).val;
+ Value &operator=(Managed *m) {
+ val = Value::fromManaged(m).val;
return *this;
}
- Value &operator=(HeapObject *o) {
- m = reinterpret_cast<Managed *>(o);
+ Value &operator=(Heap::Base *o) {
+ m = o;
+#ifndef QV4_USE_64_BIT_VALUE_ENCODING
+ tag = Managed_Type;
+#endif
return *this;
}
template<typename T>
Value &operator=(const Scoped<T> &t);
- Value &operator=(const ValueRef v);
Value &operator=(const Value &v) {
val = v.val;
return *this;
}
- template<typename T>
- inline Returned<T> *as();
};
inline Managed *Value::asManaged() const
@@ -364,13 +415,6 @@ inline Managed *Value::asManaged() const
return 0;
}
-inline String *Value::asString() const
-{
- if (isString())
- return stringValue();
- return 0;
-}
-
struct Q_QML_PRIVATE_EXPORT Primitive : public Value
{
inline static Primitive emptyValue();
@@ -381,18 +425,18 @@ struct Q_QML_PRIVATE_EXPORT Primitive : public Value
static inline Primitive fromDouble(double d);
static inline Primitive fromUInt32(uint i);
+ using Value::toInt32;
+ using Value::toUInt32;
+
static double toInteger(double fromNumber);
static int toInt32(double value);
static unsigned int toUInt32(double value);
-
- inline operator ValueRef();
- Value asValue() const { return *this; }
};
inline Primitive Primitive::undefinedValue()
{
Primitive v;
-#if QT_POINTER_SIZE == 8
+#ifdef QV4_USE_64_BIT_VALUE_ENCODING
v.val = quint64(Undefined_Type) << Tag_Shift;
#else
v.tag = Undefined_Type;
@@ -409,34 +453,20 @@ inline Primitive Primitive::emptyValue()
return v;
}
-inline Value Value::fromManaged(Managed *m)
-{
- if (!m)
- return QV4::Primitive::undefinedValue();
- Value v;
-#if QT_POINTER_SIZE == 8
- v.m = m;
-#else
- v.tag = Managed_Type;
- v.m = m;
-#endif
- return v;
-}
-
template <typename T>
struct TypedValue : public Value
{
template<typename X>
TypedValue &operator =(X *x) {
m = x;
-#if QT_POINTER_SIZE == 4
+#ifndef QV4_USE_64_BIT_VALUE_ENCODING
tag = Managed_Type;
#endif
+ return *this;
}
TypedValue &operator =(T *t);
TypedValue &operator =(const Scoped<T> &v);
// TypedValue &operator =(const ManagedRef<T> &v);
- TypedValue &operator =(Returned<T> *t);
TypedValue &operator =(const TypedValue<T> &t);
@@ -446,7 +476,6 @@ struct TypedValue : public Value
T *operator->() { return static_cast<T *>(managed()); }
const T *operator->() const { return static_cast<T *>(managed()); }
T *getPointer() const { return static_cast<T *>(managed()); }
- Returned<T> *ret() const;
void mark(ExecutionEngine *e) { if (managed()) managed()->mark(e); }
};
@@ -485,9 +514,9 @@ struct Encode {
val = v;
}
- template<typename T>
- Encode(Returned<T> *t) {
- val = t->getPointer()->asReturnedValue();
+ Encode(Heap::Base *o) {
+ Q_ASSERT(o);
+ val = Value::fromHeapObject(o).asReturnedValue();
}
operator ReturnedValue() const {
@@ -498,58 +527,11 @@ private:
Encode(void *);
};
-struct ValueRef {
- ValueRef(const ScopedValue &v);
- template <typename T>
- ValueRef(const Scoped<T> &v);
- ValueRef(const PersistentValue &v);
- ValueRef(PersistentValuePrivate *p);
- ValueRef(Value &v) { ptr = &v; }
- // Important: Do NOT add a copy constructor to this class
- // adding a copy constructor actually changes the calling convention, ie.
- // is not even binary compatible. Adding it would break assumptions made
- // in the jit'ed code.
- ValueRef &operator=(const ScopedValue &o);
- ValueRef &operator=(const Value &v)
- { *ptr = v; return *this; }
- ValueRef &operator=(const ReturnedValue &v) {
- ptr->val = v;
- return *this;
- }
- template <typename T>
- ValueRef &operator=(Returned<T> *v) {
- ptr->val = v->asReturnedValue();
- return *this;
- }
-
- operator const Value *() const {
- return ptr;
- }
- const Value *operator->() const {
- return ptr;
- }
-
- operator Value *() {
- return ptr;
- }
- Value *operator->() {
- return ptr;
- }
-
- static ValueRef fromRawValue(Value *v) {
- return ValueRef(v);
- }
- static const ValueRef fromRawValue(const Value *v) {
- return ValueRef(const_cast<Value *>(v));
- }
-
- ReturnedValue asReturnedValue() const { return ptr->val; }
-
- // ### get rid of this one!
- ValueRef(Value *v) { ptr = reinterpret_cast<Value *>(v); }
-private:
- Value *ptr;
-};
+inline
+ReturnedValue Heap::Base::asReturnedValue() const
+{
+ return Value::fromHeapObject(const_cast<Heap::Base *>(this)).asReturnedValue();
+}
template<typename T>
@@ -561,8 +543,6 @@ T *value_cast(const Value &v)
template<typename T>
ReturnedValue value_convert(ExecutionEngine *e, const Value &v);
-
-
}
QT_END_NAMESPACE
diff --git a/src/qml/jsruntime/qv4variantobject.cpp b/src/qml/jsruntime/qv4variantobject.cpp
index 3cde96992e..966f83acef 100644
--- a/src/qml/jsruntime/qv4variantobject.cpp
+++ b/src/qml/jsruntime/qv4variantobject.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -43,53 +43,20 @@ using namespace QV4;
DEFINE_OBJECT_VTABLE(VariantObject);
-VariantObject::Data::Data(InternalClass *ic)
- : Object::Data(ic)
-{
-}
-
-VariantObject::Data::Data(ExecutionEngine *engine, const QVariant &value)
- : Object::Data(engine->variantClass)
+Heap::VariantObject::VariantObject(QV4::ExecutionEngine *engine, const QVariant &value)
+ : Heap::Object(engine->emptyClass, engine->variantPrototype.asObject())
{
data = value;
if (isScarce())
engine->scarceResources.insert(this);
}
-QVariant VariantObject::toVariant(const QV4::ValueRef v)
-{
- if (v->asObject())
- return v->engine()->v8Engine->toVariant(v, /*typeHint*/ -1, /*createJSValueForObjects*/ false);
-
- if (v->isString())
- return QVariant(v->stringValue()->toQString());
- if (v->isBoolean())
- return QVariant(v->booleanValue());
- if (v->isNumber()) {
- QV4::Value val;
- val = v;
- if (val.isInt32())
- return QVariant(val.integerValue());
- return QVariant(v->asDouble());
- }
- if (v->isNull())
- return QVariant(QMetaType::VoidStar, 0);
- Q_ASSERT(v->isUndefined());
- return QVariant();
-}
-
bool VariantObject::Data::isScarce() const
{
QVariant::Type t = data.type();
return t == QVariant::Pixmap || t == QVariant::Image;
}
-void VariantObject::destroy(Managed *that)
-{
- VariantObject *v = static_cast<VariantObject *>(that);
- v->d()->~Data();
-}
-
bool VariantObject::isEqualTo(Managed *m, Managed *other)
{
Q_ASSERT(m->as<QV4::VariantObject>());
@@ -98,7 +65,7 @@ bool VariantObject::isEqualTo(Managed *m, Managed *other)
if (QV4::VariantObject *rv = other->as<QV4::VariantObject>())
return lv->d()->data == rv->d()->data;
- if (QV4::QmlValueTypeWrapper *v = other->as<QmlValueTypeWrapper>())
+ if (QV4::QQmlValueTypeWrapper *v = other->as<QQmlValueTypeWrapper>())
return v->isEqual(lv->d()->data);
return false;
@@ -136,7 +103,7 @@ void VariantPrototype::init()
QV4::ReturnedValue VariantPrototype::method_preserve(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<VariantObject> o(scope, ctx->d()->callData->thisObject.as<QV4::VariantObject>());
+ Scoped<VariantObject> o(scope, ctx->thisObject().as<QV4::VariantObject>());
if (o && o->d()->isScarce())
o->d()->node.remove();
return Encode::undefined();
@@ -145,7 +112,7 @@ QV4::ReturnedValue VariantPrototype::method_preserve(CallContext *ctx)
QV4::ReturnedValue VariantPrototype::method_destroy(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<VariantObject> o(scope, ctx->d()->callData->thisObject.as<QV4::VariantObject>());
+ Scoped<VariantObject> o(scope, ctx->thisObject().as<QV4::VariantObject>());
if (o) {
if (o->d()->isScarce())
o->d()->node.remove();
@@ -157,7 +124,7 @@ QV4::ReturnedValue VariantPrototype::method_destroy(CallContext *ctx)
QV4::ReturnedValue VariantPrototype::method_toString(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<VariantObject> o(scope, ctx->d()->callData->thisObject.as<QV4::VariantObject>());
+ Scoped<VariantObject> o(scope, ctx->thisObject().as<QV4::VariantObject>());
if (!o)
return Encode::undefined();
QString result = o->d()->data.toString();
@@ -169,7 +136,7 @@ QV4::ReturnedValue VariantPrototype::method_toString(CallContext *ctx)
QV4::ReturnedValue VariantPrototype::method_valueOf(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<VariantObject> o(scope, ctx->d()->callData->thisObject.as<QV4::VariantObject>());
+ Scoped<VariantObject> o(scope, ctx->thisObject().as<QV4::VariantObject>());
if (o) {
QVariant v = o->d()->data;
switch (v.type()) {
@@ -185,10 +152,12 @@ QV4::ReturnedValue VariantPrototype::method_valueOf(CallContext *ctx)
case QVariant::Bool:
return Encode(v.toBool());
default:
+ if (QMetaType::typeFlags(v.userType()) & QMetaType::IsEnumeration)
+ return Encode(v.toInt());
break;
}
}
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
QT_END_NAMESPACE
diff --git a/src/qml/jsruntime/qv4variantobject_p.h b/src/qml/jsruntime/qv4variantobject_p.h
index ef7554d7ab..2b48412c4d 100644
--- a/src/qml/jsruntime/qv4variantobject_p.h
+++ b/src/qml/jsruntime/qv4variantobject_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -56,27 +56,32 @@ QT_BEGIN_NAMESPACE
namespace QV4 {
+namespace Heap {
+
+struct VariantObject : Object, public ExecutionEngine::ScarceResourceData
+{
+ VariantObject(InternalClass *ic, QV4::Object *prototype)
+ : Object(ic, prototype)
+ {}
+ VariantObject(QV4::ExecutionEngine *engine, const QVariant &value);
+ ~VariantObject() {
+ if (isScarce())
+ node.remove();
+ }
+ bool isScarce() const;
+ int vmePropertyReferenceCount;
+};
+
+}
+
struct VariantObject : Object
{
- struct Data : Object::Data, public ExecutionEngine::ScarceResourceData
- {
- Data(InternalClass *ic);
- Data(ExecutionEngine *engine, const QVariant &value);
- ~Data() {
- if (isScarce())
- node.remove();
- }
- bool isScarce() const;
- int vmePropertyReferenceCount;
- };
- V4_OBJECT(Object)
-
- static QVariant toVariant(const ValueRef v);
+ V4_OBJECT2(VariantObject, Object)
+ V4_NEEDS_DESTROY
void addVmePropertyReference();
void removeVmePropertyReference();
- static void destroy(Managed *that);
static bool isEqualTo(Managed *m, Managed *other);
};
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp
index cd73314bce..390bbf5ee3 100644
--- a/src/qml/jsruntime/qv4vme_moth.cpp
+++ b/src/qml/jsruntime/qv4vme_moth.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -33,8 +33,14 @@
#include "qv4vme_moth_p.h"
#include "qv4instr_moth_p.h"
+
+#include <QtCore/qjsondocument.h>
+#include <QtCore/qjsonobject.h>
+
#include <private/qv4value_inl_p.h>
#include <private/qv4debugging_p.h>
+#include <private/qv4function_p.h>
+#include <private/qv4functionobject_p.h>
#include <private/qv4math_p.h>
#include <private/qv4scopedvalue_p.h>
#include <private/qv4lookup_p.h>
@@ -42,14 +48,238 @@
#include "qv4alloca_p.h"
+#undef DO_TRACE_INSTR // define to enable instruction tracing
+
#ifdef DO_TRACE_INSTR
-# define TRACE_INSTR(I) fprintf(stderr, "executing a %s\n", #I);
-# define TRACE(n, str, ...) { char buf[4096]; snprintf(buf, 4096, str, __VA_ARGS__); fprintf(stderr, " %s : %s\n", #n, buf); }
+# define TRACE_INSTR(I) qDebug("executing a %s\n", #I);
+# define TRACE(n, str, ...) { char buf[4096]; snprintf(buf, 4096, str, __VA_ARGS__); qDebug(" %s : %s", #n, buf); }
#else
# define TRACE_INSTR(I)
# define TRACE(n, str, ...)
#endif // DO_TRACE_INSTR
+extern "C" {
+
+// This is the interface to Qt Creator's (new) QML debugger.
+
+/*! \internal
+ \since 5.5
+
+ This function is called uncondionally from VME::run().
+
+ An attached debugger can set a breakpoint here to
+ intercept calls to VME::run().
+ */
+
+Q_QML_EXPORT void qt_v4ResolvePendingBreakpointsHook()
+{
+}
+
+/*! \internal
+ \since 5.5
+
+ This function is called when a QML interpreter breakpoint
+ is hit.
+
+ An attached debugger can set a breakpoint here.
+*/
+Q_QML_EXPORT void qt_v4TriggeredBreakpointHook()
+{
+}
+
+/*! \internal
+ \since 5.5
+
+ The main entry point into "Native Mixed" Debugging.
+
+ Commands are passed as UTF-8 encoded JSON data.
+ The data has two compulsory fields:
+ \list
+ \li \c version: Version of the protocol (currently 1)
+ \li \c command: Name of the command
+ \endlist
+
+ Depending on \c command, more fields can be present.
+
+ Error is indicated by negative return values,
+ success by non-negative return values.
+
+ \c protocolVersion:
+ Returns version of implemented protocol.
+
+ \c insertBreakpoint:
+ Sets a breakpoint on a given file and line.
+ \list
+ \li \c fullName: Name of the QML/JS file
+ \li \c lineNumber: Line number in the file
+ \li \c condition: Breakpoint condition
+ \endlist
+ Returns a unique positive number as handle.
+
+ \c removeBreakpoint:
+ Removes a breakpoint from a given file and line.
+ \list
+ \li \c fullName: Name of the QML/JS file
+ \li \c lineNumber: Line number in the file
+ \li \c condition: Breakpoint condition
+ \endlist
+ Returns zero on success, a negative number on failure.
+
+ \c prepareStep:
+ Puts the interpreter in stepping mode.
+ Returns zero.
+
+*/
+Q_QML_EXPORT int qt_v4DebuggerHook(const char *json);
+
+
+} // extern "C"
+
+static int qt_v4BreakpointCount = 0;
+static bool qt_v4IsDebugging = true;
+static bool qt_v4IsStepping = false;
+
+class Breakpoint
+{
+public:
+ Breakpoint() : bpNumber(0), lineNumber(-1) {}
+
+ bool matches(const QString &file, int line) const
+ {
+ return fullName == file && lineNumber == line;
+ }
+
+ int bpNumber;
+ int lineNumber;
+ QString fullName; // e.g. /opt/project/main.qml
+ QString engineName; // e.g. qrc:/main.qml
+ QString condition; // optional
+};
+
+static QVector<Breakpoint> qt_v4Breakpoints;
+static Breakpoint qt_v4LastStop;
+
+static QV4::Function *qt_v4ExtractFunction(QV4::ExecutionContext *context)
+{
+ QV4::Scope scope(context->engine());
+ QV4::ScopedFunctionObject function(scope, context->getFunctionObject());
+ if (function)
+ return function->function();
+ else
+ return context->d()->engine->globalCode;
+}
+
+static void qt_v4TriggerBreakpoint(const Breakpoint &bp, QV4::Function *function)
+{
+ qt_v4LastStop = bp;
+
+ // Set up some auxiliary data for informational purpose.
+ // This is not part of the protocol.
+ QV4::Heap::String *functionName = function->name();
+ QByteArray functionNameUtf8;
+ if (functionName)
+ functionNameUtf8 = functionName->toQString().toUtf8();
+
+ qt_v4TriggeredBreakpointHook(); // Trigger Breakpoint.
+}
+
+int qt_v4DebuggerHook(const char *json)
+{
+ const int ProtocolVersion = 1;
+
+ enum {
+ Success = 0,
+ WrongProtocol,
+ NoSuchCommand,
+ NoSuchBreakpoint
+ };
+
+ QJsonDocument doc = QJsonDocument::fromJson(json);
+ QJsonObject ob = doc.object();
+ QByteArray command = ob.value(QStringLiteral("command")).toString().toUtf8();
+
+ if (command == "protocolVersion") {
+ return ProtocolVersion; // Version number.
+ }
+
+ int version = ob.value(QLatin1Literal("version")).toString().toInt();
+ if (version != ProtocolVersion) {
+ return -WrongProtocol;
+ }
+
+ if (command == "insertBreakpoint") {
+ Breakpoint bp;
+ bp.bpNumber = ++qt_v4BreakpointCount;
+ bp.lineNumber = ob.value(QStringLiteral("lineNumber")).toString().toInt();
+ bp.engineName = ob.value(QStringLiteral("engineName")).toString();
+ bp.fullName = ob.value(QStringLiteral("fullName")).toString();
+ bp.condition = ob.value(QStringLiteral("condition")).toString();
+ qt_v4Breakpoints.append(bp);
+ return bp.bpNumber;
+ }
+
+ if (command == "removeBreakpoint") {
+ int lineNumber = ob.value(QStringLiteral("lineNumber")).toString().toInt();
+ QString fullName = ob.value(QStringLiteral("fullName")).toString();
+ if (qt_v4Breakpoints.last().matches(fullName, lineNumber)) {
+ qt_v4Breakpoints.removeLast();
+ return Success;
+ }
+ for (int i = 0; i + 1 < qt_v4Breakpoints.size(); ++i) {
+ if (qt_v4Breakpoints.at(i).matches(fullName, lineNumber)) {
+ qt_v4Breakpoints[i] = qt_v4Breakpoints.takeLast();
+ return Success; // Ok.
+ }
+ }
+ return -NoSuchBreakpoint; // Failure
+ }
+
+ if (command == "prepareStep") {
+ qt_v4IsStepping = true;
+ return Success; // Ok.
+ }
+
+
+ return -NoSuchCommand; // Failure.
+}
+
+static void qt_v4CheckForBreak(QV4::ExecutionContext *context, QV4::Value **scopes, int scopeDepth)
+{
+ Q_UNUSED(scopes);
+ Q_UNUSED(scopeDepth);
+ const int lineNumber = context->d()->lineNumber;
+ QV4::Function *function = qt_v4ExtractFunction(context);
+ QString engineName = function->sourceFile();
+
+ if (engineName.isEmpty())
+ return;
+
+ if (qt_v4IsStepping) {
+ if (qt_v4LastStop.lineNumber != lineNumber
+ || qt_v4LastStop.engineName != engineName) {
+ qt_v4IsStepping = false;
+ Breakpoint bp;
+ bp.bpNumber = 0;
+ bp.lineNumber = lineNumber;
+ bp.engineName = engineName;
+ qt_v4TriggerBreakpoint(bp, function);
+ return;
+ }
+ }
+
+ for (int i = qt_v4Breakpoints.size(); --i >= 0; ) {
+ const Breakpoint &bp = qt_v4Breakpoints.at(i);
+ if (bp.lineNumber != lineNumber)
+ continue;
+ if (bp.engineName != engineName)
+ continue;
+
+ qt_v4TriggerBreakpoint(bp, function);
+ }
+}
+
+// End of debugger interface
+
using namespace QV4;
using namespace QV4::Moth;
@@ -79,59 +309,23 @@ using namespace QV4::Moth;
#endif
-#ifdef WITH_STATS
-namespace {
-struct VMStats {
- quint64 paramIsValue;
- quint64 paramIsArg;
- quint64 paramIsLocal;
- quint64 paramIsTemp;
- quint64 paramIsScopedLocal;
-
- VMStats()
- : paramIsValue(0)
- , paramIsArg(0)
- , paramIsLocal(0)
- , paramIsTemp(0)
- , paramIsScopedLocal(0)
- {}
-
- ~VMStats()
- { show(); }
-
- void show() {
- fprintf(stderr, "VM stats:\n");
- fprintf(stderr, " value: %lu\n", paramIsValue);
- fprintf(stderr, " arg: %lu\n", paramIsArg);
- fprintf(stderr, " local: %lu\n", paramIsLocal);
- fprintf(stderr, " temp: %lu\n", paramIsTemp);
- fprintf(stderr, " scoped local: %lu\n", paramIsScopedLocal);
- }
-};
-static VMStats vmStats;
-#define VMSTATS(what) ++vmStats.what
-}
-#else // !WITH_STATS
-#define VMSTATS(what) {}
-#endif // WITH_STATS
-
#ifdef DO_TRACE_INSTR
Param traceParam(const Param &param)
{
if (param.isConstant()) {
- fprintf(stderr, " constant\n");
+ qDebug(" constant\n");
} else if (param.isArgument()) {
- fprintf(stderr, " argument %d@%d\n", param.index, param.scope);
+ qDebug(" argument %d@%d\n", param.index, param.scope);
} else if (param.isLocal()) {
- fprintf(stderr, " local %d\n", param.index);
+ qDebug(" local %d\n", param.index);
} else if (param.isTemp()) {
- fprintf(stderr, " temp %d\n", param.index);
+ qDebug(" temp %d\n", param.index);
} else if (param.isScopedLocal()) {
- fprintf(stderr, " temp %d@%d\n", param.index, param.scope);
+ qDebug(" temp %d@%d\n", param.index, param.scope);
} else {
Q_ASSERT(!"INVALID");
}
- return Param
+ return param;
}
# define VALUE(param) (*VALUEPTR(param))
# define VALUEPTR(param) (scopes[traceParam(param).scope] + param.index)
@@ -150,7 +344,7 @@ Param traceParam(const Param &param)
if (engine->hasException) \
goto catchException
-QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
+QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code
#ifdef MOTH_THREADED_INTERPRETER
, void ***storeJumpTable
#endif
@@ -160,6 +354,8 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
qDebug("Starting VME with context=%p and code=%p", context, code);
#endif // DO_TRACE_INSTR
+ qt_v4ResolvePendingBreakpointsHook();
+
#ifdef MOTH_THREADED_INTERPRETER
if (storeJumpTable) {
#define MOTH_INSTR_ADDR(I, FMT) &&op_##I,
@@ -177,22 +373,21 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
const uchar *exceptionHandler = 0;
- context->d()->lineNumber = -1;
- QV4::ExecutionEngine *engine = context->d()->engine;
+ QV4::Scope scope(engine);
+ QV4::ScopedContext context(scope, engine->currentContext());
+ engine->currentContext()->lineNumber = -1;
#ifdef DO_TRACE_INSTR
qDebug("Starting VME with context=%p and code=%p", context, code);
#endif // DO_TRACE_INSTR
- QV4::StringValue * const runtimeStrings = context->d()->compilationUnit->runtimeStrings;
-
// setup lookup scopes
int scopeDepth = 0;
{
- QV4::ExecutionContext *scope = context;
+ QV4::Heap::ExecutionContext *scope = context->d();
while (scope) {
++scopeDepth;
- scope = scope->d()->outer;
+ scope = scope->outer;
}
}
@@ -201,19 +396,19 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
scopes[0] = const_cast<QV4::Value *>(context->d()->compilationUnit->data->constants());
// stack gets setup in push instruction
scopes[1] = 0;
- QV4::ExecutionContext *scope = context;
+ QV4::Heap::ExecutionContext *scope = context->d();
int i = 0;
while (scope) {
- if (scope->d()->type >= QV4::ExecutionContext::Type_SimpleCallContext) {
- QV4::CallContext *cc = static_cast<QV4::CallContext *>(scope);
- scopes[2*i + 2] = cc->d()->callData->args;
- scopes[2*i + 3] = cc->d()->locals;
+ if (scope->type >= QV4::Heap::ExecutionContext::Type_SimpleCallContext) {
+ QV4::Heap::CallContext *cc = static_cast<QV4::Heap::CallContext *>(scope);
+ scopes[2*i + 2] = cc->callData->args;
+ scopes[2*i + 3] = cc->locals;
} else {
scopes[2*i + 2] = 0;
scopes[2*i + 3] = 0;
}
++i;
- scope = scope->d()->outer;
+ scope = scope->outer;
}
}
@@ -240,7 +435,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_BEGIN_INSTR(LoadRuntimeString)
// TRACE(value, "%s", instr.value.toString(context)->toQString().toUtf8().constData());
- VALUE(instr.result) = runtimeStrings[instr.stringId].asReturnedValue();
+ VALUE(instr.result) = context->d()->compilationUnit->runtimeStrings[instr.stringId];
MOTH_END_INSTR(LoadRuntimeString)
MOTH_BEGIN_INSTR(LoadRegExp)
@@ -249,90 +444,86 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(LoadRegExp)
MOTH_BEGIN_INSTR(LoadClosure)
- STOREVALUE(instr.result, Runtime::closure(context, instr.value));
+ STOREVALUE(instr.result, Runtime::closure(engine, instr.value));
MOTH_END_INSTR(LoadClosure)
MOTH_BEGIN_INSTR(LoadName)
TRACE(inline, "property name = %s", runtimeStrings[instr.name]->toQString().toUtf8().constData());
- STOREVALUE(instr.result, Runtime::getActivationProperty(context, runtimeStrings[instr.name]));
+ STOREVALUE(instr.result, Runtime::getActivationProperty(engine, instr.name));
MOTH_END_INSTR(LoadName)
MOTH_BEGIN_INSTR(GetGlobalLookup)
- TRACE(inline, "property name = %s", runtimeStrings[instr.name]->toQString().toUtf8().constData());
QV4::Lookup *l = context->d()->lookups + instr.index;
- STOREVALUE(instr.result, l->globalGetter(l, context));
+ STOREVALUE(instr.result, l->globalGetter(l, engine));
MOTH_END_INSTR(GetGlobalLookup)
MOTH_BEGIN_INSTR(StoreName)
TRACE(inline, "property name = %s", runtimeStrings[instr.name]->toQString().toUtf8().constData());
- Runtime::setActivationProperty(context, runtimeStrings[instr.name], VALUEPTR(instr.source));
+ Runtime::setActivationProperty(engine, instr.name, VALUE(instr.source));
CHECK_EXCEPTION;
MOTH_END_INSTR(StoreName)
MOTH_BEGIN_INSTR(LoadElement)
- STOREVALUE(instr.result, Runtime::getElement(context, VALUEPTR(instr.base), VALUEPTR(instr.index)));
+ STOREVALUE(instr.result, Runtime::getElement(engine, VALUE(instr.base), VALUE(instr.index)));
MOTH_END_INSTR(LoadElement)
MOTH_BEGIN_INSTR(LoadElementLookup)
QV4::Lookup *l = context->d()->lookups + instr.lookup;
- STOREVALUE(instr.result, l->indexedGetter(l, VALUEPTR(instr.base), VALUEPTR(instr.index)));
+ STOREVALUE(instr.result, l->indexedGetter(l, VALUE(instr.base), VALUE(instr.index)));
MOTH_END_INSTR(LoadElementLookup)
MOTH_BEGIN_INSTR(StoreElement)
- Runtime::setElement(context, VALUEPTR(instr.base), VALUEPTR(instr.index), VALUEPTR(instr.source));
+ Runtime::setElement(engine, VALUE(instr.base), VALUE(instr.index), VALUE(instr.source));
CHECK_EXCEPTION;
MOTH_END_INSTR(StoreElement)
MOTH_BEGIN_INSTR(StoreElementLookup)
QV4::Lookup *l = context->d()->lookups + instr.lookup;
- l->indexedSetter(l, VALUEPTR(instr.base), VALUEPTR(instr.index), VALUEPTR(instr.source));
+ l->indexedSetter(l, VALUE(instr.base), VALUE(instr.index), VALUE(instr.source));
CHECK_EXCEPTION;
MOTH_END_INSTR(StoreElementLookup)
MOTH_BEGIN_INSTR(LoadProperty)
- STOREVALUE(instr.result, Runtime::getProperty(context, VALUEPTR(instr.base), runtimeStrings[instr.name]));
+ STOREVALUE(instr.result, Runtime::getProperty(engine, VALUE(instr.base), instr.name));
MOTH_END_INSTR(LoadProperty)
MOTH_BEGIN_INSTR(GetLookup)
QV4::Lookup *l = context->d()->lookups + instr.index;
- STOREVALUE(instr.result, l->getter(l, VALUEPTR(instr.base)));
+ STOREVALUE(instr.result, l->getter(l, engine, VALUE(instr.base)));
MOTH_END_INSTR(GetLookup)
MOTH_BEGIN_INSTR(StoreProperty)
- Runtime::setProperty(context, VALUEPTR(instr.base), runtimeStrings[instr.name], VALUEPTR(instr.source));
+ Runtime::setProperty(engine, VALUE(instr.base), instr.name, VALUE(instr.source));
CHECK_EXCEPTION;
MOTH_END_INSTR(StoreProperty)
MOTH_BEGIN_INSTR(SetLookup)
QV4::Lookup *l = context->d()->lookups + instr.index;
- l->setter(l, VALUEPTR(instr.base), VALUEPTR(instr.source));
+ l->setter(l, engine, VALUE(instr.base), VALUE(instr.source));
CHECK_EXCEPTION;
MOTH_END_INSTR(SetLookup)
MOTH_BEGIN_INSTR(StoreQObjectProperty)
- Runtime::setQmlQObjectProperty(context, VALUEPTR(instr.base), instr.propertyIndex, VALUEPTR(instr.source));
+ Runtime::setQmlQObjectProperty(engine, VALUE(instr.base), instr.propertyIndex, VALUE(instr.source));
CHECK_EXCEPTION;
MOTH_END_INSTR(StoreQObjectProperty)
MOTH_BEGIN_INSTR(LoadQObjectProperty)
- STOREVALUE(instr.result, Runtime::getQmlQObjectProperty(context, VALUEPTR(instr.base), instr.propertyIndex, instr.captureRequired));
+ STOREVALUE(instr.result, Runtime::getQmlQObjectProperty(engine, VALUE(instr.base), instr.propertyIndex, instr.captureRequired));
MOTH_END_INSTR(LoadQObjectProperty)
MOTH_BEGIN_INSTR(LoadAttachedQObjectProperty)
- STOREVALUE(instr.result, Runtime::getQmlAttachedProperty(context, instr.attachedPropertiesId, instr.propertyIndex));
+ STOREVALUE(instr.result, Runtime::getQmlAttachedProperty(engine, instr.attachedPropertiesId, instr.propertyIndex));
MOTH_END_INSTR(LoadAttachedQObjectProperty)
MOTH_BEGIN_INSTR(LoadSingletonQObjectProperty)
- STOREVALUE(instr.result, Runtime::getQmlSingletonQObjectProperty(context, VALUEPTR(instr.base), instr.propertyIndex, instr.captureRequired));
+ STOREVALUE(instr.result, Runtime::getQmlSingletonQObjectProperty(engine, VALUE(instr.base), instr.propertyIndex, instr.captureRequired));
MOTH_END_INSTR(LoadSingletonQObjectProperty)
MOTH_BEGIN_INSTR(Push)
TRACE(inline, "stack size: %u", instr.value);
stackSize = instr.value;
- stack = context->engine()->stackPush(stackSize);
-#ifndef QT_NO_DEBUG
- memset(stack, 0, stackSize * sizeof(QV4::Value));
-#endif
+ stack = scope.alloc(stackSize);
scopes[1] = stack;
MOTH_END_INSTR(Push)
@@ -352,7 +543,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = QV4::Primitive::undefinedValue();
- STOREVALUE(instr.result, Runtime::callValue(context, VALUEPTR(instr.dest), callData));
+ STOREVALUE(instr.result, Runtime::callValue(engine, VALUE(instr.dest), callData));
MOTH_END_INSTR(CallValue)
MOTH_BEGIN_INSTR(CallProperty)
@@ -362,17 +553,16 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = VALUE(instr.base);
- STOREVALUE(instr.result, Runtime::callProperty(context, runtimeStrings[instr.name], callData));
+ STOREVALUE(instr.result, Runtime::callProperty(engine, instr.name, callData));
MOTH_END_INSTR(CallProperty)
MOTH_BEGIN_INSTR(CallPropertyLookup)
- TRACE(property name, "%s, args=%u, argc=%u, this=%s", qPrintable(runtimeStrings[instr.name]->toQString()), instr.callData, instr.argc, (VALUE(instr.base)).toString(context)->toQString().toUtf8().constData());
Q_ASSERT(instr.callData + instr.argc + qOffsetOf(QV4::CallData, args)/sizeof(QV4::Value) <= stackSize);
QV4::CallData *callData = reinterpret_cast<QV4::CallData *>(stack + instr.callData);
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = VALUE(instr.base);
- STOREVALUE(instr.result, Runtime::callPropertyLookup(context, instr.lookupIndex, callData));
+ STOREVALUE(instr.result, Runtime::callPropertyLookup(engine, instr.lookupIndex, callData));
MOTH_END_INSTR(CallPropertyLookup)
MOTH_BEGIN_INSTR(CallElement)
@@ -381,111 +571,113 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = VALUE(instr.base);
- STOREVALUE(instr.result, Runtime::callElement(context, VALUEPTR(instr.index), callData));
+ STOREVALUE(instr.result, Runtime::callElement(engine, VALUE(instr.index), callData));
MOTH_END_INSTR(CallElement)
MOTH_BEGIN_INSTR(CallActivationProperty)
- TRACE(args, "starting at %d, length %d", instr.args, instr.argc);
Q_ASSERT(instr.callData + instr.argc + qOffsetOf(QV4::CallData, args)/sizeof(QV4::Value) <= stackSize);
QV4::CallData *callData = reinterpret_cast<QV4::CallData *>(stack + instr.callData);
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = QV4::Primitive::undefinedValue();
- STOREVALUE(instr.result, Runtime::callActivationProperty(context, runtimeStrings[instr.name], callData));
+ STOREVALUE(instr.result, Runtime::callActivationProperty(engine, instr.name, callData));
MOTH_END_INSTR(CallActivationProperty)
MOTH_BEGIN_INSTR(CallGlobalLookup)
- TRACE(args, "starting at %d, length %d", instr.args, instr.argc);
Q_ASSERT(instr.callData + instr.argc + qOffsetOf(QV4::CallData, args)/sizeof(QV4::Value) <= stackSize);
QV4::CallData *callData = reinterpret_cast<QV4::CallData *>(stack + instr.callData);
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = QV4::Primitive::undefinedValue();
- STOREVALUE(instr.result, Runtime::callGlobalLookup(context, instr.index, callData));
+ STOREVALUE(instr.result, Runtime::callGlobalLookup(engine, instr.index, callData));
MOTH_END_INSTR(CallGlobalLookup)
MOTH_BEGIN_INSTR(SetExceptionHandler)
- exceptionHandler = instr.offset ? ((uchar *)&instr.offset) + instr.offset : 0;
+ exceptionHandler = instr.offset ? ((const uchar *)&instr.offset) + instr.offset : 0;
MOTH_END_INSTR(SetExceptionHandler)
MOTH_BEGIN_INSTR(CallBuiltinThrow)
- Runtime::throwException(context, VALUEPTR(instr.arg));
+ Runtime::throwException(engine, VALUE(instr.arg));
CHECK_EXCEPTION;
MOTH_END_INSTR(CallBuiltinThrow)
MOTH_BEGIN_INSTR(CallBuiltinUnwindException)
- STOREVALUE(instr.result, Runtime::unwindException(context));
+ STOREVALUE(instr.result, Runtime::unwindException(engine));
MOTH_END_INSTR(CallBuiltinUnwindException)
MOTH_BEGIN_INSTR(CallBuiltinPushCatchScope)
- context = Runtime::pushCatchScope(context, runtimeStrings[instr.name]);
+ Runtime::pushCatchScope(static_cast<QV4::NoThrowEngine*>(engine), instr.name);
+ context = engine->currentContext();
MOTH_END_INSTR(CallBuiltinPushCatchScope)
MOTH_BEGIN_INSTR(CallBuiltinPushScope)
- context = Runtime::pushWithScope(VALUEPTR(instr.arg), context);
+ Runtime::pushWithScope(VALUE(instr.arg), engine);
+ context = engine->currentContext();
+ CHECK_EXCEPTION;
MOTH_END_INSTR(CallBuiltinPushScope)
MOTH_BEGIN_INSTR(CallBuiltinPopScope)
- context = Runtime::popScope(context);
+ Runtime::popScope(engine);
+ context = engine->currentContext();
MOTH_END_INSTR(CallBuiltinPopScope)
MOTH_BEGIN_INSTR(CallBuiltinForeachIteratorObject)
- STOREVALUE(instr.result, Runtime::foreachIterator(context, VALUEPTR(instr.arg)));
+ STOREVALUE(instr.result, Runtime::foreachIterator(engine, VALUE(instr.arg)));
MOTH_END_INSTR(CallBuiltinForeachIteratorObject)
MOTH_BEGIN_INSTR(CallBuiltinForeachNextPropertyName)
- STOREVALUE(instr.result, Runtime::foreachNextPropertyName(VALUEPTR(instr.arg)));
+ STOREVALUE(instr.result, Runtime::foreachNextPropertyName(VALUE(instr.arg)));
MOTH_END_INSTR(CallBuiltinForeachNextPropertyName)
MOTH_BEGIN_INSTR(CallBuiltinDeleteMember)
- STOREVALUE(instr.result, Runtime::deleteMember(context, VALUEPTR(instr.base), runtimeStrings[instr.member]));
+ STOREVALUE(instr.result, Runtime::deleteMember(engine, VALUE(instr.base), instr.member));
MOTH_END_INSTR(CallBuiltinDeleteMember)
MOTH_BEGIN_INSTR(CallBuiltinDeleteSubscript)
- STOREVALUE(instr.result, Runtime::deleteElement(context, VALUEPTR(instr.base), VALUEPTR(instr.index)));
+ STOREVALUE(instr.result, Runtime::deleteElement(engine, VALUE(instr.base), VALUE(instr.index)));
MOTH_END_INSTR(CallBuiltinDeleteSubscript)
MOTH_BEGIN_INSTR(CallBuiltinDeleteName)
- STOREVALUE(instr.result, Runtime::deleteName(context, runtimeStrings[instr.name]));
+ STOREVALUE(instr.result, Runtime::deleteName(engine, instr.name));
MOTH_END_INSTR(CallBuiltinDeleteName)
MOTH_BEGIN_INSTR(CallBuiltinTypeofMember)
- STOREVALUE(instr.result, Runtime::typeofMember(context, VALUEPTR(instr.base), runtimeStrings[instr.member]));
+ STOREVALUE(instr.result, Runtime::typeofMember(engine, VALUE(instr.base), instr.member));
MOTH_END_INSTR(CallBuiltinTypeofMember)
MOTH_BEGIN_INSTR(CallBuiltinTypeofSubscript)
- STOREVALUE(instr.result, Runtime::typeofElement(context, VALUEPTR(instr.base), VALUEPTR(instr.index)));
+ STOREVALUE(instr.result, Runtime::typeofElement(engine, VALUE(instr.base), VALUE(instr.index)));
MOTH_END_INSTR(CallBuiltinTypeofSubscript)
MOTH_BEGIN_INSTR(CallBuiltinTypeofName)
- STOREVALUE(instr.result, Runtime::typeofName(context, runtimeStrings[instr.name]));
+ STOREVALUE(instr.result, Runtime::typeofName(engine, instr.name));
MOTH_END_INSTR(CallBuiltinTypeofName)
MOTH_BEGIN_INSTR(CallBuiltinTypeofValue)
- STOREVALUE(instr.result, Runtime::typeofValue(context, VALUEPTR(instr.value)));
+ STOREVALUE(instr.result, Runtime::typeofValue(engine, VALUE(instr.value)));
MOTH_END_INSTR(CallBuiltinTypeofValue)
MOTH_BEGIN_INSTR(CallBuiltinDeclareVar)
- Runtime::declareVar(context, instr.isDeletable, runtimeStrings[instr.varName]);
+ Runtime::declareVar(engine, instr.isDeletable, instr.varName);
MOTH_END_INSTR(CallBuiltinDeclareVar)
MOTH_BEGIN_INSTR(CallBuiltinDefineArray)
Q_ASSERT(instr.args + instr.argc <= stackSize);
QV4::Value *args = stack + instr.args;
- STOREVALUE(instr.result, Runtime::arrayLiteral(context, args, instr.argc));
+ STOREVALUE(instr.result, Runtime::arrayLiteral(engine, args, instr.argc));
MOTH_END_INSTR(CallBuiltinDefineArray)
MOTH_BEGIN_INSTR(CallBuiltinDefineObjectLiteral)
QV4::Value *args = stack + instr.args;
- STOREVALUE(instr.result, Runtime::objectLiteral(context, args, instr.internalClassId, instr.arrayValueCount, instr.arrayGetterSetterCountAndFlags));
+ STOREVALUE(instr.result, Runtime::objectLiteral(engine, args, instr.internalClassId, instr.arrayValueCount, instr.arrayGetterSetterCountAndFlags));
MOTH_END_INSTR(CallBuiltinDefineObjectLiteral)
MOTH_BEGIN_INSTR(CallBuiltinSetupArgumentsObject)
- STOREVALUE(instr.result, Runtime::setupArgumentsObject(context));
+ STOREVALUE(instr.result, Runtime::setupArgumentsObject(engine));
MOTH_END_INSTR(CallBuiltinSetupArgumentsObject)
MOTH_BEGIN_INSTR(CallBuiltinConvertThisToObject)
- Runtime::convertThisToObject(context);
+ Runtime::convertThisToObject(engine);
CHECK_EXCEPTION;
MOTH_END_INSTR(CallBuiltinConvertThisToObject)
@@ -495,7 +687,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = QV4::Primitive::undefinedValue();
- STOREVALUE(instr.result, Runtime::constructValue(context, VALUEPTR(instr.func), callData));
+ STOREVALUE(instr.result, Runtime::constructValue(engine, VALUE(instr.func), callData));
MOTH_END_INSTR(CreateValue)
MOTH_BEGIN_INSTR(CreateProperty)
@@ -504,7 +696,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = VALUE(instr.base);
- STOREVALUE(instr.result, Runtime::constructProperty(context, runtimeStrings[instr.name], callData));
+ STOREVALUE(instr.result, Runtime::constructProperty(engine, instr.name, callData));
MOTH_END_INSTR(CreateProperty)
MOTH_BEGIN_INSTR(ConstructPropertyLookup)
@@ -513,49 +705,47 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = VALUE(instr.base);
- STOREVALUE(instr.result, Runtime::constructPropertyLookup(context, instr.index, callData));
+ STOREVALUE(instr.result, Runtime::constructPropertyLookup(engine, instr.index, callData));
MOTH_END_INSTR(ConstructPropertyLookup)
MOTH_BEGIN_INSTR(CreateActivationProperty)
- TRACE(inline, "property name = %s, args = %d, argc = %d", runtimeStrings[instr.name]->toQString().toUtf8().constData(), instr.args, instr.argc);
Q_ASSERT(instr.callData + instr.argc + qOffsetOf(QV4::CallData, args)/sizeof(QV4::Value) <= stackSize);
QV4::CallData *callData = reinterpret_cast<QV4::CallData *>(stack + instr.callData);
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = QV4::Primitive::undefinedValue();
- STOREVALUE(instr.result, Runtime::constructActivationProperty(context, runtimeStrings[instr.name], callData));
+ STOREVALUE(instr.result, Runtime::constructActivationProperty(engine, instr.name, callData));
MOTH_END_INSTR(CreateActivationProperty)
MOTH_BEGIN_INSTR(ConstructGlobalLookup)
- TRACE(inline, "property name = %s, args = %d, argc = %d", runtimeStrings[instr.name]->toQString().toUtf8().constData(), instr.args, instr.argc);
Q_ASSERT(instr.callData + instr.argc + qOffsetOf(QV4::CallData, args)/sizeof(QV4::Value) <= stackSize);
QV4::CallData *callData = reinterpret_cast<QV4::CallData *>(stack + instr.callData);
callData->tag = QV4::Value::Integer_Type;
callData->argc = instr.argc;
callData->thisObject = QV4::Primitive::undefinedValue();
- STOREVALUE(instr.result, Runtime::constructGlobalLookup(context, instr.index, callData));
+ STOREVALUE(instr.result, Runtime::constructGlobalLookup(engine, instr.index, callData));
MOTH_END_INSTR(ConstructGlobalLookup)
MOTH_BEGIN_INSTR(Jump)
- code = ((uchar *)&instr.offset) + instr.offset;
+ code = ((const uchar *)&instr.offset) + instr.offset;
MOTH_END_INSTR(Jump)
MOTH_BEGIN_INSTR(JumpEq)
bool cond = VALUEPTR(instr.condition)->toBoolean();
TRACE(condition, "%s", cond ? "TRUE" : "FALSE");
if (cond)
- code = ((uchar *)&instr.offset) + instr.offset;
+ code = ((const uchar *)&instr.offset) + instr.offset;
MOTH_END_INSTR(JumpEq)
MOTH_BEGIN_INSTR(JumpNe)
bool cond = VALUEPTR(instr.condition)->toBoolean();
TRACE(condition, "%s", cond ? "TRUE" : "FALSE");
if (!cond)
- code = ((uchar *)&instr.offset) + instr.offset;
+ code = ((const uchar *)&instr.offset) + instr.offset;
MOTH_END_INSTR(JumpNe)
MOTH_BEGIN_INSTR(UNot)
- STOREVALUE(instr.result, Runtime::uNot(VALUEPTR(instr.source)));
+ STOREVALUE(instr.result, Runtime::uNot(VALUE(instr.source)));
MOTH_END_INSTR(UNot)
MOTH_BEGIN_INSTR(UNotBool)
@@ -564,15 +754,15 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(UNotBool)
MOTH_BEGIN_INSTR(UPlus)
- STOREVALUE(instr.result, Runtime::uPlus(VALUEPTR(instr.source)));
+ STOREVALUE(instr.result, Runtime::uPlus(VALUE(instr.source)));
MOTH_END_INSTR(UPlus)
MOTH_BEGIN_INSTR(UMinus)
- STOREVALUE(instr.result, Runtime::uMinus(VALUEPTR(instr.source)));
+ STOREVALUE(instr.result, Runtime::uMinus(VALUE(instr.source)));
MOTH_END_INSTR(UMinus)
MOTH_BEGIN_INSTR(UCompl)
- STOREVALUE(instr.result, Runtime::complement(VALUEPTR(instr.source)));
+ STOREVALUE(instr.result, Runtime::complement(VALUE(instr.source)));
MOTH_END_INSTR(UCompl)
MOTH_BEGIN_INSTR(UComplInt)
@@ -580,31 +770,31 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(UComplInt)
MOTH_BEGIN_INSTR(Increment)
- STOREVALUE(instr.result, Runtime::increment(VALUEPTR(instr.source)));
+ STOREVALUE(instr.result, Runtime::increment(VALUE(instr.source)));
MOTH_END_INSTR(Increment)
MOTH_BEGIN_INSTR(Decrement)
- STOREVALUE(instr.result, Runtime::decrement(VALUEPTR(instr.source)));
+ STOREVALUE(instr.result, Runtime::decrement(VALUE(instr.source)));
MOTH_END_INSTR(Decrement)
MOTH_BEGIN_INSTR(Binop)
- STOREVALUE(instr.result, instr.alu(VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
+ STOREVALUE(instr.result, instr.alu(VALUE(instr.lhs), VALUE(instr.rhs)));
MOTH_END_INSTR(Binop)
MOTH_BEGIN_INSTR(Add)
- STOREVALUE(instr.result, Runtime::add(context, VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
+ STOREVALUE(instr.result, Runtime::add(engine, VALUE(instr.lhs), VALUE(instr.rhs)));
MOTH_END_INSTR(Add)
MOTH_BEGIN_INSTR(BitAnd)
- STOREVALUE(instr.result, Runtime::bitAnd(VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
+ STOREVALUE(instr.result, Runtime::bitAnd(VALUE(instr.lhs), VALUE(instr.rhs)));
MOTH_END_INSTR(BitAnd)
MOTH_BEGIN_INSTR(BitOr)
- STOREVALUE(instr.result, Runtime::bitOr(VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
+ STOREVALUE(instr.result, Runtime::bitOr(VALUE(instr.lhs), VALUE(instr.rhs)));
MOTH_END_INSTR(BitOr)
MOTH_BEGIN_INSTR(BitXor)
- STOREVALUE(instr.result, Runtime::bitXor(VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
+ STOREVALUE(instr.result, Runtime::bitXor(VALUE(instr.lhs), VALUE(instr.rhs)));
MOTH_END_INSTR(BitXor)
MOTH_BEGIN_INSTR(Shr)
@@ -639,56 +829,59 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
MOTH_END_INSTR(ShlConst)
MOTH_BEGIN_INSTR(Mul)
- STOREVALUE(instr.result, Runtime::mul(VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
+ STOREVALUE(instr.result, Runtime::mul(VALUE(instr.lhs), VALUE(instr.rhs)));
MOTH_END_INSTR(Mul)
MOTH_BEGIN_INSTR(Sub)
- STOREVALUE(instr.result, Runtime::sub(VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
+ STOREVALUE(instr.result, Runtime::sub(VALUE(instr.lhs), VALUE(instr.rhs)));
MOTH_END_INSTR(Sub)
MOTH_BEGIN_INSTR(BinopContext)
- STOREVALUE(instr.result, instr.alu(context, VALUEPTR(instr.lhs), VALUEPTR(instr.rhs)));
+ STOREVALUE(instr.result, instr.alu(engine, VALUE(instr.lhs), VALUE(instr.rhs)));
MOTH_END_INSTR(BinopContext)
MOTH_BEGIN_INSTR(Ret)
- context->engine()->stackPop(stackSize);
// TRACE(Ret, "returning value %s", result.toString(context)->toQString().toUtf8().constData());
return VALUE(instr.result).asReturnedValue();
MOTH_END_INSTR(Ret)
MOTH_BEGIN_INSTR(Debug)
- context->d()->lineNumber = instr.lineNumber;
+ engine->currentContext()->lineNumber = instr.lineNumber;
QV4::Debugging::Debugger *debugger = context->engine()->debugger;
if (debugger && debugger->pauseAtNextOpportunity())
debugger->maybeBreakAtInstruction();
+ if (qt_v4IsDebugging)
+ qt_v4CheckForBreak(context, scopes, scopeDepth);
MOTH_END_INSTR(Debug)
MOTH_BEGIN_INSTR(Line)
- context->d()->lineNumber = instr.lineNumber;
+ engine->currentContext()->lineNumber = instr.lineNumber;
+ if (qt_v4IsDebugging)
+ qt_v4CheckForBreak(context, scopes, scopeDepth);
MOTH_END_INSTR(Debug)
MOTH_BEGIN_INSTR(LoadThis)
- VALUE(instr.result) = context->d()->callData->thisObject;
+ VALUE(instr.result) = context->thisObject();
MOTH_END_INSTR(LoadThis)
MOTH_BEGIN_INSTR(LoadQmlIdArray)
- VALUE(instr.result) = Runtime::getQmlIdArray(static_cast<QV4::NoThrowContext*>(context));
+ VALUE(instr.result) = Runtime::getQmlIdArray(static_cast<QV4::NoThrowEngine*>(engine));
MOTH_END_INSTR(LoadQmlIdArray)
MOTH_BEGIN_INSTR(LoadQmlImportedScripts)
- VALUE(instr.result) = Runtime::getQmlImportedScripts(static_cast<QV4::NoThrowContext*>(context));
+ VALUE(instr.result) = Runtime::getQmlImportedScripts(static_cast<QV4::NoThrowEngine*>(engine));
MOTH_END_INSTR(LoadQmlImportedScripts)
MOTH_BEGIN_INSTR(LoadQmlContextObject)
- VALUE(instr.result) = Runtime::getQmlContextObject(static_cast<QV4::NoThrowContext*>(context));
+ VALUE(instr.result) = Runtime::getQmlContextObject(static_cast<QV4::NoThrowEngine*>(engine));
MOTH_END_INSTR(LoadContextObject)
MOTH_BEGIN_INSTR(LoadQmlScopeObject)
- VALUE(instr.result) = Runtime::getQmlScopeObject(static_cast<QV4::NoThrowContext*>(context));
+ VALUE(instr.result) = Runtime::getQmlScopeObject(static_cast<QV4::NoThrowEngine*>(engine));
MOTH_END_INSTR(LoadScopeObject)
MOTH_BEGIN_INSTR(LoadQmlSingleton)
- VALUE(instr.result) = Runtime::getQmlSingleton(static_cast<QV4::NoThrowContext*>(context), runtimeStrings[instr.name]);
+ VALUE(instr.result) = Runtime::getQmlSingleton(static_cast<QV4::NoThrowEngine*>(engine), instr.name);
MOTH_END_INSTR(LoadQmlSingleton)
#ifdef MOTH_THREADED_INTERPRETER
@@ -703,10 +896,8 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code
Q_ASSERT(false);
catchException:
Q_ASSERT(context->engine()->hasException);
- if (!exceptionHandler) {
- context->engine()->stackPop(stackSize);
+ if (!exceptionHandler)
return QV4::Encode::undefined();
- }
code = exceptionHandler;
}
@@ -725,13 +916,13 @@ void **VME::instructionJumpTable()
}
#endif
-QV4::ReturnedValue VME::exec(QV4::ExecutionContext *ctxt, const uchar *code)
+QV4::ReturnedValue VME::exec(ExecutionEngine *engine, const uchar *code)
{
VME vme;
- QV4::Debugging::Debugger *debugger = ctxt->engine()->debugger;
+ QV4::Debugging::Debugger *debugger = engine->debugger;
if (debugger)
debugger->enteringFunction();
- QV4::ReturnedValue retVal = vme.run(ctxt, code);
+ QV4::ReturnedValue retVal = vme.run(engine, code);
if (debugger)
debugger->leavingFunction(retVal);
return retVal;
diff --git a/src/qml/jsruntime/qv4vme_moth_p.h b/src/qml/jsruntime/qv4vme_moth_p.h
index 731fb0f9a9..55cac75a66 100644
--- a/src/qml/jsruntime/qv4vme_moth_p.h
+++ b/src/qml/jsruntime/qv4vme_moth_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -45,14 +45,14 @@ namespace Moth {
class VME
{
public:
- static QV4::ReturnedValue exec(QV4::ExecutionContext *, const uchar *);
+ static QV4::ReturnedValue exec(QV4::ExecutionEngine *, const uchar *);
#ifdef MOTH_THREADED_INTERPRETER
static void **instructionJumpTable();
#endif
private:
- QV4::ReturnedValue run(QV4::ExecutionContext *, const uchar *code
+ QV4::ReturnedValue run(QV4::ExecutionEngine *, const uchar *code
#ifdef MOTH_THREADED_INTERPRETER
, void ***storeJumpTable = 0
#endif
diff --git a/src/qml/parser/qqmljs.g b/src/qml/parser/qqmljs.g
index 616e3b3166..71b6978983 100644
--- a/src/qml/parser/qqmljs.g
+++ b/src/qml/parser/qqmljs.g
@@ -1,7 +1,7 @@
----------------------------------------------------------------------------
--
--- Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
--- Contact: http://www.qt-project.org/legal
+-- Copyright (C) 2015 The Qt Company Ltd.
+-- Contact: http://www.qt.io/licensing/
--
-- This file is part of the QtQml module of the Qt Toolkit.
--
@@ -10,9 +10,9 @@
-- Licensees holding valid commercial Qt licenses may use this file in
-- accordance with the commercial license agreement provided with the
-- Software or, alternatively, in accordance with the terms contained in
--- a written agreement between you and Digia. For licensing terms and
--- conditions see http://qt.digia.com/licensing. For further information
--- use the contact form at http://qt.digia.com/contact-us.
+-- a written agreement between you and The Qt Company. For licensing terms
+-- and conditions see http://www.qt.io/terms-conditions. For further
+-- information use the contact form at http://www.qt.io/contact-us.
--
-- GNU Lesser General Public License Usage
-- Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
-- requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-- http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
--
--- In addition, as a special exception, Digia gives you certain additional
--- rights. These rights are described in the Digia Qt LGPL Exception
+-- As a special exception, The Qt Company gives you certain additional
+-- rights. These rights are described in The Qt Company LGPL Exception
-- version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
--
-- $QT_END_LICENSE$
@@ -99,8 +99,8 @@
/./****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -109,9 +109,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -122,8 +122,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -144,8 +144,8 @@
/:/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -154,9 +154,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -167,8 +167,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -3055,9 +3055,9 @@ PropertyAssignmentListOpt: PropertyAssignmentList ;
QString msg;
int token = token_buffer[0].token;
if (token < 0 || token >= TERMINAL_COUNT)
- msg = qApp->translate("QQmlParser", "Syntax error");
+ msg = QCoreApplication::translate("QQmlParser", "Syntax error");
else
- msg = qApp->translate("QQmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token]));
+ msg = QCoreApplication::translate("QQmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
action = errorState;
@@ -3085,7 +3085,7 @@ PropertyAssignmentListOpt: PropertyAssignmentList ;
for (int *tk = tokens; *tk != EOF_SYMBOL; ++tk) {
int a = t_action(errorState, *tk);
if (a > 0 && t_action(a, yytoken)) {
- const QString msg = qApp->translate("QQmlParser", "Expected token `%1'").arg(QLatin1String(spell[*tk]));
+ const QString msg = QCoreApplication::translate("QQmlParser", "Expected token `%1'").arg(QLatin1String(spell[*tk]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
yytoken = *tk;
@@ -3109,7 +3109,7 @@ PropertyAssignmentListOpt: PropertyAssignmentList ;
int a = t_action(errorState, tk);
if (a > 0 && t_action(a, yytoken)) {
- const QString msg = qApp->translate("QQmlParser", "Expected token `%1'").arg(QLatin1String(spell[tk]));
+ const QString msg = QCoreApplication::translate("QQmlParser", "Expected token `%1'").arg(QLatin1String(spell[tk]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
yytoken = tk;
@@ -3122,7 +3122,7 @@ PropertyAssignmentListOpt: PropertyAssignmentList ;
}
}
- const QString msg = qApp->translate("QQmlParser", "Syntax error");
+ const QString msg = QCoreApplication::translate("QQmlParser", "Syntax error");
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
}
diff --git a/src/qml/parser/qqmljsast.cpp b/src/qml/parser/qqmljsast.cpp
index e18a7ca76a..a834399ae5 100644
--- a/src/qml/parser/qqmljsast.cpp
+++ b/src/qml/parser/qqmljsast.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/parser/qqmljsast_p.h b/src/qml/parser/qqmljsast_p.h
index c015f0484a..fa6b5d2488 100644
--- a/src/qml/parser/qqmljsast_p.h
+++ b/src/qml/parser/qqmljsast_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/parser/qqmljsastfwd_p.h b/src/qml/parser/qqmljsastfwd_p.h
index a735727404..eae4125ab2 100644
--- a/src/qml/parser/qqmljsastfwd_p.h
+++ b/src/qml/parser/qqmljsastfwd_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/parser/qqmljsastvisitor.cpp b/src/qml/parser/qqmljsastvisitor.cpp
index f0f8f928c6..4ba8b24940 100644
--- a/src/qml/parser/qqmljsastvisitor.cpp
+++ b/src/qml/parser/qqmljsastvisitor.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/parser/qqmljsastvisitor_p.h b/src/qml/parser/qqmljsastvisitor_p.h
index 52221c7bd8..4e15b453f3 100644
--- a/src/qml/parser/qqmljsastvisitor_p.h
+++ b/src/qml/parser/qqmljsastvisitor_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/parser/qqmljsengine_p.cpp b/src/qml/parser/qqmljsengine_p.cpp
index 7ac5dbc9bb..1c0a70a372 100644
--- a/src/qml/parser/qqmljsengine_p.cpp
+++ b/src/qml/parser/qqmljsengine_p.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -114,7 +114,7 @@ double integerFromString(const QString &str, int radix)
Engine::Engine()
- : _lexer(0)
+ : _lexer(0), _directives(0)
{ }
Engine::~Engine()
@@ -135,6 +135,12 @@ Lexer *Engine::lexer() const
void Engine::setLexer(Lexer *lexer)
{ _lexer = lexer; }
+Directives *Engine::directives() const
+{ return _directives; }
+
+void Engine::setDirectives(Directives *directives)
+{ _directives = directives; }
+
MemoryPool *Engine::pool()
{ return &_pool; }
diff --git a/src/qml/parser/qqmljsengine_p.h b/src/qml/parser/qqmljsengine_p.h
index 661681d19c..fb65d7f028 100644
--- a/src/qml/parser/qqmljsengine_p.h
+++ b/src/qml/parser/qqmljsengine_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -57,6 +57,7 @@ QT_QML_BEGIN_NAMESPACE
namespace QQmlJS {
class Lexer;
+class Directives;
class MemoryPool;
class QML_PARSER_EXPORT DiagnosticMessage
@@ -84,6 +85,7 @@ public:
class QML_PARSER_EXPORT Engine
{
Lexer *_lexer;
+ Directives *_directives;
MemoryPool _pool;
QList<AST::SourceLocation> _comments;
QString _extraCode;
@@ -102,6 +104,9 @@ public:
Lexer *lexer() const;
void setLexer(Lexer *lexer);
+ Directives *directives() const;
+ void setDirectives(Directives *directives);
+
MemoryPool *pool();
inline QStringRef midRef(int position, int size) { return _code.midRef(position, size); }
diff --git a/src/qml/parser/qqmljsglobal_p.h b/src/qml/parser/qqmljsglobal_p.h
index ba2daf5150..fe2cbe7d1d 100644
--- a/src/qml/parser/qqmljsglobal_p.h
+++ b/src/qml/parser/qqmljsglobal_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/parser/qqmljsgrammar.cpp b/src/qml/parser/qqmljsgrammar.cpp
index 2600a5e14c..609c490d06 100644
--- a/src/qml/parser/qqmljsgrammar.cpp
+++ b/src/qml/parser/qqmljsgrammar.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/parser/qqmljsgrammar_p.h b/src/qml/parser/qqmljsgrammar_p.h
index 7a369be194..667cae07e9 100644
--- a/src/qml/parser/qqmljsgrammar_p.h
+++ b/src/qml/parser/qqmljsgrammar_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/parser/qqmljskeywords_p.h b/src/qml/parser/qqmljskeywords_p.h
index b8fe50086d..f7368b94d6 100644
--- a/src/qml/parser/qqmljskeywords_p.h
+++ b/src/qml/parser/qqmljskeywords_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/parser/qqmljslexer.cpp b/src/qml/parser/qqmljslexer.cpp
index 416a6ee745..5e8ea049ed 100644
--- a/src/qml/parser/qqmljslexer.cpp
+++ b/src/qml/parser/qqmljslexer.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -887,8 +887,7 @@ again:
int Lexer::scanNumber(QChar ch)
{
if (ch != QLatin1Char('0')) {
- QByteArray buf;
- buf.reserve(64);
+ QVarLengthArray<char, 64> buf;
buf += ch.toLatin1();
QChar n = _char;
@@ -1225,12 +1224,60 @@ bool Lexer::canInsertAutomaticSemicolon(int token) const
|| _followsClosingBrace;
}
-bool Lexer::scanDirectives(Directives *directives)
+static const int uriTokens[] = {
+ QQmlJSGrammar::T_IDENTIFIER,
+ QQmlJSGrammar::T_PROPERTY,
+ QQmlJSGrammar::T_SIGNAL,
+ QQmlJSGrammar::T_READONLY,
+ QQmlJSGrammar::T_ON,
+ QQmlJSGrammar::T_BREAK,
+ QQmlJSGrammar::T_CASE,
+ QQmlJSGrammar::T_CATCH,
+ QQmlJSGrammar::T_CONTINUE,
+ QQmlJSGrammar::T_DEFAULT,
+ QQmlJSGrammar::T_DELETE,
+ QQmlJSGrammar::T_DO,
+ QQmlJSGrammar::T_ELSE,
+ QQmlJSGrammar::T_FALSE,
+ QQmlJSGrammar::T_FINALLY,
+ QQmlJSGrammar::T_FOR,
+ QQmlJSGrammar::T_FUNCTION,
+ QQmlJSGrammar::T_IF,
+ QQmlJSGrammar::T_IN,
+ QQmlJSGrammar::T_INSTANCEOF,
+ QQmlJSGrammar::T_NEW,
+ QQmlJSGrammar::T_NULL,
+ QQmlJSGrammar::T_RETURN,
+ QQmlJSGrammar::T_SWITCH,
+ QQmlJSGrammar::T_THIS,
+ QQmlJSGrammar::T_THROW,
+ QQmlJSGrammar::T_TRUE,
+ QQmlJSGrammar::T_TRY,
+ QQmlJSGrammar::T_TYPEOF,
+ QQmlJSGrammar::T_VAR,
+ QQmlJSGrammar::T_VOID,
+ QQmlJSGrammar::T_WHILE,
+ QQmlJSGrammar::T_CONST,
+ QQmlJSGrammar::T_DEBUGGER,
+ QQmlJSGrammar::T_RESERVED_WORD,
+ QQmlJSGrammar::T_WITH,
+
+ QQmlJSGrammar::EOF_SYMBOL
+};
+static inline bool isUriToken(int token)
{
- if (_qmlMode) {
- // the directives are a Javascript-only extension.
- return false;
+ const int *current = uriTokens;
+ while (*current != QQmlJSGrammar::EOF_SYMBOL) {
+ if (*current == token)
+ return true;
+ ++current;
}
+ return false;
+}
+
+bool Lexer::scanDirectives(Directives *directives, DiagnosticMessage *error)
+{
+ Q_ASSERT(!_qmlMode);
lex(); // fetch the first token
@@ -1238,24 +1285,33 @@ bool Lexer::scanDirectives(Directives *directives)
return true;
do {
- lex(); // skip T_DOT
-
const int lineNumber = tokenStartLine();
+ const int column = tokenStartColumn();
+
+ lex(); // skip T_DOT
if (! (_tokenKind == T_IDENTIFIER || _tokenKind == T_RESERVED_WORD))
- return false; // expected a valid QML/JS directive
+ return true; // expected a valid QML/JS directive
const QString directiveName = tokenText();
if (! (directiveName == QLatin1String("pragma") ||
- directiveName == QLatin1String("import")))
+ directiveName == QLatin1String("import"))) {
+ error->message = QCoreApplication::translate("QQmlParser", "Syntax error");
+ error->loc.startLine = tokenStartLine();
+ error->loc.startColumn = tokenStartColumn();
return false; // not a valid directive name
+ }
// it must be a pragma or an import directive.
if (directiveName == QLatin1String("pragma")) {
// .pragma library
- if (! (lex() == T_IDENTIFIER && tokenText() == QLatin1String("library")))
+ if (! (lex() == T_IDENTIFIER && tokenText() == QLatin1String("library"))) {
+ error->message = QCoreApplication::translate("QQmlParser", "Syntax error");
+ error->loc.startLine = tokenStartLine();
+ error->loc.startColumn = tokenStartColumn();
return false; // expected `library
+ }
// we found a .pragma library directive
directives->pragmaLibrary();
@@ -1274,22 +1330,53 @@ bool Lexer::scanDirectives(Directives *directives)
fileImport = true;
pathOrUri = tokenText();
+ if (!pathOrUri.endsWith(QLatin1String("js"))) {
+ error->message = QCoreApplication::translate("QQmlParser","Imported file must be a script");
+ error->loc.startLine = tokenStartLine();
+ error->loc.startColumn = tokenStartColumn();
+ return false;
+ }
+
} else if (_tokenKind == T_IDENTIFIER) {
// .import T_IDENTIFIER (. T_IDENTIFIER)* T_NUMERIC_LITERAL as T_IDENTIFIER
- pathOrUri = tokenText();
+ while (true) {
+ if (!isUriToken(_tokenKind)) {
+ error->message = QCoreApplication::translate("QQmlParser","Invalid module URI");
+ error->loc.startLine = tokenStartLine();
+ error->loc.startColumn = tokenStartColumn();
+ return false;
+ }
- lex(); // skip the first T_IDENTIFIER
- for (; _tokenKind == T_DOT; lex()) {
- if (lex() != T_IDENTIFIER)
+ pathOrUri.append(tokenText());
+
+ lex();
+ if (tokenStartLine() != lineNumber) {
+ error->message = QCoreApplication::translate("QQmlParser","Invalid module URI");
+ error->loc.startLine = tokenStartLine();
+ error->loc.startColumn = tokenStartColumn();
return false;
+ }
+ if (_tokenKind != QQmlJSGrammar::T_DOT)
+ break;
+
+ pathOrUri.append(QLatin1Char('.'));
- pathOrUri += QLatin1Char('.');
- pathOrUri += tokenText();
+ lex();
+ if (tokenStartLine() != lineNumber) {
+ error->message = QCoreApplication::translate("QQmlParser","Invalid module URI");
+ error->loc.startLine = tokenStartLine();
+ error->loc.startColumn = tokenStartColumn();
+ return false;
+ }
}
- if (_tokenKind != T_NUMERIC_LITERAL)
+ if (_tokenKind != T_NUMERIC_LITERAL) {
+ error->message = QCoreApplication::translate("QQmlParser","Module import requires a version");
+ error->loc.startLine = tokenStartLine();
+ error->loc.startColumn = tokenStartColumn();
return false; // expected the module version number
+ }
version = tokenText();
}
@@ -1297,22 +1384,51 @@ bool Lexer::scanDirectives(Directives *directives)
//
// recognize the mandatory `as' followed by the module name
//
- if (! (lex() == T_IDENTIFIER && tokenText() == QLatin1String("as")))
+ if (! (lex() == T_IDENTIFIER && tokenText() == QLatin1String("as") && tokenStartLine() == lineNumber)) {
+ if (fileImport)
+ error->message = QCoreApplication::translate("QQmlParser", "File import requires a qualifier");
+ else
+ error->message = QCoreApplication::translate("QQmlParser", "Module import requires a qualifier");
+ if (tokenStartLine() != lineNumber) {
+ error->loc.startLine = lineNumber;
+ error->loc.startColumn = column;
+ } else {
+ error->loc.startLine = tokenStartLine();
+ error->loc.startColumn = tokenStartColumn();
+ }
return false; // expected `as'
+ }
- if (lex() != T_IDENTIFIER)
+ if (lex() != T_IDENTIFIER || tokenStartLine() != lineNumber) {
+ if (fileImport)
+ error->message = QCoreApplication::translate("QQmlParser", "File import requires a qualifier");
+ else
+ error->message = QCoreApplication::translate("QQmlParser", "Module import requires a qualifier");
+ error->loc.startLine = tokenStartLine();
+ error->loc.startColumn = tokenStartColumn();
return false; // expected module name
+ }
const QString module = tokenText();
+ if (!module.at(0).isUpper()) {
+ error->message = QCoreApplication::translate("QQmlParser","Invalid import qualifier");
+ error->loc.startLine = tokenStartLine();
+ error->loc.startColumn = tokenStartColumn();
+ return false;
+ }
if (fileImport)
- directives->importFile(pathOrUri, module);
+ directives->importFile(pathOrUri, module, lineNumber, column);
else
- directives->importModule(pathOrUri, version, module);
+ directives->importModule(pathOrUri, version, module, lineNumber, column);
}
- if (tokenStartLine() != lineNumber)
+ if (tokenStartLine() != lineNumber) {
+ error->message = QCoreApplication::translate("QQmlParser", "Syntax error");
+ error->loc.startLine = tokenStartLine();
+ error->loc.startColumn = tokenStartColumn();
return false; // the directives cannot span over multiple lines
+ }
// fetch the first token after the .pragma/.import directive
lex();
diff --git a/src/qml/parser/qqmljslexer_p.h b/src/qml/parser/qqmljslexer_p.h
index 9106c94477..427affe4b9 100644
--- a/src/qml/parser/qqmljslexer_p.h
+++ b/src/qml/parser/qqmljslexer_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -55,6 +55,7 @@ QT_QML_BEGIN_NAMESPACE
namespace QQmlJS {
class Engine;
+class DiagnosticMessage;
class QML_PARSER_EXPORT Directives {
public:
@@ -64,17 +65,21 @@ public:
{
}
- virtual void importFile(const QString &jsfile, const QString &module)
+ virtual void importFile(const QString &jsfile, const QString &module, int line, int column)
{
Q_UNUSED(jsfile);
Q_UNUSED(module);
+ Q_UNUSED(line);
+ Q_UNUSED(column);
}
- virtual void importModule(const QString &uri, const QString &version, const QString &module)
+ virtual void importModule(const QString &uri, const QString &version, const QString &module, int line, int column)
{
Q_UNUSED(uri);
Q_UNUSED(version);
Q_UNUSED(module);
+ Q_UNUSED(line);
+ Q_UNUSED(column);
}
};
@@ -146,7 +151,7 @@ public:
int lex();
bool scanRegExp(RegExpBodyPrefix prefix = NoPrefix);
- bool scanDirectives(Directives *directives);
+ bool scanDirectives(Directives *directives, DiagnosticMessage *error);
int regExpFlags() const { return _patternFlags; }
QString regExpPattern() const { return _tokenText; }
diff --git a/src/qml/parser/qqmljsmemorypool_p.h b/src/qml/parser/qqmljsmemorypool_p.h
index 293eaa025e..16927251c7 100644
--- a/src/qml/parser/qqmljsmemorypool_p.h
+++ b/src/qml/parser/qqmljsmemorypool_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/parser/qqmljsparser.cpp b/src/qml/parser/qqmljsparser.cpp
index 762e60c827..c1162f875c 100644
--- a/src/qml/parser/qqmljsparser.cpp
+++ b/src/qml/parser/qqmljsparser.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -161,7 +161,24 @@ bool Parser::parse(int startToken)
token_buffer[0].token = startToken;
first_token = &token_buffer[0];
- last_token = &token_buffer[1];
+ if (startToken == T_FEED_JS_PROGRAM && !lexer->qmlMode()) {
+ Directives ignoreDirectives;
+ Directives *directives = driver->directives();
+ if (!directives)
+ directives = &ignoreDirectives;
+ DiagnosticMessage error;
+ if (!lexer->scanDirectives(directives, &error)) {
+ diagnostic_messages.append(error);
+ return false;
+ }
+ token_buffer[1].token = lexer->tokenKind();
+ token_buffer[1].dval = lexer->tokenValue();
+ token_buffer[1].loc = location(lexer);
+ token_buffer[1].spell = lexer->tokenSpell();
+ last_token = &token_buffer[2];
+ } else {
+ last_token = &token_buffer[1];
+ }
tos = -1;
program = 0;
@@ -1790,7 +1807,7 @@ case 355: {
yylloc.startColumn += yylloc.length;
yylloc.length = 0;
- //const QString msg = qApp->translate("QQmlParser", "Missing `;'");
+ //const QString msg = QCoreApplication::translate("QQmlParser", "Missing `;'");
//diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, yylloc, msg));
first_token = &token_buffer[0];
@@ -1820,9 +1837,9 @@ case 355: {
QString msg;
int token = token_buffer[0].token;
if (token < 0 || token >= TERMINAL_COUNT)
- msg = qApp->translate("QQmlParser", "Syntax error");
+ msg = QCoreApplication::translate("QQmlParser", "Syntax error");
else
- msg = qApp->translate("QQmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token]));
+ msg = QCoreApplication::translate("QQmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
action = errorState;
@@ -1850,7 +1867,7 @@ case 355: {
for (int *tk = tokens; *tk != EOF_SYMBOL; ++tk) {
int a = t_action(errorState, *tk);
if (a > 0 && t_action(a, yytoken)) {
- const QString msg = qApp->translate("QQmlParser", "Expected token `%1'").arg(QLatin1String(spell[*tk]));
+ const QString msg = QCoreApplication::translate("QQmlParser", "Expected token `%1'").arg(QLatin1String(spell[*tk]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
yytoken = *tk;
@@ -1874,7 +1891,7 @@ case 355: {
int a = t_action(errorState, tk);
if (a > 0 && t_action(a, yytoken)) {
- const QString msg = qApp->translate("QQmlParser", "Expected token `%1'").arg(QLatin1String(spell[tk]));
+ const QString msg = QCoreApplication::translate("QQmlParser", "Expected token `%1'").arg(QLatin1String(spell[tk]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
yytoken = tk;
@@ -1887,7 +1904,7 @@ case 355: {
}
}
- const QString msg = qApp->translate("QQmlParser", "Syntax error");
+ const QString msg = QCoreApplication::translate("QQmlParser", "Syntax error");
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
}
diff --git a/src/qml/parser/qqmljsparser_p.h b/src/qml/parser/qqmljsparser_p.h
index cf9f641fbc..5042e47112 100644
--- a/src/qml/parser/qqmljsparser_p.h
+++ b/src/qml/parser/qqmljsparser_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/ftw/ftw.pri b/src/qml/qml/ftw/ftw.pri
index 00d56263c6..4b109107f9 100644
--- a/src/qml/qml/ftw/ftw.pri
+++ b/src/qml/qml/ftw/ftw.pri
@@ -13,16 +13,15 @@ HEADERS += \
$$PWD/qdeletewatcher_p.h \
$$PWD/qrecyclepool_p.h \
$$PWD/qflagpointer_p.h \
- $$PWD/qqmltrace_p.h \
$$PWD/qpointervaluepair_p.h \
$$PWD/qlazilyallocated_p.h \
+ $$PWD/qqmlnullablevalue_p.h \
SOURCES += \
$$PWD/qintrusivelist.cpp \
$$PWD/qhashedstring.cpp \
$$PWD/qqmlpool.cpp \
$$PWD/qqmlthread.cpp \
- $$PWD/qqmltrace.cpp \
# mirrors logic in $$QT_SOURCE_TREE/config.tests/unix/clock-gettime/clock-gettime.pri
# clock_gettime() is implemented in librt on these systems
diff --git a/src/qml/qml/ftw/qbitfield_p.h b/src/qml/qml/ftw/qbitfield_p.h
index 24546904e8..e3b6b0e498 100644
--- a/src/qml/qml/ftw/qbitfield_p.h
+++ b/src/qml/qml/ftw/qbitfield_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -129,15 +129,16 @@ QBitField QBitField::united(const QBitField &o)
rv.bits = max;
rv.ownData = new quint32[length + 1];
*(rv.ownData) = 1;
- rv.data = rv.ownData + 1;
+ quint32 *rvdata;
+ rv.data = rvdata = rv.ownData + 1;
if (bits > o.bits) {
- ::memcpy((quint32 *)rv.data, data, length * sizeof(quint32));
+ ::memcpy(rvdata, data, length * sizeof(quint32));
for (quint32 ii = 0; ii < (o.bits + quint32(31)) / 32; ++ii)
- ((quint32 *)rv.data)[ii] |= o.data[ii];
+ (rvdata)[ii] |= o.data[ii];
} else {
- ::memcpy((quint32 *)rv.data, o.data, length * sizeof(quint32));
+ ::memcpy(rvdata, o.data, length * sizeof(quint32));
for (quint32 ii = 0; ii < (bits + quint32(31)) / 32; ++ii)
- ((quint32 *)rv.data)[ii] |= data[ii];
+ (rvdata)[ii] |= data[ii];
}
return rv;
}
diff --git a/src/qml/qml/ftw/qdeletewatcher_p.h b/src/qml/qml/ftw/qdeletewatcher_p.h
index 59528888ec..12e63fed7f 100644
--- a/src/qml/qml/ftw/qdeletewatcher_p.h
+++ b/src/qml/qml/ftw/qdeletewatcher_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/ftw/qfieldlist_p.h b/src/qml/qml/ftw/qfieldlist_p.h
index 52c8b5d006..e9b0c495a3 100644
--- a/src/qml/qml/ftw/qfieldlist_p.h
+++ b/src/qml/qml/ftw/qfieldlist_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/ftw/qfinitestack_p.h b/src/qml/qml/ftw/qfinitestack_p.h
index 5fb1abaaa5..2286c00ace 100644
--- a/src/qml/qml/ftw/qfinitestack_p.h
+++ b/src/qml/qml/ftw/qfinitestack_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/ftw/qflagpointer_p.h b/src/qml/qml/ftw/qflagpointer_p.h
index 739e9dce4d..db84a23e8a 100644
--- a/src/qml/qml/ftw/qflagpointer_p.h
+++ b/src/qml/qml/ftw/qflagpointer_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/ftw/qhashedstring.cpp b/src/qml/qml/ftw/qhashedstring.cpp
index 8f5dd6b874..1a006a7fbd 100644
--- a/src/qml/qml/ftw/qhashedstring.cpp
+++ b/src/qml/qml/ftw/qhashedstring.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/ftw/qhashedstring_p.h b/src/qml/qml/ftw/qhashedstring_p.h
index 7a7786557e..d38fd668f3 100644
--- a/src/qml/qml/ftw/qhashedstring_p.h
+++ b/src/qml/qml/ftw/qhashedstring_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -224,8 +224,8 @@ public:
inline char *cStrData() const { return (char *)ckey; }
inline quint16 *utf16Data() const { return (quint16 *)strData->data(); }
- inline bool equals(const QV4::ValueRef string) const {
- QString s = string->toQStringNoThrow();
+ inline bool equals(const QV4::Value &string) const {
+ QString s = string.toQStringNoThrow();
if (isQString()) {
QStringDataPtr dd;
dd.ptr = strData;
@@ -252,14 +252,14 @@ public:
inline bool equals(const QHashedStringRef &string) const {
return length == string.length() &&
hash == string.hash() &&
- (isQString()?QHashedString::compare(string.constData(), (QChar *)utf16Data(), length):
+ (isQString()?QHashedString::compare(string.constData(), (const QChar *)utf16Data(), length):
QHashedString::compare(string.constData(), cStrData(), length));
}
inline bool equals(const QHashedCStringRef &string) const {
return length == string.length() &&
hash == string.hash() &&
- (isQString()?QHashedString::compare((QChar *)utf16Data(), string.constData(), length):
+ (isQString()?QHashedString::compare((const QChar *)utf16Data(), string.constData(), length):
QHashedString::compare(string.constData(), cStrData(), length));
}
};
diff --git a/src/qml/qml/ftw/qhashfield_p.h b/src/qml/qml/ftw/qhashfield_p.h
index 283a214baa..461cadfd98 100644
--- a/src/qml/qml/ftw/qhashfield_p.h
+++ b/src/qml/qml/ftw/qhashfield_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/ftw/qintrusivelist.cpp b/src/qml/qml/ftw/qintrusivelist.cpp
index 04cb9d75b7..c76b460e89 100644
--- a/src/qml/qml/ftw/qintrusivelist.cpp
+++ b/src/qml/qml/ftw/qintrusivelist.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/ftw/qintrusivelist_p.h b/src/qml/qml/ftw/qintrusivelist_p.h
index 527ecc8326..cc930f5a88 100644
--- a/src/qml/qml/ftw/qintrusivelist_p.h
+++ b/src/qml/qml/ftw/qintrusivelist_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/ftw/qlazilyallocated_p.h b/src/qml/qml/ftw/qlazilyallocated_p.h
index 09041d9abd..7ca88a1fd7 100644
--- a/src/qml/qml/ftw/qlazilyallocated_p.h
+++ b/src/qml/qml/ftw/qlazilyallocated_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/ftw/qpodvector_p.h b/src/qml/qml/ftw/qpodvector_p.h
index 38086f015c..0b0eb5acbb 100644
--- a/src/qml/qml/ftw/qpodvector_p.h
+++ b/src/qml/qml/ftw/qpodvector_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/ftw/qpointervaluepair_p.h b/src/qml/qml/ftw/qpointervaluepair_p.h
index 5b91d3b6d3..71c83ed34a 100644
--- a/src/qml/qml/ftw/qpointervaluepair_p.h
+++ b/src/qml/qml/ftw/qpointervaluepair_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlnullablevalue_p_p.h b/src/qml/qml/ftw/qqmlnullablevalue_p.h
index 5dcfe9273e..202c2b79d7 100644
--- a/src/qml/qml/qqmlnullablevalue_p_p.h
+++ b/src/qml/qml/ftw/qqmlnullablevalue_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/ftw/qqmlpool.cpp b/src/qml/qml/ftw/qqmlpool.cpp
index 5722c490cf..b86dcba107 100644
--- a/src/qml/qml/ftw/qqmlpool.cpp
+++ b/src/qml/qml/ftw/qqmlpool.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/ftw/qqmlpool_p.h b/src/qml/qml/ftw/qqmlpool_p.h
index a60efe19eb..4956cd81d8 100644
--- a/src/qml/qml/ftw/qqmlpool_p.h
+++ b/src/qml/qml/ftw/qqmlpool_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -45,7 +45,7 @@
// We mean it.
//
-#include <private/qtqmlglobal_p.h>
+#include <private/qv4global_p.h>
#include <QtCore/qstring.h>
#include <QtCore/qurl.h>
diff --git a/src/qml/qml/ftw/qqmlrefcount_p.h b/src/qml/qml/ftw/qqmlrefcount_p.h
index 3f1d252862..59ed77b580 100644
--- a/src/qml/qml/ftw/qqmlrefcount_p.h
+++ b/src/qml/qml/ftw/qqmlrefcount_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -47,7 +47,7 @@
#include <QtCore/qglobal.h>
#include <QtCore/qatomic.h>
-#include <private/qtqmlglobal_p.h>
+#include <private/qv4global_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/qml/qml/ftw/qqmlthread.cpp b/src/qml/qml/ftw/qqmlthread.cpp
index b3d7bddff7..4addcd9e58 100644
--- a/src/qml/qml/ftw/qqmlthread.cpp
+++ b/src/qml/qml/ftw/qqmlthread.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/ftw/qqmlthread_p.h b/src/qml/qml/ftw/qqmlthread_p.h
index 95d32d4fd2..86d7d2cf19 100644
--- a/src/qml/qml/ftw/qqmlthread_p.h
+++ b/src/qml/qml/ftw/qqmlthread_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/ftw/qqmltrace.cpp b/src/qml/qml/ftw/qqmltrace.cpp
deleted file mode 100644
index 104ff2e117..0000000000
--- a/src/qml/qml/ftw/qqmltrace.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qqmltrace_p.h"
-
-#ifdef QML_ENABLE_TRACE
-#include <stdio.h>
-#include <unistd.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-#ifdef QML_ENABLE_TRACE
-
-QQmlTrace::Pool QQmlTrace::logPool;
-QQmlTrace::Entry *QQmlTrace::first = 0;
-QQmlTrace::Entry *QQmlTrace::last = 0;
-
-static qint64 toNsecs(QQmlTrace::TimeType time)
-{
-#ifdef Q_OS_MAC
- static mach_timebase_info_data_t info = {0,0};
- if (info.denom == 0)
- mach_timebase_info(&info);
- return time * info.numer / info.denom;
-#else
- qint64 rv = time.tv_sec * 1000000000 + time.tv_nsec;
- return rv;
-#endif
-}
-
-QQmlTrace::Pool::Pool()
-{
- first = New<Entry>();
- last = first;
-}
-
-QQmlTrace::Pool::~Pool()
-{
- char buffer[128];
- sprintf(buffer, "qml.%d.log", ::getpid());
- FILE *out = fopen(buffer, "w");
- if (!out) {
- fprintf (stderr, "QML Log: Could not open %s\n", buffer);
- return;
- } else {
- fprintf (stderr, "QML Log: Writing log to %s\n", buffer);
- }
-
- QQmlTrace::Entry *cur = QQmlTrace::first;
- QByteArray indent;
- int depth = -1;
-
- qint64 firstTime = -1;
-
- while (cur) {
-
- switch (cur->type) {
- case QQmlTrace::Entry::RangeStart: {
- RangeStart *rs = static_cast<QQmlTrace::RangeStart *>(cur);
-
- qint64 nsecs = toNsecs(rs->time);
-
- if (firstTime == -1)
- firstTime = nsecs;
-
- nsecs -= firstTime;
-
- depth++;
- indent = QByteArray(depth * 4, ' ');
- fprintf(out, "%s%s @%lld (%lld ns)\n", indent.constData(),
- rs->description, nsecs, toNsecs(rs->end->time) - nsecs - firstTime);
- } break;
- case QQmlTrace::Entry::RangeEnd:
- depth--;
- indent = QByteArray(depth * 4, ' ');
- break;
- case QQmlTrace::Entry::Detail:
- fprintf(out, "%s %s\n", indent.constData(),
- static_cast<QQmlTrace::Detail *>(cur)->description);
- break;
- case QQmlTrace::Entry::IntDetail:
- fprintf(out, "%s %s: %d\n", indent.constData(),
- static_cast<QQmlTrace::Detail *>(cur)->description,
- static_cast<QQmlTrace::IntDetail *>(cur)->value);
- break;
- case QQmlTrace::Entry::StringDetail: {
- QByteArray vLatin1 = static_cast<QQmlTrace::StringDetail *>(cur)->value->toLatin1();
- fprintf(out, "%s %s: %s\n", indent.constData(),
- static_cast<QQmlTrace::Detail *>(cur)->description,
- vLatin1.constData());
- } break;
- case QQmlTrace::Entry::UrlDetail: {
- QByteArray vLatin1 = static_cast<QQmlTrace::UrlDetail *>(cur)->value->toString().toLatin1();
- fprintf(out, "%s %s: %s\n", indent.constData(),
- static_cast<QQmlTrace::Detail *>(cur)->description,
- vLatin1.constData());
- } break;
- case QQmlTrace::Entry::Event: {
- Event *ev = static_cast<QQmlTrace::Event *>(cur);
- qint64 nsecs = toNsecs(ev->time) - firstTime;
- fprintf(out, "%s + %s @%lld +%lld ns\n", indent.constData(),
- ev->description, nsecs, nsecs - (toNsecs(ev->start->time) - firstTime));
- } break;
- case QQmlTrace::Entry::Null:
- default:
- break;
- }
- cur = cur->next;
- }
- fclose(out);
-}
-
-#endif
-
-QT_END_NAMESPACE
-
diff --git a/src/qml/qml/ftw/qqmltrace_p.h b/src/qml/qml/ftw/qqmltrace_p.h
deleted file mode 100644
index 19e81965dd..0000000000
--- a/src/qml/qml/ftw/qqmltrace_p.h
+++ /dev/null
@@ -1,286 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQMLTRACE_P_H
-#define QQMLTRACE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qglobal.h>
-#include <private/qqmlpool_p.h>
-
-// #define QML_ENABLE_TRACE
-
-#if defined(QML_ENABLE_TRACE) && defined(Q_OS_MAC)
-#include <mach/mach_time.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-class QUrl;
-class QQmlTrace
-{
-public:
- inline QQmlTrace(const char *desc);
- inline ~QQmlTrace();
-
- inline void addDetail(const char *);
- inline void addDetail(const char *, int);
- inline void addDetail(const char *, const QString &);
- inline void addDetail(const char *, const QUrl &);
-
- inline void event(const char *desc);
-
-#ifdef QML_ENABLE_TRACE
-
-#ifdef Q_OS_MAC
- typedef uint64_t TimeType;
-#else
- typedef timespec TimeType;
-#endif
-
- struct Entry : public QQmlPool::POD {
- enum Type { Null, RangeStart, RangeEnd, Detail, IntDetail, StringDetail, UrlDetail, Event };
- inline Entry();
- inline Entry(Type);
- Type type;
- Entry *next;
- };
- struct RangeEnd : public Entry {
- inline RangeEnd();
- TimeType time;
- };
- struct RangeStart : public Entry {
- inline RangeStart();
- const char *description;
- TimeType time;
- QQmlTrace::RangeEnd *end;
- };
- struct Detail : public Entry {
- inline Detail();
- inline Detail(Type t);
- const char *description;
- };
- struct IntDetail : public Detail {
- inline IntDetail();
- int value;
- };
- struct StringDetail : public Detail {
- inline StringDetail();
- QString *value;
- };
- struct UrlDetail : public Detail {
- inline UrlDetail();
- QUrl *value;
- };
- struct Event : public Entry {
- inline Event();
- const char *description;
- TimeType time;
- QQmlTrace::RangeStart *start;
- };
-
- struct Pool : public QQmlPool {
- Pool();
- ~Pool();
- };
-
- static Pool logPool;
- static Entry *first;
- static Entry *last;
-
-private:
- RangeStart *start;
-
- static TimeType gettime() {
-#ifdef Q_OS_MAC
- return mach_absolute_time();
-#else
- TimeType ts;
- clock_gettime(CLOCK_MONOTONIC, &ts);
- return ts;
-#endif
- }
-#endif
-};
-
-#ifdef QML_ENABLE_TRACE
-QQmlTrace::Entry::Entry()
-: type(Null), next(0)
-{
-}
-
-QQmlTrace::Entry::Entry(Type type)
-: type(type), next(0)
-{
- QQmlTrace::last->next = this;
- QQmlTrace::last = this;
-}
-
-QQmlTrace::RangeEnd::RangeEnd()
-: QQmlTrace::Entry(QQmlTrace::Entry::RangeEnd),
- time(gettime())
-{
-}
-
-QQmlTrace::RangeStart::RangeStart()
-: QQmlTrace::Entry(QQmlTrace::Entry::RangeStart),
- description(0), time(gettime())
-{
-}
-
-QQmlTrace::Detail::Detail()
-: QQmlTrace::Entry(QQmlTrace::Entry::Detail),
- description(0)
-{
-}
-
-QQmlTrace::Detail::Detail(Type type)
-: QQmlTrace::Entry(type), description(0)
-{
-}
-
-QQmlTrace::IntDetail::IntDetail()
-: QQmlTrace::Detail(QQmlTrace::Entry::IntDetail),
- value(0)
-{
-}
-
-QQmlTrace::StringDetail::StringDetail()
-: QQmlTrace::Detail(QQmlTrace::Entry::StringDetail),
- value(0)
-{
-}
-
-QQmlTrace::UrlDetail::UrlDetail()
-: QQmlTrace::Detail(QQmlTrace::Entry::UrlDetail),
- value(0)
-{
-}
-
-QQmlTrace::Event::Event()
-: QQmlTrace::Entry(QQmlTrace::Entry::Event),
- description(0), time(gettime()), start(0)
-{
-}
-#endif
-
-QQmlTrace::QQmlTrace(const char *desc)
-{
-#ifdef QML_ENABLE_TRACE
- RangeStart *e = logPool.New<RangeStart>();
- e->description = desc;
- e->end = 0;
- start = e;
-#else
- Q_UNUSED(desc);
-#endif
-}
-
-QQmlTrace::~QQmlTrace()
-{
-#ifdef QML_ENABLE_TRACE
- RangeEnd *e = logPool.New<RangeEnd>();
- start->end = e;
-#endif
-}
-
-void QQmlTrace::addDetail(const char *desc)
-{
-#ifdef QML_ENABLE_TRACE
- Detail *e = logPool.New<Detail>();
- e->description = desc;
-#else
- Q_UNUSED(desc);
-#endif
-}
-
-void QQmlTrace::addDetail(const char *desc, int v)
-{
-#ifdef QML_ENABLE_TRACE
- IntDetail *e = logPool.New<IntDetail>();
- e->description = desc;
- e->value = v;
-#else
- Q_UNUSED(desc);
- Q_UNUSED(v);
-#endif
-}
-
-void QQmlTrace::addDetail(const char *desc, const QString &v)
-{
-#ifdef QML_ENABLE_TRACE
- StringDetail *e = logPool.New<StringDetail>();
- e->description = desc;
- e->value = logPool.NewString(v);
-#else
- Q_UNUSED(desc);
- Q_UNUSED(v);
-#endif
-}
-
-void QQmlTrace::addDetail(const char *desc, const QUrl &v)
-{
-#ifdef QML_ENABLE_TRACE
- UrlDetail *e = logPool.New<UrlDetail>();
- e->description = desc;
- e->value = logPool.NewUrl(v);
-#else
- Q_UNUSED(desc);
- Q_UNUSED(v);
-#endif
-}
-
-void QQmlTrace::event(const char *desc)
-{
-#ifdef QML_ENABLE_TRACE
- Event *e = logPool.New<Event>();
- e->start = start;
- e->description = desc;
-#else
- Q_UNUSED(desc);
-#endif
-}
-
-QT_END_NAMESPACE
-
-#endif // QQMLTRACE_P_H
diff --git a/src/qml/qml/ftw/qrecursionwatcher_p.h b/src/qml/qml/ftw/qrecursionwatcher_p.h
index a8939d550f..0774e6c948 100644
--- a/src/qml/qml/ftw/qrecursionwatcher_p.h
+++ b/src/qml/qml/ftw/qrecursionwatcher_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/ftw/qrecyclepool_p.h b/src/qml/qml/ftw/qrecyclepool_p.h
index 45ea730225..f790ac8c53 100644
--- a/src/qml/qml/ftw/qrecyclepool_p.h
+++ b/src/qml/qml/ftw/qrecyclepool_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qml.pri b/src/qml/qml/qml.pri
index 013f757c90..e733bcec05 100644
--- a/src/qml/qml/qml.pri
+++ b/src/qml/qml/qml.pri
@@ -1,12 +1,4 @@
SOURCES += \
- $$PWD/qqmldirparser.cpp \
-
-HEADERS += \
- $$PWD/qqmldirparser_p.h \
-
-!qmldevtools_build {
-
-SOURCES += \
$$PWD/qqmlopenmetaobject.cpp \
$$PWD/qqmlvmemetaobject.cpp \
$$PWD/qqmlengine.cpp \
@@ -49,7 +41,6 @@ SOURCES += \
$$PWD/qqmlvaluetypeproxybinding.cpp \
$$PWD/qqmlglobal.cpp \
$$PWD/qqmlfile.cpp \
- $$PWD/qqmlbundle.cpp \
$$PWD/qqmlmemoryprofiler.cpp \
$$PWD/qqmlplatform.cpp \
$$PWD/qqmlbinding.cpp \
@@ -60,7 +51,8 @@ SOURCES += \
$$PWD/qqmlvaluetypewrapper.cpp \
$$PWD/qqmltypewrapper.cpp \
$$PWD/qqmlfileselector.cpp \
- $$PWD/qqmlobjectcreator.cpp
+ $$PWD/qqmlobjectcreator.cpp \
+ $$PWD/qqmldirparser.cpp
HEADERS += \
$$PWD/qqmlglobal_p.h \
@@ -112,7 +104,6 @@ HEADERS += \
$$PWD/qqmlextensioninterface.h \
$$PWD/qqmlimport_p.h \
$$PWD/qqmlextensionplugin.h \
- $$PWD/qqmlnullablevalue_p_p.h \
$$PWD/qqmlscriptstring_p.h \
$$PWD/qqmllocale_p.h \
$$PWD/qqmlcomponentattached_p.h \
@@ -121,7 +112,6 @@ HEADERS += \
$$PWD/qqmlabstractbinding_p.h \
$$PWD/qqmlvaluetypeproxybinding_p.h \
$$PWD/qqmlfile.h \
- $$PWD/qqmlbundle_p.h \
$$PWD/qqmlmemoryprofiler_p.h \
$$PWD/qqmlplatform_p.h \
$$PWD/qqmlbinding_p.h \
@@ -135,9 +125,8 @@ HEADERS += \
$$PWD/qqmltypewrapper_p.h \
$$PWD/qqmlfileselector_p.h \
$$PWD/qqmlfileselector.h \
- $$PWD/qqmlobjectcreator_p.h
+ $$PWD/qqmlobjectcreator_p.h \
+ $$PWD/qqmldirparser_p.h
include(ftw/ftw.pri)
include(v8/v8.pri)
-
-}
diff --git a/src/qml/qml/qqml.h b/src/qml/qml/qqml.h
index 77beb5722d..d6fd7b96f6 100644
--- a/src/qml/qml/qqml.h
+++ b/src/qml/qml/qqml.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlabstractbinding.cpp b/src/qml/qml/qqmlabstractbinding.cpp
index 71169abc98..40c8f451b4 100644
--- a/src/qml/qml/qqmlabstractbinding.cpp
+++ b/src/qml/qml/qqmlabstractbinding.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -75,15 +75,12 @@ void QQmlAbstractBinding::addToObject()
QObject *obj = object();
Q_ASSERT(obj);
- int index = propertyIndex();
-
QQmlData *data = QQmlData::get(obj, true);
- if (index & 0xFFFF0000) {
+ int coreIndex;
+ if (QQmlPropertyData::decodeValueTypePropertyIndex(propertyIndex(), &coreIndex) != -1) {
// Value type
- int coreIndex = index & 0x0000FFFF;
-
// Find the value type proxy (if there is one)
QQmlValueTypeProxyBinding *proxy = 0;
if (data->hasBindingBit(coreIndex)) {
@@ -110,7 +107,7 @@ void QQmlAbstractBinding::addToObject()
setNextBinding(data->bindings);
data->bindings = this;
- data->setBindingBit(obj, index);
+ data->setBindingBit(obj, coreIndex);
}
setAddedToObject(true);
@@ -123,16 +120,15 @@ void QQmlAbstractBinding::removeFromObject()
{
if (isAddedToObject()) {
QObject *obj = object();
- int index = propertyIndex();
-
QQmlData *data = QQmlData::get(obj, false);
Q_ASSERT(data);
- if (index & 0xFFFF0000) {
+ int coreIndex;
+ if (QQmlPropertyData::decodeValueTypePropertyIndex(propertyIndex(), &coreIndex) != -1) {
// Find the value type binding
QQmlAbstractBinding *vtbinding = data->bindings;
- while (vtbinding->propertyIndex() != (index & 0x0000FFFF)) {
+ while (vtbinding->propertyIndex() != coreIndex) {
vtbinding = vtbinding->nextBinding();
Q_ASSERT(vtbinding);
}
@@ -169,7 +165,7 @@ void QQmlAbstractBinding::removeFromObject()
binding->setNextBinding(nextBinding());
}
- data->clearBindingBit(index);
+ data->clearBindingBit(coreIndex);
}
setNextBinding(0);
diff --git a/src/qml/qml/qqmlabstractbinding_p.h b/src/qml/qml/qqmlabstractbinding_p.h
index 4015fc110c..b5d8181ca5 100644
--- a/src/qml/qml/qqmlabstractbinding_p.h
+++ b/src/qml/qml/qqmlabstractbinding_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlabstractexpression.cpp b/src/qml/qml/qqmlabstractexpression.cpp
index 0af143c78e..c55c86952c 100644
--- a/src/qml/qml/qqmlabstractexpression.cpp
+++ b/src/qml/qml/qqmlabstractexpression.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlabstractexpression_p.h b/src/qml/qml/qqmlabstractexpression_p.h
index 95181fd243..82ba010434 100644
--- a/src/qml/qml/qqmlabstractexpression_p.h
+++ b/src/qml/qml/qqmlabstractexpression_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlabstracturlinterceptor.cpp b/src/qml/qml/qqmlabstracturlinterceptor.cpp
index 761a5f265f..e64b33b181 100644
--- a/src/qml/qml/qqmlabstracturlinterceptor.cpp
+++ b/src/qml/qml/qqmlabstracturlinterceptor.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Research In Motion.
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlabstracturlinterceptor.h b/src/qml/qml/qqmlabstracturlinterceptor.h
index 2d22165959..fc6c29abb6 100644
--- a/src/qml/qml/qqmlabstracturlinterceptor.h
+++ b/src/qml/qml/qqmlabstracturlinterceptor.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Research In Motion.
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlaccessors.cpp b/src/qml/qml/qqmlaccessors.cpp
index c0f6471434..133822f3d9 100644
--- a/src/qml/qml/qqmlaccessors.cpp
+++ b/src/qml/qml/qqmlaccessors.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlaccessors_p.h b/src/qml/qml/qqmlaccessors_p.h
index 9eb727b984..24cd0b60cb 100644
--- a/src/qml/qml/qqmlaccessors_p.h
+++ b/src/qml/qml/qqmlaccessors_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlapplicationengine.cpp b/src/qml/qml/qqmlapplicationengine.cpp
index 240c01233b..b2bf1939b0 100644
--- a/src/qml/qml/qqmlapplicationengine.cpp
+++ b/src/qml/qml/qqmlapplicationengine.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Research In Motion.
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlapplicationengine.h b/src/qml/qml/qqmlapplicationengine.h
index d954105c9f..84cb2625dc 100644
--- a/src/qml/qml/qqmlapplicationengine.h
+++ b/src/qml/qml/qqmlapplicationengine.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Research In Motion.
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlapplicationengine_p.h b/src/qml/qml/qqmlapplicationengine_p.h
index e6a969862f..e66cb5d823 100644
--- a/src/qml/qml/qqmlapplicationengine_p.h
+++ b/src/qml/qml/qqmlapplicationengine_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Research In Motion.
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp
index 7babcd2f4e..f223d099e4 100644
--- a/src/qml/qml/qqmlbinding.cpp
+++ b/src/qml/qml/qqmlbinding.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -39,7 +39,6 @@
#include "qqmlcompiler_p.h"
#include "qqmldata_p.h"
#include <private/qqmlprofiler_p.h>
-#include <private/qqmltrace_p.h>
#include <private/qqmlexpression_p.h>
#include <private/qqmlscriptstring_p.h>
#include <private/qqmlcontextwrapper_p.h>
@@ -75,7 +74,8 @@ QQmlBinding::QQmlBinding(const QString &str, QObject *obj, QQmlContext *ctxt)
QQmlAbstractExpression::setContext(QQmlContextData::get(ctxt));
setScopeObject(obj);
- v4function = qmlBinding(context(), obj, str, QString(), 0);
+ QV4::ExecutionEngine *v4 = QQmlEnginePrivate::get(context()->engine)->v4engine();
+ v4function.set(v4, qmlBinding(context(), obj, str, QString(), 0));
}
QQmlBinding::QQmlBinding(const QQmlScriptString &script, QObject *obj, QQmlContext *ctxt)
@@ -93,8 +93,8 @@ QQmlBinding::QQmlBinding(const QQmlScriptString &script, QObject *obj, QQmlConte
QQmlContextData *ctxtdata = QQmlContextData::get(scriptPrivate->context);
QQmlEnginePrivate *engine = QQmlEnginePrivate::get(scriptPrivate->context->engine());
- if (engine && ctxtdata && !ctxtdata->url.isEmpty() && ctxtdata->typeCompilationUnit) {
- url = ctxtdata->url.toString();
+ if (engine && ctxtdata && !ctxtdata->urlString().isEmpty() && ctxtdata->typeCompilationUnit) {
+ url = ctxtdata->urlString();
if (scriptPrivate->bindingId != QQmlBinding::Invalid)
runtimeFunction = ctxtdata->typeCompilationUnit->runtimeFunctions.at(scriptPrivate->bindingId);
}
@@ -103,11 +103,12 @@ QQmlBinding::QQmlBinding(const QQmlScriptString &script, QObject *obj, QQmlConte
QQmlAbstractExpression::setContext(QQmlContextData::get(ctxt ? ctxt : scriptPrivate->context));
setScopeObject(obj ? obj : scriptPrivate->scope);
+ QV4::ExecutionEngine *v4 = QQmlEnginePrivate::get(context()->engine)->v4engine();
if (runtimeFunction) {
- v4function = QV4::QmlBindingWrapper::createQmlCallableForFunction(ctxtdata, scopeObject(), runtimeFunction);
+ v4function.set(v4, QV4::QmlBindingWrapper::createQmlCallableForFunction(ctxtdata, scopeObject(), runtimeFunction));
} else {
QString code = scriptPrivate->script;
- v4function = qmlBinding(context(), scopeObject(), code, url, scriptPrivate->lineNumber);
+ v4function.set(v4, qmlBinding(context(), scopeObject(), code, url, scriptPrivate->lineNumber));
}
}
@@ -118,7 +119,8 @@ QQmlBinding::QQmlBinding(const QString &str, QObject *obj, QQmlContextData *ctxt
QQmlAbstractExpression::setContext(ctxt);
setScopeObject(obj);
- v4function = qmlBinding(ctxt, obj, str, QString(), 0);
+ QV4::ExecutionEngine *v4 = QQmlEnginePrivate::get(context()->engine)->v4engine();
+ v4function.set(v4, qmlBinding(ctxt, obj, str, QString(), 0));
}
QQmlBinding::QQmlBinding(const QString &str, QObject *obj,
@@ -131,17 +133,18 @@ QQmlBinding::QQmlBinding(const QString &str, QObject *obj,
QQmlAbstractExpression::setContext(ctxt);
setScopeObject(obj);
- v4function = qmlBinding(ctxt, obj, str, url, lineNumber);
+ QV4::ExecutionEngine *v4 = QQmlEnginePrivate::get(context()->engine)->v4engine();
+ v4function.set(v4, qmlBinding(ctxt, obj, str, url, lineNumber));
}
-QQmlBinding::QQmlBinding(const QV4::ValueRef functionPtr, QObject *obj, QQmlContextData *ctxt)
+QQmlBinding::QQmlBinding(const QV4::Value &functionPtr, QObject *obj, QQmlContextData *ctxt)
: QQmlJavaScriptExpression(&QQmlBinding_jsvtable), QQmlAbstractBinding(Binding)
{
setNotifyOnValueChanged(true);
QQmlAbstractExpression::setContext(ctxt);
setScopeObject(obj);
- v4function = functionPtr;
+ v4function.set(functionPtr.asObject()->engine(), functionPtr);
}
QQmlBinding::~QQmlBinding()
@@ -162,39 +165,13 @@ void QQmlBinding::update(QQmlPropertyPrivate::WriteFlags flags)
if (QQmlData::wasDeleted(object()))
return;
- QString url;
- quint16 lineNumber;
- quint16 columnNumber;
-
QQmlEnginePrivate *ep = QQmlEnginePrivate::get(context()->engine);
QV4::Scope scope(ep->v4engine());
QV4::ScopedFunctionObject f(scope, v4function.value());
Q_ASSERT(f);
- if (f->bindingKeyFlag()) {
- Q_ASSERT(f->as<QV4::QQmlBindingFunction>());
- QQmlSourceLocation loc = static_cast<QV4::QQmlBindingFunction *>(f.getPointer())->d()->bindingLocation;
- url = loc.sourceFile;
- lineNumber = loc.line;
- columnNumber = loc.column;
- } else {
- QV4::Function *function = f->asFunctionObject()->function();
- Q_ASSERT(function);
-
- url = function->sourceFile();
- lineNumber = function->compiledFunction->location.line;
- columnNumber = function->compiledFunction->location.column;
- }
-
- int lineNo = qmlSourceCoordinate(lineNumber);
- int columnNo = qmlSourceCoordinate(columnNumber);
-
- QQmlTrace trace("General Binding Update");
- trace.addDetail("URL", url);
- trace.addDetail("Line", lineNo);
- trace.addDetail("Column", columnNo);
if (!updatingFlag()) {
- QQmlBindingProfiler prof(ep->profiler, url, lineNo, columnNo);
+ QQmlBindingProfiler prof(ep->profiler, f);
setUpdatingFlag(true);
QQmlAbstractExpression::DeleteWatcher watcher(this);
@@ -216,8 +193,6 @@ void QQmlBinding::update(QQmlPropertyPrivate::WriteFlags flags)
QV4::ScopedValue result(scope, QQmlJavaScriptExpression::evaluate(context(), f, &isUndefined));
- trace.event("writing binding result");
-
bool needsErrorLocationData = false;
if (!watcher.wasDeleted() && !hasError())
needsErrorLocationData = !QQmlPropertyPrivate::writeBinding(*m_coreObject, m_core, context(),
@@ -226,7 +201,7 @@ void QQmlBinding::update(QQmlPropertyPrivate::WriteFlags flags)
if (!watcher.wasDeleted()) {
if (needsErrorLocationData)
- delayedError()->setErrorLocation(QUrl(url), lineNumber, columnNumber);
+ delayedError()->setErrorLocation(f->sourceLocation());
if (hasError()) {
if (!delayedError()->addError(ep)) ep->warning(this->error(context()->engine));
@@ -260,7 +235,7 @@ QVariant QQmlBinding::evaluate()
ep->dereferenceScarceResources();
- return ep->v8engine()->toVariant(result, qMetaTypeId<QList<QObject*> >());
+ return scope.engine->toVariant(result, qMetaTypeId<QList<QObject*> >());
}
QString QQmlBinding::expressionIdentifier(QQmlJavaScriptExpression *e)
diff --git a/src/qml/qml/qqmlbinding_p.h b/src/qml/qml/qqmlbinding_p.h
index 4a44f11cd4..1e440b2e86 100644
--- a/src/qml/qml/qqmlbinding_p.h
+++ b/src/qml/qml/qqmlbinding_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -73,7 +73,7 @@ public:
QQmlBinding(const QString &, QObject *, QQmlContextData *);
QQmlBinding(const QString &, QObject *, QQmlContextData *,
const QString &url, quint16 lineNumber, quint16 columnNumber);
- QQmlBinding(const QV4::ValueRef, QObject *, QQmlContextData *);
+ QQmlBinding(const QV4::Value &, QObject *, QQmlContextData *);
void setTarget(const QQmlProperty &);
void setTarget(QObject *, const QQmlPropertyData &, QQmlContextData *);
diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp
index 26fe659616..766e657c59 100644
--- a/src/qml/qml/qqmlboundsignal.cpp
+++ b/src/qml/qml/qqmlboundsignal.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -76,8 +76,8 @@ QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index,
const QString &handlerName,
const QString &parameterString)
: QQmlJavaScriptExpression(&QQmlBoundSignalExpression_jsvtable),
- m_target(target),
m_index(index),
+ m_target(target),
m_extra(new ExtraData(handlerName, parameterString, expression, fileName, line, column))
{
setExpressionFunctionValid(false);
@@ -86,11 +86,11 @@ QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index,
init(ctxt, scope);
}
-QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index, QQmlContextData *ctxt, QObject *scope, const QV4::ValueRef &function)
+QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index, QQmlContextData *ctxt, QObject *scope, const QV4::Value &function)
: QQmlJavaScriptExpression(&QQmlBoundSignalExpression_jsvtable),
- m_v8function(function),
- m_target(target),
m_index(index),
+ m_function(function.asObject()->engine(), function),
+ m_target(target),
m_extra(0)
{
setExpressionFunctionValid(true);
@@ -101,8 +101,8 @@ QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index,
QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index, QQmlContextData *ctxt, QObject *scope, QV4::Function *runtimeFunction)
: QQmlJavaScriptExpression(&QQmlBoundSignalExpression_jsvtable),
- m_target(target),
m_index(index),
+ m_target(target),
m_extra(0)
{
setExpressionFunctionValid(true);
@@ -113,7 +113,8 @@ QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index,
QMetaMethod signal = QMetaObjectPrivate::signal(m_target->metaObject(), m_index);
QString error;
- m_v8function = QV4::QmlBindingWrapper::createQmlCallableForFunction(ctxt, scope, runtimeFunction, signal.parameterNames(), &error);
+ QV4::ExecutionEngine *engine = QQmlEnginePrivate::getV4Engine(ctxt->engine);
+ m_function.set(engine, QV4::QmlBindingWrapper::createQmlCallableForFunction(ctxt, scope, runtimeFunction, signal.parameterNames(), &error));
if (!error.isEmpty()) {
qmlInfo(scopeObject()) << error;
setInvalidParameterName(true);
@@ -168,7 +169,7 @@ QString QQmlBoundSignalExpression::expression() const
if (expressionFunctionValid()) {
Q_ASSERT (context() && engine());
QV4::Scope scope(QQmlEnginePrivate::get(engine())->v4engine());
- QV4::ScopedValue v(scope, m_v8function.value());
+ QV4::ScopedValue v(scope, m_function.value());
return v->toQStringNoThrow();
} else {
Q_ASSERT(!m_extra.isNull());
@@ -181,7 +182,7 @@ QV4::Function *QQmlBoundSignalExpression::function() const
if (expressionFunctionValid()) {
Q_ASSERT (context() && engine());
QV4::Scope scope(QQmlEnginePrivate::get(engine())->v4engine());
- QV4::Scoped<QV4::FunctionObject> v(scope, m_v8function.value());
+ QV4::ScopedFunctionObject v(scope, m_function.value());
return v ? v->function() : 0;
}
return 0;
@@ -217,7 +218,7 @@ void QQmlBoundSignalExpression::evaluate(void **a)
//TODO: look at using the property cache here (as in the compiler)
// for further optimization
QMetaMethod signal = QMetaObjectPrivate::signal(m_target->metaObject(), m_index);
- expression += QQmlPropertyCache::signalParameterStringForJS(engine(), signal.parameterNames(), &error);
+ expression += QQmlPropertyCache::signalParameterStringForJS(scope.engine, signal.parameterNames(), &error);
if (!error.isEmpty()) {
qmlInfo(scopeObject()) << error;
@@ -236,10 +237,10 @@ void QQmlBoundSignalExpression::evaluate(void **a)
m_extra->m_handlerName.clear();
m_extra->m_parameterString.clear();
- m_v8function = evalFunction(context(), scopeObject(), expression,
- m_extra->m_sourceLocation.sourceFile, m_extra->m_sourceLocation.line, &m_extra->m_v8qmlscope);
+ m_function.set(scope.engine, evalFunction(context(), scopeObject(), expression,
+ m_extra->m_sourceLocation.sourceFile, m_extra->m_sourceLocation.line, &m_extra->m_v8qmlscope));
- if (m_v8function.isNullOrUndefined()) {
+ if (m_function.isNullOrUndefined()) {
ep->dereferenceScarceResources();
return; // could not evaluate function. Not valid.
}
@@ -247,14 +248,13 @@ void QQmlBoundSignalExpression::evaluate(void **a)
setExpressionFunctionValid(true);
}
- QV8Engine *engine = ep->v8engine();
QVarLengthArray<int, 9> dummy;
//TODO: lookup via signal index rather than method index as an optimization
int methodIndex = QMetaObjectPrivate::signal(m_target->metaObject(), m_index).methodIndex();
- int *argsTypes = QQmlPropertyCache::methodParameterTypes(m_target, methodIndex, dummy, 0);
+ int *argsTypes = QQmlMetaObject(m_target).methodParameterTypes(methodIndex, dummy, 0);
int argCount = argsTypes ? *argsTypes : 0;
- QV4::ScopedValue f(scope, m_v8function.value());
+ QV4::ScopedValue f(scope, m_function.value());
QV4::ScopedCallData callData(scope, argCount);
for (int ii = 0; ii < argCount; ++ii) {
int type = argsTypes[ii + 1];
@@ -262,7 +262,7 @@ void QQmlBoundSignalExpression::evaluate(void **a)
// for several cases (such as QVariant type and QObject-derived types)
//args[ii] = engine->metaTypeToJS(type, a[ii + 1]);
if (type == QMetaType::QVariant) {
- callData->args[ii] = engine->fromVariant(*((QVariant *)a[ii + 1]));
+ callData->args[ii] = scope.engine->fromVariant(*((QVariant *)a[ii + 1]));
} else if (type == QMetaType::Int) {
//### optimization. Can go away if we switch to metaTypeToJS, or be expanded otherwise
callData->args[ii] = QV4::Primitive::fromInt32(*reinterpret_cast<const int*>(a[ii + 1]));
@@ -274,7 +274,7 @@ void QQmlBoundSignalExpression::evaluate(void **a)
else
callData->args[ii] = QV4::QObjectWrapper::wrap(ep->v4engine(), *reinterpret_cast<QObject* const *>(a[ii + 1]));
} else {
- callData->args[ii] = engine->fromVariant(QVariant(type, a[ii + 1]));
+ callData->args[ii] = scope.engine->fromVariant(QVariant(type, a[ii + 1]));
}
}
diff --git a/src/qml/qml/qqmlboundsignal_p.h b/src/qml/qml/qqmlboundsignal_p.h
index b9f519a920..8d677ea039 100644
--- a/src/qml/qml/qqmlboundsignal_p.h
+++ b/src/qml/qml/qqmlboundsignal_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -68,7 +68,7 @@ public:
const QString &parameterString = QString());
QQmlBoundSignalExpression(QObject *target, int index,
- QQmlContextData *ctxt, QObject *scope, const QV4::ValueRef &function);
+ QQmlContextData *ctxt, QObject *scope, const QV4::Value &function);
QQmlBoundSignalExpression(QObject *target, int index,
QQmlContextData *ctxt, QObject *scope, QV4::Function *runtimeFunction);
@@ -98,10 +98,10 @@ private:
bool invalidParameterName() const { return m_extra.flag2(); }
void setInvalidParameterName(bool v) { m_extra.setFlag2Value(v); }
- QV4::PersistentValue m_v8function;
+ int m_index;
+ QV4::PersistentValue m_function;
QObject *m_target;
- int m_index;
// only needed when !expressionFunctionValid()
struct ExtraData {
diff --git a/src/qml/qml/qqmlboundsignalexpressionpointer_p.h b/src/qml/qml/qqmlboundsignalexpressionpointer_p.h
index 002b8ef850..883a946c7c 100644
--- a/src/qml/qml/qqmlboundsignalexpressionpointer_p.h
+++ b/src/qml/qml/qqmlboundsignalexpressionpointer_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlbundle.cpp b/src/qml/qml/qqmlbundle.cpp
deleted file mode 100644
index 1034dd1b4c..0000000000
--- a/src/qml/qml/qqmlbundle.cpp
+++ /dev/null
@@ -1,310 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qqmlbundle_p.h"
-#include <iostream>
-#include <cstdlib>
-
-static const unsigned char qmlBundleHeaderData[] = { 255, 'q', 'm', 'l', 'd', 'i', 'r', 255 };
-static const unsigned int qmlBundleHeaderLength = 8;
-
-//
-// Entries
-//
-QString QQmlBundle::FileEntry::fileName() const
-{
- return QString((QChar *)&data[0], fileNameLength / sizeof(QChar));
-}
-
-bool QQmlBundle::FileEntry::isFileName(const QString &fileName) const
-{
- return fileName.length() * sizeof(QChar) == (unsigned)fileNameLength &&
- 0 == ::memcmp(fileName.constData(), &data[0], fileNameLength);
-}
-
-const char *QQmlBundle::FileEntry::contents() const {
- return &data[fileNameLength];
-}
-
-quint32 QQmlBundle::FileEntry::fileSize() const
-{
- return size - (sizeof(FileEntry) + fileNameLength);
-}
-
-
-//
-// QQmlBundle
-//
-QQmlBundle::QQmlBundle(const QString &fileName)
-: file(fileName),
- buffer(0),
- bufferSize(0),
- opened(false),
- headerWritten(false)
-{
-}
-
-QQmlBundle::~QQmlBundle()
-{
- close();
-}
-
-bool QQmlBundle::open(QIODevice::OpenMode mode)
-{
- if (!opened) {
- if (!file.open(mode))
- return false;
-
- bufferSize = file.size();
- buffer = file.map(0, bufferSize);
-
- if (bufferSize == 0 ||
- (bufferSize >= 8 && 0 == ::memcmp(buffer, qmlBundleHeaderData, qmlBundleHeaderLength))) {
- opened = true;
- headerWritten = false;
- return true;
- } else {
- close();
- return false;
- }
- }
- return true;
-}
-
-void QQmlBundle::close()
-{
- if (opened) {
- opened = false;
- headerWritten = false;
- file.unmap(buffer);
- file.close();
- }
-}
-
-QList<const QQmlBundle::FileEntry *> QQmlBundle::files() const
-{
- QList<const FileEntry *> files;
- const char *ptr = (const char *) buffer + qmlBundleHeaderLength;
- const char *end = (const char *) buffer + bufferSize;
-
- while (ptr < end) {
- const Entry *cmd = (const Entry *) ptr;
-
- switch (static_cast<Entry::Kind>(cmd->kind)) {
- case Entry::File: {
- const FileEntry *f = reinterpret_cast<const FileEntry *>(cmd);
- files.append(f);
- } break;
-
- case Entry::Link:
- case Entry::Skip: {
- // Skip
- } break;
-
- default:
- // throw an error
- return QList<const FileEntry *>();
- } // switch
-
- ptr += cmd->size;
- Q_ASSERT(ptr <= end); // throw an error
- }
- return files;
-}
-
-void QQmlBundle::remove(const FileEntry *entry)
-{
- Q_ASSERT(entry->kind == Entry::File); // ### throw an error
- Q_ASSERT(file.isWritable());
- const_cast<FileEntry *>(entry)->kind = Entry::Skip;
-}
-
-int QQmlBundle::bundleHeaderLength()
-{
- return qmlBundleHeaderLength;
-}
-
-bool QQmlBundle::isBundleHeader(const char *data, int size)
-{
- if ((unsigned int)size < qmlBundleHeaderLength)
- return false;
-
- return 0 == ::memcmp(data, qmlBundleHeaderData, qmlBundleHeaderLength);
-}
-
-//
-// find a some empty space we can use to insert new entries.
-//
-const QQmlBundle::Entry *QQmlBundle::findInsertPoint(quint32 size, qint32 *offset)
-{
- const char *ptr = (const char *) buffer + qmlBundleHeaderLength;
- const char *end = (const char *) buffer + bufferSize;
-
- while (ptr < end) {
- const Entry *cmd = (const Entry *) ptr;
-
- if (cmd->kind == Entry::Skip && size + sizeof(RawEntry) < cmd->size) {
- *offset = ptr - ((const char *) buffer + qmlBundleHeaderLength);
- return cmd;
- }
-
- ptr += cmd->size;
- Q_ASSERT(ptr <= end); // throw an error
- }
-
- return 0;
-}
-
-const QQmlBundle::FileEntry *QQmlBundle::find(const QString &fileName) const
-{
- const char *ptr = (const char *) buffer + qmlBundleHeaderLength;
- const char *end = (const char *) buffer + bufferSize;
-
- while (ptr < end) {
- const Entry *cmd = (const Entry *) ptr;
-
- if (cmd->kind == Entry::File) {
- const FileEntry *fileEntry = static_cast<const FileEntry *>(cmd);
-
- if (fileEntry->isFileName(fileName))
- return fileEntry;
- }
-
- ptr += cmd->size;
- Q_ASSERT(ptr <= end); // throw an error
- }
-
- return 0;
-}
-
-const QQmlBundle::FileEntry *QQmlBundle::link(const FileEntry *entry, const QString &linkName) const
-{
- const char *ptr = (const char *) buffer + entry->link;
-
- while (ptr != (const char *)buffer) {
- const Entry *cmd = (const Entry *) ptr;
- Q_ASSERT(cmd->kind == Entry::Link);
-
- const FileEntry *fileEntry = static_cast<const FileEntry *>(cmd);
- if (fileEntry->fileName() == linkName)
- return fileEntry;
-
- ptr = (const char *) buffer + fileEntry->link;
- }
-
- return 0;
-}
-
-const QQmlBundle::FileEntry *QQmlBundle::find(const QChar *fileName, int length) const
-{
- return find(QString::fromRawData(fileName, length));
-}
-
-bool QQmlBundle::add(const QString &name, const QString &fileName)
-{
- if (!file.isWritable())
- return false;
- else if (find(fileName))
- return false;
-
- QFile inputFile(fileName);
- if (!inputFile.open(QFile::ReadOnly))
- return false;
-
- // ### use best-fit algorithm
- if (!file.atEnd())
- file.seek(file.size());
-
- FileEntry cmd;
- const quint32 inputFileSize = inputFile.size();
-
- cmd.kind = Entry::File;
- cmd.link = 0;
- cmd.size = sizeof(FileEntry) + name.length() * sizeof(QChar) + inputFileSize;
- cmd.fileNameLength = name.length() * sizeof(QChar);
-
- if (bufferSize == 0 && headerWritten == false) {
- file.write((const char *)qmlBundleHeaderData, qmlBundleHeaderLength);
- headerWritten = true;
- }
-
- file.write((const char *) &cmd, sizeof(FileEntry));
- file.write((const char *) name.constData(), name.length() * sizeof(QChar));
-
- uchar *source = inputFile.map(0, inputFileSize);
- file.write((const char *) source, inputFileSize);
- inputFile.unmap(source);
- return true;
-}
-
-bool QQmlBundle::add(const QString &fileName)
-{
- return add(fileName, fileName);
-}
-
-bool QQmlBundle::addMetaLink(const QString &fileName,
- const QString &linkName,
- const QByteArray &data)
-{
- if (!file.isWritable())
- return false;
-
- const FileEntry *fileEntry = find(fileName);
- if (!fileEntry)
- return false;
-
- // ### use best-fit algorithm
- if (!file.atEnd())
- file.seek(file.size());
-
- FileEntry cmd;
-
- const quint32 inputFileSize = data.size();
-
- cmd.kind = Entry::Link;
- cmd.link = fileEntry->link;
- cmd.size = sizeof(FileEntry) + linkName.length() * sizeof(QChar) + inputFileSize;
- cmd.fileNameLength = linkName.length() * sizeof(QChar);
-
- if (bufferSize == 0 && headerWritten == false) {
- file.write((const char *)qmlBundleHeaderData, qmlBundleHeaderLength);
- headerWritten = true;
- }
-
- const_cast<FileEntry *>(fileEntry)->link = file.size();
-
- file.write((const char *) &cmd, sizeof(FileEntry));
- file.write((const char *) linkName.constData(), linkName.length() * sizeof(QChar));
- file.write((const char *) data.constData(), inputFileSize);
- return true;
-}
diff --git a/src/qml/qml/qqmlbundle_p.h b/src/qml/qml/qqmlbundle_p.h
deleted file mode 100644
index e1066ed378..0000000000
--- a/src/qml/qml/qqmlbundle_p.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQMLBUNDLE_P_H
-#define QQMLBUNDLE_P_H
-
-#include <QtCore/qfile.h>
-#include <QtCore/qstring.h>
-#include <private/qtqmlglobal_p.h>
-
-#ifdef Q_CC_MSVC
-// nonstandard extension used : zero-sized array in struct/union.
-# pragma warning( disable : 4200 )
-#endif
-
-QT_BEGIN_NAMESPACE
-
-class Q_QML_PRIVATE_EXPORT QQmlBundle
-{
- Q_DISABLE_COPY(QQmlBundle)
-public:
- struct Q_QML_PRIVATE_EXPORT Entry
- {
- enum Kind {
- File = 123, // Normal file
- Skip, // Empty space
- Link // A meta data linked file
-
- // ### add entries for qmldir, index, ...
- };
-
- int kind;
- quint32 size;
- };
-
- struct Q_QML_PRIVATE_EXPORT RawEntry : public Entry
- {
- char data[]; // trailing data
- };
-
- struct Q_QML_PRIVATE_EXPORT FileEntry : public Entry
- {
- quint32 link;
- int fileNameLength;
- char data[]; // trailing data
-
- QString fileName() const;
- bool isFileName(const QString &) const;
-
- quint32 fileSize() const;
- const char *contents() const;
- };
-
- QQmlBundle(const QString &fileName);
- ~QQmlBundle();
-
- bool open(QIODevice::OpenMode mode = QIODevice::ReadWrite);
- void close();
-
- QList<const FileEntry *> files() const;
- void remove(const FileEntry *entry);
- bool add(const QString &fileName);
- bool add(const QString &name, const QString &fileName);
-
- bool addMetaLink(const QString &fileName,
- const QString &linkName,
- const QByteArray &data);
-
- const FileEntry *find(const QString &fileName) const;
- const FileEntry *find(const QChar *fileName, int length) const;
-
- const FileEntry *link(const FileEntry *, const QString &linkName) const;
-
- static int bundleHeaderLength();
- static bool isBundleHeader(const char *, int size);
-private:
- const Entry *findInsertPoint(quint32 size, qint32 *offset);
-
-private:
- QFile file;
- uchar *buffer;
- quint32 bufferSize;
- bool opened:1;
- bool headerWritten:1;
-};
-
-QT_END_NAMESPACE
-
-#endif // QQMLBUNDLE_P_H
diff --git a/src/qml/qml/qqmlcleanup.cpp b/src/qml/qml/qqmlcleanup.cpp
index 28a259f1f7..f7f7fe6319 100644
--- a/src/qml/qml/qqmlcleanup.cpp
+++ b/src/qml/qml/qqmlcleanup.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlcleanup_p.h b/src/qml/qml/qqmlcleanup_p.h
index 2b6f35c391..e9af960810 100644
--- a/src/qml/qml/qqmlcleanup_p.h
+++ b/src/qml/qml/qqmlcleanup_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlcompileddata.cpp b/src/qml/qml/qqmlcompileddata.cpp
index 22838786b6..9c6aab2c82 100644
--- a/src/qml/qml/qqmlcompileddata.cpp
+++ b/src/qml/qml/qqmlcompileddata.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlcompiler_p.h b/src/qml/qml/qqmlcompiler_p.h
index 5e76533739..31aac6ab5f 100644
--- a/src/qml/qml/qqmlcompiler_p.h
+++ b/src/qml/qml/qqmlcompiler_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -84,7 +84,7 @@ public:
QQmlEngine *engine;
QString fileName() const { return compilationUnit->fileName(); }
- QUrl url() const { return QUrl(fileName()); }
+ QUrl url() const { return compilationUnit->url(); }
QQmlTypeNameCache *importCache;
int metaTypeId;
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index 63a43966b1..9210610cec 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -87,12 +87,12 @@ QT_BEGIN_NAMESPACE
class QQmlComponentExtension : public QV8Engine::Deletable
{
public:
- QQmlComponentExtension(QV8Engine *);
+ QQmlComponentExtension(QV4::ExecutionEngine *v4);
virtual ~QQmlComponentExtension();
QV4::PersistentValue incubationProto;
};
-V8_DEFINE_EXTENSION(QQmlComponentExtension, componentExtension);
+V4_DEFINE_EXTENSION(QQmlComponentExtension, componentExtension);
/*!
\class QQmlComponent
@@ -247,9 +247,9 @@ V8_DEFINE_EXTENSION(QQmlComponentExtension, componentExtension);
\table
\row
\li MyItem.qml
- \li main.qml
- \row
\li \snippet qml/component/MyItem.qml 0
+ \row
+ \li main.qml
\li \snippet qml/component/main.qml 0
\endtable
*/
@@ -675,9 +675,9 @@ void QQmlComponentPrivate::loadUrl(const QUrl &newUrl, QQmlComponent::Compilatio
emit q->progressChanged(progress);
}
- QQmlDataLoader::Mode loaderMode = (mode == QQmlComponent::Asynchronous)
- ? QQmlDataLoader::Asynchronous
- : QQmlDataLoader::PreferSynchronous;
+ QQmlTypeLoader::Mode loaderMode = (mode == QQmlComponent::Asynchronous)
+ ? QQmlTypeLoader::Asynchronous
+ : QQmlTypeLoader::PreferSynchronous;
QQmlTypeData *data = QQmlEnginePrivate::get(engine)->typeLoader.getType(url, loaderMode);
@@ -1070,18 +1070,25 @@ void QQmlComponent::create(QQmlIncubator &incubator, QQmlContext *context,
class QQmlComponentIncubator;
+namespace QV4 {
+
+namespace Heap {
+
+struct QmlIncubatorObject : Object {
+ QmlIncubatorObject(QV4::ExecutionEngine *engine, QQmlIncubator::IncubationMode = QQmlIncubator::Asynchronous);
+ QScopedPointer<QQmlComponentIncubator> incubator;
+ QPointer<QObject> parent;
+ QV4::Value valuemap;
+ QV4::Value qmlGlobal;
+ QV4::Value statusChanged;
+};
+
+}
+
struct QmlIncubatorObject : public QV4::Object
{
- struct Data : QV4::Object::Data {
- Data(QV8Engine *engine, QQmlIncubator::IncubationMode = QQmlIncubator::Asynchronous);
- QScopedPointer<QQmlComponentIncubator> incubator;
- QV8Engine *v8;
- QPointer<QObject> parent;
- QV4::Value valuemap;
- QV4::Value qmlGlobal;
- QV4::Value statusChanged;
- };
- V4_OBJECT(QV4::Object)
+ V4_OBJECT2(QmlIncubatorObject, Object)
+ V4_NEEDS_DESTROY
static QV4::ReturnedValue method_get_statusChanged(QV4::CallContext *ctx);
static QV4::ReturnedValue method_set_statusChanged(QV4::CallContext *ctx);
@@ -1089,36 +1096,37 @@ struct QmlIncubatorObject : public QV4::Object
static QV4::ReturnedValue method_get_object(QV4::CallContext *ctx);
static QV4::ReturnedValue method_forceCompletion(QV4::CallContext *ctx);
- static void destroy(Managed *that);
- static void markObjects(Managed *that, QV4::ExecutionEngine *e);
+ static void markObjects(QV4::Heap::Base *that, QV4::ExecutionEngine *e);
void statusChanged(QQmlIncubator::Status);
void setInitialState(QObject *);
};
-DEFINE_OBJECT_VTABLE(QmlIncubatorObject);
+}
+
+DEFINE_OBJECT_VTABLE(QV4::QmlIncubatorObject);
class QQmlComponentIncubator : public QQmlIncubator
{
public:
- QQmlComponentIncubator(QmlIncubatorObject::Data *inc, IncubationMode mode)
+ QQmlComponentIncubator(QV4::Heap::QmlIncubatorObject *inc, IncubationMode mode)
: QQmlIncubator(mode)
, incubatorObject(inc)
{}
virtual void statusChanged(Status s) {
QV4::Scope scope(incubatorObject->internalClass->engine);
- QV4::Scoped<QmlIncubatorObject> i(scope, incubatorObject);
+ QV4::Scoped<QV4::QmlIncubatorObject> i(scope, incubatorObject);
i->statusChanged(s);
}
virtual void setInitialState(QObject *o) {
QV4::Scope scope(incubatorObject->internalClass->engine);
- QV4::Scoped<QmlIncubatorObject> i(scope, incubatorObject);
+ QV4::Scoped<QV4::QmlIncubatorObject> i(scope, incubatorObject);
i->setInitialState(o);
}
- QmlIncubatorObject::Data *incubatorObject;
+ QV4::Heap::QmlIncubatorObject *incubatorObject;
};
@@ -1236,7 +1244,7 @@ void QQmlComponent::createObject(QQmlV4Function *args)
QV4::ScopedValue f(scope, QV4::Script::evaluate(v4, QString::fromLatin1(INITIALPROPERTIES_SOURCE), qmlglobal));
Q_ASSERT(f->asFunctionObject());
QV4::ScopedCallData callData(scope, 2);
- callData->thisObject = v4->globalObject;
+ callData->thisObject = v4->globalObject();
callData->args[0] = object;
callData->args[1] = valuemap;
f->asFunctionObject()->call(callData);
@@ -1251,7 +1259,7 @@ void QQmlComponent::createObject(QQmlV4Function *args)
if (!rv)
args->setReturnValue(QV4::Encode::null());
else
- args->setReturnValue(object.asReturnedValue());
+ args->setReturnValue(object->asReturnedValue());
}
/*!
@@ -1352,11 +1360,11 @@ void QQmlComponent::incubateObject(QQmlV4Function *args)
mode = QQmlIncubator::AsynchronousIfNested;
}
- QQmlComponentExtension *e = componentExtension(args->engine());
+ QQmlComponentExtension *e = componentExtension(args->v4engine());
- QV4::Scoped<QmlIncubatorObject> r(scope, v4->memoryManager->alloc<QmlIncubatorObject>(args->engine(), mode));
+ QV4::Scoped<QV4::QmlIncubatorObject> r(scope, v4->memoryManager->alloc<QV4::QmlIncubatorObject>(args->v4engine(), mode));
QV4::ScopedObject p(scope, e->incubationProto.value());
- r->setPrototype(p.getPointer());
+ r->setPrototype(p);
if (!valuemap->isUndefined()) {
r->d()->valuemap = valuemap;
@@ -1364,7 +1372,7 @@ void QQmlComponent::incubateObject(QQmlV4Function *args)
}
r->d()->parent = parent;
- QQmlIncubator *incubator = r.getPointer()->d()->incubator.data();
+ QQmlIncubator *incubator = r->d()->incubator.data();
create(*incubator, creationContext());
if (incubator->status() == QQmlIncubator::Null) {
@@ -1375,93 +1383,91 @@ void QQmlComponent::incubateObject(QQmlV4Function *args)
}
// XXX used by QSGLoader
-void QQmlComponentPrivate::initializeObjectWithInitialProperties(const QV4::ValueRef qmlGlobal, const QV4::ValueRef valuemap, QObject *toCreate)
+void QQmlComponentPrivate::initializeObjectWithInitialProperties(const QV4::Value &qmlGlobal, const QV4::Value &valuemap, QObject *toCreate)
{
QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine);
- QV8Engine *v8engine = ep->v8engine();
- QV4::ExecutionEngine *v4engine = QV8Engine::getV4(v8engine);
+ QV4::ExecutionEngine *v4engine = QV8Engine::getV4(ep->v8engine());
QV4::Scope scope(v4engine);
QV4::ScopedValue object(scope, QV4::QObjectWrapper::wrap(v4engine, toCreate));
Q_ASSERT(object->asObject());
- if (!valuemap->isUndefined()) {
+ if (!valuemap.isUndefined()) {
QV4::ScopedObject qmlGlobalObj(scope, qmlGlobal);
- QV4::Scoped<QV4::FunctionObject> f(scope, QV4::Script::evaluate(QV8Engine::getV4(v8engine),
- QString::fromLatin1(INITIALPROPERTIES_SOURCE), qmlGlobalObj));
+ QV4::ScopedFunctionObject f(scope, QV4::Script::evaluate(v4engine,
+ QString::fromLatin1(INITIALPROPERTIES_SOURCE), qmlGlobalObj));
QV4::ScopedCallData callData(scope, 2);
- callData->thisObject = v4engine->globalObject;
+ callData->thisObject = v4engine->globalObject();
callData->args[0] = object;
callData->args[1] = valuemap;
f->call(callData);
}
}
-QQmlComponentExtension::QQmlComponentExtension(QV8Engine *engine)
+QQmlComponentExtension::QQmlComponentExtension(QV4::ExecutionEngine *v4)
{
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine);
QV4::Scope scope(v4);
- QV4::Scoped<QV4::Object> proto(scope, v4->newObject());
+ QV4::ScopedObject proto(scope, v4->newObject());
proto->defineAccessorProperty(QStringLiteral("onStatusChanged"),
- QmlIncubatorObject::method_get_statusChanged, QmlIncubatorObject::method_set_statusChanged);
- proto->defineAccessorProperty(QStringLiteral("status"), QmlIncubatorObject::method_get_status, 0);
- proto->defineAccessorProperty(QStringLiteral("object"), QmlIncubatorObject::method_get_object, 0);
- proto->defineDefaultProperty(QStringLiteral("forceCompletion"), QmlIncubatorObject::method_forceCompletion);
+ QV4::QmlIncubatorObject::method_get_statusChanged, QV4::QmlIncubatorObject::method_set_statusChanged);
+ proto->defineAccessorProperty(QStringLiteral("status"), QV4::QmlIncubatorObject::method_get_status, 0);
+ proto->defineAccessorProperty(QStringLiteral("object"), QV4::QmlIncubatorObject::method_get_object, 0);
+ proto->defineDefaultProperty(QStringLiteral("forceCompletion"), QV4::QmlIncubatorObject::method_forceCompletion);
- incubationProto = proto;
+ incubationProto.set(v4, proto);
}
-QV4::ReturnedValue QmlIncubatorObject::method_get_object(QV4::CallContext *ctx)
+QV4::ReturnedValue QV4::QmlIncubatorObject::method_get_object(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QmlIncubatorObject> o(scope, ctx->d()->callData->thisObject.as<QmlIncubatorObject>());
+ QV4::Scoped<QmlIncubatorObject> o(scope, ctx->thisObject().as<QmlIncubatorObject>());
if (!o)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
return QV4::QObjectWrapper::wrap(ctx->d()->engine, o->d()->incubator->object());
}
-QV4::ReturnedValue QmlIncubatorObject::method_forceCompletion(QV4::CallContext *ctx)
+QV4::ReturnedValue QV4::QmlIncubatorObject::method_forceCompletion(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QmlIncubatorObject> o(scope, ctx->d()->callData->thisObject.as<QmlIncubatorObject>());
+ QV4::Scoped<QmlIncubatorObject> o(scope, ctx->thisObject().as<QmlIncubatorObject>());
if (!o)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
o->d()->incubator->forceCompletion();
return QV4::Encode::undefined();
}
-QV4::ReturnedValue QmlIncubatorObject::method_get_status(QV4::CallContext *ctx)
+QV4::ReturnedValue QV4::QmlIncubatorObject::method_get_status(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QmlIncubatorObject> o(scope, ctx->d()->callData->thisObject.as<QmlIncubatorObject>());
+ QV4::Scoped<QmlIncubatorObject> o(scope, ctx->thisObject().as<QmlIncubatorObject>());
if (!o)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
return QV4::Encode(o->d()->incubator->status());
}
-QV4::ReturnedValue QmlIncubatorObject::method_get_statusChanged(QV4::CallContext *ctx)
+QV4::ReturnedValue QV4::QmlIncubatorObject::method_get_statusChanged(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QmlIncubatorObject> o(scope, ctx->d()->callData->thisObject.as<QmlIncubatorObject>());
+ QV4::Scoped<QmlIncubatorObject> o(scope, ctx->thisObject().as<QmlIncubatorObject>());
if (!o)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
return o->d()->statusChanged.asReturnedValue();
}
-QV4::ReturnedValue QmlIncubatorObject::method_set_statusChanged(QV4::CallContext *ctx)
+QV4::ReturnedValue QV4::QmlIncubatorObject::method_set_statusChanged(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QmlIncubatorObject> o(scope, ctx->d()->callData->thisObject.as<QmlIncubatorObject>());
- if (!o || ctx->d()->callData->argc < 1)
- return ctx->throwTypeError();
+ QV4::Scoped<QmlIncubatorObject> o(scope, ctx->thisObject().as<QmlIncubatorObject>());
+ if (!o || ctx->argc() < 1)
+ return ctx->engine()->throwTypeError();
- o->d()->statusChanged = ctx->d()->callData->args[0];
+ o->d()->statusChanged = ctx->args()[0];
return QV4::Encode::undefined();
}
@@ -1469,53 +1475,44 @@ QQmlComponentExtension::~QQmlComponentExtension()
{
}
-QmlIncubatorObject::Data::Data(QV8Engine *engine, QQmlIncubator::IncubationMode m)
- : Object::Data(QV8Engine::getV4(engine))
- , v8(engine)
+QV4::Heap::QmlIncubatorObject::QmlIncubatorObject(ExecutionEngine *engine, QQmlIncubator::IncubationMode m)
+ : QV4::Heap::Object(engine)
, valuemap(QV4::Primitive::undefinedValue())
, qmlGlobal(QV4::Primitive::undefinedValue())
, statusChanged(QV4::Primitive::undefinedValue())
{
- setVTable(staticVTable());
-
incubator.reset(new QQmlComponentIncubator(this, m));
}
-void QmlIncubatorObject::setInitialState(QObject *o)
+void QV4::QmlIncubatorObject::setInitialState(QObject *o)
{
QQmlComponent_setQmlParent(o, d()->parent);
if (!d()->valuemap.isUndefined()) {
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(d()->v8);
+ QV4::ExecutionEngine *v4 = engine();
QV4::Scope scope(v4);
- QV4::Scoped<QV4::FunctionObject> f(scope, QV4::Script::evaluate(v4, QString::fromLatin1(INITIALPROPERTIES_SOURCE), d()->qmlGlobal.asObject()));
+ QV4::ScopedFunctionObject f(scope, QV4::Script::evaluate(v4, QString::fromLatin1(INITIALPROPERTIES_SOURCE), d()->qmlGlobal.asObject()));
QV4::ScopedCallData callData(scope, 2);
- callData->thisObject = v4->globalObject;
+ callData->thisObject = v4->globalObject();
callData->args[0] = QV4::QObjectWrapper::wrap(v4, o);
callData->args[1] = d()->valuemap;
f->call(callData);
}
}
-void QmlIncubatorObject::destroy(Managed *that)
-{
- static_cast<QmlIncubatorObject *>(that)->d()->~Data();
-}
-
-void QmlIncubatorObject::markObjects(QV4::Managed *that, QV4::ExecutionEngine *e)
+void QV4::QmlIncubatorObject::markObjects(QV4::Heap::Base *that, QV4::ExecutionEngine *e)
{
- QmlIncubatorObject *o = static_cast<QmlIncubatorObject *>(that);
- Q_ASSERT(that->as<QmlIncubatorObject>());
- o->d()->valuemap.mark(e);
- o->d()->qmlGlobal.mark(e);
- o->d()->statusChanged.mark(e);
+ QmlIncubatorObject::Data *o = static_cast<QmlIncubatorObject::Data *>(that);
+ o->valuemap.mark(e);
+ o->qmlGlobal.mark(e);
+ o->statusChanged.mark(e);
Object::markObjects(that, e);
}
-void QmlIncubatorObject::statusChanged(QQmlIncubator::Status s)
+void QV4::QmlIncubatorObject::statusChanged(QQmlIncubator::Status s)
{
- QV4::Scope scope(QV8Engine::getV4(d()->v8));
+ QV4::Scope scope(engine());
// hold the incubated object in a scoped value to prevent it's destruction before this method returns
QV4::ScopedObject incubatedObject(scope, QV4::QObjectWrapper::wrap(scope.engine, d()->incubator->object()));
@@ -1527,14 +1524,13 @@ void QmlIncubatorObject::statusChanged(QQmlIncubator::Status s)
QV4::ScopedFunctionObject f(scope, d()->statusChanged);
if (f) {
- QV4::ExecutionContext *ctx = scope.engine->currentContext();
QV4::ScopedCallData callData(scope, 1);
callData->thisObject = this;
callData->args[0] = QV4::Primitive::fromUInt32(s);
f->call(callData);
if (scope.hasException()) {
- QQmlError error = QV4::ExecutionEngine::catchExceptionAsQmlError(ctx);
- QQmlEnginePrivate::warning(QQmlEnginePrivate::get(d()->v8->engine()), error);
+ QQmlError error = scope.engine->catchExceptionAsQmlError();
+ QQmlEnginePrivate::warning(QQmlEnginePrivate::get(scope.engine->qmlEngine()), error);
}
}
}
diff --git a/src/qml/qml/qqmlcomponent.h b/src/qml/qml/qqmlcomponent.h
index 30d8253110..8c866c585a 100644
--- a/src/qml/qml/qqmlcomponent.h
+++ b/src/qml/qml/qqmlcomponent.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlcomponent_p.h b/src/qml/qml/qqmlcomponent_p.h
index 1dcc605ca4..adc6e173d2 100644
--- a/src/qml/qml/qqmlcomponent_p.h
+++ b/src/qml/qml/qqmlcomponent_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -82,7 +82,7 @@ public:
QObject *beginCreate(QQmlContextData *);
void completeCreate();
- void initializeObjectWithInitialProperties(const QV4::ValueRef qmlGlobal, const QV4::ValueRef valuemap, QObject *toCreate);
+ void initializeObjectWithInitialProperties(const QV4::Value &qmlGlobal, const QV4::Value &valuemap, QObject *toCreate);
QQmlTypeData *typeData;
virtual void typeDataReady(QQmlTypeData *);
diff --git a/src/qml/qml/qqmlcomponentattached_p.h b/src/qml/qml/qqmlcomponentattached_p.h
index db60109067..b6ad3dec00 100644
--- a/src/qml/qml/qqmlcomponentattached_p.h
+++ b/src/qml/qml/qqmlcomponentattached_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlcontext.cpp b/src/qml/qml/qqmlcontext.cpp
index d162d82528..fb51bad3a7 100644
--- a/src/qml/qml/qqmlcontext.cpp
+++ b/src/qml/qml/qqmlcontext.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -305,12 +305,10 @@ void QQmlContext::setContextProperty(const QString &name, const QVariant &value)
}
}
- if (data->propertyNames.isEmpty())
- data->propertyNames = QV4::IdentifierHash<int>(QV8Engine::getV4(engine()->handle()));
-
- int idx = data->propertyNames.value(name);
+ QV4::IdentifierHash<int> &properties = data->propertyNames();
+ int idx = properties.value(name);
if (idx == -1) {
- data->propertyNames.add(name, data->idValueCount + d->propertyValues.count());
+ properties.add(name, data->idValueCount + d->propertyValues.count());
d->propertyValues.append(value);
data->refreshExpressions();
@@ -343,12 +341,11 @@ void QQmlContext::setContextProperty(const QString &name, QObject *value)
return;
}
- if (data->propertyNames.isEmpty())
- data->propertyNames = QV4::IdentifierHash<int>(QV8Engine::getV4(engine()->handle()));
- int idx = data->propertyNames.value(name);
+ QV4::IdentifierHash<int> &properties = data->propertyNames();
+ int idx = properties.value(name);
if (idx == -1) {
- data->propertyNames.add(name, data->idValueCount + d->propertyValues.count());
+ properties.add(name, data->idValueCount + d->propertyValues.count());
d->propertyValues.append(QVariant::fromValue(value));
data->refreshExpressions();
@@ -370,8 +367,9 @@ QVariant QQmlContext::contextProperty(const QString &name) const
QQmlContextData *data = d->data;
- if (data->propertyNames.count())
- idx = data->propertyNames.value(name);
+ const QV4::IdentifierHash<int> &properties = data->propertyNames();
+ if (properties.count())
+ idx = properties.value(name);
if (idx == -1) {
if (data->contextObject) {
@@ -428,14 +426,14 @@ QUrl QQmlContextData::resolvedUrl(const QUrl &src)
if (src.isRelative() && !src.isEmpty()) {
if (ctxt) {
while(ctxt) {
- if(ctxt->url.isValid())
+ if (ctxt->url().isValid())
break;
else
ctxt = ctxt->parent;
}
if (ctxt)
- resolved = ctxt->url.resolved(src);
+ resolved = ctxt->url().resolved(src);
else if (engine)
resolved = engine->baseUrl().resolved(src);
}
@@ -464,8 +462,8 @@ void QQmlContext::setBaseUrl(const QUrl &baseUrl)
{
Q_D(QQmlContext);
- d->data->url = baseUrl;
- d->data->urlString = baseUrl.toString();
+ d->data->baseUrl = baseUrl;
+ d->data->baseUrlString = baseUrl.toString();
}
/*!
@@ -476,11 +474,11 @@ QUrl QQmlContext::baseUrl() const
{
Q_D(const QQmlContext);
const QQmlContextData* data = d->data;
- while (data && data->url.isEmpty())
+ while (data && data->url().isEmpty())
data = data->parent;
if (data)
- return data->url;
+ return data->url();
else
return QUrl();
}
@@ -762,33 +760,31 @@ void QQmlContextData::setIdProperty(int idx, QObject *obj)
idValues[idx].context = this;
}
-void QQmlContextData::setIdPropertyData(const QVector<ObjectIdMapping> &data)
+void QQmlContextData::setIdPropertyData(const QHash<int, int> &data)
{
- Q_ASSERT(propertyNames.isEmpty());
- propertyNames = QV4::IdentifierHash<int>(QV8Engine::getV4(engine->handle()));
- for (QVector<ObjectIdMapping>::ConstIterator it = data.begin(), end = data.end();
- it != end; ++it)
- propertyNames.add(it->name, it->id);
-
+ Q_ASSERT(objectIndexToId.isEmpty());
+ objectIndexToId = data;
+ Q_ASSERT(propertyNameCache.isEmpty());
idValueCount = data.count();
idValues = new ContextGuard[idValueCount];
}
QString QQmlContextData::findObjectId(const QObject *obj) const
{
- if (propertyNames.isEmpty())
+ const QV4::IdentifierHash<int> &properties = propertyNames();
+ if (propertyNameCache.isEmpty())
return QString();
for (int ii = 0; ii < idValueCount; ii++) {
if (idValues[ii] == obj)
- return propertyNames.findId(ii);
+ return properties.findId(ii);
}
if (publicContext) {
QQmlContextPrivate *p = QQmlContextPrivate::get(publicContext);
for (int ii = 0; ii < p->propertyValues.count(); ++ii)
- if (p->propertyValues.at(ii) == QVariant::fromValue((QObject *)obj))
- return propertyNames.findId(ii);
+ if (p->propertyValues.at(ii) == QVariant::fromValue(const_cast<QObject *>(obj)))
+ return properties.findId(ii);
}
if (linkedContext)
@@ -808,4 +804,33 @@ QQmlContextPrivate *QQmlContextData::asQQmlContextPrivate()
return QQmlContextPrivate::get(asQQmlContext());
}
+QV4::IdentifierHash<int> &QQmlContextData::propertyNames() const
+{
+ if (propertyNameCache.isEmpty()) {
+ propertyNameCache = QV4::IdentifierHash<int>(QV8Engine::getV4(engine->handle()));
+ for (QHash<int, int>::ConstIterator it = objectIndexToId.begin(), end = objectIndexToId.end();
+ it != end; ++it) {
+ const QV4::CompiledData::Object *obj = typeCompilationUnit->data->objectAt(it.key());
+ const QString name = typeCompilationUnit->data->stringAt(obj->idIndex);
+ propertyNameCache.add(name, it.value());
+ }
+ objectIndexToId.clear();
+ }
+ return propertyNameCache;
+}
+
+QUrl QQmlContextData::url() const
+{
+ if (typeCompilationUnit)
+ return typeCompilationUnit->url();
+ return baseUrl;
+}
+
+QString QQmlContextData::urlString() const
+{
+ if (typeCompilationUnit)
+ return typeCompilationUnit->fileName();
+ return baseUrlString;
+}
+
QT_END_NAMESPACE
diff --git a/src/qml/qml/qqmlcontext.h b/src/qml/qml/qqmlcontext.h
index 7b90505253..c714846147 100644
--- a/src/qml/qml/qqmlcontext.h
+++ b/src/qml/qml/qqmlcontext.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlcontext_p.h b/src/qml/qml/qqmlcontext_p.h
index 233ea4d34a..f5fd7d0a5c 100644
--- a/src/qml/qml/qqmlcontext_p.h
+++ b/src/qml/qml/qqmlcontext_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -144,8 +144,9 @@ public:
// Compilation unit for contexts that belong to a compiled type.
QQmlRefPointer<QV4::CompiledData::CompilationUnit> typeCompilationUnit;
- // Property name cache
- QV4::IdentifierHash<int> propertyNames;
+ mutable QHash<int, int> objectIndexToId;
+ mutable QV4::IdentifierHash<int> propertyNameCache;
+ QV4::IdentifierHash<int> &propertyNames() const;
// Context object
QObject *contextObject;
@@ -153,9 +154,11 @@ public:
// Any script blocks that exist on this context
QV4::PersistentValue importedScripts; // This is a JS Array
- // Context base url
- QUrl url;
- QString urlString;
+ QUrl baseUrl;
+ QString baseUrlString;
+
+ QUrl url() const;
+ QString urlString() const;
// List of imports that apply to this context
QQmlTypeNameCache *imports;
@@ -188,17 +191,10 @@ public:
QFlagPointer<QQmlContextData> context;
QQmlNotifier bindings;
};
- struct ObjectIdMapping {
- ObjectIdMapping() : id(-1) {}
- ObjectIdMapping(const QString &name, int id)
- : name(name), id(id) {}
- QString name;
- int id;
- };
ContextGuard *idValues;
int idValueCount;
void setIdProperty(int, QObject *);
- void setIdPropertyData(const QVector<ObjectIdMapping> &);
+ void setIdPropertyData(const QHash<int, int> &);
// Linked contexts. this owns linkedContext.
QQmlContextData *linkedContext;
diff --git a/src/qml/qml/qqmlcontextwrapper.cpp b/src/qml/qml/qqmlcontextwrapper.cpp
index 0816bc05df..5844eab54f 100644
--- a/src/qml/qml/qqmlcontextwrapper.cpp
+++ b/src/qml/qml/qqmlcontextwrapper.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -53,43 +53,42 @@ using namespace QV4;
DEFINE_OBJECT_VTABLE(QmlContextWrapper);
-QmlContextWrapper::Data::Data(QV8Engine *engine, QQmlContextData *context, QObject *scopeObject, bool ownsContext)
- : Object::Data(QV8Engine::getV4(engine))
+Heap::QmlContextWrapper::QmlContextWrapper(QV4::ExecutionEngine *engine, QQmlContextData *context, QObject *scopeObject, bool ownsContext)
+ : Heap::Object(engine)
, readOnly(true)
, ownsContext(ownsContext)
, isNullWrapper(false)
, context(context)
, scopeObject(scopeObject)
+ , idObjectsWrapper(Q_NULLPTR)
{
- setVTable(staticVTable());
}
-QmlContextWrapper::Data::~Data()
+Heap::QmlContextWrapper::~QmlContextWrapper()
{
if (context && ownsContext)
context->destroy();
}
-ReturnedValue QmlContextWrapper::qmlScope(QV8Engine *v8, QQmlContextData *ctxt, QObject *scope)
+ReturnedValue QmlContextWrapper::qmlScope(ExecutionEngine *v4, QQmlContextData *ctxt, QObject *scope)
{
- ExecutionEngine *v4 = QV8Engine::getV4(v8);
Scope valueScope(v4);
- Scoped<QmlContextWrapper> w(valueScope, v4->memoryManager->alloc<QmlContextWrapper>(v8, ctxt, scope));
+ Scoped<QmlContextWrapper> w(valueScope, v4->memoryManager->alloc<QmlContextWrapper>(v4, ctxt, scope));
return w.asReturnedValue();
}
-ReturnedValue QmlContextWrapper::urlScope(QV8Engine *v8, const QUrl &url)
+ReturnedValue QmlContextWrapper::urlScope(ExecutionEngine *v4, const QUrl &url)
{
- ExecutionEngine *v4 = QV8Engine::getV4(v8);
Scope scope(v4);
QQmlContextData *context = new QQmlContextData;
- context->url = url;
+ context->baseUrl = url;
+ context->baseUrlString = url.toString();
context->isInternal = true;
context->isJSContext = true;
- Scoped<QmlContextWrapper> w(scope, v4->memoryManager->alloc<QmlContextWrapper>(v8, context, (QObject*)0, true));
+ Scoped<QmlContextWrapper> w(scope, v4->memoryManager->alloc<QmlContextWrapper>(v4, context, (QObject*)0, true));
w->d()->isNullWrapper = true;
return w.asReturnedValue();
}
@@ -97,28 +96,28 @@ ReturnedValue QmlContextWrapper::urlScope(QV8Engine *v8, const QUrl &url)
QQmlContextData *QmlContextWrapper::callingContext(ExecutionEngine *v4)
{
Scope scope(v4);
- QV4::Scoped<QmlContextWrapper> c(scope, v4->qmlContextObject(), QV4::Scoped<QmlContextWrapper>::Cast);
+ QV4::Scoped<QmlContextWrapper> c(scope, v4->qmlContextObject());
return !!c ? c->getContext() : 0;
}
-QQmlContextData *QmlContextWrapper::getContext(const ValueRef value)
+QQmlContextData *QmlContextWrapper::getContext(const Value &value)
{
- QV4::ExecutionEngine *v4 = value->engine();
- if (!v4)
+ if (!value.isObject())
return 0;
+ QV4::ExecutionEngine *v4 = value.asObject()->engine();
Scope scope(v4);
QV4::Scoped<QmlContextWrapper> c(scope, value);
return c ? c->getContext() : 0;
}
-void QmlContextWrapper::takeContextOwnership(const ValueRef qmlglobal)
+void QmlContextWrapper::takeContextOwnership(const Value &qmlglobal)
{
- QV4::ExecutionEngine *v4 = qmlglobal->engine();
- Q_ASSERT(v4);
+ Q_ASSERT(qmlglobal.isObject());
+ QV4::ExecutionEngine *v4 = qmlglobal.asObject()->engine();
Scope scope(v4);
QV4::Scoped<QmlContextWrapper> c(scope, qmlglobal);
Q_ASSERT(c);
@@ -129,18 +128,18 @@ void QmlContextWrapper::takeContextOwnership(const ValueRef qmlglobal)
ReturnedValue QmlContextWrapper::get(Managed *m, String *name, bool *hasProperty)
{
Q_ASSERT(m->as<QmlContextWrapper>());
- QV4::ExecutionEngine *v4 = m->engine();
- QV4::Scope scope(v4);
QmlContextWrapper *resource = static_cast<QmlContextWrapper *>(m);
+ QV4::ExecutionEngine *v4 = resource->engine();
+ QV4::Scope scope(v4);
// In V8 the JS global object would come _before_ the QML global object,
// so simulate that here.
bool hasProp;
- QV4::ScopedValue result(scope, v4->globalObject->get(name, &hasProp));
+ QV4::ScopedValue result(scope, v4->globalObject()->get(name, &hasProp));
if (hasProp) {
if (hasProperty)
*hasProperty = hasProp;
- return result.asReturnedValue();
+ return result->asReturnedValue();
}
if (resource->d()->isNullWrapper)
@@ -153,7 +152,7 @@ ReturnedValue QmlContextWrapper::get(Managed *m, String *name, bool *hasProperty
if (hasProp) {
if (hasProperty)
*hasProperty = hasProp;
- return result.asReturnedValue();
+ return result->asReturnedValue();
}
// Its possible we could delay the calculation of the "actual" context (in the case
@@ -164,7 +163,7 @@ ReturnedValue QmlContextWrapper::get(Managed *m, String *name, bool *hasProperty
if (!context) {
if (hasProperty)
*hasProperty = true;
- return result.asReturnedValue();
+ return result->asReturnedValue();
}
// Search type (attached property/enum/imported scripts) names
@@ -175,8 +174,6 @@ ReturnedValue QmlContextWrapper::get(Managed *m, String *name, bool *hasProperty
// context = context->parent
// }
- QV8Engine *engine = v4->v8Engine;
-
QObject *scopeObject = resource->getScopeObject();
if (context->imports && name->startsWithUpper()) {
@@ -187,12 +184,12 @@ ReturnedValue QmlContextWrapper::get(Managed *m, String *name, bool *hasProperty
if (hasProperty)
*hasProperty = true;
if (r.scriptIndex != -1) {
- QV4::ScopedObject scripts(scope, context->importedScripts);
+ QV4::ScopedObject scripts(scope, context->importedScripts.valueRef());
return scripts->getIndexed(r.scriptIndex);
} else if (r.type) {
- return QmlTypeWrapper::create(engine, scopeObject, r.type);
+ return QmlTypeWrapper::create(v4, scopeObject, r.type);
} else if (r.importNamespace) {
- return QmlTypeWrapper::create(engine, scopeObject, context->imports, r.importNamespace);
+ return QmlTypeWrapper::create(v4, scopeObject, context->imports, r.importNamespace);
}
Q_ASSERT(!"Unreachable");
}
@@ -200,12 +197,13 @@ ReturnedValue QmlContextWrapper::get(Managed *m, String *name, bool *hasProperty
// Fall through
}
- QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine->engine());
+ QQmlEnginePrivate *ep = QQmlEnginePrivate::get(v4->qmlEngine());
while (context) {
// Search context properties
- if (context->propertyNames.count()) {
- int propertyIdx = context->propertyNames.value(name);
+ const QV4::IdentifierHash<int> &properties = context->propertyNames();
+ if (properties.count()) {
+ int propertyIdx = properties.value(name);
if (propertyIdx != -1) {
@@ -229,9 +227,9 @@ ReturnedValue QmlContextWrapper::get(Managed *m, String *name, bool *hasProperty
QQmlListProperty<QObject> prop(context->asQQmlContext(), (void*) qintptr(propertyIdx),
QQmlContextPrivate::context_count,
QQmlContextPrivate::context_at);
- return QmlListWrapper::create(engine, prop, qMetaTypeId<QQmlListProperty<QObject> >());
+ return QmlListWrapper::create(v4, prop, qMetaTypeId<QQmlListProperty<QObject> >());
} else {
- return engine->fromVariant(cp->propertyValues.at(propertyIdx));
+ return scope.engine->fromVariant(cp->propertyValues.at(propertyIdx));
}
}
}
@@ -240,12 +238,12 @@ ReturnedValue QmlContextWrapper::get(Managed *m, String *name, bool *hasProperty
// Search scope object
if (scopeObject) {
bool hasProp = false;
- QV4::ScopedValue result(scope, QV4::QObjectWrapper::getQmlProperty(v4->currentContext(), context, scopeObject,
+ QV4::ScopedValue result(scope, QV4::QObjectWrapper::getQmlProperty(v4, context, scopeObject,
name, QV4::QObjectWrapper::CheckRevision, &hasProp));
if (hasProp) {
if (hasProperty)
*hasProperty = true;
- return result.asReturnedValue();
+ return result->asReturnedValue();
}
}
scopeObject = 0;
@@ -254,11 +252,11 @@ ReturnedValue QmlContextWrapper::get(Managed *m, String *name, bool *hasProperty
// Search context object
if (context->contextObject) {
bool hasProp = false;
- result = QV4::QObjectWrapper::getQmlProperty(v4->currentContext(), context, context->contextObject, name, QV4::QObjectWrapper::CheckRevision, &hasProp);
+ result = QV4::QObjectWrapper::getQmlProperty(v4, context, context->contextObject, name, QV4::QObjectWrapper::CheckRevision, &hasProp);
if (hasProp) {
if (hasProperty)
*hasProperty = true;
- return result.asReturnedValue();
+ return result->asReturnedValue();
}
}
@@ -267,17 +265,18 @@ ReturnedValue QmlContextWrapper::get(Managed *m, String *name, bool *hasProperty
expressionContext->unresolvedNames = true;
- return Primitive::undefinedValue().asReturnedValue();
+ return Encode::undefined();
}
-void QmlContextWrapper::put(Managed *m, String *name, const ValueRef value)
+void QmlContextWrapper::put(Managed *m, String *name, const Value &value)
{
Q_ASSERT(m->as<QmlContextWrapper>());
- ExecutionEngine *v4 = m->engine();
+ QmlContextWrapper *resource = static_cast<QmlContextWrapper *>(m);
+ ExecutionEngine *v4 = resource->engine();
QV4::Scope scope(v4);
if (scope.hasException())
return;
- QV4::Scoped<QmlContextWrapper> wrapper(scope, static_cast<QmlContextWrapper *>(m));
+ QV4::Scoped<QmlContextWrapper> wrapper(scope, resource);
PropertyAttributes attrs;
Property *pd = wrapper->__getOwnProperty__(name, &attrs);
@@ -290,8 +289,8 @@ void QmlContextWrapper::put(Managed *m, String *name, const ValueRef value)
if (wrapper && wrapper->d()->readOnly) {
QString error = QLatin1String("Invalid write to global property \"") + name->toQString() +
QLatin1Char('"');
- Scoped<String> e(scope, v4->currentContext()->d()->engine->newString(error));
- v4->currentContext()->throwError(e);
+ ScopedString e(scope, v4->currentContext()->engine->newString(error));
+ v4->throwError(e);
return;
}
@@ -312,19 +311,20 @@ void QmlContextWrapper::put(Managed *m, String *name, const ValueRef value)
QObject *scopeObject = wrapper->getScopeObject();
while (context) {
+ const QV4::IdentifierHash<int> &properties = context->propertyNames();
// Search context properties
- if (context->propertyNames.count() && -1 != context->propertyNames.value(name))
+ if (properties.count() && properties.value(name) != -1)
return;
// Search scope object
if (scopeObject &&
- QV4::QObjectWrapper::setQmlProperty(v4->currentContext(), context, scopeObject, name, QV4::QObjectWrapper::CheckRevision, value))
+ QV4::QObjectWrapper::setQmlProperty(v4, context, scopeObject, name, QV4::QObjectWrapper::CheckRevision, value))
return;
scopeObject = 0;
// Search context object
if (context->contextObject &&
- QV4::QObjectWrapper::setQmlProperty(v4->currentContext(), context, context->contextObject, name, QV4::QObjectWrapper::CheckRevision, value))
+ QV4::QObjectWrapper::setQmlProperty(v4, context, context->contextObject, name, QV4::QObjectWrapper::CheckRevision, value))
return;
context = context->parent;
@@ -335,23 +335,18 @@ void QmlContextWrapper::put(Managed *m, String *name, const ValueRef value)
if (wrapper->d()->readOnly) {
QString error = QLatin1String("Invalid write to global property \"") + name->toQString() +
QLatin1Char('"');
- v4->currentContext()->throwError(error);
+ v4->throwError(error);
return;
}
Object::put(m, name, value);
}
-void QmlContextWrapper::destroy(Managed *that)
+void QmlContextWrapper::markObjects(Heap::Base *m, ExecutionEngine *engine)
{
- static_cast<QmlContextWrapper *>(that)->d()->~Data();
-}
-
-void QmlContextWrapper::markObjects(Managed *m, ExecutionEngine *engine)
-{
- QmlContextWrapper *This = static_cast<QmlContextWrapper*>(m);
- if (This->d()->idObjectsWrapper)
- This->d()->idObjectsWrapper->mark(engine);
+ QmlContextWrapper::Data *This = static_cast<QmlContextWrapper::Data *>(m);
+ if (This->idObjectsWrapper)
+ This->idObjectsWrapper->mark(engine);
Object::markObjects(m, engine);
}
@@ -360,7 +355,7 @@ void QmlContextWrapper::registerQmlDependencies(ExecutionEngine *engine, const C
// Let the caller check and avoid the function call :)
Q_ASSERT(compiledFunction->hasQmlDependencies());
- QQmlEnginePrivate *ep = engine->v8Engine->engine() ? QQmlEnginePrivate::get(engine->v8Engine->engine()) : 0;
+ QQmlEnginePrivate *ep = engine->qmlEngine() ? QQmlEnginePrivate::get(engine->qmlEngine()) : 0;
if (!ep)
return;
QQmlEnginePrivate::PropertyCapture *capture = ep->propertyCapture;
@@ -368,7 +363,7 @@ void QmlContextWrapper::registerQmlDependencies(ExecutionEngine *engine, const C
return;
QV4::Scope scope(engine);
- QV4::Scoped<QmlContextWrapper> contextWrapper(scope, engine->qmlContextObject(), QV4::Scoped<QmlContextWrapper>::Cast);
+ QV4::Scoped<QmlContextWrapper> contextWrapper(scope, engine->qmlContextObject());
QQmlContextData *qmlContext = contextWrapper->getContext();
const quint32 *idObjectDependency = compiledFunction->qmlIdObjectDependencyTable();
@@ -402,14 +397,12 @@ ReturnedValue QmlContextWrapper::idObjectsArray()
{
if (!d()->idObjectsWrapper) {
ExecutionEngine *v4 = engine();
- Scope scope(v4);
- Scoped<QQmlIdObjectsArray> a(scope, v4->memoryManager->alloc<QQmlIdObjectsArray>(v4, this));
- d()->idObjectsWrapper = a.getPointer();
+ d()->idObjectsWrapper = v4->memoryManager->alloc<QQmlIdObjectsArray>(v4, this);
}
return d()->idObjectsWrapper->asReturnedValue();
}
-ReturnedValue QmlContextWrapper::qmlSingletonWrapper(QV8Engine *v8, String *name)
+ReturnedValue QmlContextWrapper::qmlSingletonWrapper(ExecutionEngine *v4, String *name)
{
if (!d()->context->imports)
return Encode::undefined();
@@ -419,30 +412,31 @@ ReturnedValue QmlContextWrapper::qmlSingletonWrapper(QV8Engine *v8, String *name
Q_ASSERT(r.isValid());
Q_ASSERT(r.type);
Q_ASSERT(r.type->isSingleton());
- Q_ASSERT(v8);
+ Q_ASSERT(v4);
- QQmlEngine *e = v8->engine();
+ QQmlEngine *e = v4->qmlEngine();
QQmlType::SingletonInstanceInfo *siinfo = r.type->singletonInstanceInfo();
siinfo->init(e);
if (QObject *qobjectSingleton = siinfo->qobjectApi(e))
return QV4::QObjectWrapper::wrap(engine(), qobjectSingleton);
- return QJSValuePrivate::get(siinfo->scriptApi(e))->getValue(engine());
+ return QJSValuePrivate::convertedToValue(engine(), siinfo->scriptApi(e));
}
DEFINE_OBJECT_VTABLE(QQmlIdObjectsArray);
-QQmlIdObjectsArray::Data::Data(ExecutionEngine *engine, QmlContextWrapper *contextWrapper)
- : Object::Data(engine)
- , contextWrapper(contextWrapper)
+Heap::QQmlIdObjectsArray::QQmlIdObjectsArray(ExecutionEngine *engine, QV4::QmlContextWrapper *contextWrapper)
+ : Heap::Object(engine)
+ , contextWrapper(contextWrapper->d())
{
- setVTable(staticVTable());
}
ReturnedValue QQmlIdObjectsArray::getIndexed(Managed *m, uint index, bool *hasProperty)
{
- QQmlIdObjectsArray *This = static_cast<QQmlIdObjectsArray*>(m);
- QQmlContextData *context = This->d()->contextWrapper->getContext();
+ Scope scope(static_cast<QV4::QQmlIdObjectsArray*>(m)->engine());
+ Scoped<QQmlIdObjectsArray> This(scope, static_cast<QV4::QQmlIdObjectsArray*>(m));
+ Scoped<QmlContextWrapper> contextWrapper(scope, This->d()->contextWrapper);
+ QQmlContextData *context = contextWrapper->getContext();
if (!context) {
if (hasProperty)
*hasProperty = false;
@@ -457,18 +451,17 @@ ReturnedValue QQmlIdObjectsArray::getIndexed(Managed *m, uint index, bool *hasPr
if (hasProperty)
*hasProperty = true;
- ExecutionEngine *v4 = m->engine();
- QQmlEnginePrivate *ep = v4->v8Engine->engine() ? QQmlEnginePrivate::get(v4->v8Engine->engine()) : 0;
+ QQmlEnginePrivate *ep = scope.engine->qmlEngine() ? QQmlEnginePrivate::get(scope.engine->qmlEngine()) : 0;
if (ep)
ep->captureProperty(&context->idValues[index].bindings);
return QObjectWrapper::wrap(This->engine(), context->idValues[index].data());
}
-void QQmlIdObjectsArray::markObjects(Managed *that, ExecutionEngine *engine)
+void QQmlIdObjectsArray::markObjects(Heap::Base *that, ExecutionEngine *engine)
{
- QQmlIdObjectsArray *This = static_cast<QQmlIdObjectsArray*>(that);
- This->d()->contextWrapper->mark(engine);
+ QQmlIdObjectsArray::Data *This = static_cast<QQmlIdObjectsArray::Data *>(that);
+ This->contextWrapper->mark(engine);
Object::markObjects(that, engine);
}
diff --git a/src/qml/qml/qqmlcontextwrapper_p.h b/src/qml/qml/qqmlcontextwrapper_p.h
index cae6800f48..52d8677103 100644
--- a/src/qml/qml/qqmlcontextwrapper_p.h
+++ b/src/qml/qml/qqmlcontextwrapper_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -61,57 +61,65 @@ namespace CompiledData {
struct Function;
}
+struct QmlContextWrapper;
+
+namespace Heap {
+
struct QQmlIdObjectsArray;
+struct QmlContextWrapper : Object {
+ QmlContextWrapper(ExecutionEngine *engine, QQmlContextData *context, QObject *scopeObject, bool ownsContext = false);
+ ~QmlContextWrapper();
+ bool readOnly;
+ bool ownsContext;
+ bool isNullWrapper;
+
+ QQmlGuardedContextData context;
+ QPointer<QObject> scopeObject;
+ QQmlIdObjectsArray *idObjectsWrapper;
+};
+
+struct QQmlIdObjectsArray : Object {
+ QQmlIdObjectsArray(QV4::ExecutionEngine *engine, QV4::QmlContextWrapper *contextWrapper);
+ QmlContextWrapper *contextWrapper;
+};
+
+}
+
struct Q_QML_EXPORT QmlContextWrapper : Object
{
- struct Data : Object::Data {
- Data(QV8Engine *engine, QQmlContextData *context, QObject *scopeObject, bool ownsContext = false);
- ~Data();
- bool readOnly;
- bool ownsContext;
- bool isNullWrapper;
-
- QQmlGuardedContextData context;
- QPointer<QObject> scopeObject;
- QQmlIdObjectsArray *idObjectsWrapper;
- };
- V4_OBJECT(Object)
-
- static ReturnedValue qmlScope(QV8Engine *e, QQmlContextData *ctxt, QObject *scope);
- static ReturnedValue urlScope(QV8Engine *e, const QUrl &);
+ V4_OBJECT2(QmlContextWrapper, Object)
+ V4_NEEDS_DESTROY
+
+ static ReturnedValue qmlScope(ExecutionEngine *e, QQmlContextData *ctxt, QObject *scope);
+ static ReturnedValue urlScope(ExecutionEngine *v4, const QUrl &);
static QQmlContextData *callingContext(ExecutionEngine *v4);
- static void takeContextOwnership(const ValueRef qmlglobal);
+ static void takeContextOwnership(const Value &qmlglobal);
inline QObject *getScopeObject() const { return d()->scopeObject; }
inline QQmlContextData *getContext() const { return d()->context; }
- static QQmlContextData *getContext(const ValueRef value);
+ static QQmlContextData *getContext(const Value &value);
void setReadOnly(bool b) { d()->readOnly = b; }
static ReturnedValue get(Managed *m, String *name, bool *hasProperty);
- static void put(Managed *m, String *name, const ValueRef value);
- static void destroy(Managed *that);
- static void markObjects(Managed *m, ExecutionEngine *engine);
+ static void put(Managed *m, String *name, const Value &value);
+ static void markObjects(Heap::Base *m, ExecutionEngine *engine);
static void registerQmlDependencies(ExecutionEngine *context, const CompiledData::Function *compiledFunction);
ReturnedValue idObjectsArray();
- ReturnedValue qmlSingletonWrapper(QV8Engine *e, String *name);
+ ReturnedValue qmlSingletonWrapper(ExecutionEngine *e, String *name);
};
struct QQmlIdObjectsArray : public Object
{
- struct Data : Object::Data {
- Data(ExecutionEngine *engine, QmlContextWrapper *contextWrapper);
- QmlContextWrapper *contextWrapper;
- };
- V4_OBJECT(Object)
+ V4_OBJECT2(QQmlIdObjectsArray, Object)
static ReturnedValue getIndexed(Managed *m, uint index, bool *hasProperty);
- static void markObjects(Managed *that, ExecutionEngine *engine);
+ static void markObjects(Heap::Base *that, ExecutionEngine *engine);
};
diff --git a/src/qml/qml/qqmlcustomparser.cpp b/src/qml/qml/qqmlcustomparser.cpp
index 84840c4fda..ebca9d2718 100644
--- a/src/qml/qml/qqmlcustomparser.cpp
+++ b/src/qml/qml/qqmlcustomparser.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlcustomparser_p.h b/src/qml/qml/qqmlcustomparser_p.h
index 769a88d66c..88282b1bbc 100644
--- a/src/qml/qml/qqmlcustomparser_p.h
+++ b/src/qml/qml/qqmlcustomparser_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -100,7 +100,7 @@ protected:
private:
QList<QQmlError> exceptions;
- QQmlCustomParserCompilerBackend *compiler;
+ const QQmlCustomParserCompilerBackend *compiler;
Flags m_flags;
QBiPointer<const QQmlImports, QQmlTypeNameCache> imports;
friend class QQmlPropertyValidator;
diff --git a/src/qml/qml/qqmldata_p.h b/src/qml/qml/qqmldata_p.h
index 1a7cb92b49..04c42b638d 100644
--- a/src/qml/qml/qqmldata_p.h
+++ b/src/qml/qml/qqmldata_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -74,10 +74,10 @@ class Q_QML_PRIVATE_EXPORT QQmlData : public QAbstractDeclarativeData
public:
QQmlData()
: ownedByQml1(false), ownMemory(true), ownContext(false), indestructible(true), explicitIndestructibleSet(false),
- hasTaintedV8Object(false), isQueuedForDeletion(false), rootObjectInCreation(false),
- hasVMEMetaObject(false), parentFrozen(false), notifyList(0), context(0), outerContext(0),
- bindings(0), signalHandlers(0), nextContextObject(0), prevContextObject(0), bindingBitsSize(0), bindingBits(0),
- lineNumber(0), columnNumber(0), compiledData(0), deferredData(0), jsEngineId(0),
+ hasTaintedV4Object(false), isQueuedForDeletion(false), rootObjectInCreation(false),
+ hasVMEMetaObject(false), parentFrozen(false), bindingBitsSize(0), bindingBits(0), notifyList(0), context(0), outerContext(0),
+ bindings(0), signalHandlers(0), nextContextObject(0), prevContextObject(0),
+ lineNumber(0), columnNumber(0), jsEngineId(0), compiledData(0), deferredData(0),
propertyCache(0), guards(0), extendedData(0) {
init();
}
@@ -112,7 +112,7 @@ public:
quint32 ownContext:1;
quint32 indestructible:1;
quint32 explicitIndestructibleSet:1;
- quint32 hasTaintedV8Object:1;
+ quint32 hasTaintedV4Object:1;
quint32 isQueuedForDeletion:1;
/*
* rootObjectInCreation should be true only when creating top level CPP and QML objects,
@@ -123,6 +123,15 @@ public:
quint32 parentFrozen:1;
quint32 dummy:22;
+ // When bindingBitsSize < 32, we store the binding bit flags inside
+ // bindingBitsValue. When we need more than 32 bits, we allocated
+ // sufficient space and use bindingBits to point to it.
+ int bindingBitsSize;
+ union {
+ quint32 *bindingBits;
+ quint32 bindingBitsValue;
+ };
+
struct NotifyList {
quint64 connectionMask;
@@ -155,9 +164,6 @@ public:
QQmlData *nextContextObject;
QQmlData**prevContextObject;
- int bindingBitsSize;
- quint32 *bindingBits;
-
inline bool hasBindingBit(int) const;
void clearBindingBit(int);
void setBindingBit(QObject *obj, int);
@@ -169,6 +175,8 @@ public:
quint16 lineNumber;
quint16 columnNumber;
+ quint32 jsEngineId; // id of the engine that created the jsWrapper
+
struct DeferredData {
unsigned int deferredIdx;
QQmlCompiledData *compiledData;//Not always the same as the other compiledData
@@ -177,7 +185,6 @@ public:
QQmlCompiledData *compiledData;
DeferredData *deferredData;
- quint32 jsEngineId; // id of the engine that cerated the jsWrapper
QV4::WeakValue jsWrapper;
QQmlPropertyCache *propertyCache;
@@ -216,7 +223,7 @@ public:
static inline void flushPendingBinding(QObject *, int coreIndex);
- static void ensurePropertyCache(QQmlEngine *engine, QObject *object);
+ static void ensurePropertyCache(QJSEngine *engine, QObject *object);
private:
// For attachedProperties
@@ -260,19 +267,19 @@ QQmlNotifierEndpoint *QQmlData::notify(int index)
bool QQmlData::hasBindingBit(int coreIndex) const
{
int bit = coreIndex * 2;
- if (bindingBitsSize > bit)
- return bindingBits[bit / 32] & (1 << (bit % 32));
- else
- return false;
+
+ return bindingBitsSize > bit &&
+ ((bindingBitsSize == 32) ? (bindingBitsValue & (1 << bit)) :
+ (bindingBits[bit / 32] & (1 << (bit % 32))));
}
bool QQmlData::hasPendingBindingBit(int coreIndex) const
{
int bit = coreIndex * 2 + 1;
- if (bindingBitsSize > bit)
- return bindingBits[bit / 32] & (1 << (bit % 32));
- else
- return false;
+
+ return bindingBitsSize > bit &&
+ ((bindingBitsSize == 32) ? (bindingBitsValue & (1 << bit)) :
+ (bindingBits[bit / 32] & (1 << (bit % 32))));
}
void QQmlData::flushPendingBinding(QObject *o, int coreIndex)
diff --git a/src/qml/qml/qqmldirparser.cpp b/src/qml/qml/qqmldirparser.cpp
index 83e1c9c757..7f6310d58e 100644
--- a/src/qml/qml/qqmldirparser.cpp
+++ b/src/qml/qml/qqmldirparser.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -55,6 +55,19 @@ static int parseInt(const QStringRef &str, bool *ok)
return number;
}
+static bool parseVersion(const QString &str, int *major, int *minor)
+{
+ const int dotIndex = str.indexOf(QLatin1Char('.'));
+ if (dotIndex != -1 && str.indexOf(QLatin1Char('.'), dotIndex + 1) == -1) {
+ bool ok = false;
+ *major = parseInt(QStringRef(&str, 0, dotIndex), &ok);
+ if (ok)
+ *minor = parseInt(QStringRef(&str, dotIndex + 1, str.length() - dotIndex - 1), &ok);
+ return ok;
+ }
+ return false;
+}
+
QQmlDirParser::QQmlDirParser() : _designerSupported(false)
{
}
@@ -192,27 +205,14 @@ bool QQmlDirParser::parse(const QString &source)
} else {
// handle qmldir module listing case where singleton is defined in the following pattern:
// singleton TestSingletonType 2.0 TestSingletonType20.qml
- const QString &version = sections[2];
- const int dotIndex = version.indexOf(QLatin1Char('.'));
-
- if (dotIndex == -1) {
- reportError(lineNumber, 0, QLatin1String("expected '.'"));
- } else if (version.indexOf(QLatin1Char('.'), dotIndex + 1) != -1) {
- reportError(lineNumber, 0, QLatin1String("unexpected '.'"));
+ int major, minor;
+ if (parseVersion(sections[2], &major, &minor)) {
+ const QString &fileName = sections[3];
+ Component entry(sections[1], fileName, major, minor);
+ entry.singleton = true;
+ _components.insertMulti(entry.typeName, entry);
} else {
- bool validVersionNumber = false;
- const int majorVersion = parseInt(QStringRef(&version, 0, dotIndex), &validVersionNumber);
-
- if (validVersionNumber) {
- const int minorVersion = parseInt(QStringRef(&version, dotIndex+1, version.length()-dotIndex-1), &validVersionNumber);
-
- if (validVersionNumber) {
- const QString &fileName = sections[3];
- Component entry(sections[1], fileName, majorVersion, minorVersion);
- entry.singleton = true;
- _components.insertMulti(entry.typeName, entry);
- }
- }
+ reportError(lineNumber, 0, QStringLiteral("invalid version %1, expected <major>.<minor>").arg(sections[2]));
}
}
} else if (sections[0] == QLatin1String("typeinfo")) {
@@ -238,53 +238,33 @@ bool QQmlDirParser::parse(const QString &source)
continue;
}
- const QString &version = sections[2];
- const int dotIndex = version.indexOf(QLatin1Char('.'));
- bool validVersionNumber = false;
- const int majorVersion = parseInt(QStringRef(&version, 0, dotIndex), &validVersionNumber);
- if (validVersionNumber) {
- const int minorVersion = parseInt(QStringRef(&version, dotIndex+1, version.length()-dotIndex-1), &validVersionNumber);
-
- if (validVersionNumber) {
- Component entry(sections[1], QString(), majorVersion, minorVersion);
- entry.internal = true;
- _dependencies.insert(entry.typeName, entry);
- }
+ int major, minor;
+ if (parseVersion(sections[2], &major, &minor)) {
+ Component entry(sections[1], QString(), major, minor);
+ entry.internal = true;
+ _dependencies.insert(entry.typeName, entry);
} else {
- reportError(lineNumber, 0, QString(QLatin1String("invalid version %1")).arg(version));
+ reportError(lineNumber, 0, QStringLiteral("invalid version %1, expected <major>.<minor>").arg(sections[2]));
}
} 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);
} else if (sectionCount == 3) {
- const QString &version = sections[1];
- const int dotIndex = version.indexOf(QLatin1Char('.'));
-
- if (dotIndex == -1) {
- reportError(lineNumber, 0, QLatin1String("expected '.'"));
- } else if (version.indexOf(QLatin1Char('.'), dotIndex + 1) != -1) {
- reportError(lineNumber, 0, QLatin1String("unexpected '.'"));
- } else {
- bool validVersionNumber = false;
- const int majorVersion = parseInt(QStringRef(&version, 0, dotIndex), &validVersionNumber);
-
- if (validVersionNumber) {
- const int minorVersion = parseInt(QStringRef(&version, dotIndex+1, version.length()-dotIndex-1), &validVersionNumber);
-
- if (validVersionNumber) {
- const QString &fileName = sections[2];
-
- if (fileName.endsWith(QLatin1String(".js"))) {
- // A 'js' extension indicates a namespaced script import
- const Script entry(sections[0], fileName, majorVersion, minorVersion);
- _scripts.append(entry);
- } else {
- const Component entry(sections[0], fileName, majorVersion, minorVersion);
- _components.insertMulti(entry.typeName, entry);
- }
- }
+ int major, minor;
+ if (parseVersion(sections[1], &major, &minor)) {
+ const QString &fileName = sections[2];
+
+ if (fileName.endsWith(QLatin1String(".js"))) {
+ // A 'js' extension indicates a namespaced script import
+ const Script entry(sections[0], fileName, major, minor);
+ _scripts.append(entry);
+ } else {
+ const Component entry(sections[0], fileName, major, minor);
+ _components.insertMulti(entry.typeName, entry);
}
+ } else {
+ reportError(lineNumber, 0, QStringLiteral("invalid version %1, expected <major>.<minor>").arg(sections[1]));
}
} else {
reportError(lineNumber, 0,
@@ -314,17 +294,6 @@ bool QQmlDirParser::hasError() const
return false;
}
-#if defined(QT_BUILD_QMLDEVTOOLS_LIB) || defined(QT_QMLDEVTOOLS_LIB)
-QList<QQmlJS::DiagnosticMessage> QQmlDirParser::errors(const QString &uri) const
-{
- QList<QQmlJS::DiagnosticMessage> errors = _errors;
- for (int i = 0; i < errors.size(); ++i) {
- QQmlJS::DiagnosticMessage &msg = errors[i];
- msg.message.replace(QLatin1String("$$URI$$"), uri);
- }
- return errors;
-}
-#else
void QQmlDirParser::setError(const QQmlError &e)
{
_errors.clear();
@@ -348,7 +317,6 @@ QList<QQmlError> QQmlDirParser::errors(const QString &uri) const
}
return errors;
}
-#endif
QString QQmlDirParser::typeNamespace() const
{
diff --git a/src/qml/qml/qqmldirparser_p.h b/src/qml/qml/qqmldirparser_p.h
index bbe61dfb96..c2f47f49b6 100644
--- a/src/qml/qml/qqmldirparser_p.h
+++ b/src/qml/qml/qqmldirparser_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -49,7 +49,7 @@
#include <QtCore/QHash>
#include <QtCore/QDebug>
#include <private/qqmljsengine_p.h>
-#include <private/qtqmlglobal_p.h>
+#include <private/qv4global_p.h>
QT_BEGIN_NAMESPACE
@@ -66,12 +66,8 @@ public:
bool parse(const QString &source);
bool hasError() const;
-#if defined(QT_BUILD_QMLDEVTOOLS_LIB) || defined(QT_QMLDEVTOOLS_LIB)
- QList<QQmlJS::DiagnosticMessage> errors(const QString &uri) const;
-#else
void setError(const QQmlError &);
QList<QQmlError> errors(const QString &uri) const;
-#endif
QString typeNamespace() const;
void setTypeNamespace(const QString &s);
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index 610952440e..1f27e4ecb3 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -525,6 +525,34 @@ The following functions are also on the Qt object.
further details.
*/
+/*!
+ \qmlproperty object Qt::styleHints
+ \since 5.5
+
+ The \c styleHints object provides platform-specific style hints and settings.
+ See the QStyleHints documentation for further details.
+
+ \note The \c styleHints object is only available when using the Qt Quick module.
+
+ The following example uses the \c styleHints object to determine whether an
+ item should gain focus on mouse press or touch release:
+ \code
+ import QtQuick 2.4
+
+ MouseArea {
+ id: button
+
+ onPressed: {
+ if (!Qt.styleHints.setFocusOnTouchRelease)
+ button.forceActiveFocus()
+ }
+ onReleased: {
+ if (Qt.styleHints.setFocusOnTouchRelease)
+ button.forceActiveFocus()
+ }
+ }
+ \endcode
+*/
/*!
\qmlmethod object Qt::include(string url, jsobject callback)
@@ -555,19 +583,21 @@ the same object as is returned from the Qt.include() call.
QQmlEnginePrivate::QQmlEnginePrivate(QQmlEngine *e)
: propertyCapture(0), rootContext(0), isDebugging(false),
- profiler(0), outputWarningsToStdErr(true),
+ profiler(0), outputWarningsToMsgLog(true),
cleanup(0), erroredBindings(0), inProgressCreations(0),
workerScriptEngine(0),
activeObjectCreator(0),
networkAccessManager(0), networkAccessManagerFactory(0), urlInterceptor(0),
scarceResourcesRefCount(0), typeLoader(e), importDatabase(e), uniqueId(1),
- incubatorCount(0), incubationController(0), mutex(QMutex::Recursive)
+ incubatorCount(0), incubationController(0)
{
- useNewCompiler = true;
}
QQmlEnginePrivate::~QQmlEnginePrivate()
{
+ typedef QHash<QPair<QQmlType *, int>, QQmlPropertyCache *>::Iterator TypePropertyCacheIt;
+ typedef QHash<int, QQmlCompiledData *>::Iterator CompositeTypesIt;
+
if (inProgressCreations)
qWarning() << QQmlEngine::tr("There are still \"%1\" items in the process of being created at engine destruction.").arg(inProgressCreations);
@@ -585,12 +615,16 @@ QQmlEnginePrivate::~QQmlEnginePrivate()
if (incubationController) incubationController->d = 0;
incubationController = 0;
- for(QHash<const QMetaObject *, QQmlPropertyCache *>::Iterator iter = propertyCache.begin(); iter != propertyCache.end(); ++iter)
- (*iter)->release();
- for(QHash<QPair<QQmlType *, int>, QQmlPropertyCache *>::Iterator iter = typePropertyCache.begin(); iter != typePropertyCache.end(); ++iter)
+ for (TypePropertyCacheIt iter = typePropertyCache.begin(), end = typePropertyCache.end(); iter != end; ++iter)
(*iter)->release();
- for (QHash<int, QQmlCompiledData *>::Iterator iter = m_compositeTypes.begin(); iter != m_compositeTypes.end(); ++iter)
+ for (CompositeTypesIt iter = m_compositeTypes.begin(), end = m_compositeTypes.end(); iter != end; ++iter) {
iter.value()->isRegisteredWithEngine = false;
+
+ // since unregisterInternalCompositeType() will not be called in this
+ // case, we have to clean up the type registration manually
+ QMetaType::unregisterType(iter.value()->metaTypeId);
+ QMetaType::unregisterType(iter.value()->listMetaTypeId);
+ }
delete profiler;
}
@@ -1183,7 +1217,7 @@ void QQmlEngine::setBaseUrl(const QUrl &url)
bool QQmlEngine::outputWarningsToStandardError() const
{
Q_D(const QQmlEngine);
- return d->outputWarningsToStdErr;
+ return d->outputWarningsToMsgLog;
}
/*!
@@ -1199,7 +1233,7 @@ bool QQmlEngine::outputWarningsToStandardError() const
void QQmlEngine::setOutputWarningsToStandardError(bool enabled)
{
Q_D(QQmlEngine);
- d->outputWarningsToStdErr = enabled;
+ d->outputWarningsToMsgLog = enabled;
}
/*!
@@ -1451,9 +1485,42 @@ QQmlDebuggingEnabler::QQmlDebuggingEnabler(bool printWarning)
qDebug("QML debugging is enabled. Only use this in a safe environment.");
}
QQmlEnginePrivate::qml_debugging_enabled = true;
+#else
+ Q_UNUSED(printWarning);
#endif
}
+/*!
+ * \enum QQmlDebuggingEnabler::StartMode
+ *
+ * Defines the debug server's start behavior. You can interrupt QML engines starting while a debug
+ * client is connecting, in order to set breakpoints in or profile startup code.
+ *
+ * \value DoNotWaitForClient Run any QML engines as usual while the debug services are connecting.
+ * \value WaitForClient If a QML engine starts while the debug services are connecting,
+ * interrupt it until they are done.
+ */
+
+/*!
+ * Enables debugging for QML engines created after calling this function. The debug server will
+ * listen on \a port at \a hostName and block the QML engine until it receives a connection if
+ * \a mode is \c WaitForClient. If \a mode is not specified it won't block and if \a hostName is not
+ * specified it will listen on all available interfaces. You can only start one debug server at a
+ * time. A debug server may have already been started if the -qmljsdebugger= command line argument
+ * was given. This method returns \c true if a new debug server was successfully started, or
+ * \c false otherwise.
+ */
+bool QQmlDebuggingEnabler::startTcpDebugServer(int port, StartMode mode, const QString &hostName)
+{
+#ifndef QQML_NO_DEBUG_PROTOCOL
+ return QQmlDebugServer::enable(port, port, mode == WaitForClient, hostName);
+#else
+ Q_UNUSED(port);
+ Q_UNUSED(block);
+ Q_UNUSED(hostName);
+ return false;
+#endif
+}
class QQmlDataExtended {
public:
@@ -1640,7 +1707,7 @@ void QQmlData::destroyed(QObject *object)
signalHandler = next;
}
- if (bindingBits)
+ if (bindingBitsSize > 32)
free(bindingBits);
if (propertyCache)
@@ -1688,14 +1755,24 @@ void QQmlData::parentChanged(QObject *object, QObject *parent)
static void QQmlData_setBit(QQmlData *data, QObject *obj, int bit)
{
+ if (data->bindingBitsSize == 0 && bit < 32) {
+ data->bindingBitsSize = 32;
+ }
+
if (data->bindingBitsSize <= bit) {
int props = QQmlMetaObject(obj).propertyCount();
Q_ASSERT(bit < 2 * props);
int arraySize = (2 * props + 31) / 32;
- int oldArraySize = data->bindingBitsSize / 32;
+ Q_ASSERT(arraySize > 1);
+
+ // special handling for 32 here is to make sure we wipe the first byte
+ // when going from bindingBitsValue to bindingBits, and preserve the old
+ // set bits so we can restore them after the allocation
+ int oldArraySize = data->bindingBitsSize > 32 ? data->bindingBitsSize / 32 : 0;
+ quint32 oldValue = data->bindingBitsSize == 32 ? data->bindingBitsValue : 0;
- data->bindingBits = (quint32 *)realloc(data->bindingBits,
+ data->bindingBits = (quint32 *)realloc((data->bindingBitsSize == 32) ? 0 : data->bindingBits,
arraySize * sizeof(quint32));
memset(data->bindingBits + oldArraySize,
@@ -1703,15 +1780,27 @@ static void QQmlData_setBit(QQmlData *data, QObject *obj, int bit)
sizeof(quint32) * (arraySize - oldArraySize));
data->bindingBitsSize = arraySize * 32;
+
+ // reinstate bindingBitsValue after we dropped it
+ if (oldValue) {
+ memcpy(data->bindingBits, &oldValue, sizeof(oldValue));
+ }
}
- data->bindingBits[bit / 32] |= (1 << (bit % 32));
+ if (data->bindingBitsSize == 32)
+ data->bindingBitsValue |= (1 << (bit % 32));
+ else
+ data->bindingBits[bit / 32] |= (1 << (bit % 32));
}
static void QQmlData_clearBit(QQmlData *data, int bit)
{
- if (data->bindingBitsSize > bit)
- data->bindingBits[bit / 32] &= ~(1 << (bit % 32));
+ if (data->bindingBitsSize > bit) {
+ if (data->bindingBitsSize == 32)
+ data->bindingBitsValue &= ~(1 << (bit % 32));
+ else
+ data->bindingBits[bit / 32] &= ~(1 << (bit % 32));
+ }
}
void QQmlData::clearBindingBit(int coreIndex)
@@ -1734,13 +1823,13 @@ void QQmlData::setPendingBindingBit(QObject *obj, int coreIndex)
QQmlData_setBit(this, obj, coreIndex * 2 + 1);
}
-void QQmlData::ensurePropertyCache(QQmlEngine *engine, QObject *object)
+void QQmlData::ensurePropertyCache(QJSEngine *engine, QObject *object)
{
Q_ASSERT(engine);
QQmlData *ddata = QQmlData::get(object, /*create*/true);
if (ddata->propertyCache)
return;
- ddata->propertyCache = QQmlEnginePrivate::get(engine)->cache(object);
+ ddata->propertyCache = QJSEnginePrivate::get(engine)->cache(object);
if (ddata->propertyCache) ddata->propertyCache->addref();
}
@@ -1770,7 +1859,7 @@ void QQmlEnginePrivate::warning(const QQmlError &error)
{
Q_Q(QQmlEngine);
q->warnings(QList<QQmlError>() << error);
- if (outputWarningsToStdErr)
+ if (outputWarningsToMsgLog)
dumpwarning(error);
}
@@ -1778,7 +1867,7 @@ void QQmlEnginePrivate::warning(const QList<QQmlError> &errors)
{
Q_Q(QQmlEngine);
q->warnings(errors);
- if (outputWarningsToStdErr)
+ if (outputWarningsToMsgLog)
dumpwarning(errors);
}
@@ -1982,7 +2071,7 @@ void QQmlEngine::setPluginPathList(const QStringList &paths)
bool QQmlEngine::importPlugin(const QString &filePath, const QString &uri, QList<QQmlError> *errors)
{
Q_D(QQmlEngine);
- return d->importDatabase.importDynamicPlugin(filePath, uri, QString(), errors);
+ return d->importDatabase.importDynamicPlugin(filePath, uri, QString(), -1, errors);
}
/*!
@@ -2024,22 +2113,6 @@ QString QQmlEngine::offlineStoragePath() const
return d->offlineStoragePath;
}
-QQmlPropertyCache *QQmlEnginePrivate::createCache(const QMetaObject *mo)
-{
- Q_Q(QQmlEngine);
-
- if (!mo->superClass()) {
- QQmlPropertyCache *rv = new QQmlPropertyCache(q, mo);
- propertyCache.insert(mo, rv);
- return rv;
- } else {
- QQmlPropertyCache *super = cache(mo->superClass());
- QQmlPropertyCache *rv = super->copyAndAppend(q, mo);
- propertyCache.insert(mo, rv);
- return rv;
- }
-}
-
QQmlPropertyCache *QQmlEnginePrivate::createCache(QQmlType *type, int minorVersion,
QQmlError &error)
{
@@ -2155,7 +2228,7 @@ QObject *QQmlEnginePrivate::toQObject(const QVariant &v, bool *ok) const
int t = v.userType();
if (t == QMetaType::QObjectStar || m_compositeTypes.contains(t)) {
if (ok) *ok = true;
- return *(QObject **)(v.constData());
+ return *(QObject *const *)(v.constData());
} else {
return QQmlMetaType::toQObject(v, ok);
}
@@ -2246,16 +2319,12 @@ void QQmlEnginePrivate::registerInternalCompositeType(QQmlCompiledData *data)
QByteArray lst = "QQmlListProperty<" + name + '>';
int ptr_type = QMetaType::registerNormalizedType(ptr,
- QtMetaTypePrivate::QMetaTypeFunctionHelper<QObject*>::Delete,
- QtMetaTypePrivate::QMetaTypeFunctionHelper<QObject*>::Create,
QtMetaTypePrivate::QMetaTypeFunctionHelper<QObject*>::Destruct,
QtMetaTypePrivate::QMetaTypeFunctionHelper<QObject*>::Construct,
sizeof(QObject*),
static_cast<QFlags<QMetaType::TypeFlag> >(QtPrivate::QMetaTypeTypeFlags<QObject*>::Flags),
0);
int lst_type = QMetaType::registerNormalizedType(lst,
- QtMetaTypePrivate::QMetaTypeFunctionHelper<QQmlListProperty<QObject> >::Delete,
- QtMetaTypePrivate::QMetaTypeFunctionHelper<QQmlListProperty<QObject> >::Create,
QtMetaTypePrivate::QMetaTypeFunctionHelper<QQmlListProperty<QObject> >::Destruct,
QtMetaTypePrivate::QMetaTypeFunctionHelper<QQmlListProperty<QObject> >::Construct,
sizeof(QQmlListProperty<QObject>),
@@ -2281,6 +2350,9 @@ void QQmlEnginePrivate::unregisterInternalCompositeType(QQmlCompiledData *data)
Locker locker(this);
m_qmlLists.remove(lst_type);
m_compositeTypes.remove(ptr_type);
+
+ QMetaType::unregisterType(ptr_type);
+ QMetaType::unregisterType(lst_type);
}
bool QQmlEnginePrivate::isTypeLoaded(const QUrl &url) const
diff --git a/src/qml/qml/qqmlengine.h b/src/qml/qml/qqmlengine.h
index 1de68ce573..df673c1fd5 100644
--- a/src/qml/qml/qqmlengine.h
+++ b/src/qml/qml/qqmlengine.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -78,7 +78,6 @@ class QQmlExpression;
class QQmlContext;
class QQmlType;
class QUrl;
-class QScriptContext;
class QNetworkAccessManager;
class QQmlNetworkAccessManagerFactory;
class QQmlIncubationController;
diff --git a/src/qml/qml/qqmlengine_p.h b/src/qml/qml/qqmlengine_p.h
index f19bfc84b3..f1fbad3cf8 100644
--- a/src/qml/qml/qqmlengine_p.h
+++ b/src/qml/qml/qqmlengine_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -138,11 +138,10 @@ public:
QQmlContext *rootContext;
bool isDebugging;
- bool useNewCompiler;
QQmlProfiler *profiler;
void enableProfiler();
- bool outputWarningsToStdErr;
+ bool outputWarningsToMsgLog;
// Registered cleanup handlers
QQmlCleanup *cleanup;
@@ -209,9 +208,8 @@ public:
inline static void deleteInEngineThread(QQmlEngine *, T *);
// These methods may be called from the loader thread
- inline QQmlPropertyCache *cache(QObject *obj);
- inline QQmlPropertyCache *cache(const QMetaObject *);
inline QQmlPropertyCache *cache(QQmlType *, int, QQmlError &error);
+ using QJSEnginePrivate::cache;
// These methods may be called from the loader thread
bool isQObject(int);
@@ -261,40 +259,13 @@ public:
static bool qml_debugging_enabled;
mutable QMutex networkAccessManagerMutex;
- mutable QMutex mutex;
private:
- // Locker locks the QQmlEnginePrivate data structures for read and write, if necessary.
- // Currently, locking is only necessary if the threaded loader is running concurrently. If it is
- // either idle, or is running with the main thread blocked, no locking is necessary. This way
- // we only pay for locking when we have to.
- // Consequently, this class should only be used to protect simple accesses or modifications of the
- // QQmlEnginePrivate structures or operations that can be guaranteed not to start activity
- // on the loader thread.
- // The Locker API is identical to QMutexLocker. Locker reuses the QQmlEnginePrivate::mutex
- // QMutex instance and multiple Lockers are recursive in the same thread.
- class Locker
- {
- public:
- inline Locker(const QQmlEngine *);
- inline Locker(const QQmlEnginePrivate *);
- inline ~Locker();
-
- inline void unlock();
- inline void relock();
-
- private:
- const QQmlEnginePrivate *m_ep;
- quint32 m_locked:1;
- };
-
// Must be called locked
- QQmlPropertyCache *createCache(const QMetaObject *);
QQmlPropertyCache *createCache(QQmlType *, int, QQmlError &error);
// These members must be protected by a QQmlEnginePrivate::Locker as they are required by
// the threaded loader. Only access them through their respective accessor methods.
- QHash<const QMetaObject *, QQmlPropertyCache *> propertyCache;
QHash<QPair<QQmlType *, int>, QQmlPropertyCache *> typePropertyCache;
QHash<int, int> m_qmlLists;
QHash<int, QQmlCompiledData *> m_compositeTypes;
@@ -307,40 +278,6 @@ private:
void doDeleteInEngineThread();
};
-QQmlEnginePrivate::Locker::Locker(const QQmlEngine *e)
-: m_ep(QQmlEnginePrivate::get(e))
-{
- relock();
-}
-
-QQmlEnginePrivate::Locker::Locker(const QQmlEnginePrivate *e)
-: m_ep(e), m_locked(false)
-{
- relock();
-}
-
-QQmlEnginePrivate::Locker::~Locker()
-{
- unlock();
-}
-
-void QQmlEnginePrivate::Locker::unlock()
-{
- if (m_locked) {
- m_ep->mutex.unlock();
- m_locked = false;
- }
-}
-
-void QQmlEnginePrivate::Locker::relock()
-{
- Q_ASSERT(!m_locked);
- if (m_ep->typeLoader.isConcurrent()) {
- m_ep->mutex.lock();
- m_locked = true;
- }
-}
-
/*!
Returns true if the calling thread is the QQmlEngine thread.
*/
@@ -405,52 +342,6 @@ void QQmlEnginePrivate::deleteInEngineThread(QQmlEngine *engine, T *value)
}
/*!
-Returns a QQmlPropertyCache for \a obj if one is available.
-
-If \a obj is null, being deleted or contains a dynamic meta object 0
-is returned.
-
-The returned cache is not referenced, so if it is to be stored, call addref().
-
-XXX thread There is a potential future race condition in this and all the cache()
-functions. As the QQmlPropertyCache is returned unreferenced, when called
-from the loader thread, it is possible that the cache will have been dereferenced
-and deleted before the loader thread has a chance to use or reference it. This
-can't currently happen as the cache holds a reference to the
-QQmlPropertyCache until the QQmlEngine is destroyed.
-*/
-QQmlPropertyCache *QQmlEnginePrivate::cache(QObject *obj)
-{
- if (!obj || QObjectPrivate::get(obj)->metaObject || QObjectPrivate::get(obj)->wasDeleted)
- return 0;
-
- Locker locker(this);
- const QMetaObject *mo = obj->metaObject();
- QQmlPropertyCache *rv = propertyCache.value(mo);
- if (!rv) rv = createCache(mo);
- return rv;
-}
-
-/*!
-Returns a QQmlPropertyCache for \a metaObject.
-
-As the cache is persisted for the life of the engine, \a metaObject must be
-a static "compile time" meta-object, or a meta-object that is otherwise known to
-exist for the lifetime of the QQmlEngine.
-
-The returned cache is not referenced, so if it is to be stored, call addref().
-*/
-QQmlPropertyCache *QQmlEnginePrivate::cache(const QMetaObject *metaObject)
-{
- Q_ASSERT(metaObject);
-
- Locker locker(this);
- QQmlPropertyCache *rv = propertyCache.value(metaObject);
- if (!rv) rv = createCache(metaObject);
- return rv;
-}
-
-/*!
Returns a QQmlPropertyCache for \a type with \a minorVersion.
The returned cache is not referenced, so if it is to be stored, call addref().
diff --git a/src/qml/qml/qqmlerror.cpp b/src/qml/qml/qqmlerror.cpp
index 5322fc2c87..adab3cd6c4 100644
--- a/src/qml/qml/qqmlerror.cpp
+++ b/src/qml/qml/qqmlerror.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -56,8 +56,8 @@ QT_BEGIN_NAMESPACE
file:///home/user/test.qml:7:8: Invalid property assignment: double expected
\endcode
- You can use qDebug() or qWarning() to output errors to the console. This method
- will attempt to open the file indicated by the error
+ You can use qDebug(), qInfo(), or qWarning() to output errors to the console.
+ This method will attempt to open the file indicated by the error
and include additional contextual information.
\code
file:///home/user/test.qml:7:8: Invalid property assignment: double expected
diff --git a/src/qml/qml/qqmlerror.h b/src/qml/qml/qqmlerror.h
index af0d7e13a0..46c27ad08b 100644
--- a/src/qml/qml/qqmlerror.h
+++ b/src/qml/qml/qqmlerror.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlexpression.cpp b/src/qml/qml/qqmlexpression.cpp
index 947b55f15d..35e0bc8c64 100644
--- a/src/qml/qml/qqmlexpression.cpp
+++ b/src/qml/qml/qqmlexpression.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -73,7 +73,8 @@ void QQmlExpressionPrivate::init(QQmlContextData *ctxt, const QString &expr, QOb
void QQmlExpressionPrivate::init(QQmlContextData *ctxt, QV4::Function *runtimeFunction, QObject *me)
{
expressionFunctionValid = true;
- function = QV4::QmlBindingWrapper::createQmlCallableForFunction(ctxt, me, runtimeFunction);
+ QV4::ExecutionEngine *engine = QQmlEnginePrivate::getV4Engine(ctxt->engine);
+ function.set(engine, QV4::QmlBindingWrapper::createQmlCallableForFunction(ctxt, me, runtimeFunction));
QQmlAbstractExpression::setContext(ctxt);
setScopeObject(me);
@@ -148,8 +149,8 @@ QQmlExpression::QQmlExpression(const QQmlScriptString &script, QQmlContext *ctxt
if (scriptPrivate->context) {
QQmlContextData *ctxtdata = QQmlContextData::get(scriptPrivate->context);
QQmlEnginePrivate *engine = QQmlEnginePrivate::get(scriptPrivate->context->engine());
- if (engine && ctxtdata && !ctxtdata->url.isEmpty() && ctxtdata->typeCompilationUnit) {
- d->url = ctxtdata->url.toString();
+ if (engine && ctxtdata && !ctxtdata->urlString().isEmpty() && ctxtdata->typeCompilationUnit) {
+ d->url = ctxtdata->urlString();
d->line = scriptPrivate->lineNumber;
d->column = scriptPrivate->columnNumber;
@@ -247,12 +248,13 @@ QV4::ReturnedValue QQmlExpressionPrivate::v4value(bool *isUndefined)
{
Q_Q(QQmlExpression);
+ QV4::ExecutionEngine *v4 = QQmlEnginePrivate::get(q->engine())->v4engine();
+
if (!expressionFunctionValid) {
- function = qmlBinding(context(), scopeObject(), expression, url, line, &qmlscope);
+ function.set(v4, qmlBinding(context(), scopeObject(), expression, url, line, &qmlscope));
expressionFunctionValid = true;
}
- QV4::ExecutionEngine *v4 = QQmlEnginePrivate::get(q->engine())->v4engine();
QV4::Scope scope(v4);
QV4::ScopedValue f(scope, function.value());
return evaluate(context(), f, isUndefined);
@@ -275,7 +277,8 @@ QVariant QQmlExpressionPrivate::value(bool *isUndefined)
{
QV4::Scope scope(QV8Engine::getV4(ep->v8engine()));
QV4::ScopedValue result(scope, v4value(isUndefined));
- rv = ep->v8engine()->toVariant(result, -1);
+ if (!hasError())
+ rv = scope.engine->toVariant(result, -1);
}
ep->dereferenceScarceResources(); // "release" scarce resources if top-level expression evaluation is complete.
@@ -361,7 +364,7 @@ int QQmlExpression::columnNumber() const
}
/*!
- Set the location of this expression to \a line of \a url. This information
+ Set the location of this expression to \a line and \a column of \a url. This information
is used by the script engine.
*/
void QQmlExpression::setSourceLocation(const QString &url, int line, int column)
diff --git a/src/qml/qml/qqmlexpression.h b/src/qml/qml/qqmlexpression.h
index 8b61f37ab6..408871cfc5 100644
--- a/src/qml/qml/qqmlexpression.h
+++ b/src/qml/qml/qqmlexpression.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlexpression_p.h b/src/qml/qml/qqmlexpression_p.h
index eee1b03665..d8da387878 100644
--- a/src/qml/qml/qqmlexpression_p.h
+++ b/src/qml/qml/qqmlexpression_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlextensioninterface.h b/src/qml/qml/qqmlextensioninterface.h
index b4d7430156..b64fbef1bf 100644
--- a/src/qml/qml/qqmlextensioninterface.h
+++ b/src/qml/qml/qqmlextensioninterface.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlextensionplugin.cpp b/src/qml/qml/qqmlextensionplugin.cpp
index e48224333c..7b560268ba 100644
--- a/src/qml/qml/qqmlextensionplugin.cpp
+++ b/src/qml/qml/qqmlextensionplugin.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlextensionplugin.h b/src/qml/qml/qqmlextensionplugin.h
index cedaf424de..879cc91abe 100644
--- a/src/qml/qml/qqmlextensionplugin.h
+++ b/src/qml/qml/qqmlextensionplugin.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlextensionplugin_p.h b/src/qml/qml/qqmlextensionplugin_p.h
index 81396c6053..8ade20bf22 100644
--- a/src/qml/qml/qqmlextensionplugin_p.h
+++ b/src/qml/qml/qqmlextensionplugin_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlfile.cpp b/src/qml/qml/qqmlfile.cpp
index 1aa350acc8..9f453ba65e 100644
--- a/src/qml/qml/qqmlfile.cpp
+++ b/src/qml/qml/qqmlfile.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -36,6 +36,7 @@
#include <QtCore/qurl.h>
#include <QtCore/qobject.h>
#include <QtCore/qmetaobject.h>
+#include <QtCore/qfile.h>
#include <private/qqmlengine_p.h>
#include <private/qqmlglobal_p.h>
@@ -45,7 +46,7 @@
\internal
-Supports file://, qrc:/, bundle:// uris and whatever QNetworkAccessManager supports.
+Supports file:// and qrc:/ uris and whatever QNetworkAccessManager supports.
*/
#define QQMLFILE_MAX_REDIRECT_RECURSION 16
@@ -54,7 +55,6 @@ QT_BEGIN_NAMESPACE
static char qrc_string[] = "qrc";
static char file_string[] = "file";
-static char bundle_string[] = "bundle";
#if defined(Q_OS_ANDROID)
static char assets_string[] = "assets";
@@ -100,9 +100,6 @@ public:
mutable QUrl url;
mutable QString urlString;
- QQmlBundleData *bundle;
- const QQmlBundle::FileEntry *file;
-
QByteArray data;
enum Error {
@@ -199,7 +196,7 @@ void QQmlFileNetworkReply::networkDownloadProgress(qint64 a, qint64 b)
}
QQmlFilePrivate::QQmlFilePrivate()
-: bundle(0), file(0), error(None), reply(0)
+: error(None), reply(0)
{
}
@@ -222,11 +219,7 @@ QQmlFile::QQmlFile(QQmlEngine *e, const QString &url)
QQmlFile::~QQmlFile()
{
- if (d->reply)
- delete d->reply;
- if (d->bundle)
- d->bundle->release();
-
+ delete d->reply;
delete d;
d = 0;
}
@@ -287,31 +280,17 @@ QString QQmlFile::error() const
qint64 QQmlFile::size() const
{
- if (d->file) return d->file->fileSize();
- else return d->data.size();
+ return d->data.size();
}
const char *QQmlFile::data() const
{
- if (d->file) return d->file->contents();
- else return d->data.constData();
+ return d->data.constData();
}
QByteArray QQmlFile::dataByteArray() const
{
- if (d->file) return QByteArray(d->file->contents(), d->file->fileSize());
- else return d->data;
-}
-
-QByteArray QQmlFile::metaData(const QString &name) const
-{
- if (d->file) {
- Q_ASSERT(d->bundle);
- const QQmlBundle::FileEntry *meta = d->bundle->link(d->file, name);
- if (meta)
- return QByteArray::fromRawData(meta->contents(), meta->fileSize());
- }
- return QByteArray();
+ return d->data;
}
void QQmlFile::load(QQmlEngine *engine, const QUrl &url)
@@ -321,25 +300,7 @@ void QQmlFile::load(QQmlEngine *engine, const QUrl &url)
clear();
d->url = url;
- if (isBundle(url)) {
- // Bundle
- QQmlEnginePrivate *p = QQmlEnginePrivate::get(engine);
- QQmlBundleData *bundle = p->typeLoader.getBundle(url.host());
-
- d->error = QQmlFilePrivate::NotFound;
-
- if (bundle) {
- QString filename = url.path().mid(1);
- const QQmlBundle::FileEntry *entry = bundle->find(filename);
- if (entry) {
- d->file = entry;
- d->bundle = bundle;
- d->bundle->addref();
- d->error = QQmlFilePrivate::None;
- }
- bundle->release();
- }
- } else if (isLocalFile(url)) {
+ if (isLocalFile(url)) {
QString lf = urlToLocalFileOrQrc(url);
if (!QQml_isFileCaseCorrect(lf)) {
@@ -366,33 +327,7 @@ void QQmlFile::load(QQmlEngine *engine, const QString &url)
d->urlString = url;
- if (isBundle(url)) {
- // Bundle
- QQmlEnginePrivate *p = QQmlEnginePrivate::get(engine);
-
- d->error = QQmlFilePrivate::NotFound;
-
- int index = url.indexOf(QLatin1Char('/'), 9);
- if (index == -1)
- return;
-
- QStringRef identifier(&url, 9, index - 9);
-
- QQmlBundleData *bundle = p->typeLoader.getBundle(identifier);
-
- d->error = QQmlFilePrivate::NotFound;
-
- if (bundle) {
- QString filename = url.mid(index);
- const QQmlBundle::FileEntry *entry = bundle->find(filename);
- if (entry) {
- d->data = QByteArray(entry->contents(), entry->fileSize());
- d->error = QQmlFilePrivate::None;
- }
- bundle->release();
- }
-
- } else if (isLocalFile(url)) {
+ if (isLocalFile(url)) {
QString lf = urlToLocalFileOrQrc(url);
if (!QQml_isFileCaseCorrect(lf)) {
@@ -419,9 +354,6 @@ void QQmlFile::clear()
d->url = QUrl();
d->urlString = QString();
d->data = QByteArray();
- if (d->bundle) d->bundle->release();
- d->bundle = 0;
- d->file = 0;
d->error = QQmlFilePrivate::None;
}
@@ -477,7 +409,7 @@ bool QQmlFile::connectDownloadProgress(QObject *object, int method)
/*!
Returns true if QQmlFile will open \a url synchronously.
-Synchronous urls have a qrc:/, file://, or bundle:// scheme.
+Synchronous urls have a qrc:/ or file:// scheme.
\note On Android, urls with assets:/ scheme are also considered synchronous.
*/
@@ -486,7 +418,6 @@ bool QQmlFile::isSynchronous(const QUrl &url)
QString scheme = url.scheme();
if ((scheme.length() == 4 && 0 == scheme.compare(QLatin1String(file_string), Qt::CaseInsensitive)) ||
- (scheme.length() == 6 && 0 == scheme.compare(QLatin1String(bundle_string), Qt::CaseInsensitive)) ||
(scheme.length() == 3 && 0 == scheme.compare(QLatin1String(qrc_string), Qt::CaseInsensitive))) {
return true;
@@ -503,7 +434,7 @@ bool QQmlFile::isSynchronous(const QUrl &url)
/*!
Returns true if QQmlFile will open \a url synchronously.
-Synchronous urls have a qrc:/, file://, or bundle:// scheme.
+Synchronous urls have a qrc:/ or file:// scheme.
\note On Android, urls with assets:/ scheme are also considered synchronous.
*/
@@ -520,12 +451,6 @@ bool QQmlFile::isSynchronous(const QString &url)
url.startsWith(QLatin1String(file_string), Qt::CaseInsensitive) &&
url[4] == QLatin1Char(':') && url[5] == QLatin1Char('/') && url[6] == QLatin1Char('/');
- } else if (f == QLatin1Char('b') || f == QLatin1Char('B')) {
-
- return url.length() >= 9 /* bundle:// */ &&
- url.startsWith(QLatin1String(bundle_string), Qt::CaseInsensitive) &&
- url[6] == QLatin1Char(':') && url[7] == QLatin1Char('/') && url[8] == QLatin1Char('/');
-
} else if (f == QLatin1Char('q') || f == QLatin1Char('Q')) {
return url.length() >= 5 /* qrc:/ */ &&
@@ -547,29 +472,6 @@ bool QQmlFile::isSynchronous(const QString &url)
}
/*!
-Returns true if \a url is a bundle.
-
-Bundle urls have a bundle:// scheme.
-*/
-bool QQmlFile::isBundle(const QString &url)
-{
- return url.length() >= 9 && url.startsWith(QLatin1String(bundle_string), Qt::CaseInsensitive) &&
- url[6] == QLatin1Char(':') && url[7] == QLatin1Char('/') && url[8] == QLatin1Char('/');
-}
-
-/*!
-Returns true if \a url is a bundle.
-
-Bundle urls have a bundle:// scheme.
-*/
-bool QQmlFile::isBundle(const QUrl &url)
-{
- QString scheme = url.scheme();
-
- return scheme.length() == 6 && 0 == scheme.compare(QLatin1String(bundle_string), Qt::CaseInsensitive);
-}
-
-/*!
Returns true if \a url is a local file that can be opened with QFile.
Local file urls have either a qrc:/ or file:// scheme.
@@ -688,162 +590,6 @@ QString QQmlFile::urlToLocalFileOrQrc(const QString& url)
return toLocalFile(url);
}
-bool QQmlFile::bundleDirectoryExists(const QString &dir, QQmlEngine *e)
-{
- if (!isBundle(dir))
- return false;
-
- int index = dir.indexOf(QLatin1Char('/'), 9);
-
- if (index == -1 && dir.length() > 9) // We accept "bundle://<blah>" with no extra path
- index = dir.length();
-
- if (index == -1)
- return false;
-
- QStringRef identifier(&dir, 9, index - 9);
-
- QQmlBundleData *bundle = QQmlEnginePrivate::get(e)->typeLoader.getBundle(identifier);
-
- if (bundle) {
- int lastIndex = dir.lastIndexOf(QLatin1Char('/'));
-
- if (lastIndex <= index) {
- bundle->release();
- return true;
- }
-
- QStringRef d(&dir, index + 1, lastIndex - index);
-
- QList<const QQmlBundle::FileEntry *> entries = bundle->files();
-
- for (int ii = 0; ii < entries.count(); ++ii) {
- QString name = entries.at(ii)->fileName();
- if (name.startsWith(d)) {
- bundle->release();
- return true;
- }
- }
-
- bundle->release();
- }
-
- return false;
-}
-
-bool QQmlFile::bundleDirectoryExists(const QUrl &url, QQmlEngine *e)
-{
- if (!isBundle(url))
- return false;
-
- QQmlBundleData *bundle = QQmlEnginePrivate::get(e)->typeLoader.getBundle(url.host());
-
- if (bundle) {
- QString path = url.path();
-
- int lastIndex = path.lastIndexOf(QLatin1Char('/'));
-
- if (lastIndex == -1) {
- bundle->release();
- return true;
- }
-
- QStringRef d(&path, 0, lastIndex);
-
- QList<const QQmlBundle::FileEntry *> entries = bundle->files();
-
- for (int ii = 0; ii < entries.count(); ++ii) {
- QString name = entries.at(ii)->fileName();
- if (name.startsWith(d)) {
- bundle->release();
- return true;
- }
- }
-
- bundle->release();
- }
-
- return false;
-}
-
-bool QQmlFile::bundleFileExists(const QString &file, QQmlEngine *e)
-{
- if (!isBundle(file))
- return false;
-
- int index = file.indexOf(QLatin1Char('/'), 9);
-
- if (index == -1)
- return false;
-
- QStringRef identifier(&file, 9, index - 9);
- QStringRef path(&file, index + 1, file.length() - index - 1);
-
- QQmlBundleData *bundle = QQmlEnginePrivate::get(e)->typeLoader.getBundle(identifier);
-
- if (bundle) {
- const QQmlBundle::FileEntry *entry = bundle->find(path.constData(), path.length());
- bundle->release();
-
- return entry != 0;
- }
-
- return false;
-}
-
-bool QQmlFile::bundleFileExists(const QUrl &, QQmlEngine *)
-{
- qFatal("Not implemented");
- return true;
-}
-
-/*!
-Returns the file name for the bundle file referenced by \a url or an
-empty string if \a url isn't a bundle url.
-*/
-QString QQmlFile::bundleFileName(const QString &url, QQmlEngine *e)
-{
- if (!isBundle(url))
- return QString();
-
- int index = url.indexOf(QLatin1Char('/'), 9);
-
- if (index == -1)
- index = url.length();
-
- QStringRef identifier(&url, 9, index - 9);
-
- QQmlBundleData *bundle = QQmlEnginePrivate::get(e)->typeLoader.getBundle(identifier);
-
- if (bundle) {
- QString rv = bundle->fileName;
- bundle->release();
- return rv;
- }
-
- return QString();
-}
-
-/*!
-Returns the file name for the bundle file referenced by \a url or an
-empty string if \a url isn't a bundle url.
-*/
-QString QQmlFile::bundleFileName(const QUrl &url, QQmlEngine *e)
-{
- if (!isBundle(url))
- return QString();
-
- QQmlBundleData *bundle = QQmlEnginePrivate::get(e)->typeLoader.getBundle(url.host());
-
- if (bundle) {
- QString rv = bundle->fileName;
- bundle->release();
- return rv;
- }
-
- return QString();
-}
-
QT_END_NAMESPACE
#include "qqmlfile.moc"
diff --git a/src/qml/qml/qqmlfile.h b/src/qml/qml/qqmlfile.h
index 3d27224500..7f46165eb0 100644
--- a/src/qml/qml/qqmlfile.h
+++ b/src/qml/qml/qqmlfile.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -68,8 +68,6 @@ public:
const char *data() const;
QByteArray dataByteArray() const;
- QByteArray metaData(const QString &) const;
-
void load(QQmlEngine *, const QUrl &);
void load(QQmlEngine *, const QString &);
@@ -84,24 +82,11 @@ public:
static bool isSynchronous(const QString &url);
static bool isSynchronous(const QUrl &url);
- static bool isBundle(const QString &url);
- static bool isBundle(const QUrl &url);
-
static bool isLocalFile(const QString &url);
static bool isLocalFile(const QUrl &url);
static QString urlToLocalFileOrQrc(const QString &);
static QString urlToLocalFileOrQrc(const QUrl &);
-
- static bool bundleDirectoryExists(const QString &, QQmlEngine *);
- static bool bundleDirectoryExists(const QUrl &, QQmlEngine *);
-
- static bool bundleFileExists(const QString &, QQmlEngine *);
- static bool bundleFileExists(const QUrl &, QQmlEngine *);
-
- static QString bundleFileName(const QString &, QQmlEngine *);
- static QString bundleFileName(const QUrl &, QQmlEngine *);
-
private:
Q_DISABLE_COPY(QQmlFile)
QQmlFilePrivate *d;
diff --git a/src/qml/qml/qqmlfileselector.cpp b/src/qml/qml/qqmlfileselector.cpp
index fc080a4ff3..3ee7bb3040 100644
--- a/src/qml/qml/qqmlfileselector.cpp
+++ b/src/qml/qml/qqmlfileselector.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -88,9 +88,9 @@ Q_GLOBAL_STATIC(interceptorSelectorMap, interceptorInstances);
*/
/*!
- Creates a new QQmlFileSelector, which includes its own QFileSelector.
- \a engine is the QQmlEngine you wish to apply file selectors too. It will
- also take ownership of the QQmlFileSelector.
+ Creates a new QQmlFileSelector with parent object \a parent, which includes
+ its own QFileSelector. \a engine is the QQmlEngine you wish to apply file
+ selectors to. It will also take ownership of the QQmlFileSelector.
*/
QQmlFileSelector::QQmlFileSelector(QQmlEngine* engine, QObject* parent)
@@ -121,9 +121,9 @@ QQmlFileSelectorPrivate::QQmlFileSelectorPrivate()
}
/*!
- Sets a different QFileSelector instance for use by the QQmlFileSelector. QQmlFileSelector does not
- take ownership of the new QFileSelector. To reset QQmlFileSelector to use its internal
- QFileSelector instance, call setSelector(0).
+ Sets the QFileSelector instance for use by the QQmlFileSelector to \a selector.
+ QQmlFileSelector does not take ownership of the new QFileSelector. To reset QQmlFileSelector
+ to use its internal QFileSelector instance, call setSelector(0).
*/
void QQmlFileSelector::setSelector(QFileSelector *selector)
diff --git a/src/qml/qml/qqmlfileselector.h b/src/qml/qml/qqmlfileselector.h
index ea739005f1..d86908e9cb 100644
--- a/src/qml/qml/qqmlfileselector.h
+++ b/src/qml/qml/qqmlfileselector.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlfileselector_p.h b/src/qml/qml/qqmlfileselector_p.h
index 5276cd043a..58248bf1c1 100644
--- a/src/qml/qml/qqmlfileselector_p.h
+++ b/src/qml/qml/qqmlfileselector_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlglobal.cpp b/src/qml/qml/qqmlglobal.cpp
index 492836ae03..d904242f93 100644
--- a/src/qml/qml/qqmlglobal.cpp
+++ b/src/qml/qml/qqmlglobal.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -33,6 +33,7 @@
#include <private/qqmlglobal_p.h>
+#include <QtQml/qqmlengine.h>
#include <QtCore/qvariant.h>
#include <QtCore/qstringlist.h>
#include <QtCore/qdebug.h>
@@ -50,14 +51,12 @@ QQmlValueTypeProvider::~QQmlValueTypeProvider()
QQml_removeValueTypeProvider(this);
}
-QQmlValueType *QQmlValueTypeProvider::createValueType(int type)
+const QMetaObject *QQmlValueTypeProvider::metaObjectForMetaType(int type)
{
- QQmlValueType *value = 0;
-
QQmlValueTypeProvider *p = this;
do {
- if (p->create(type, value))
- return value;
+ if (const QMetaObject *mo = p->getMetaObjectForMetaType(type))
+ return mo;
} while ((p = p->next));
return 0;
@@ -173,7 +172,7 @@ QVariant QQmlValueTypeProvider::createVariantFromString(int type, const QString
return QVariant();
}
-QVariant QQmlValueTypeProvider::createVariantFromJsObject(int type, QQmlV4Handle obj, QV8Engine *e, bool *ok)
+QVariant QQmlValueTypeProvider::createVariantFromJsObject(int type, QQmlV4Handle obj, QV4::ExecutionEngine *e, bool *ok)
{
QVariant v;
@@ -245,7 +244,7 @@ bool QQmlValueTypeProvider::writeValueType(int type, const void *src, void *dst,
return false;
}
-bool QQmlValueTypeProvider::create(int, QQmlValueType *&) { return false; }
+const QMetaObject *QQmlValueTypeProvider::getMetaObjectForMetaType(int) { return 0; }
bool QQmlValueTypeProvider::init(int, void *, size_t) { return false; }
bool QQmlValueTypeProvider::destroy(int, void *, size_t) { return false; }
bool QQmlValueTypeProvider::copy(int, const void *, void *, size_t) { return false; }
@@ -254,7 +253,7 @@ bool QQmlValueTypeProvider::createFromString(int, const QString &, void *, size_
bool QQmlValueTypeProvider::createStringFrom(int, const void *, QString *) { return false; }
bool QQmlValueTypeProvider::variantFromString(const QString &, QVariant *) { return false; }
bool QQmlValueTypeProvider::variantFromString(int, const QString &, QVariant *) { return false; }
-bool QQmlValueTypeProvider::variantFromJsObject(int, QQmlV4Handle, QV8Engine *, QVariant *) { return false; }
+bool QQmlValueTypeProvider::variantFromJsObject(int, QQmlV4Handle, QV4::ExecutionEngine *, QVariant *) { return false; }
bool QQmlValueTypeProvider::equal(int, const void *, const void *, size_t) { return false; }
bool QQmlValueTypeProvider::store(int, const void *, void *, size_t) { return false; }
bool QQmlValueTypeProvider::read(int, const void *, size_t, int, void *) { return false; }
@@ -318,6 +317,7 @@ QVariant QQmlColorProvider::colorFromString(const QString &, bool *ok) { if (ok)
unsigned QQmlColorProvider::rgbaFromString(const QString &, bool *ok) { if (ok) *ok = false; return 0; }
QVariant QQmlColorProvider::fromRgbF(double, double, double, double) { return QVariant(); }
QVariant QQmlColorProvider::fromHslF(double, double, double, double) { return QVariant(); }
+QVariant QQmlColorProvider::fromHsvF(double, double, double, double) { return QVariant(); }
QVariant QQmlColorProvider::lighter(const QVariant &, qreal) { return QVariant(); }
QVariant QQmlColorProvider::darker(const QVariant &, qreal) { return QVariant(); }
QVariant QQmlColorProvider::tint(const QVariant &, const QVariant &) { return QVariant(); }
@@ -360,10 +360,19 @@ QObject *QQmlGuiProvider::inputMethod()
// We don't have any input method code by default
QObject *o = new QObject();
o->setObjectName(QString::fromLatin1("No inputMethod available"));
+ QQmlEngine::setObjectOwnership(o, QQmlEngine::JavaScriptOwnership);
return o;
}
#endif
+QObject *QQmlGuiProvider::styleHints()
+{
+ QObject *o = new QObject();
+ o->setObjectName(QString::fromLatin1("No styleHints available"));
+ QQmlEngine::setObjectOwnership(o, QQmlEngine::JavaScriptOwnership);
+ return o;
+}
+
static QQmlGuiProvider *guiProvider = 0;
Q_QML_PRIVATE_EXPORT QQmlGuiProvider *QQml_setGuiProvider(QQmlGuiProvider *newProvider)
diff --git a/src/qml/qml/qqmlglobal_p.h b/src/qml/qml/qqmlglobal_p.h
index 1d0bf59670..7856d85376 100644
--- a/src/qml/qml/qqmlglobal_p.h
+++ b/src/qml/qml/qqmlglobal_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -215,7 +215,6 @@ inline void QQml_setParent_noEvent(QObject *object, QObject *parent)
}
-class QQmlValueType;
class QV8Engine;
class Q_QML_PRIVATE_EXPORT QQmlValueTypeProvider
{
@@ -223,7 +222,7 @@ public:
QQmlValueTypeProvider();
virtual ~QQmlValueTypeProvider();
- QQmlValueType *createValueType(int);
+ const QMetaObject *metaObjectForMetaType(int);
bool initValueType(int, void *, size_t);
bool destroyValueType(int, void *, size_t);
@@ -235,7 +234,7 @@ public:
QVariant createVariantFromString(const QString &);
QVariant createVariantFromString(int, const QString &, bool *);
- QVariant createVariantFromJsObject(int, QQmlV4Handle, QV8Engine *, bool*);
+ QVariant createVariantFromJsObject(int, QQmlV4Handle, QV4::ExecutionEngine *, bool*);
bool equalValueType(int, const void *, const void *, size_t);
bool storeValueType(int, const void *, void *, size_t);
@@ -243,8 +242,7 @@ public:
bool writeValueType(int, const void *, void *, size_t);
private:
- virtual bool create(int, QQmlValueType *&);
-
+ virtual const QMetaObject *getMetaObjectForMetaType(int);
virtual bool init(int, void *, size_t);
virtual bool destroy(int, void *, size_t);
virtual bool copy(int, const void *, void *, size_t);
@@ -255,7 +253,7 @@ private:
virtual bool variantFromString(const QString &, QVariant *);
virtual bool variantFromString(int, const QString &, QVariant *);
- virtual bool variantFromJsObject(int, QQmlV4Handle, QV8Engine *, QVariant *);
+ virtual bool variantFromJsObject(int, QQmlV4Handle, QV4::ExecutionEngine *, QVariant *);
virtual bool equal(int, const void *, const void *, size_t);
virtual bool store(int, const void *, void *, size_t);
@@ -281,6 +279,7 @@ public:
virtual QVariant fromRgbF(double, double, double, double);
virtual QVariant fromHslF(double, double, double, double);
+ virtual QVariant fromHsvF(double, double, double, double);
virtual QVariant lighter(const QVariant &, qreal);
virtual QVariant darker(const QVariant &, qreal);
virtual QVariant tint(const QVariant &, const QVariant &);
@@ -298,6 +297,7 @@ public:
#ifndef QT_NO_IM
virtual QObject *inputMethod();
#endif
+ virtual QObject *styleHints();
virtual QStringList fontFamilies();
virtual bool openUrlExternally(QUrl &);
};
diff --git a/src/qml/qml/qqmlguard_p.h b/src/qml/qml/qqmlguard_p.h
index ccd58d596d..a797e916bd 100644
--- a/src/qml/qml/qqmlguard_p.h
+++ b/src/qml/qml/qqmlguard_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
index 807eb05362..ff48a10d95 100644
--- a/src/qml/qml/qqmlimport.cpp
+++ b/src/qml/qml/qqmlimport.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -653,9 +653,10 @@ bool QQmlImportNamespace::Import::resolveType(QQmlTypeLoader *typeLoader,
}
if (candidate != end) {
+ QQmlType *returnType = getTypeForUrl(componentUrl, type, isCompositeSingleton, 0);
if (type_return)
- *type_return = getTypeForUrl(componentUrl, type, isCompositeSingleton, 0);
- return (*type_return != 0);
+ *type_return = returnType;
+ return returnType != 0;
}
} else if (!isLibrary) {
QString qmlUrl;
@@ -667,15 +668,7 @@ bool QQmlImportNamespace::Import::resolveType(QQmlTypeLoader *typeLoader,
};
for (uint i = 0; i < sizeof(urlsToTry) / sizeof(urlsToTry[0]); ++i) {
const QString url = urlsToTry[i];
-
- if (QQmlFile::isBundle(url)) {
- exists = QQmlFile::bundleFileExists(url, typeLoader->engine());
- } else {
- exists = !typeLoader->absoluteFilePath(QQmlFile::urlToLocalFileOrQrc(url)).isEmpty();
- if (!exists)
- exists = QQmlMetaType::findCachedCompilationUnit(QUrl(url));
- }
-
+ exists = !typeLoader->absoluteFilePath(QQmlFile::urlToLocalFileOrQrc(url)).isEmpty();
if (exists) {
qmlUrl = url;
break;
@@ -687,9 +680,10 @@ bool QQmlImportNamespace::Import::resolveType(QQmlTypeLoader *typeLoader,
if (typeRecursionDetected)
*typeRecursionDetected = true;
} else {
+ QQmlType *returnType = getTypeForUrl(qmlUrl, type, false, 0);
if (type_return)
- *type_return = getTypeForUrl(qmlUrl, type, false, 0);
- return (*type_return) != 0;
+ *type_return = returnType;
+ return returnType != 0;
}
}
}
@@ -879,7 +873,7 @@ bool QQmlImportsPrivate::populatePluginPairVector(QVector<StaticPluginPair> &res
/*!
Import an extension defined by a qmldir file.
-\a qmldirFilePath is either a raw file path, or a bundle url.
+\a qmldirFilePath is a raw file path.
*/
bool QQmlImportsPrivate::importExtension(const QString &qmldirFilePath,
const QString &uri,
@@ -930,7 +924,7 @@ bool QQmlImportsPrivate::importExtension(const QString &qmldirFilePath,
QString resolvedFilePath = database->resolvePlugin(typeLoader, qmldirPath, plugin.path, plugin.name);
if (!resolvedFilePath.isEmpty()) {
dynamicPluginsFound++;
- if (!database->importDynamicPlugin(resolvedFilePath, uri, typeNamespace, errors)) {
+ if (!database->importDynamicPlugin(resolvedFilePath, uri, typeNamespace, vmaj, errors)) {
if (errors) {
// XXX TODO: should we leave the import plugin error alone?
// Here, we pop it off the top and coalesce it into this error's message.
@@ -966,7 +960,7 @@ bool QQmlImportsPrivate::importExtension(const QString &qmldirFilePath,
if (versionUri == metaTagUri.toString()) {
staticPluginsFound++;
QObject *instance = pair.first.instance();
- if (!database->importStaticPlugin(instance, basePath, uri, typeNamespace, errors)) {
+ if (!database->importStaticPlugin(instance, basePath, uri, typeNamespace, vmaj, errors)) {
if (errors) {
QQmlError poppedError = errors->takeFirst();
QQmlError error;
@@ -1012,17 +1006,11 @@ bool QQmlImportsPrivate::getQmldirContent(const QString &qmldirIdentifier, const
Q_ASSERT(errors);
Q_ASSERT(qmldir);
- *qmldir = typeLoader->qmldirContent(qmldirIdentifier, uri);
+ *qmldir = typeLoader->qmldirContent(qmldirIdentifier);
if (*qmldir) {
// Ensure that parsing was successful
if ((*qmldir)->hasError()) {
- QUrl url;
-
- if (QQmlFile::isBundle(qmldirIdentifier))
- url = QUrl(qmldirIdentifier);
- else
- url = QUrl::fromLocalFile(qmldirIdentifier);
-
+ QUrl url = QUrl::fromLocalFile(qmldirIdentifier);
const QList<QQmlError> qmldirErrors = (*qmldir)->errors(uri);
for (int i = 0; i < qmldirErrors.size(); ++i) {
QQmlError error = qmldirErrors.at(i);
@@ -1328,30 +1316,7 @@ bool QQmlImportsPrivate::addFileImport(const QString& uri, const QString &prefix
QString qmldirIdentifier;
- if (QQmlFile::isBundle(qmldirUrl)) {
-
- QString dir = resolveLocalUrl(base, importUri);
- Q_ASSERT(QQmlFile::isBundle(dir));
- if (!QQmlFile::bundleDirectoryExists(dir, typeLoader->engine())) {
- if (!isImplicitImport) {
- QQmlError error;
- error.setDescription(QQmlImportDatabase::tr("\"%1\": no such directory").arg(uri));
- error.setUrl(QUrl(qmldirUrl));
- errors->prepend(error);
- }
- return false;
- }
-
- // Transforms the (possible relative) uri into our best guess relative to the
- // import paths.
- importUri = resolvedUri(dir, database);
- if (importUri.endsWith(Slash))
- importUri.chop(1);
-
- if (QQmlFile::bundleFileExists(qmldirUrl, typeLoader->engine()))
- qmldirIdentifier = qmldirUrl;
-
- } else if (QQmlFile::isLocalFile(qmldirUrl)) {
+ if (QQmlFile::isLocalFile(qmldirUrl)) {
QString localFileOrQrc = QQmlFile::urlToLocalFileOrQrc(qmldirUrl);
Q_ASSERT(!localFileOrQrc.isEmpty());
@@ -1555,12 +1520,12 @@ bool QQmlImports::locateQmldir(QQmlImportDatabase *importDb,
bool QQmlImports::isLocal(const QString &url)
{
- return QQmlFile::isBundle(url) || !QQmlFile::urlToLocalFileOrQrc(url).isEmpty();
+ return !QQmlFile::urlToLocalFileOrQrc(url).isEmpty();
}
bool QQmlImports::isLocal(const QUrl &url)
{
- return QQmlFile::isBundle(url) || !QQmlFile::urlToLocalFileOrQrc(url).isEmpty();
+ return !QQmlFile::urlToLocalFileOrQrc(url).isEmpty();
}
void QQmlImports::setDesignerSupportRequired(bool b)
@@ -1676,7 +1641,7 @@ QString QQmlImportDatabase::resolvePlugin(QQmlTypeLoader *typeLoader,
\row \li Unix/Linux \li \c .so
\row \li AIX \li \c .a
\row \li HP-UX \li \c .sl, \c .so (HP-UXi)
- \row \li Mac OS X \li \c .dylib, \c .bundle, \c .so
+ \row \li OS X \li \c .dylib, \c .bundle, \c .so
\endtable
Version number on unix are ignored.
@@ -1844,7 +1809,7 @@ void QQmlImportDatabase::setImportPathList(const QStringList &paths)
\internal
*/
bool QQmlImportDatabase::registerPluginTypes(QObject *instance, const QString &basePath,
- const QString &uri, const QString &typeNamespace, QList<QQmlError> *errors)
+ const QString &uri, const QString &typeNamespace, int vmaj, QList<QQmlError> *errors)
{
if (qmlImportTrace())
qDebug().nospace() << "QQmlImportDatabase::registerPluginTypes: " << uri << " from " << basePath;
@@ -1866,7 +1831,7 @@ bool QQmlImportDatabase::registerPluginTypes(QObject *instance, const QString &b
{
// Create a scope for QWriteLocker to keep it as narrow as possible, and
// to ensure that we release it before the call to initalizeEngine below
- QWriteLocker lock(QQmlMetaType::typeRegistrationLock());
+ QMutexLocker lock(QQmlMetaType::typeRegistrationLock());
if (!typeNamespace.isEmpty()) {
// This is an 'identified' module
@@ -1880,7 +1845,7 @@ bool QQmlImportDatabase::registerPluginTypes(QObject *instance, const QString &b
return false;
}
- if (QQmlMetaType::namespaceContainsRegistrations(typeNamespace)) {
+ if (QQmlMetaType::namespaceContainsRegistrations(typeNamespace, vmaj)) {
// Other modules have already installed to this namespace
if (errors) {
QQmlError error;
@@ -1927,7 +1892,7 @@ bool QQmlImportDatabase::registerPluginTypes(QObject *instance, const QString &b
\internal
*/
bool QQmlImportDatabase::importStaticPlugin(QObject *instance, const QString &basePath,
- const QString &uri, const QString &typeNamespace, QList<QQmlError> *errors)
+ const QString &uri, const QString &typeNamespace, int vmaj, QList<QQmlError> *errors)
{
#ifndef QT_NO_LIBRARY
// Dynamic plugins are differentiated by their filepath. For static plugins we
@@ -1951,7 +1916,7 @@ bool QQmlImportDatabase::importStaticPlugin(QObject *instance, const QString &ba
plugin.loader = 0;
plugins->insert(uniquePluginID, plugin);
- if (!registerPluginTypes(instance, basePath, uri, typeNamespace, errors))
+ if (!registerPluginTypes(instance, basePath, uri, typeNamespace, vmaj, errors))
return false;
}
@@ -1974,7 +1939,7 @@ bool QQmlImportDatabase::importStaticPlugin(QObject *instance, const QString &ba
\internal
*/
bool QQmlImportDatabase::importDynamicPlugin(const QString &filePath, const QString &uri,
- const QString &typeNamespace, QList<QQmlError> *errors)
+ const QString &typeNamespace, int vmaj, QList<QQmlError> *errors)
{
#ifndef QT_NO_LIBRARY
QFileInfo fileInfo(filePath);
@@ -2010,9 +1975,8 @@ bool QQmlImportDatabase::importDynamicPlugin(const QString &filePath, const QStr
QQmlError error;
error.setDescription(loader->errorString());
errors->prepend(error);
-
- delete loader;
}
+ delete loader;
return false;
}
} else {
@@ -2028,7 +1992,7 @@ bool QQmlImportDatabase::importDynamicPlugin(const QString &filePath, const QStr
plugins->insert(absoluteFilePath, plugin);
// Continue with shared code path for dynamic and static plugins:
- if (!registerPluginTypes(instance, fileInfo.absolutePath(), uri, typeNamespace, errors))
+ if (!registerPluginTypes(instance, fileInfo.absolutePath(), uri, typeNamespace, vmaj, errors))
return false;
}
diff --git a/src/qml/qml/qqmlimport_p.h b/src/qml/qml/qqmlimport_p.h
index 26eab669bc..bda87f29b1 100644
--- a/src/qml/qml/qqmlimport_p.h
+++ b/src/qml/qml/qqmlimport_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -145,7 +145,7 @@ public:
QQmlImportDatabase(QQmlEngine *);
~QQmlImportDatabase();
- bool importDynamicPlugin(const QString &filePath, const QString &uri, const QString &importNamespace, QList<QQmlError> *errors);
+ bool importDynamicPlugin(const QString &filePath, const QString &uri, const QString &importNamespace, int vmaj, QList<QQmlError> *errors);
QStringList importPathList(PathType type = LocalOrRemote) const;
void setImportPathList(const QStringList &paths);
@@ -165,9 +165,9 @@ private:
const QString &qmldirPath, const QString &qmldirPluginPath,
const QString &baseName);
bool importStaticPlugin(QObject *instance, const QString &basePath, const QString &uri,
- const QString &typeNamespace, QList<QQmlError> *errors);
+ const QString &typeNamespace, int vmaj, QList<QQmlError> *errors);
bool registerPluginTypes(QObject *instance, const QString &basePath,
- const QString &uri, const QString &typeNamespace, QList<QQmlError> *errors);
+ const QString &uri, const QString &typeNamespace, int vmaj, QList<QQmlError> *errors);
void clearDirCache();
struct QmldirCache {
diff --git a/src/qml/qml/qqmlincubator.cpp b/src/qml/qml/qqmlincubator.cpp
index b40ac5fdeb..63604d4622 100644
--- a/src/qml/qml/qqmlincubator.cpp
+++ b/src/qml/qml/qqmlincubator.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlincubator.h b/src/qml/qml/qqmlincubator.h
index 8b0f05e9a3..178c88f7db 100644
--- a/src/qml/qml/qqmlincubator.h
+++ b/src/qml/qml/qqmlincubator.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlincubator_p.h b/src/qml/qml/qqmlincubator_p.h
index 6d027800bb..addb4e45a5 100644
--- a/src/qml/qml/qqmlincubator_p.h
+++ b/src/qml/qml/qqmlincubator_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlinfo.cpp b/src/qml/qml/qqmlinfo.cpp
index 6451b45cae..b9f96a724c 100644
--- a/src/qml/qml/qqmlinfo.cpp
+++ b/src/qml/qml/qqmlinfo.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -44,7 +44,7 @@
QT_BEGIN_NAMESPACE
/*!
- \fn QQmlInfo qmlInfo(const QObject *object)
+ \fn QQmlInfo QtQml::qmlInfo(const QObject *object)
\relates QQmlEngine
Prints warning messages that include the file and line number for the
@@ -140,7 +140,7 @@ QQmlInfo::~QQmlInfo()
QQmlData *ddata = QQmlData::get(object, false);
if (ddata && ddata->outerContext) {
- error.setUrl(ddata->outerContext->url);
+ error.setUrl(ddata->outerContext->url());
error.setLine(ddata->lineNumber);
error.setColumn(ddata->columnNumber);
}
diff --git a/src/qml/qml/qqmlinfo.h b/src/qml/qml/qqmlinfo.h
index 99e51e6b3e..b56f74198c 100644
--- a/src/qml/qml/qqmlinfo.h
+++ b/src/qml/qml/qqmlinfo.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp
index 7425509b40..02bd1c4b83 100644
--- a/src/qml/qml/qqmljavascriptexpression.cpp
+++ b/src/qml/qml/qqmljavascriptexpression.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -40,6 +40,7 @@
#include <private/qv4script_p.h>
#include <private/qv4errorobject_p.h>
#include <private/qv4scopedvalue_p.h>
+#include <private/qqmlglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -59,11 +60,11 @@ bool QQmlDelayedError::addError(QQmlEnginePrivate *e)
return true;
}
-void QQmlDelayedError::setErrorLocation(const QUrl &url, quint16 line, quint16 column)
+void QQmlDelayedError::setErrorLocation(const QQmlSourceLocation &sourceLocation)
{
- m_error.setUrl(url);
- m_error.setLine(line);
- m_error.setColumn(column);
+ m_error.setUrl(QUrl(sourceLocation.sourceFile));
+ m_error.setLine(sourceLocation.line);
+ m_error.setColumn(sourceLocation.column);
}
void QQmlDelayedError::setErrorDescription(const QString &description)
@@ -76,9 +77,9 @@ void QQmlDelayedError::setErrorObject(QObject *object)
m_error.setObject(object);
}
-void QQmlDelayedError::catchJavaScriptException(QV4::ExecutionContext *context)
+void QQmlDelayedError::catchJavaScriptException(QV4::ExecutionEngine *engine)
{
- m_error = QV4::ExecutionEngine::catchExceptionAsQmlError(context);
+ m_error = engine->catchExceptionAsQmlError();
}
@@ -106,23 +107,23 @@ void QQmlJavaScriptExpression::resetNotifyOnValueChanged()
}
QV4::ReturnedValue QQmlJavaScriptExpression::evaluate(QQmlContextData *context,
- const QV4::ValueRef function, bool *isUndefined)
+ const QV4::Value &function, bool *isUndefined)
{
QV4::ExecutionEngine *v4 = QV8Engine::getV4(context->engine);
QV4::Scope scope(v4);
- QV4::ScopedCallData callData(scope, 0);
+ QV4::ScopedCallData callData(scope);
return evaluate(context, function, callData, isUndefined);
}
QV4::ReturnedValue QQmlJavaScriptExpression::evaluate(QQmlContextData *context,
- const QV4::ValueRef function,
+ const QV4::Value &function,
QV4::CallData *callData,
bool *isUndefined)
{
Q_ASSERT(context && context->engine);
- if (function->isUndefined()) {
+ if (function.isUndefined()) {
if (isUndefined)
*isUndefined = true;
return QV4::Encode::undefined();
@@ -147,20 +148,19 @@ QV4::ReturnedValue QQmlJavaScriptExpression::evaluate(QQmlContextData *context,
QV4::ExecutionEngine *v4 = QV8Engine::getV4(ep->v8engine());
QV4::Scope scope(v4);
QV4::ScopedValue result(scope, QV4::Primitive::undefinedValue());
- QV4::ExecutionContext *ctx = v4->currentContext();
- callData->thisObject = v4->globalObject;
+ callData->thisObject = v4->globalObject();
if (scopeObject()) {
- QV4::ScopedValue value(scope, QV4::QObjectWrapper::wrap(ctx->d()->engine, scopeObject()));
+ QV4::ScopedValue value(scope, QV4::QObjectWrapper::wrap(v4, scopeObject()));
if (value->isObject())
callData->thisObject = value;
}
- result = function->asFunctionObject()->call(callData);
+ result = function.asFunctionObject()->call(callData);
if (scope.hasException()) {
if (watcher.wasDeleted())
- ctx->catchException(); // ignore exception
+ scope.engine->catchException(); // ignore exception
else
- delayedError()->catchJavaScriptException(ctx);
+ delayedError()->catchJavaScriptException(scope.engine);
if (isUndefined)
*isUndefined = true;
} else {
@@ -183,7 +183,7 @@ QV4::ReturnedValue QQmlJavaScriptExpression::evaluate(QQmlContextData *context,
ep->propertyCapture = lastPropertyCapture;
- return result.asReturnedValue();
+ return result->asReturnedValue();
}
void QQmlJavaScriptExpression::GuardCapture::captureProperty(QQmlNotifier *n)
@@ -288,17 +288,16 @@ QQmlJavaScriptExpression::evalFunction(QQmlContextData *ctxt, QObject *scopeObje
QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine);
QV4::ExecutionEngine *v4 = QV8Engine::getV4(ep->v8engine());
- QV4::ExecutionContext *ctx = v4->currentContext();
QV4::Scope scope(v4);
- QV4::ScopedObject qmlScopeObject(scope, QV4::QmlContextWrapper::qmlScope(ep->v8engine(), ctxt, scopeObject));
+ QV4::ScopedObject qmlScopeObject(scope, QV4::QmlContextWrapper::qmlScope(v4, ctxt, scopeObject));
QV4::Script script(v4, qmlScopeObject, code, filename, line);
QV4::ScopedValue result(scope);
script.parse();
if (!v4->hasException)
result = script.run();
if (v4->hasException) {
- QQmlError error = QV4::ExecutionEngine::catchExceptionAsQmlError(ctx);
+ QQmlError error = v4->catchExceptionAsQmlError();
if (error.description().isEmpty())
error.setDescription(QLatin1String("Exception occurred during function evaluation"));
if (error.line() == -1)
@@ -310,8 +309,8 @@ QQmlJavaScriptExpression::evalFunction(QQmlContextData *ctxt, QObject *scopeObje
return QV4::Encode::undefined();
}
if (qmlscope)
- *qmlscope = qmlScopeObject;
- return result.asReturnedValue();
+ qmlscope->set(v4, qmlScopeObject);
+ return result->asReturnedValue();
}
QV4::ReturnedValue QQmlJavaScriptExpression::qmlBinding(QQmlContextData *ctxt, QObject *qmlScope,
@@ -322,17 +321,16 @@ QV4::ReturnedValue QQmlJavaScriptExpression::qmlBinding(QQmlContextData *ctxt, Q
QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine);
QV4::ExecutionEngine *v4 = QV8Engine::getV4(ep->v8engine());
- QV4::ExecutionContext *ctx = v4->currentContext();
QV4::Scope scope(v4);
- QV4::ScopedObject qmlScopeObject(scope, QV4::QmlContextWrapper::qmlScope(ep->v8engine(), ctxt, qmlScope));
+ QV4::ScopedObject qmlScopeObject(scope, QV4::QmlContextWrapper::qmlScope(v4, ctxt, qmlScope));
QV4::Script script(v4, qmlScopeObject, code, filename, line);
QV4::ScopedValue result(scope);
script.parse();
if (!v4->hasException)
result = script.qmlBinding();
if (v4->hasException) {
- QQmlError error = QV4::ExecutionEngine::catchExceptionAsQmlError(ctx);
+ QQmlError error = v4->catchExceptionAsQmlError();
if (error.description().isEmpty())
error.setDescription(QLatin1String("Exception occurred during function evaluation"));
if (error.line() == -1)
@@ -344,8 +342,8 @@ QV4::ReturnedValue QQmlJavaScriptExpression::qmlBinding(QQmlContextData *ctxt, Q
return QV4::Encode::undefined();
}
if (qmlscope)
- *qmlscope = qmlScopeObject;
- return result.asReturnedValue();
+ qmlscope->set(v4, qmlScopeObject);
+ return result->asReturnedValue();
}
diff --git a/src/qml/qml/qqmljavascriptexpression_p.h b/src/qml/qml/qqmljavascriptexpression_p.h
index 2c78a745fc..989d5a0b0d 100644
--- a/src/qml/qml/qqmljavascriptexpression_p.h
+++ b/src/qml/qml/qqmljavascriptexpression_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -52,9 +52,7 @@
QT_BEGIN_NAMESPACE
-namespace QV4 {
-struct ExecutionContext;
-}
+struct QQmlSourceLocation;
class QQmlDelayedError
{
@@ -76,12 +74,12 @@ public:
inline const QQmlError &error() const { return m_error; }
inline void clearError() { m_error = QQmlError(); }
- void setErrorLocation(const QUrl &url, quint16 line, quint16 column);
+ void setErrorLocation(const QQmlSourceLocation &sourceLocation);
void setErrorDescription(const QString &description);
void setErrorObject(QObject *object);
// Call only from catch(...) -- will re-throw if no JS exception
- void catchJavaScriptException(QV4::ExecutionContext *context);
+ void catchJavaScriptException(QV4::ExecutionEngine *engine);
private:
@@ -106,8 +104,8 @@ public:
QQmlJavaScriptExpression(VTable *vtable);
- QV4::ReturnedValue evaluate(QQmlContextData *, const QV4::ValueRef function, bool *isUndefined);
- QV4::ReturnedValue evaluate(QQmlContextData *, const QV4::ValueRef function, QV4::CallData *callData, bool *isUndefined);
+ QV4::ReturnedValue evaluate(QQmlContextData *, const QV4::Value &function, bool *isUndefined);
+ QV4::ReturnedValue evaluate(QQmlContextData *, const QV4::Value &function, QV4::CallData *callData, bool *isUndefined);
inline bool notifyOnValueChanged() const;
diff --git a/src/qml/qml/qqmllist.cpp b/src/qml/qml/qqmllist.cpp
index 7dc5bdd614..c379373e7e 100644
--- a/src/qml/qml/qqmllist.cpp
+++ b/src/qml/qml/qqmllist.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmllist.h b/src/qml/qml/qqmllist.h
index a4cdf81949..edd61b26c9 100644
--- a/src/qml/qml/qqmllist.h
+++ b/src/qml/qml/qqmllist.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmllist_p.h b/src/qml/qml/qqmllist_p.h
index ca1084869a..07f700362e 100644
--- a/src/qml/qml/qqmllist_p.h
+++ b/src/qml/qml/qqmllist_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmllistwrapper.cpp b/src/qml/qml/qqmllistwrapper.cpp
index 13e5e49b55..bcb1e72f0b 100644
--- a/src/qml/qml/qqmllistwrapper.cpp
+++ b/src/qml/qml/qqmllistwrapper.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -35,6 +35,7 @@
#include <private/qv8engine_p.h>
#include <private/qqmllist_p.h>
#include <private/qv4objectproto_p.h>
+#include <qv4objectiterator_p.h>
#include <private/qv4functionobject_p.h>
@@ -44,30 +45,26 @@ using namespace QV4;
DEFINE_OBJECT_VTABLE(QmlListWrapper);
-QmlListWrapper::Data::Data(QV8Engine *engine)
- : Object::Data(QV8Engine::getV4(engine))
- , v8(engine)
+Heap::QmlListWrapper::QmlListWrapper(ExecutionEngine *engine)
+ : Heap::Object(engine)
{
- setVTable(staticVTable());
-
- QV4::Scope scope(QV8Engine::getV4(engine));
+ QV4::Scope scope(engine);
QV4::ScopedObject o(scope, this);
- o->setArrayType(ArrayData::Custom);
+ o->setArrayType(Heap::ArrayData::Custom);
}
-QmlListWrapper::Data::~Data()
+Heap::QmlListWrapper::~QmlListWrapper()
{
}
-ReturnedValue QmlListWrapper::create(QV8Engine *v8, QObject *object, int propId, int propType)
+ReturnedValue QmlListWrapper::create(ExecutionEngine *engine, QObject *object, int propId, int propType)
{
if (!object || propId == -1)
return Encode::null();
- ExecutionEngine *v4 = QV8Engine::getV4(v8);
- Scope scope(v4);
+ Scope scope(engine);
- Scoped<QmlListWrapper> r(scope, v4->memoryManager->alloc<QmlListWrapper>(v8));
+ Scoped<QmlListWrapper> r(scope, engine->memoryManager->alloc<QmlListWrapper>(engine));
r->d()->object = object;
r->d()->propertyType = propType;
void *args[] = { &r->d()->property, 0 };
@@ -75,12 +72,11 @@ ReturnedValue QmlListWrapper::create(QV8Engine *v8, QObject *object, int propId,
return r.asReturnedValue();
}
-ReturnedValue QmlListWrapper::create(QV8Engine *v8, const QQmlListProperty<QObject> &prop, int propType)
+ReturnedValue QmlListWrapper::create(ExecutionEngine *engine, const QQmlListProperty<QObject> &prop, int propType)
{
- ExecutionEngine *v4 = QV8Engine::getV4(v8);
- Scope scope(v4);
+ Scope scope(engine);
- Scoped<QmlListWrapper> r(scope, v4->memoryManager->alloc<QmlListWrapper>(v8));
+ Scoped<QmlListWrapper> r(scope, engine->memoryManager->alloc<QmlListWrapper>(engine));
r->d()->object = prop.object;
r->d()->property = prop;
r->d()->propertyType = propType;
@@ -92,15 +88,15 @@ QVariant QmlListWrapper::toVariant() const
if (!d()->object)
return QVariant();
- return QVariant::fromValue(QQmlListReferencePrivate::init(d()->property, d()->propertyType, d()->v8->engine()));
+ return QVariant::fromValue(QQmlListReferencePrivate::init(d()->property, d()->propertyType, engine()->qmlEngine()));
}
ReturnedValue QmlListWrapper::get(Managed *m, String *name, bool *hasProperty)
{
Q_ASSERT(m->as<QmlListWrapper>());
- QV4::ExecutionEngine *v4 = m->engine();
QmlListWrapper *w = static_cast<QmlListWrapper *>(m);
+ QV4::ExecutionEngine *v4 = w->engine();
if (name->equals(v4->id_length) && !w->d()->object.isNull()) {
quint32 count = w->d()->property.count ? w->d()->property.count(&w->d()->property) : 0;
@@ -119,8 +115,8 @@ ReturnedValue QmlListWrapper::getIndexed(Managed *m, uint index, bool *hasProper
Q_UNUSED(hasProperty);
Q_ASSERT(m->as<QmlListWrapper>());
- QV4::ExecutionEngine *v4 = m->engine();
QmlListWrapper *w = static_cast<QmlListWrapper *>(m);
+ QV4::ExecutionEngine *v4 = w->engine();
quint32 count = w->d()->property.count ? w->d()->property.count(&w->d()->property) : 0;
if (index < count && w->d()->property.at) {
@@ -134,7 +130,7 @@ ReturnedValue QmlListWrapper::getIndexed(Managed *m, uint index, bool *hasProper
return Primitive::undefinedValue().asReturnedValue();
}
-void QmlListWrapper::put(Managed *m, String *name, const ValueRef value)
+void QmlListWrapper::put(Managed *m, String *name, const Value &value)
{
// doesn't do anything. Should we throw?
Q_UNUSED(m);
@@ -142,15 +138,9 @@ void QmlListWrapper::put(Managed *m, String *name, const ValueRef value)
Q_UNUSED(value);
}
-void QmlListWrapper::destroy(Managed *that)
-{
- Q_ASSERT(that->as<QmlListWrapper>());
- static_cast<QmlListWrapper *>(that)->d()->~Data();
-}
-
-void QmlListWrapper::advanceIterator(Managed *m, ObjectIterator *it, String *&name, uint *index, Property *p, PropertyAttributes *attrs)
+void QmlListWrapper::advanceIterator(Managed *m, ObjectIterator *it, Heap::String **name, uint *index, Property *p, PropertyAttributes *attrs)
{
- name = (String *)0;
+ *name = (Heap::String *)0;
*index = UINT_MAX;
Q_ASSERT(m->as<QmlListWrapper>());
QmlListWrapper *w = static_cast<QmlListWrapper *>(m);
diff --git a/src/qml/qml/qqmllistwrapper_p.h b/src/qml/qml/qqmllistwrapper_p.h
index fe78079bac..3590bcb1c9 100644
--- a/src/qml/qml/qqmllistwrapper_p.h
+++ b/src/qml/qml/qqmllistwrapper_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -59,28 +59,32 @@ class QV8Engine;
namespace QV4 {
+namespace Heap {
+
+struct QmlListWrapper : Object {
+ QmlListWrapper(ExecutionEngine *engine);
+ ~QmlListWrapper();
+ QPointer<QObject> object;
+ QQmlListProperty<QObject> property;
+ int propertyType;
+};
+
+}
+
struct Q_QML_EXPORT QmlListWrapper : Object
{
- struct Data : Object::Data {
- Data(QV8Engine *engine);
- ~Data();
- QV8Engine *v8;
- QPointer<QObject> object;
- QQmlListProperty<QObject> property;
- int propertyType;
- };
- V4_OBJECT(Object)
-
- static ReturnedValue create(QV8Engine *v8, QObject *object, int propId, int propType);
- static ReturnedValue create(QV8Engine *v8, const QQmlListProperty<QObject> &prop, int propType);
+ V4_OBJECT2(QmlListWrapper, Object)
+ V4_NEEDS_DESTROY
+
+ static ReturnedValue create(ExecutionEngine *engine, QObject *object, int propId, int propType);
+ static ReturnedValue create(ExecutionEngine *engine, const QQmlListProperty<QObject> &prop, int propType);
QVariant toVariant() const;
static ReturnedValue get(Managed *m, String *name, bool *hasProperty);
static ReturnedValue getIndexed(Managed *m, uint index, bool *hasProperty);
- static void put(Managed *m, String *name, const ValueRef value);
- static void advanceIterator(Managed *m, ObjectIterator *it, String *&name, uint *index, Property *p, PropertyAttributes *attributes);
- static void destroy(Managed *that);
+ static void put(Managed *m, String *name, const Value &value);
+ static void advanceIterator(Managed *m, ObjectIterator *it, Heap::String **name, uint *index, Property *p, PropertyAttributes *attributes);
};
}
diff --git a/src/qml/qml/qqmllocale.cpp b/src/qml/qml/qqmllocale.cpp
index 6df0bd0e1d..62b5b76ede 100644
--- a/src/qml/qml/qqmllocale.cpp
+++ b/src/qml/qml/qqmllocale.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -46,6 +46,8 @@
QT_BEGIN_NAMESPACE
+using namespace QV4;
+
DEFINE_OBJECT_VTABLE(QQmlLocaleData);
#define GET_LOCALE_DATA_RESOURCE(OBJECT) \
@@ -53,9 +55,9 @@ DEFINE_OBJECT_VTABLE(QQmlLocaleData);
if (!r) \
V4THROW_ERROR("Not a valid Locale object")
-static bool isLocaleObject(const QV4::ValueRef val)
+static bool isLocaleObject(const QV4::Value &val)
{
- return val->as<QQmlLocaleData>();
+ return val.as<QQmlLocaleData>();
}
//--------------
@@ -63,9 +65,9 @@ static bool isLocaleObject(const QV4::ValueRef val)
void QQmlDateExtension::registerExtension(QV4::ExecutionEngine *engine)
{
- engine->dateClass->prototype->defineDefaultProperty(QStringLiteral("toLocaleString"), method_toLocaleString);
- engine->dateClass->prototype->defineDefaultProperty(QStringLiteral("toLocaleTimeString"), method_toLocaleTimeString);
- engine->dateClass->prototype->defineDefaultProperty(QStringLiteral("toLocaleDateString"), method_toLocaleDateString);
+ engine->datePrototype.asObject()->defineDefaultProperty(QStringLiteral("toLocaleString"), method_toLocaleString);
+ engine->datePrototype.asObject()->defineDefaultProperty(QStringLiteral("toLocaleTimeString"), method_toLocaleTimeString);
+ engine->datePrototype.asObject()->defineDefaultProperty(QStringLiteral("toLocaleDateString"), method_toLocaleDateString);
engine->dateCtor.objectValue()->defineDefaultProperty(QStringLiteral("fromLocaleString"), method_fromLocaleString);
engine->dateCtor.objectValue()->defineDefaultProperty(QStringLiteral("fromLocaleTimeString"), method_fromLocaleTimeString);
engine->dateCtor.objectValue()->defineDefaultProperty(QStringLiteral("fromLocaleDateString"), method_fromLocaleDateString);
@@ -74,36 +76,36 @@ void QQmlDateExtension::registerExtension(QV4::ExecutionEngine *engine)
QV4::ReturnedValue QQmlDateExtension::method_toLocaleString(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc > 2)
+ if (ctx->argc() > 2)
return QV4::DatePrototype::method_toLocaleString(ctx);
QV4::Scope scope(ctx);
- QV4::DateObject *date = ctx->d()->callData->thisObject.asDateObject();
+ QV4::DateObject *date = ctx->thisObject().asDateObject();
if (!date)
return QV4::DatePrototype::method_toLocaleString(ctx);
QDateTime dt = date->toQDateTime();
- if (ctx->d()->callData->argc == 0) {
+ if (ctx->argc() == 0) {
// Use QLocale for standard toLocaleString() function
QLocale locale;
return ctx->d()->engine->newString(locale.toString(dt))->asReturnedValue();
}
- if (!isLocaleObject(ctx->d()->callData->args[0]))
+ if (!isLocaleObject(ctx->args()[0]))
return QV4::DatePrototype::method_toLocaleString(ctx); // Use the default Date toLocaleString()
- GET_LOCALE_DATA_RESOURCE(ctx->d()->callData->args[0]);
+ GET_LOCALE_DATA_RESOURCE(ctx->args()[0]);
QLocale::FormatType enumFormat = QLocale::LongFormat;
QString formattedDt;
- if (ctx->d()->callData->argc == 2) {
- if (ctx->d()->callData->args[1].isString()) {
- QString format = ctx->d()->callData->args[1].stringValue()->toQString();
+ if (ctx->argc() == 2) {
+ if (ctx->args()[1].isString()) {
+ QString format = ctx->args()[1].stringValue()->toQString();
formattedDt = r->d()->locale.toString(dt, format);
- } else if (ctx->d()->callData->args[1].isNumber()) {
- quint32 intFormat = ctx->d()->callData->args[1].toNumber();
+ } else if (ctx->args()[1].isNumber()) {
+ quint32 intFormat = ctx->args()[1].toNumber();
QLocale::FormatType format = QLocale::FormatType(intFormat);
formattedDt = r->d()->locale.toString(dt, format);
} else {
@@ -118,37 +120,37 @@ QV4::ReturnedValue QQmlDateExtension::method_toLocaleString(QV4::CallContext *ct
QV4::ReturnedValue QQmlDateExtension::method_toLocaleTimeString(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc > 2)
+ if (ctx->argc() > 2)
return QV4::DatePrototype::method_toLocaleTimeString(ctx);
QV4::Scope scope(ctx);
- QV4::DateObject *date = ctx->d()->callData->thisObject.asDateObject();
+ QV4::DateObject *date = ctx->thisObject().asDateObject();
if (!date)
return QV4::DatePrototype::method_toLocaleTimeString(ctx);
QDateTime dt = date->toQDateTime();
QTime time = dt.time();
- if (ctx->d()->callData->argc == 0) {
+ if (ctx->argc() == 0) {
// Use QLocale for standard toLocaleString() function
QLocale locale;
return ctx->d()->engine->newString(locale.toString(time))->asReturnedValue();
}
- if (!isLocaleObject(ctx->d()->callData->args[0]))
+ if (!isLocaleObject(ctx->args()[0]))
return QV4::DatePrototype::method_toLocaleTimeString(ctx); // Use the default Date toLocaleTimeString()
- GET_LOCALE_DATA_RESOURCE(ctx->d()->callData->args[0]);
+ GET_LOCALE_DATA_RESOURCE(ctx->args()[0]);
QLocale::FormatType enumFormat = QLocale::LongFormat;
QString formattedTime;
- if (ctx->d()->callData->argc == 2) {
- if (ctx->d()->callData->args[1].isString()) {
- QString format = ctx->d()->callData->args[1].stringValue()->toQString();
+ if (ctx->argc() == 2) {
+ if (ctx->args()[1].isString()) {
+ QString format = ctx->args()[1].stringValue()->toQString();
formattedTime = r->d()->locale.toString(time, format);
- } else if (ctx->d()->callData->args[1].isNumber()) {
- quint32 intFormat = ctx->d()->callData->args[1].toNumber();
+ } else if (ctx->args()[1].isNumber()) {
+ quint32 intFormat = ctx->args()[1].toNumber();
QLocale::FormatType format = QLocale::FormatType(intFormat);
formattedTime = r->d()->locale.toString(time, format);
} else {
@@ -163,37 +165,37 @@ QV4::ReturnedValue QQmlDateExtension::method_toLocaleTimeString(QV4::CallContext
QV4::ReturnedValue QQmlDateExtension::method_toLocaleDateString(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc > 2)
+ if (ctx->argc() > 2)
return QV4::DatePrototype::method_toLocaleDateString(ctx);
QV4::Scope scope(ctx);
- QV4::DateObject *dateObj = ctx->d()->callData->thisObject.asDateObject();
+ QV4::DateObject *dateObj = ctx->thisObject().asDateObject();
if (!dateObj)
return QV4::DatePrototype::method_toLocaleDateString(ctx);
QDateTime dt = dateObj->toQDateTime();
QDate date = dt.date();
- if (ctx->d()->callData->argc == 0) {
+ if (ctx->argc() == 0) {
// Use QLocale for standard toLocaleString() function
QLocale locale;
return ctx->d()->engine->newString(locale.toString(date))->asReturnedValue();
}
- if (!isLocaleObject(ctx->d()->callData->args[0]))
+ if (!isLocaleObject(ctx->args()[0]))
return QV4::DatePrototype::method_toLocaleDateString(ctx); // Use the default Date toLocaleDateString()
- GET_LOCALE_DATA_RESOURCE(ctx->d()->callData->args[0]);
+ GET_LOCALE_DATA_RESOURCE(ctx->args()[0]);
QLocale::FormatType enumFormat = QLocale::LongFormat;
QString formattedDate;
- if (ctx->d()->callData->argc == 2) {
- if (ctx->d()->callData->args[1].isString()) {
- QString format = ctx->d()->callData->args[1].stringValue()->toQString();
+ if (ctx->argc() == 2) {
+ if (ctx->args()[1].isString()) {
+ QString format = ctx->args()[1].stringValue()->toQString();
formattedDate = r->d()->locale.toString(date, format);
- } else if (ctx->d()->callData->args[1].isNumber()) {
- quint32 intFormat = ctx->d()->callData->args[1].toNumber();
+ } else if (ctx->args()[1].isNumber()) {
+ quint32 intFormat = ctx->args()[1].toNumber();
QLocale::FormatType format = QLocale::FormatType(intFormat);
formattedDate = r->d()->locale.toString(date, format);
} else {
@@ -209,29 +211,29 @@ QV4::ReturnedValue QQmlDateExtension::method_toLocaleDateString(QV4::CallContext
QV4::ReturnedValue QQmlDateExtension::method_fromLocaleString(QV4::CallContext *ctx)
{
QV4::ExecutionEngine * const engine = ctx->d()->engine;
- if (ctx->d()->callData->argc == 1 && ctx->d()->callData->args[0].isString()) {
+ if (ctx->argc() == 1 && ctx->args()[0].isString()) {
QLocale locale;
- QString dateString = ctx->d()->callData->args[0].stringValue()->toQString();
+ QString dateString = ctx->args()[0].stringValue()->toQString();
QDateTime dt = locale.toDateTime(dateString);
return QV4::Encode(engine->newDateObject(dt));
}
QV4::Scope scope(ctx);
- if (ctx->d()->callData->argc < 1 || ctx->d()->callData->argc > 3 || !isLocaleObject(ctx->d()->callData->args[0]))
+ if (ctx->argc() < 1 || ctx->argc() > 3 || !isLocaleObject(ctx->args()[0]))
V4THROW_ERROR("Locale: Date.fromLocaleString(): Invalid arguments");
- GET_LOCALE_DATA_RESOURCE(ctx->d()->callData->args[0]);
+ GET_LOCALE_DATA_RESOURCE(ctx->args()[0]);
QLocale::FormatType enumFormat = QLocale::LongFormat;
QDateTime dt;
- QString dateString = ctx->d()->callData->args[1].toQStringNoThrow();
- if (ctx->d()->callData->argc == 3) {
- if (ctx->d()->callData->args[2].isString()) {
- QString format = ctx->d()->callData->args[2].stringValue()->toQString();
+ QString dateString = ctx->args()[1].toQStringNoThrow();
+ if (ctx->argc() == 3) {
+ if (ctx->args()[2].isString()) {
+ QString format = ctx->args()[2].stringValue()->toQString();
dt = r->d()->locale.toDateTime(dateString, format);
- } else if (ctx->d()->callData->args[2].isNumber()) {
- quint32 intFormat = ctx->d()->callData->args[2].toNumber();
+ } else if (ctx->args()[2].isNumber()) {
+ quint32 intFormat = ctx->args()[2].toNumber();
QLocale::FormatType format = QLocale::FormatType(intFormat);
dt = r->d()->locale.toDateTime(dateString, format);
} else {
@@ -248,31 +250,31 @@ QV4::ReturnedValue QQmlDateExtension::method_fromLocaleTimeString(QV4::CallConte
{
QV4::ExecutionEngine * const engine = ctx->d()->engine;
- if (ctx->d()->callData->argc == 1 && ctx->d()->callData->args[0].isString()) {
+ if (ctx->argc() == 1 && ctx->args()[0].isString()) {
QLocale locale;
- QString timeString = ctx->d()->callData->args[0].stringValue()->toQString();
+ QString timeString = ctx->args()[0].stringValue()->toQString();
QTime time = locale.toTime(timeString);
QDateTime dt = QDateTime::currentDateTime();
dt.setTime(time);
return QV4::Encode(engine->newDateObject(dt));
}
- if (ctx->d()->callData->argc < 1 || ctx->d()->callData->argc > 3 || !isLocaleObject(ctx->d()->callData->args[0]))
+ if (ctx->argc() < 1 || ctx->argc() > 3 || !isLocaleObject(ctx->args()[0]))
V4THROW_ERROR("Locale: Date.fromLocaleTimeString(): Invalid arguments");
QV4::Scope scope(ctx);
- GET_LOCALE_DATA_RESOURCE(ctx->d()->callData->args[0]);
+ GET_LOCALE_DATA_RESOURCE(ctx->args()[0]);
QLocale::FormatType enumFormat = QLocale::LongFormat;
QTime tm;
- QString dateString = ctx->d()->callData->args[1].toQStringNoThrow();
- if (ctx->d()->callData->argc == 3) {
- if (ctx->d()->callData->args[2].isString()) {
- QString format = ctx->d()->callData->args[2].stringValue()->toQString();
+ QString dateString = ctx->args()[1].toQStringNoThrow();
+ if (ctx->argc() == 3) {
+ if (ctx->args()[2].isString()) {
+ QString format = ctx->args()[2].stringValue()->toQString();
tm = r->d()->locale.toTime(dateString, format);
- } else if (ctx->d()->callData->args[2].isNumber()) {
- quint32 intFormat = ctx->d()->callData->args[2].toNumber();
+ } else if (ctx->args()[2].isNumber()) {
+ quint32 intFormat = ctx->args()[2].toNumber();
QLocale::FormatType format = QLocale::FormatType(intFormat);
tm = r->d()->locale.toTime(dateString, format);
} else {
@@ -295,29 +297,29 @@ QV4::ReturnedValue QQmlDateExtension::method_fromLocaleDateString(QV4::CallConte
{
QV4::ExecutionEngine * const engine = ctx->d()->engine;
- if (ctx->d()->callData->argc == 1 && ctx->d()->callData->args[0].isString()) {
+ if (ctx->argc() == 1 && ctx->args()[0].isString()) {
QLocale locale;
- QString dateString = ctx->d()->callData->args[0].stringValue()->toQString();
+ QString dateString = ctx->args()[0].stringValue()->toQString();
QDate date = locale.toDate(dateString);
return QV4::Encode(engine->newDateObject(QDateTime(date)));
}
- if (ctx->d()->callData->argc < 1 || ctx->d()->callData->argc > 3 || !isLocaleObject(ctx->d()->callData->args[0]))
+ if (ctx->argc() < 1 || ctx->argc() > 3 || !isLocaleObject(ctx->args()[0]))
V4THROW_ERROR("Locale: Date.fromLocaleDateString(): Invalid arguments");
QV4::Scope scope(ctx);
- GET_LOCALE_DATA_RESOURCE(ctx->d()->callData->args[0]);
+ GET_LOCALE_DATA_RESOURCE(ctx->args()[0]);
QLocale::FormatType enumFormat = QLocale::LongFormat;
QDate dt;
- QString dateString = ctx->d()->callData->args[1].toQStringNoThrow();
- if (ctx->d()->callData->argc == 3) {
- if (ctx->d()->callData->args[2].isString()) {
- QString format = ctx->d()->callData->args[2].stringValue()->toQString();
+ QString dateString = ctx->args()[1].toQStringNoThrow();
+ if (ctx->argc() == 3) {
+ if (ctx->args()[2].isString()) {
+ QString format = ctx->args()[2].stringValue()->toQString();
dt = r->d()->locale.toDate(dateString, format);
- } else if (ctx->d()->callData->args[2].isNumber()) {
- quint32 intFormat = ctx->d()->callData->args[2].toNumber();
+ } else if (ctx->args()[2].isNumber()) {
+ quint32 intFormat = ctx->args()[2].toNumber();
QLocale::FormatType format = QLocale::FormatType(intFormat);
dt = r->d()->locale.toDate(dateString, format);
} else {
@@ -332,7 +334,7 @@ QV4::ReturnedValue QQmlDateExtension::method_fromLocaleDateString(QV4::CallConte
QV4::ReturnedValue QQmlDateExtension::method_timeZoneUpdated(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc != 0)
+ if (ctx->argc() != 0)
V4THROW_ERROR("Locale: Date.timeZoneUpdated(): Invalid arguments");
QV4::DatePrototype::timezoneUpdated();
@@ -345,44 +347,44 @@ QV4::ReturnedValue QQmlDateExtension::method_timeZoneUpdated(QV4::CallContext *c
void QQmlNumberExtension::registerExtension(QV4::ExecutionEngine *engine)
{
- engine->numberClass->prototype->defineDefaultProperty(QStringLiteral("toLocaleString"), method_toLocaleString);
- engine->numberClass->prototype->defineDefaultProperty(QStringLiteral("toLocaleCurrencyString"), method_toLocaleCurrencyString);
+ engine->numberPrototype.asObject()->defineDefaultProperty(QStringLiteral("toLocaleString"), method_toLocaleString);
+ engine->numberPrototype.asObject()->defineDefaultProperty(QStringLiteral("toLocaleCurrencyString"), method_toLocaleCurrencyString);
engine->numberCtor.objectValue()->defineDefaultProperty(QStringLiteral("fromLocaleString"), method_fromLocaleString);
}
QV4::ReturnedValue QQmlNumberExtension::method_toLocaleString(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc > 3)
+ if (ctx->argc() > 3)
V4THROW_ERROR("Locale: Number.toLocaleString(): Invalid arguments");
- double number = ctx->d()->callData->thisObject.toNumber();
+ double number = ctx->thisObject().toNumber();
- if (ctx->d()->callData->argc == 0) {
+ if (ctx->argc() == 0) {
// Use QLocale for standard toLocaleString() function
QLocale locale;
return ctx->d()->engine->newString(locale.toString(number))->asReturnedValue();
}
- if (!isLocaleObject(ctx->d()->callData->args[0]))
+ if (!isLocaleObject(ctx->args()[0]))
return QV4::NumberPrototype::method_toLocaleString(ctx); // Use the default Number toLocaleString()
QV4::Scope scope(ctx);
- GET_LOCALE_DATA_RESOURCE(ctx->d()->callData->args[0]);
+ GET_LOCALE_DATA_RESOURCE(ctx->args()[0]);
quint16 format = 'f';
- if (ctx->d()->callData->argc > 1) {
- if (!ctx->d()->callData->args[1].isString())
+ if (ctx->argc() > 1) {
+ if (!ctx->args()[1].isString())
V4THROW_ERROR("Locale: Number.toLocaleString(): Invalid arguments");
- QV4::String *fs = ctx->d()->callData->args[1].toString(ctx);
- if (fs->d()->length())
- format = fs->toQString().at(0).unicode();
+ QString fs = ctx->args()[1].toQString();
+ if (fs.length())
+ format = fs.at(0).unicode();
}
int prec = 2;
- if (ctx->d()->callData->argc > 2) {
- if (!ctx->d()->callData->args[2].isNumber())
+ if (ctx->argc() > 2) {
+ if (!ctx->args()[2].isNumber())
V4THROW_ERROR("Locale: Number.toLocaleString(): Invalid arguments");
- prec = ctx->d()->callData->args[2].toInt32();
+ prec = ctx->args()[2].toInt32();
}
return ctx->d()->engine->newString(r->d()->locale.toString(number, (char)format, prec))->asReturnedValue();
@@ -390,29 +392,29 @@ QV4::ReturnedValue QQmlNumberExtension::method_toLocaleString(QV4::CallContext *
QV4::ReturnedValue QQmlNumberExtension::method_toLocaleCurrencyString(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc > 2)
+ if (ctx->argc() > 2)
V4THROW_ERROR("Locale: Number.toLocaleCurrencyString(): Invalid arguments");
- double number = ctx->d()->callData->thisObject.toNumber();
+ double number = ctx->thisObject().toNumber();
- if (ctx->d()->callData->argc == 0) {
+ if (ctx->argc() == 0) {
// Use QLocale for standard toLocaleString() function
QLocale locale;
return ctx->d()->engine->newString(locale.toString(number))->asReturnedValue();
}
- if (!isLocaleObject(ctx->d()->callData->args[0]))
+ if (!isLocaleObject(ctx->args()[0]))
V4THROW_ERROR("Locale: Number.toLocaleCurrencyString(): Invalid arguments");
QV4::Scope scope(ctx);
- GET_LOCALE_DATA_RESOURCE(ctx->d()->callData->args[0]);
+ GET_LOCALE_DATA_RESOURCE(ctx->args()[0]);
QString symbol;
- if (ctx->d()->callData->argc > 1) {
- if (!ctx->d()->callData->args[1].isString())
+ if (ctx->argc() > 1) {
+ if (!ctx->args()[1].isString())
V4THROW_ERROR("Locale: Number.toLocaleString(): Invalid arguments");
- symbol = ctx->d()->callData->args[1].toQStringNoThrow();
+ symbol = ctx->args()[1].toQStringNoThrow();
}
return ctx->d()->engine->newString(r->d()->locale.toCurrencyString(number, symbol))->asReturnedValue();
@@ -420,7 +422,7 @@ QV4::ReturnedValue QQmlNumberExtension::method_toLocaleCurrencyString(QV4::CallC
QV4::ReturnedValue QQmlNumberExtension::method_fromLocaleString(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc < 1 || ctx->d()->callData->argc > 2)
+ if (ctx->argc() < 1 || ctx->argc() > 2)
V4THROW_ERROR("Locale: Number.fromLocaleString(): Invalid arguments");
int numberIdx = 0;
@@ -428,22 +430,22 @@ QV4::ReturnedValue QQmlNumberExtension::method_fromLocaleString(QV4::CallContext
QV4::Scope scope(ctx);
- if (ctx->d()->callData->argc == 2) {
- if (!isLocaleObject(ctx->d()->callData->args[0]))
+ if (ctx->argc() == 2) {
+ if (!isLocaleObject(ctx->args()[0]))
V4THROW_ERROR("Locale: Number.fromLocaleString(): Invalid arguments");
- GET_LOCALE_DATA_RESOURCE(ctx->d()->callData->args[0]);
+ GET_LOCALE_DATA_RESOURCE(ctx->args()[0]);
locale = r->d()->locale;
numberIdx = 1;
}
- QV4::String *ns = ctx->d()->callData->args[numberIdx].toString(ctx);
- if (!ns->d()->length())
+ QString ns = ctx->args()[numberIdx].toQString();
+ if (!ns.length())
return QV4::Encode(Q_QNAN);
bool ok = false;
- double val = locale.toDouble(ns->toQString(), &ok);
+ double val = locale.toDouble(ns, &ok);
if (!ok)
V4THROW_ERROR("Locale: Number.fromLocaleString(): Invalid format")
@@ -491,7 +493,7 @@ QV4::ReturnedValue QQmlLocaleData::method_get_weekDays(QV4::CallContext *ctx)
QList<Qt::DayOfWeek> days = locale->weekdays();
- QV4::Scoped<QV4::ArrayObject> result(scope, ctx->d()->engine->newArrayObject());
+ QV4::ScopedArrayObject result(scope, ctx->d()->engine->newArrayObject());
result->arrayReserve(days.size());
for (int i = 0; i < days.size(); ++i) {
int day = days.at(i);
@@ -512,7 +514,7 @@ QV4::ReturnedValue QQmlLocaleData::method_get_uiLanguages(QV4::CallContext *ctx)
return QV4::Encode::undefined();
QStringList langs = locale->uiLanguages();
- QV4::Scoped<QV4::ArrayObject> result(scope, ctx->d()->engine->newArrayObject());
+ QV4::ScopedArrayObject result(scope, ctx->d()->engine->newArrayObject());
result->arrayReserve(langs.size());
QV4::ScopedValue v(scope);
for (int i = 0; i < langs.size(); ++i)
@@ -529,12 +531,12 @@ QV4::ReturnedValue QQmlLocaleData::method_currencySymbol(QV4::CallContext *ctx)
if (!locale)
return QV4::Encode::undefined();
- if (ctx->d()->callData->argc > 1)
+ if (ctx->argc() > 1)
V4THROW_ERROR("Locale: currencySymbol(): Invalid arguments");
QLocale::CurrencySymbolFormat format = QLocale::CurrencySymbol;
- if (ctx->d()->callData->argc == 1) {
- quint32 intFormat = ctx->d()->callData->args[0].toNumber();
+ if (ctx->argc() == 1) {
+ quint32 intFormat = ctx->args()[0].toNumber();
format = QLocale::CurrencySymbolFormat(intFormat);
}
@@ -546,11 +548,11 @@ QV4::ReturnedValue QQmlLocaleData::method_ ##FUNC (QV4::CallContext *ctx) { \
QLocale *locale = getThisLocale(ctx); \
if (!locale) \
return QV4::Encode::undefined(); \
- if (ctx->d()->callData->argc > 1) \
+ if (ctx->argc() > 1) \
V4THROW_ERROR("Locale: " #FUNC "(): Invalid arguments"); \
QLocale::FormatType format = QLocale::LongFormat;\
- if (ctx->d()->callData->argc == 1) { \
- quint32 intFormat = ctx->d()->callData->args[0].toUInt32(); \
+ if (ctx->argc() == 1) { \
+ quint32 intFormat = ctx->args()[0].toUInt32(); \
format = QLocale::FormatType(intFormat); \
} \
return ctx->engine()->newString(locale-> FUNC (format))->asReturnedValue(); \
@@ -566,16 +568,16 @@ QV4::ReturnedValue QQmlLocaleData::method_ ## VARIABLE (QV4::CallContext *ctx) {
QLocale *locale = getThisLocale(ctx); \
if (!locale) \
return QV4::Encode::undefined(); \
- if (ctx->d()->callData->argc < 1 || ctx->d()->callData->argc > 2) \
+ if (ctx->argc() < 1 || ctx->argc() > 2) \
V4THROW_ERROR("Locale: " #VARIABLE "(): Invalid arguments"); \
QLocale::FormatType enumFormat = QLocale::LongFormat; \
- int idx = ctx->d()->callData->args[0].toInt32() + 1; \
+ int idx = ctx->args()[0].toInt32() + 1; \
if (idx < 1 || idx > 12) \
V4THROW_ERROR("Locale: Invalid month"); \
QString name; \
- if (ctx->d()->callData->argc == 2) { \
- if (ctx->d()->callData->args[1].isNumber()) { \
- quint32 intFormat = ctx->d()->callData->args[1].toUInt32(); \
+ if (ctx->argc() == 2) { \
+ if (ctx->args()[1].isNumber()) { \
+ quint32 intFormat = ctx->args()[1].toUInt32(); \
QLocale::FormatType format = QLocale::FormatType(intFormat); \
name = locale-> VARIABLE(idx, format); \
} else { \
@@ -593,17 +595,17 @@ QV4::ReturnedValue QQmlLocaleData::method_ ## VARIABLE (QV4::CallContext *ctx) {
QLocale *locale = getThisLocale(ctx); \
if (!locale) \
return QV4::Encode::undefined(); \
- if (ctx->d()->callData->argc < 1 || ctx->d()->callData->argc > 2) \
+ if (ctx->argc() < 1 || ctx->argc() > 2) \
V4THROW_ERROR("Locale: " #VARIABLE "(): Invalid arguments"); \
QLocale::FormatType enumFormat = QLocale::LongFormat; \
- int idx = ctx->d()->callData->args[0].toInt32(); \
+ int idx = ctx->args()[0].toInt32(); \
if (idx < 0 || idx > 7) \
V4THROW_ERROR("Locale: Invalid day"); \
if (idx == 0) idx = 7; \
QString name; \
- if (ctx->d()->callData->argc == 2) { \
- if (ctx->d()->callData->args[1].isNumber()) { \
- quint32 intFormat = ctx->d()->callData->args[1].toUInt32(); \
+ if (ctx->argc() == 2) { \
+ if (ctx->args()[1].isNumber()) { \
+ quint32 intFormat = ctx->args()[1].toUInt32(); \
QLocale::FormatType format = QLocale::FormatType(intFormat); \
name = locale-> VARIABLE(idx, format); \
} else { \
@@ -641,20 +643,19 @@ LOCALE_STRING_PROPERTY(exponential)
LOCALE_STRING_PROPERTY(amText)
LOCALE_STRING_PROPERTY(pmText)
-class QV8LocaleDataDeletable : public QV8Engine::Deletable
+class QV4LocaleDataDeletable : public QV8Engine::Deletable
{
public:
- QV8LocaleDataDeletable(QV8Engine *engine);
- ~QV8LocaleDataDeletable();
+ QV4LocaleDataDeletable(QV4::ExecutionEngine *engine);
+ ~QV4LocaleDataDeletable();
QV4::PersistentValue prototype;
};
-QV8LocaleDataDeletable::QV8LocaleDataDeletable(QV8Engine *engine)
+QV4LocaleDataDeletable::QV4LocaleDataDeletable(QV4::ExecutionEngine *engine)
{
- QV4::ExecutionEngine *eng = QV8Engine::getV4(engine);
- QV4::Scope scope(eng);
- QV4::Scoped<QV4::Object> o(scope, eng->newObject());
+ QV4::Scope scope(engine);
+ QV4::Scoped<QV4::Object> o(scope, engine->newObject());
o->defineDefaultProperty(QStringLiteral("dateFormat"), QQmlLocaleData::method_dateFormat, 0);
o->defineDefaultProperty(QStringLiteral("standaloneDayName"), QQmlLocaleData::method_standaloneDayName, 0);
@@ -682,14 +683,14 @@ QV8LocaleDataDeletable::QV8LocaleDataDeletable(QV8Engine *engine)
o->defineAccessorProperty(QStringLiteral("measurementSystem"), QQmlLocaleData::method_get_measurementSystem, 0);
o->defineAccessorProperty(QStringLiteral("exponential"), QQmlLocaleData::method_get_exponential, 0);
- prototype = o;
+ prototype.set(engine, o);
}
-QV8LocaleDataDeletable::~QV8LocaleDataDeletable()
+QV4LocaleDataDeletable::~QV4LocaleDataDeletable()
{
}
-V8_DEFINE_EXTENSION(QV8LocaleDataDeletable, localeV8Data);
+V4_DEFINE_EXTENSION(QV4LocaleDataDeletable, localeV4Data);
/*!
\qmltype Locale
@@ -793,41 +794,40 @@ QQmlLocale::~QQmlLocale()
{
}
-QV4::ReturnedValue QQmlLocale::locale(QV8Engine *v8engine, const QString &localeName)
+QV4::ReturnedValue QQmlLocale::locale(ExecutionEngine *engine, const QString &localeName)
{
QLocale qlocale;
if (!localeName.isEmpty())
qlocale = localeName;
- return wrap(v8engine, qlocale);
+ return wrap(engine, qlocale);
}
-QV4::ReturnedValue QQmlLocale::wrap(QV8Engine *engine, const QLocale &locale)
+QV4::ReturnedValue QQmlLocale::wrap(ExecutionEngine *v4, const QLocale &locale)
{
- QV8LocaleDataDeletable *d = localeV8Data(engine);
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine);
QV4::Scope scope(v4);
+ QV4LocaleDataDeletable *d = localeV4Data(scope.engine);
QV4::Scoped<QQmlLocaleData> wrapper(scope, v4->memoryManager->alloc<QQmlLocaleData>(v4));
wrapper->d()->locale = locale;
QV4::ScopedObject p(scope, d->prototype.value());
- wrapper->setPrototype(p.getPointer());
+ wrapper->setPrototype(p);
return wrapper.asReturnedValue();
}
void QQmlLocale::registerStringLocaleCompare(QV4::ExecutionEngine *engine)
{
- engine->stringObjectClass->prototype->defineDefaultProperty(QStringLiteral("localeCompare"), method_localeCompare);
+ engine->stringPrototype.asObject()->defineDefaultProperty(QStringLiteral("localeCompare"), method_localeCompare);
}
QV4::ReturnedValue QQmlLocale::method_localeCompare(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc != 1 || (!ctx->d()->callData->args[0].isString() && !ctx->d()->callData->args[0].asStringObject()))
+ if (ctx->argc() != 1 || (!ctx->args()[0].isString() && !ctx->args()[0].asStringObject()))
return QV4::StringPrototype::method_localeCompare(ctx);
- if (!ctx->d()->callData->thisObject.isString() && !ctx->d()->callData->thisObject.asStringObject())
+ if (!ctx->thisObject().isString() && !ctx->thisObject().asStringObject())
return QV4::StringPrototype::method_localeCompare(ctx);
- QString thisString = ctx->d()->callData->thisObject.toQStringNoThrow();
- QString thatString = ctx->d()->callData->args[0].toQStringNoThrow();
+ QString thisString = ctx->thisObject().toQStringNoThrow();
+ QString thatString = ctx->args()[0].toQStringNoThrow();
return QV4::Encode(QString::localeAwareCompare(thisString, thatString));
}
diff --git a/src/qml/qml/qqmllocale_p.h b/src/qml/qml/qqmllocale_p.h
index 3787517038..d4436482cf 100644
--- a/src/qml/qml/qqmllocale_p.h
+++ b/src/qml/qml/qqmllocale_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -38,8 +38,7 @@
#include <QtCore/qlocale.h>
#include <QtCore/qobject.h>
-#include <private/qv8engine_p.h>
-
+#include <private/qqmlglobal_p.h>
QT_BEGIN_NAMESPACE
@@ -110,8 +109,8 @@ public:
Saturday = Qt::Saturday
};
- static QV4::ReturnedValue locale(QV8Engine *v8engine, const QString &localeName);
- static QV4::ReturnedValue wrap(QV8Engine *engine, const QLocale &locale);
+ static QV4::ReturnedValue locale(QV4::ExecutionEngine *engine, const QString &localeName);
+ static QV4::ReturnedValue wrap(QV4::ExecutionEngine *engine, const QLocale &locale);
static void registerStringLocaleCompare(QV4::ExecutionEngine *engine);
@@ -121,23 +120,27 @@ private:
static QV4::ReturnedValue method_localeCompare(QV4::CallContext *ctx);
};
+namespace QV4 {
+
+namespace Heap {
+
+struct QQmlLocaleData : Object {
+ inline QQmlLocaleData(ExecutionEngine *engine);
+ QLocale locale;
+};
+
+}
+
struct QQmlLocaleData : public QV4::Object
{
- struct Data : Object::Data {
- Data(QV4::ExecutionEngine *engine)
- : Object::Data(engine)
- {
- setVTable(staticVTable());
- }
- QLocale locale;
- };
- V4_OBJECT(Object)
+ V4_OBJECT2(QQmlLocaleData, Object)
+ V4_NEEDS_DESTROY
static QLocale *getThisLocale(QV4::CallContext *ctx) {
- QV4::Object *o = ctx->d()->callData->thisObject.asObject();
+ QV4::Object *o = ctx->thisObject().asObject();
QQmlLocaleData *thisObject = o ? o->as<QQmlLocaleData>() : 0;
if (!thisObject) {
- ctx->throwTypeError();
+ ctx->engine()->throwTypeError();
return 0;
}
return &thisObject->d()->locale;
@@ -170,14 +173,15 @@ struct QQmlLocaleData : public QV4::Object
static QV4::ReturnedValue method_get_exponential(QV4::CallContext *ctx);
static QV4::ReturnedValue method_get_amText(QV4::CallContext *ctx);
static QV4::ReturnedValue method_get_pmText(QV4::CallContext *ctx);
-
-private:
- static void destroy(Managed *that)
- {
- static_cast<QQmlLocaleData *>(that)->d()->~Data();
- }
};
+Heap::QQmlLocaleData::QQmlLocaleData(ExecutionEngine *engine)
+ : Heap::Object(engine)
+{
+}
+
+}
+
QT_END_NAMESPACE
#endif
diff --git a/src/qml/qml/qqmlmemoryprofiler.cpp b/src/qml/qml/qqmlmemoryprofiler.cpp
index cb46f3edcb..cdd60e2dec 100644
--- a/src/qml/qml/qqmlmemoryprofiler.cpp
+++ b/src/qml/qml/qqmlmemoryprofiler.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlmemoryprofiler_p.h b/src/qml/qml/qqmlmemoryprofiler_p.h
index 3ef8c307d3..98977f9db5 100644
--- a/src/qml/qml/qqmlmemoryprofiler_p.h
+++ b/src/qml/qml/qqmlmemoryprofiler_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp
index d20fe72d09..41d44a821a 100644
--- a/src/qml/qml/qqmlmetatype.cpp
+++ b/src/qml/qml/qqmlmetatype.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -127,7 +127,7 @@ public:
};
Q_GLOBAL_STATIC(QQmlMetaTypeData, metaTypeData)
-Q_GLOBAL_STATIC_WITH_ARGS(QReadWriteLock, metaTypeDataLock, (QReadWriteLock::Recursive))
+Q_GLOBAL_STATIC_WITH_ARGS(QMutex, metaTypeDataLock, (QMutex::Recursive))
static uint qHash(const QQmlMetaTypeData::VersionedUri &v)
{
@@ -143,8 +143,7 @@ QQmlMetaTypeData::~QQmlMetaTypeData()
for (int i = 0; i < types.count(); ++i)
delete types.at(i);
- TypeModules::const_iterator i = uriToModule.constBegin();
- for (; i != uriToModule.constEnd(); ++i)
+ for (TypeModules::const_iterator i = uriToModule.constBegin(), cend = uriToModule.constEnd(); i != cend; ++i)
delete *i;
}
@@ -566,7 +565,7 @@ void QQmlTypePrivate::init() const
if (isSetup)
return;
- QWriteLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
if (isSetup)
return;
@@ -647,7 +646,7 @@ void QQmlTypePrivate::initEnums() const
init();
- QWriteLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
if (isEnumSetup) return;
if (baseMetaObject) // could be singleton type without metaobject
@@ -1001,7 +1000,7 @@ void QQmlTypeModulePrivate::add(QQmlType *type)
QQmlType *QQmlTypeModule::type(const QHashedStringRef &name, int minor)
{
- QReadLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QList<QQmlType *> *types = d->typeHash.value(name);
if (!types) return 0;
@@ -1015,7 +1014,7 @@ QQmlType *QQmlTypeModule::type(const QHashedStringRef &name, int minor)
QQmlType *QQmlTypeModule::type(const QV4::String *name, int minor)
{
- QReadLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QList<QQmlType *> *types = d->typeHash.value(name);
if (!types) return 0;
@@ -1029,7 +1028,7 @@ QQmlType *QQmlTypeModule::type(const QV4::String *name, int minor)
QList<QQmlType*> QQmlTypeModule::singletonTypes(int minor) const
{
- QReadLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QList<QQmlType *> retn;
for (int ii = 0; ii < d->types.count(); ++ii) {
@@ -1090,14 +1089,13 @@ QQmlType *QQmlTypeModuleVersion::type(const QV4::String *name) const
void qmlClearTypeRegistrations() // Declared in qqml.h
{
//Only cleans global static, assumed no running engine
- QWriteLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
for (int i = 0; i < data->types.count(); ++i)
delete data->types.at(i);
- QQmlMetaTypeData::TypeModules::const_iterator i = data->uriToModule.constBegin();
- for (; i != data->uriToModule.constEnd(); ++i)
+ for (QQmlMetaTypeData::TypeModules::const_iterator i = data->uriToModule.constBegin(), cend = data->uriToModule.constEnd(); i != cend; ++i)
delete *i;
data->types.clear();
@@ -1114,7 +1112,7 @@ void qmlClearTypeRegistrations() // Declared in qqml.h
int registerAutoParentFunction(QQmlPrivate::RegisterAutoParent &autoparent)
{
- QWriteLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
data->parentFunctions.append(autoparent.function);
@@ -1127,7 +1125,7 @@ int registerInterface(const QQmlPrivate::RegisterInterface &interface)
if (interface.version > 0)
qFatal("qmlRegisterType(): Cannot mix incompatible QML versions.");
- QWriteLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
int index = data->types.count();
@@ -1165,7 +1163,7 @@ QString registrationTypeString(QQmlType::RegistrationType typeType)
return typeStr;
}
-// NOTE: caller must hold a QWriteLocker on "data"
+// NOTE: caller must hold a QMutexLocker on "data"
bool checkRegistration(QQmlType::RegistrationType typeType, QQmlMetaTypeData *data, const char *uri, const QString &typeName, int majorVersion = -1)
{
if (!typeName.isEmpty()) {
@@ -1216,7 +1214,7 @@ bool checkRegistration(QQmlType::RegistrationType typeType, QQmlMetaTypeData *da
return true;
}
-// NOTE: caller must hold a QWriteLocker on "data"
+// NOTE: caller must hold a QMutexLocker on "data"
void addTypeToData(QQmlType* type, QQmlMetaTypeData *data)
{
if (!type->elementName().isEmpty())
@@ -1255,7 +1253,7 @@ void addTypeToData(QQmlType* type, QQmlMetaTypeData *data)
int registerType(const QQmlPrivate::RegisterType &type)
{
- QWriteLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
QString elementName = QString::fromUtf8(type.elementName);
if (!checkRegistration(QQmlType::CppType, data, type.uri, elementName, type.versionMajor))
@@ -1275,7 +1273,7 @@ int registerType(const QQmlPrivate::RegisterType &type)
int registerSingletonType(const QQmlPrivate::RegisterSingletonType &type)
{
- QWriteLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
QString typeName = QString::fromUtf8(type.typeName);
if (!checkRegistration(QQmlType::SingletonType, data, type.uri, typeName, type.versionMajor))
@@ -1294,7 +1292,7 @@ int registerSingletonType(const QQmlPrivate::RegisterSingletonType &type)
int registerCompositeSingletonType(const QQmlPrivate::RegisterCompositeSingletonType &type)
{
// Assumes URL is absolute and valid. Checking of user input should happen before the URL enters type.
- QWriteLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
QString typeName = QString::fromUtf8(type.typeName);
bool fileImport = false;
@@ -1319,7 +1317,7 @@ int registerCompositeSingletonType(const QQmlPrivate::RegisterCompositeSingleton
int registerCompositeType(const QQmlPrivate::RegisterCompositeType &type)
{
// Assumes URL is absolute and valid. Checking of user input should happen before the URL enters type.
- QWriteLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
QString typeName = QString::fromUtf8(type.typeName);
bool fileImport = false;
@@ -1344,7 +1342,7 @@ int registerQmlUnitCacheHook(const QQmlPrivate::RegisterQmlUnitCacheHook &hookRe
{
if (hookRegistration.version > 0)
qFatal("qmlRegisterType(): Cannot mix incompatible QML versions.");
- QWriteLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
data->lookupCachedQmlUnit << hookRegistration.lookupCachedQmlUnit;
return 0;
@@ -1377,7 +1375,7 @@ int QQmlPrivate::qmlregister(RegistrationType type, void *data)
//From qqml.h
bool qmlProtectModule(const char *uri, int majVersion)
{
- QWriteLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
QQmlMetaTypeData::VersionedUri versionedUri;
@@ -1391,14 +1389,14 @@ bool qmlProtectModule(const char *uri, int majVersion)
return false;
}
-bool QQmlMetaType::namespaceContainsRegistrations(const QString &uri)
+bool QQmlMetaType::namespaceContainsRegistrations(const QString &uri, int majorVersion)
{
QQmlMetaTypeData *data = metaTypeData();
// Has any type previously been installed to this namespace?
QHashedString nameSpace(uri);
foreach (const QQmlType *type, data->types)
- if (type->module() == nameSpace)
+ if (type->module() == nameSpace && type->majorVersion() == majorVersion)
return true;
return false;
@@ -1426,7 +1424,7 @@ QStringList QQmlMetaType::typeRegistrationFailures()
return data->typeRegistrationFailures;
}
-QReadWriteLock *QQmlMetaType::typeRegistrationLock()
+QMutex *QQmlMetaType::typeRegistrationLock()
{
return metaTypeDataLock();
}
@@ -1436,7 +1434,7 @@ QReadWriteLock *QQmlMetaType::typeRegistrationLock()
*/
bool QQmlMetaType::isAnyModule(const QString &uri)
{
- QReadLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
for (QQmlMetaTypeData::TypeModules::ConstIterator iter = data->uriToModule.begin();
@@ -1453,7 +1451,7 @@ bool QQmlMetaType::isAnyModule(const QString &uri)
*/
bool QQmlMetaType::isLockedModule(const QString &uri, int majVersion)
{
- QReadLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
QQmlMetaTypeData::VersionedUri versionedUri;
@@ -1474,7 +1472,7 @@ bool QQmlMetaType::isLockedModule(const QString &uri, int majVersion)
bool QQmlMetaType::isModule(const QString &module, int versionMajor, int versionMinor)
{
Q_ASSERT(versionMajor >= 0 && versionMinor >= 0);
- QReadLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
@@ -1489,14 +1487,14 @@ bool QQmlMetaType::isModule(const QString &module, int versionMajor, int version
QQmlTypeModule *QQmlMetaType::typeModule(const QString &uri, int majorVersion)
{
- QReadLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
return data->uriToModule.value(QQmlMetaTypeData::VersionedUri(uri, majorVersion));
}
QList<QQmlPrivate::AutoParentFunction> QQmlMetaType::parentFunctions()
{
- QReadLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
return data->parentFunctions;
}
@@ -1510,7 +1508,7 @@ QObject *QQmlMetaType::toQObject(const QVariant &v, bool *ok)
if (ok) *ok = true;
- return *(QObject **)v.constData();
+ return *(QObject *const *)v.constData();
}
bool QQmlMetaType::isQObject(int userType)
@@ -1518,7 +1516,7 @@ bool QQmlMetaType::isQObject(int userType)
if (userType == QMetaType::QObjectStar)
return true;
- QReadLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
return userType >= 0 && userType < data->objects.size() && data->objects.testBit(userType);
}
@@ -1528,7 +1526,7 @@ bool QQmlMetaType::isQObject(int userType)
*/
int QQmlMetaType::listType(int id)
{
- QReadLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
QQmlType *type = data->idToType.value(id);
if (type && type->qListTypeId() == id)
@@ -1539,7 +1537,7 @@ int QQmlMetaType::listType(int id)
int QQmlMetaType::attachedPropertiesFuncId(const QMetaObject *mo)
{
- QReadLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
QQmlType *type = data->metaObjectToType.value(mo);
@@ -1553,7 +1551,7 @@ QQmlAttachedPropertiesFunc QQmlMetaType::attachedPropertiesFuncById(int id)
{
if (id < 0)
return 0;
- QReadLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
return data->types.at(id)->attachedPropertiesFunction();
}
@@ -1617,7 +1615,7 @@ QQmlMetaType::TypeCategory QQmlMetaType::typeCategory(int userType)
if (userType == QMetaType::QObjectStar)
return Object;
- QReadLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
if (userType < data->objects.size() && data->objects.testBit(userType))
return Object;
@@ -1629,14 +1627,14 @@ QQmlMetaType::TypeCategory QQmlMetaType::typeCategory(int userType)
bool QQmlMetaType::isInterface(int userType)
{
- QReadLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
return userType >= 0 && userType < data->interfaces.size() && data->interfaces.testBit(userType);
}
const char *QQmlMetaType::interfaceIId(int userType)
{
- QReadLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
QQmlType *type = data->idToType.value(userType);
lock.unlock();
@@ -1648,7 +1646,7 @@ const char *QQmlMetaType::interfaceIId(int userType)
bool QQmlMetaType::isList(int userType)
{
- QReadLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
return userType >= 0 && userType < data->lists.size() && data->lists.testBit(userType);
}
@@ -1670,7 +1668,7 @@ bool QQmlMetaType::isList(int userType)
*/
void QQmlMetaType::registerCustomStringConverter(int type, StringConverter converter)
{
- QWriteLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
if (data->stringConverters.contains(type))
@@ -1684,7 +1682,7 @@ void QQmlMetaType::registerCustomStringConverter(int type, StringConverter conve
*/
QQmlMetaType::StringConverter QQmlMetaType::customStringConverter(int type)
{
- QReadLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
return data->stringConverters.value(type);
@@ -1713,7 +1711,7 @@ QQmlType *QQmlMetaType::qmlType(const QString &qualifiedName, int version_major,
QQmlType *QQmlMetaType::qmlType(const QHashedStringRef &name, const QHashedStringRef &module, int version_major, int version_minor)
{
Q_ASSERT(version_major >= 0 && version_minor >= 0);
- QReadLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
QQmlMetaTypeData::Names::ConstIterator it = data->nameToType.constFind(name);
@@ -1733,7 +1731,7 @@ QQmlType *QQmlMetaType::qmlType(const QHashedStringRef &name, const QHashedStrin
*/
QQmlType *QQmlMetaType::qmlType(const QMetaObject *metaObject)
{
- QReadLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
return data->metaObjectToType.value(metaObject);
@@ -1747,7 +1745,7 @@ QQmlType *QQmlMetaType::qmlType(const QMetaObject *metaObject)
QQmlType *QQmlMetaType::qmlType(const QMetaObject *metaObject, const QHashedStringRef &module, int version_major, int version_minor)
{
Q_ASSERT(version_major >= 0 && version_minor >= 0);
- QReadLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
QQmlMetaTypeData::MetaObjects::const_iterator it = data->metaObjectToType.constFind(metaObject);
@@ -1767,7 +1765,7 @@ QQmlType *QQmlMetaType::qmlType(const QMetaObject *metaObject, const QHashedStri
*/
QQmlType *QQmlMetaType::qmlType(int userType)
{
- QReadLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
QQmlType *type = data->idToType.value(userType);
@@ -1785,7 +1783,7 @@ QQmlType *QQmlMetaType::qmlType(int userType)
*/
QQmlType *QQmlMetaType::qmlType(const QUrl &url, bool includeNonFileImports /* = false */)
{
- QReadLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
QQmlType *type = data->urlToType.value(url);
@@ -1805,7 +1803,7 @@ QQmlType *QQmlMetaType::qmlType(const QUrl &url, bool includeNonFileImports /* =
*/
QQmlType *QQmlMetaType::qmlTypeFromIndex(int idx)
{
- QReadLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
if (idx < 0 || idx >= data->types.count())
@@ -1818,7 +1816,7 @@ QQmlType *QQmlMetaType::qmlTypeFromIndex(int idx)
*/
QList<QString> QQmlMetaType::qmlTypeNames()
{
- QReadLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
QList<QString> names;
@@ -1836,7 +1834,7 @@ QList<QString> QQmlMetaType::qmlTypeNames()
*/
QList<QQmlType*> QQmlMetaType::qmlTypes()
{
- QReadLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
return data->nameToType.values();
@@ -1847,7 +1845,7 @@ QList<QQmlType*> QQmlMetaType::qmlTypes()
*/
QList<QQmlType*> QQmlMetaType::qmlAllTypes()
{
- QReadLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
return data->types;
@@ -1858,7 +1856,7 @@ QList<QQmlType*> QQmlMetaType::qmlAllTypes()
*/
QList<QQmlType*> QQmlMetaType::qmlSingletonTypes()
{
- QReadLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
QList<QQmlType*> alltypes = data->nameToType.values();
@@ -1874,7 +1872,7 @@ QList<QQmlType*> QQmlMetaType::qmlSingletonTypes()
const QQmlPrivate::CachedQmlUnit *QQmlMetaType::findCachedCompilationUnit(const QUrl &uri)
{
- QReadLocker lock(metaTypeDataLock());
+ QMutexLocker lock(metaTypeDataLock());
QQmlMetaTypeData *data = metaTypeData();
for (QVector<QQmlPrivate::QmlUnitCacheLookupFunction>::ConstIterator it = data->lookupCachedQmlUnit.constBegin(), end = data->lookupCachedQmlUnit.constEnd();
it != end; ++it) {
diff --git a/src/qml/qml/qqmlmetatype_p.h b/src/qml/qml/qqmlmetatype_p.h
index ac408836fa..e5ac20d314 100644
--- a/src/qml/qml/qqmlmetatype_p.h
+++ b/src/qml/qml/qqmlmetatype_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -62,7 +62,7 @@ class QQmlTypePrivate;
class QQmlTypeModule;
class QHashedString;
class QHashedStringRef;
-class QReadWriteLock;
+class QMutex;
namespace QV4 { struct String; }
@@ -114,14 +114,14 @@ public:
static const QQmlPrivate::CachedQmlUnit *findCachedCompilationUnit(const QUrl &uri);
- static bool namespaceContainsRegistrations(const QString &);
+ static bool namespaceContainsRegistrations(const QString &, int majorVersion);
static void protectNamespace(const QString &);
static void setTypeRegistrationNamespace(const QString &);
static QStringList typeRegistrationFailures();
- static QReadWriteLock *typeRegistrationLock();
+ static QMutex *typeRegistrationLock();
};
struct QQmlMetaTypeData;
diff --git a/src/qml/qml/qqmlnetworkaccessmanagerfactory.cpp b/src/qml/qml/qqmlnetworkaccessmanagerfactory.cpp
index a4c49c4b82..cc55d07887 100644
--- a/src/qml/qml/qqmlnetworkaccessmanagerfactory.cpp
+++ b/src/qml/qml/qqmlnetworkaccessmanagerfactory.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlnetworkaccessmanagerfactory.h b/src/qml/qml/qqmlnetworkaccessmanagerfactory.h
index e6c4ca2d47..764a074c44 100644
--- a/src/qml/qml/qqmlnetworkaccessmanagerfactory.h
+++ b/src/qml/qml/qqmlnetworkaccessmanagerfactory.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlnotifier.cpp b/src/qml/qml/qqmlnotifier.cpp
index 670fe3936e..4ce5be4d1a 100644
--- a/src/qml/qml/qqmlnotifier.cpp
+++ b/src/qml/qml/qqmlnotifier.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlnotifier_p.h b/src/qml/qml/qqmlnotifier_p.h
index 1cfde3da06..2a35dcda12 100644
--- a/src/qml/qml/qqmlnotifier_p.h
+++ b/src/qml/qml/qqmlnotifier_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -72,8 +72,7 @@ public:
None = 0,
QQmlBoundSignal = 1,
QQmlJavaScriptExpressionGuard = 2,
- QQmlVMEMetaObjectEndpoint = 3,
- QV4BindingsSubscription = 4
+ QQmlVMEMetaObjectEndpoint = 3
};
inline void setCallback(Callback c) { callback = c; }
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index 42cac66fbd..3c2f3690b9 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -41,7 +41,6 @@
#include <private/qqmlbinding_p.h>
#include <private/qqmlstringconverters_p.h>
#include <private/qqmlboundsignal_p.h>
-#include <private/qqmltrace_p.h>
#include <private/qqmlcomponentattached_p.h>
#include <private/qqmlcomponent_p.h>
#include <private/qqmlcustomparser_p.h>
@@ -65,9 +64,8 @@ struct ActiveOCRestorer
static void removeBindingOnProperty(QObject *o, int index)
{
- int coreIndex = index & 0x0000FFFF;
- int valueTypeIndex = (index & 0xFFFF0000 ? index >> 16 : -1);
-
+ int coreIndex;
+ int valueTypeIndex = QQmlPropertyData::decodeValueTypePropertyIndex(index, &coreIndex);
QQmlAbstractBinding *binding = QQmlPropertyPrivate::setBinding(o, coreIndex, valueTypeIndex, 0);
if (binding) binding->destroy();
}
@@ -115,6 +113,7 @@ void QQmlObjectCreator::init(QQmlContextData *providedParentContext)
{
parentContext = providedParentContext;
engine = parentContext->engine;
+ v4 = QV8Engine::getV4(engine);
if (!compiledData->isInitialized())
compiledData->initialize(engine);
@@ -125,10 +124,11 @@ void QQmlObjectCreator::init(QQmlContextData *providedParentContext)
_scopeObject = 0;
_valueTypeProperty = 0;
_compiledObject = 0;
+ _compiledObjectIndex = -1;
_ddata = 0;
_propertyCache = 0;
_vmeMetaObject = 0;
- _qmlContext = 0;
+ _qmlBindingWrapper = 0;
}
QQmlObjectCreator::~QQmlObjectCreator()
@@ -176,8 +176,6 @@ QObject *QQmlObjectCreator::create(int subComponentIndex, QObject *parent, QQmlI
context = new QQmlContextData;
context->isInternal = true;
- context->url = compiledData->url();
- context->urlString = compiledData->fileName();
context->imports = compiledData->importCache;
context->imports->addref();
context->typeCompilationUnit = compiledData->compilationUnit;
@@ -189,31 +187,20 @@ QObject *QQmlObjectCreator::create(int subComponentIndex, QObject *parent, QQmlI
sharedState->rootContext->isRootObjectInCreation = true;
}
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine);
QV4::Scope scope(v4);
Q_ASSERT(sharedState->allJavaScriptObjects || topLevelCreator);
if (topLevelCreator)
sharedState->allJavaScriptObjects = scope.alloc(compiledData->totalObjectCount);
- QVector<QQmlContextData::ObjectIdMapping> mapping(objectIndexToId.count());
- for (QHash<int, int>::ConstIterator it = objectIndexToId.constBegin(), end = objectIndexToId.constEnd();
- it != end; ++it) {
- const QV4::CompiledData::Object *obj = qmlUnit->objectAt(it.key());
-
- QQmlContextData::ObjectIdMapping m;
- m.id = it.value();
- m.name = stringAt(obj->idIndex);
- mapping[m.id] = m;
- }
- context->setIdPropertyData(mapping);
+ context->setIdPropertyData(objectIndexToId);
- if (subComponentIndex == -1) {
+ if (subComponentIndex == -1 && compiledData->scripts.count()) {
QV4::ScopedObject scripts(scope, v4->newArrayObject(compiledData->scripts.count()));
- context->importedScripts = scripts;
+ context->importedScripts.set(v4, scripts);
for (int i = 0; i < compiledData->scripts.count(); ++i) {
QQmlScriptData *s = compiledData->scripts.at(i);
- scripts->putIndexed(i, s->scriptValueForContext(context));
+ scripts->putIndexed(i, *s->scriptValueForContext(context).valueRef());
}
} else if (sharedState->creationContext) {
context->importedScripts = sharedState->creationContext->importedScripts;
@@ -247,9 +234,7 @@ bool QQmlObjectCreator::populateDeferredProperties(QObject *instance)
QQmlData *declarativeData = QQmlData::get(instance);
context = declarativeData->deferredData->context;
sharedState->rootContext = context;
- const int objectIndex = declarativeData->deferredData->deferredIdx;
- const QV4::CompiledData::Object *obj = qmlUnit->objectAt(objectIndex);
QObject *bindingTarget = instance;
QQmlRefPointer<QQmlPropertyCache> cache = declarativeData->propertyCache;
@@ -258,27 +243,30 @@ bool QQmlObjectCreator::populateDeferredProperties(QObject *instance)
QObject *scopeObject = instance;
qSwap(_scopeObject, scopeObject);
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine);
QV4::Scope valueScope(v4);
Q_ASSERT(topLevelCreator);
Q_ASSERT(!sharedState->allJavaScriptObjects);
sharedState->allJavaScriptObjects = valueScope.alloc(compiledData->totalObjectCount);
- QV4::ScopedObject qmlScope(valueScope, QV4::QmlContextWrapper::qmlScope(QV8Engine::get(engine), context, _scopeObject));
- QV4::Scoped<QV4::QmlBindingWrapper> qmlBindingWrapper(valueScope, v4->memoryManager->alloc<QV4::QmlBindingWrapper>(v4->rootContext, qmlScope));
- QV4::ExecutionContext *qmlContext = qmlBindingWrapper->context();
+ QV4::Value *qmlBindingWrapper = valueScope.alloc(1);
- qSwap(_qmlContext, qmlContext);
+ qSwap(_qmlBindingWrapper, qmlBindingWrapper);
qSwap(_propertyCache, cache);
qSwap(_qobject, instance);
+
+ int objectIndex = declarativeData->deferredData->deferredIdx;
+ qSwap(_compiledObjectIndex, objectIndex);
+
+ const QV4::CompiledData::Object *obj = qmlUnit->objectAt(_compiledObjectIndex);
qSwap(_compiledObject, obj);
+
qSwap(_ddata, declarativeData);
qSwap(_bindingTarget, bindingTarget);
qSwap(_vmeMetaObject, vmeMetaObject);
- QBitArray bindingSkipList = compiledData->deferredBindingsPerObject.value(objectIndex);
+ QBitArray bindingSkipList = compiledData->deferredBindingsPerObject.value(_compiledObjectIndex);
for (int i = 0; i < bindingSkipList.count(); ++i)
bindingSkipList.setBit(i, !bindingSkipList.testBit(i));
@@ -288,10 +276,11 @@ bool QQmlObjectCreator::populateDeferredProperties(QObject *instance)
qSwap(_bindingTarget, bindingTarget);
qSwap(_ddata, declarativeData);
qSwap(_compiledObject, obj);
+ qSwap(_compiledObjectIndex, objectIndex);
qSwap(_qobject, instance);
qSwap(_propertyCache, cache);
- qSwap(_qmlContext, qmlContext);
+ qSwap(_qmlBindingWrapper, qmlBindingWrapper);
qSwap(_scopeObject, scopeObject);
phase = ObjectsCreated;
@@ -299,14 +288,13 @@ bool QQmlObjectCreator::populateDeferredProperties(QObject *instance)
return errors.isEmpty();
}
-void QQmlObjectCreator::setPropertyValue(QQmlPropertyData *property, const QV4::CompiledData::Binding *binding)
+void QQmlObjectCreator::setPropertyValue(const QQmlPropertyData *property, const QV4::CompiledData::Binding *binding)
{
QQmlPropertyPrivate::WriteFlags propertyWriteFlags = QQmlPropertyPrivate::BypassInterceptor |
QQmlPropertyPrivate::RemoveBindingOnAliasWrite;
int propertyWriteStatus = -1;
void *argv[] = { 0, 0, &propertyWriteStatus, &propertyWriteFlags };
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine);
QV4::Scope scope(v4);
int propertyType = property->propType;
@@ -654,13 +642,12 @@ void QQmlObjectCreator::setupBindings(const QBitArray &bindingsToSkip)
QQmlListProperty<void> savedList;
qSwap(_currentList, savedList);
- QQmlPropertyData *property = 0;
- QQmlPropertyData *defaultProperty = _compiledObject->indexOfDefaultProperty != -1 ? _propertyCache->parent()->defaultProperty() : _propertyCache->defaultProperty();
+ const QV4::CompiledData::BindingPropertyData &propertyData = compiledData->compilationUnit->bindingPropertyDataPerObject.at(_compiledObjectIndex);
- QString id = stringAt(_compiledObject->idIndex);
- if (!id.isEmpty()) {
- QQmlPropertyData *idProperty = _propertyCache->property(QStringLiteral("id"), _qobject, context);
- if (idProperty && idProperty->isWritable() && idProperty->propType == QMetaType::QString) {
+ if (_compiledObject->idIndex) {
+ const QQmlPropertyData *idProperty = propertyData.last();
+ Q_ASSERT(!idProperty || !idProperty->isValid() || idProperty->name(_qobject) == QStringLiteral("id"));
+ if (idProperty && idProperty->isValid() && idProperty->isWritable() && idProperty->propType == QMetaType::QString) {
QV4::CompiledData::Binding idBinding;
idBinding.propertyNameIndex = 0; // Not used
idBinding.flags = 0;
@@ -686,50 +673,40 @@ void QQmlObjectCreator::setupBindings(const QBitArray &bindingsToSkip)
if (qmlTypeForObject(_bindingTarget)) {
quint32 bindingSkipList = 0;
+ QQmlPropertyData *defaultProperty = _compiledObject->indexOfDefaultProperty != -1 ? _propertyCache->parent()->defaultProperty() : _propertyCache->defaultProperty();
+
const QV4::CompiledData::Binding *binding = _compiledObject->bindingTable();
for (quint32 i = 0; i < _compiledObject->nBindings; ++i, ++binding) {
- property = binding->propertyNameIndex != 0 ? _propertyCache->property(stringAt(binding->propertyNameIndex), _qobject, context) : defaultProperty;
+ QQmlPropertyData *property = binding->propertyNameIndex != 0 ? _propertyCache->property(stringAt(binding->propertyNameIndex), _qobject, context) : defaultProperty;
if (property)
bindingSkipList |= (1 << property->coreIndex);
}
- property = 0;
proxy->removeBindings(bindingSkipList);
}
}
}
+ int currentListPropertyIndex = -1;
+
const QV4::CompiledData::Binding *binding = _compiledObject->bindingTable();
for (quint32 i = 0; i < _compiledObject->nBindings; ++i, ++binding) {
+ if (static_cast<int>(i) < bindingsToSkip.size() && bindingsToSkip.testBit(i))
+ continue;
- QString name = stringAt(binding->propertyNameIndex);
- if (name.isEmpty())
- property = 0;
-
- if (!property
- || (i > 0 && ((binding - 1)->propertyNameIndex != binding->propertyNameIndex
- || (binding - 1)->flags != binding->flags))
- ) {
- if (!name.isEmpty()) {
- if (binding->flags & QV4::CompiledData::Binding::IsSignalHandlerExpression
- || binding->flags & QV4::CompiledData::Binding::IsSignalHandlerObject)
- property = QmlIR::PropertyResolver(_propertyCache).signal(name, /*notInRevision*/0, _qobject, context);
- else
- property = _propertyCache->property(name, _qobject, context);
- } else
- property = defaultProperty;
-
- if (property && property->isQList()) {
+ const QQmlPropertyData *property = propertyData.at(i);
+
+ if (property && property->isQList()) {
+ if (property->coreIndex != currentListPropertyIndex) {
void *argv[1] = { (void*)&_currentList };
QMetaObject::metacall(_qobject, QMetaObject::ReadProperty, property->coreIndex, argv);
- } else if (_currentList.object)
- _currentList = QQmlListProperty<void>();
-
+ currentListPropertyIndex = property->coreIndex;
+ }
+ } else if (_currentList.object) {
+ _currentList = QQmlListProperty<void>();
+ currentListPropertyIndex = -1;
}
- if (static_cast<int>(i) < bindingsToSkip.size() && bindingsToSkip.testBit(i))
- continue;
-
if (!setPropertyBinding(property, binding))
return;
}
@@ -737,7 +714,7 @@ void QQmlObjectCreator::setupBindings(const QBitArray &bindingsToSkip)
qSwap(_currentList, savedList);
}
-bool QQmlObjectCreator::setPropertyBinding(QQmlPropertyData *property, const QV4::CompiledData::Binding *binding)
+bool QQmlObjectCreator::setPropertyBinding(const QQmlPropertyData *property, const QV4::CompiledData::Binding *binding)
{
if (binding->type == QV4::CompiledData::Binding::Type_AttachedProperty) {
Q_ASSERT(stringAt(qmlUnit->objectAt(binding->value.objectIndex)->inheritedTypeNameIndex).isEmpty());
@@ -785,7 +762,7 @@ bool QQmlObjectCreator::setPropertyBinding(QQmlPropertyData *property, const QV4
QObject *groupObject = 0;
QQmlValueType *valueType = 0;
- QQmlPropertyData *valueTypeProperty = 0;
+ const QQmlPropertyData *valueTypeProperty = 0;
QObject *bindingTarget = _bindingTarget;
if (QQmlValueTypeFactory::isValueType(property->propType)) {
@@ -828,8 +805,9 @@ bool QQmlObjectCreator::setPropertyBinding(QQmlPropertyData *property, const QV4
if (binding->type == QV4::CompiledData::Binding::Type_Script) {
QV4::Function *runtimeFunction = compiledData->compilationUnit->runtimeFunctions[binding->value.compiledScriptIndex];
- QV4::Scope scope(_qmlContext);
- QV4::ScopedFunctionObject function(scope, QV4::FunctionObject::createScriptFunction(_qmlContext, runtimeFunction, /*createProto*/ false));
+ QV4::Scope scope(v4);
+ QV4::ScopedContext qmlContext(scope, currentQmlContext());
+ QV4::ScopedFunctionObject function(scope, QV4::FunctionObject::createScriptFunction(qmlContext, runtimeFunction, /*createProto*/ false));
if (binding->flags & QV4::CompiledData::Binding::IsSignalHandlerExpression) {
int signalIndex = _propertyCache->methodIndexToSignalIndex(property->coreIndex);
@@ -948,7 +926,6 @@ bool QQmlObjectCreator::setPropertyBinding(QQmlPropertyData *property, const QV4
}
} else if (property->propType == QMetaType::QVariant) {
if (property->isVarProperty()) {
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine);
QV4::Scope scope(v4);
QV4::ScopedValue wrappedObject(scope, QV4::QObjectWrapper::wrap(QV8Engine::getV4(engine), createdSubObject));
_vmeMetaObject->setVMEProperty(property->coreIndex, wrappedObject);
@@ -995,8 +972,9 @@ bool QQmlObjectCreator::setPropertyBinding(QQmlPropertyData *property, const QV4
void QQmlObjectCreator::setupFunctions()
{
- QV4::Scope scope(_qmlContext);
+ QV4::Scope scope(v4);
QV4::ScopedValue function(scope);
+ QV4::ScopedContext qmlContext(scope, currentQmlContext());
const quint32 *functionIdx = _compiledObject->functionOffsetTable();
for (quint32 i = 0; i < _compiledObject->nFunctions; ++i, ++functionIdx) {
@@ -1007,7 +985,7 @@ void QQmlObjectCreator::setupFunctions()
if (!property->isVMEFunction())
continue;
- function = QV4::FunctionObject::createScriptFunction(_qmlContext, runtimeFunction);
+ function = QV4::FunctionObject::createScriptFunction(qmlContext, runtimeFunction);
_vmeMetaObject->setVmeMethod(property->coreIndex, function);
}
}
@@ -1029,6 +1007,17 @@ void QQmlObjectCreator::registerObjectWithContextById(int objectIndex, QObject *
context->setIdProperty(idEntry.value(), instance);
}
+QV4::Heap::ExecutionContext *QQmlObjectCreator::currentQmlContext()
+{
+ if (!_qmlBindingWrapper->objectValue()) {
+ QV4::Scope valueScope(v4);
+ QV4::ScopedObject qmlScope(valueScope, QV4::QmlContextWrapper::qmlScope(v4, context, _scopeObject));
+ QV4::ScopedContext global(valueScope, v4->rootContext());
+ *_qmlBindingWrapper = v4->memoryManager->alloc<QV4::QmlBindingWrapper>(global, qmlScope);
+ }
+ return static_cast<QV4::QmlBindingWrapper*>(_qmlBindingWrapper->objectValue())->context();
+}
+
QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isContextObject)
{
QQmlObjectCreationProfiler profiler(sharedState->profiler.profiler);
@@ -1046,7 +1035,7 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo
isComponent = true;
QQmlComponent *component = new QQmlComponent(engine, compiledData, index, parent);
Q_QML_OC_PROFILE(sharedState->profiler, profiler.update(QStringLiteral("<component>"),
- context->url, obj->location.line, obj->location.column));
+ context->url(), obj->location.line, obj->location.column));
QQmlComponentPrivate::get(component)->creationContext = context;
instance = component;
ddata = QQmlData::get(instance, /*create*/true);
@@ -1057,7 +1046,7 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo
QQmlType *type = typeRef->type;
if (type) {
Q_QML_OC_PROFILE(sharedState->profiler, profiler.update(type->qmlTypeName(),
- context->url, obj->location.line, obj->location.column));
+ context->url(), obj->location.line, obj->location.column));
instance = type->create();
if (!instance) {
recordError(obj->location, tr("Unable to create object of type %1").arg(stringAt(obj->inheritedTypeNameIndex)));
@@ -1080,7 +1069,7 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo
} else {
Q_ASSERT(typeRef->component);
Q_QML_OC_PROFILE(sharedState->profiler, profiler.update(typeRef->component->fileName(),
- context->url, obj->location.line, obj->location.column));
+ context->url(), obj->location.line, obj->location.column));
if (typeRef->component->compilationUnit->data->isSingleton())
{
recordError(obj->location, tr("Composite Singleton Type %1 is not creatable").arg(stringAt(obj->inheritedTypeNameIndex)));
@@ -1168,22 +1157,18 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo
QObject *scopeObject = instance;
qSwap(_scopeObject, scopeObject);
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine);
-
Q_ASSERT(sharedState->allJavaScriptObjects);
- QV4::ValueRef ref = QV4::ValueRef::fromRawValue(sharedState->allJavaScriptObjects++);
- ref = QV4::QObjectWrapper::wrap(v4, instance);
+ *sharedState->allJavaScriptObjects = QV4::QObjectWrapper::wrap(v4, instance);
+ ++sharedState->allJavaScriptObjects;
QV4::Scope valueScope(v4);
- QV4::ScopedObject qmlScope(valueScope, QV4::QmlContextWrapper::qmlScope(QV8Engine::get(engine), context, _scopeObject));
- QV4::Scoped<QV4::QmlBindingWrapper> qmlBindingWrapper(valueScope, v4->memoryManager->alloc<QV4::QmlBindingWrapper>(v4->rootContext, qmlScope));
- QV4::ExecutionContext *qmlContext = qmlBindingWrapper->context();
+ QV4::Value *qmlBindingWrapper = valueScope.alloc(1);
- qSwap(_qmlContext, qmlContext);
+ qSwap(_qmlBindingWrapper, qmlBindingWrapper);
bool result = populateInstance(index, instance, /*binding target*/instance, /*value type property*/0, bindingsToSkip);
- qSwap(_qmlContext, qmlContext);
+ qSwap(_qmlBindingWrapper, qmlBindingWrapper);
qSwap(_scopeObject, scopeObject);
return result ? instance : 0;
@@ -1197,10 +1182,6 @@ QQmlContextData *QQmlObjectCreator::finalize(QQmlInstantiationInterrupt &interru
QQmlObjectCreatorRecursionWatcher watcher(this);
ActiveOCRestorer ocRestorer(this, QQmlEnginePrivate::get(engine));
- {
- QQmlTrace trace("VME Binding Enable");
- trace.event("begin binding eval");
-
while (!sharedState->allCreatedBindings.isEmpty()) {
QQmlAbstractBinding *b = sharedState->allCreatedBindings.pop();
if (!b)
@@ -1215,10 +1196,8 @@ QQmlContextData *QQmlObjectCreator::finalize(QQmlInstantiationInterrupt &interru
if (watcher.hasRecursed() || interrupt.shouldInterrupt())
return 0;
}
- }
if (QQmlVME::componentCompleteEnabled()) { // the qml designer does the component complete later
- QQmlTrace trace("VME Component Complete");
while (!sharedState->allParserStatusCallbacks.isEmpty()) {
QQmlObjectCompletionProfiler profiler(&sharedState->profiler);
QQmlParserStatus *status = sharedState->allParserStatusCallbacks.pop();
@@ -1233,8 +1212,6 @@ QQmlContextData *QQmlObjectCreator::finalize(QQmlInstantiationInterrupt &interru
}
}
- {
- QQmlTrace trace("VME Finalize Callbacks");
for (int ii = 0; ii < sharedState->finalizeCallbacks.count(); ++ii) {
QQmlEnginePrivate::FinalizeCallback callback = sharedState->finalizeCallbacks.at(ii);
QObject *obj = callback.first;
@@ -1246,10 +1223,7 @@ QQmlContextData *QQmlObjectCreator::finalize(QQmlInstantiationInterrupt &interru
return 0;
}
sharedState->finalizeCallbacks.clear();
- }
- {
- QQmlTrace trace("VME Component.onCompleted Callbacks");
while (sharedState->componentAttached) {
QQmlComponentAttached *a = sharedState->componentAttached;
a->rem();
@@ -1263,7 +1237,6 @@ QQmlContextData *QQmlObjectCreator::finalize(QQmlInstantiationInterrupt &interru
if (watcher.hasRecursed() || interrupt.shouldInterrupt())
return 0;
}
- }
phase = Done;
@@ -1287,26 +1260,25 @@ void QQmlObjectCreator::clear()
phase = Done;
}
-bool QQmlObjectCreator::populateInstance(int index, QObject *instance, QObject *bindingTarget, QQmlPropertyData *valueTypeProperty, const QBitArray &bindingsToSkip)
+bool QQmlObjectCreator::populateInstance(int index, QObject *instance, QObject *bindingTarget, const QQmlPropertyData *valueTypeProperty, const QBitArray &bindingsToSkip)
{
- const QV4::CompiledData::Object *obj = qmlUnit->objectAt(index);
-
QQmlData *declarativeData = QQmlData::get(instance, /*create*/true);
qSwap(_qobject, instance);
qSwap(_valueTypeProperty, valueTypeProperty);
+ qSwap(_compiledObjectIndex, index);
+ const QV4::CompiledData::Object *obj = qmlUnit->objectAt(_compiledObjectIndex);
qSwap(_compiledObject, obj);
qSwap(_ddata, declarativeData);
qSwap(_bindingTarget, bindingTarget);
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine);
QV4::Scope valueScope(v4);
QV4::ScopedValue scopeObjectProtector(valueScope);
- QQmlRefPointer<QQmlPropertyCache> cache = propertyCaches.at(index);
+ QQmlRefPointer<QQmlPropertyCache> cache = propertyCaches.at(_compiledObjectIndex);
QQmlVMEMetaObject *vmeMetaObject = 0;
- const QByteArray data = vmeMetaObjectData.value(index);
+ const QByteArray data = vmeMetaObjectData.value(_compiledObjectIndex);
if (!data.isEmpty()) {
Q_ASSERT(!cache.isNull());
// install on _object
@@ -1320,14 +1292,14 @@ bool QQmlObjectCreator::populateInstance(int index, QObject *instance, QObject *
vmeMetaObject = QQmlVMEMetaObject::get(_qobject);
}
- registerObjectWithContextById(index, _qobject);
+ registerObjectWithContextById(_compiledObjectIndex, _qobject);
qSwap(_propertyCache, cache);
qSwap(_vmeMetaObject, vmeMetaObject);
QBitArray bindingSkipList = bindingsToSkip;
{
- QHash<int, QBitArray>::ConstIterator deferredBindings = compiledData->deferredBindingsPerObject.find(index);
+ QHash<int, QBitArray>::ConstIterator deferredBindings = compiledData->deferredBindingsPerObject.find(_compiledObjectIndex);
if (deferredBindings != compiledData->deferredBindingsPerObject.constEnd()) {
if (bindingSkipList.isEmpty())
bindingSkipList.resize(deferredBindings->count());
@@ -1336,7 +1308,7 @@ bool QQmlObjectCreator::populateInstance(int index, QObject *instance, QObject *
if (deferredBindings->testBit(i))
bindingSkipList.setBit(i);
QQmlData::DeferredData *deferData = new QQmlData::DeferredData;
- deferData->deferredIdx = index;
+ deferData->deferredIdx = _compiledObjectIndex;
deferData->compiledData = compiledData;
deferData->compiledData->addref();
deferData->context = context;
@@ -1344,13 +1316,15 @@ bool QQmlObjectCreator::populateInstance(int index, QObject *instance, QObject *
}
}
- setupFunctions();
+ if (_compiledObject->nFunctions > 0)
+ setupFunctions();
setupBindings(bindingSkipList);
qSwap(_vmeMetaObject, vmeMetaObject);
qSwap(_bindingTarget, bindingTarget);
qSwap(_ddata, declarativeData);
qSwap(_compiledObject, obj);
+ qSwap(_compiledObjectIndex, index);
qSwap(_valueTypeProperty, valueTypeProperty);
qSwap(_qobject, instance);
qSwap(_propertyCache, cache);
diff --git a/src/qml/qml/qqmlobjectcreator_p.h b/src/qml/qml/qqmlobjectcreator_p.h
index 6919281b77..60fefe494f 100644
--- a/src/qml/qml/qqmlobjectcreator_p.h
+++ b/src/qml/qml/qqmlobjectcreator_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -94,12 +94,12 @@ private:
QObject *createInstance(int index, QObject *parent = 0, bool isContextObject = false);
bool populateInstance(int index, QObject *instance,
- QObject *bindingTarget, QQmlPropertyData *valueTypeProperty,
+ QObject *bindingTarget, const QQmlPropertyData *valueTypeProperty,
const QBitArray &bindingsToSkip = QBitArray());
void setupBindings(const QBitArray &bindingsToSkip);
- bool setPropertyBinding(QQmlPropertyData *property, const QV4::CompiledData::Binding *binding);
- void setPropertyValue(QQmlPropertyData *property, const QV4::CompiledData::Binding *binding);
+ bool setPropertyBinding(const QQmlPropertyData *property, const QV4::CompiledData::Binding *binding);
+ void setPropertyValue(const QQmlPropertyData *property, const QV4::CompiledData::Binding *binding);
void setupFunctions();
QString stringAt(int idx) const { return qmlUnit->stringAt(idx); }
@@ -107,6 +107,8 @@ private:
void registerObjectWithContextById(int objectIndex, QObject *instance) const;
+ QV4::Heap::ExecutionContext *currentQmlContext();
+
enum Phase {
Startup,
CreatingObjects,
@@ -117,6 +119,7 @@ private:
} phase;
QQmlEngine *engine;
+ QV4::ExecutionEngine *v4;
QQmlCompiledData *compiledData;
const QV4::CompiledData::Unit *qmlUnit;
QQmlGuardedContextData parentContext;
@@ -133,13 +136,14 @@ private:
QObject *_scopeObject;
QObject *_bindingTarget;
- QQmlPropertyData *_valueTypeProperty; // belongs to _qobjectForBindings's property cache
+ const QQmlPropertyData *_valueTypeProperty; // belongs to _qobjectForBindings's property cache
+ int _compiledObjectIndex;
const QV4::CompiledData::Object *_compiledObject;
QQmlData *_ddata;
QQmlRefPointer<QQmlPropertyCache> _propertyCache;
QQmlVMEMetaObject *_vmeMetaObject;
QQmlListProperty<void> _currentList;
- QV4::ExecutionContext *_qmlContext;
+ QV4::Value *_qmlBindingWrapper;
friend struct QQmlObjectCreatorRecursionWatcher;
};
diff --git a/src/qml/qml/qqmlopenmetaobject.cpp b/src/qml/qml/qqmlopenmetaobject.cpp
index f4d050a1d7..fc24b15fd2 100644
--- a/src/qml/qml/qqmlopenmetaobject.cpp
+++ b/src/qml/qml/qqmlopenmetaobject.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -35,6 +35,7 @@
#include <private/qqmlpropertycache_p.h>
#include <private/qqmldata_p.h>
#include <private/qmetaobjectbuilder_p.h>
+#include <qqmlengine.h>
#include <qdebug.h>
QT_BEGIN_NAMESPACE
@@ -119,7 +120,7 @@ int QQmlOpenMetaObjectType::createProperty(const QByteArray &name)
QQmlOpenMetaObject *omo = *it;
*static_cast<QMetaObject *>(omo) = *d->mem;
if (d->cache)
- d->cache->update(d->engine, omo);
+ d->cache->update(omo);
++it;
}
diff --git a/src/qml/qml/qqmlopenmetaobject_p.h b/src/qml/qml/qqmlopenmetaobject_p.h
index 2fdb506d10..6a29d08d4e 100644
--- a/src/qml/qml/qqmlopenmetaobject_p.h
+++ b/src/qml/qml/qqmlopenmetaobject_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlparserstatus.cpp b/src/qml/qml/qqmlparserstatus.cpp
index a3942c5d9a..3147334dde 100644
--- a/src/qml/qml/qqmlparserstatus.cpp
+++ b/src/qml/qml/qqmlparserstatus.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlparserstatus.h b/src/qml/qml/qqmlparserstatus.h
index 5d29afed14..fdf354b034 100644
--- a/src/qml/qml/qqmlparserstatus.h
+++ b/src/qml/qml/qqmlparserstatus.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlplatform.cpp b/src/qml/qml/qqmlplatform.cpp
index 53d550c25c..a453746da3 100644
--- a/src/qml/qml/qqmlplatform.cpp
+++ b/src/qml/qml/qqmlplatform.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlplatform_p.h b/src/qml/qml/qqmlplatform_p.h
index 5f4f41c6ca..363341c89e 100644
--- a/src/qml/qml/qqmlplatform_p.h
+++ b/src/qml/qml/qqmlplatform_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlprivate.h b/src/qml/qml/qqmlprivate.h
index dfbf04a50f..3576fcb6a3 100644
--- a/src/qml/qml/qqmlprivate.h
+++ b/src/qml/qml/qqmlprivate.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp
index 2a888b7a1e..800f650075 100644
--- a/src/qml/qml/qqmlproperty.cpp
+++ b/src/qml/qml/qqmlproperty.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -53,10 +53,9 @@
#include <QStringList>
#include <private/qmetaobject_p.h>
+#include <private/qqmlvaluetypewrapper_p.h>
#include <QtCore/qdebug.h>
-#include <math.h>
-
Q_DECLARE_METATYPE(QList<int>)
Q_DECLARE_METATYPE(QList<qreal>)
Q_DECLARE_METATYPE(QList<bool>)
@@ -276,7 +275,7 @@ void QQmlPropertyPrivate::initProperty(QObject *obj, const QString &name)
QQmlPropertyData local;
QQmlPropertyData *property =
- QQmlPropertyCache::property(engine, obj, pathName, context, local);
+ QQmlPropertyCache::property(engine, currentObject, pathName, context, local);
if (!property) return; // Not a property
if (property->isFunction())
@@ -284,13 +283,13 @@ void QQmlPropertyPrivate::initProperty(QObject *obj, const QString &name)
if (ii == (path.count() - 2) && QQmlValueTypeFactory::isValueType(property->propType)) {
// We're now at a value type property
- QObject *typeObject = QQmlValueTypeFactory::valueType(property->propType);
- if (!typeObject) return; // Not a value type
+ const QMetaObject *valueTypeMetaObject = QQmlValueTypeFactory::metaObjectForMetaType(property->propType);
+ if (!valueTypeMetaObject) return; // Not a value type
- int idx = typeObject->metaObject()->indexOfProperty(path.last().toUtf8().constData());
+ int idx = valueTypeMetaObject->indexOfProperty(path.last().toUtf8().constData());
if (idx == -1) return; // Value type property does not exist
- QMetaProperty vtProp = typeObject->metaObject()->property(idx);
+ QMetaProperty vtProp = valueTypeMetaObject->property(idx);
Q_ASSERT(QQmlPropertyData::flagsForProperty(vtProp) <= QQmlPropertyData::ValueTypeFlagMask);
Q_ASSERT(vtProp.userType() <= 0x0000FFFF);
@@ -463,9 +462,9 @@ const char *QQmlProperty::propertyTypeName() const
if (!d)
return 0;
if (d->isValueType()) {
- QQmlValueType *valueType = QQmlValueTypeFactory::valueType(d->core.propType);
- Q_ASSERT(valueType);
- return valueType->metaObject()->property(d->core.valueTypeCoreIndex).typeName();
+ const QMetaObject *valueTypeMetaObject = QQmlValueTypeFactory::metaObjectForMetaType(d->core.propType);
+ Q_ASSERT(valueTypeMetaObject);
+ return valueTypeMetaObject->property(d->core.valueTypeCoreIndex).typeName();
} else if (d->object && type() & Property && d->core.isValid()) {
return d->object->metaObject()->property(d->core.coreIndex).typeName();
} else {
@@ -642,10 +641,10 @@ QString QQmlProperty::name() const
} else if (d->isValueType()) {
QString rv = d->core.name(d->object) + QLatin1Char('.');
- QQmlValueType *valueType = QQmlValueTypeFactory::valueType(d->core.propType);
- Q_ASSERT(valueType);
+ const QMetaObject *valueTypeMetaObject = QQmlValueTypeFactory::metaObjectForMetaType(d->core.propType);
+ Q_ASSERT(valueTypeMetaObject);
- const char *vtName = valueType->metaObject()->property(d->core.valueTypeCoreIndex).name();
+ const char *vtName = valueTypeMetaObject->property(d->core.valueTypeCoreIndex).name();
rv += QString::fromUtf8(vtName);
d->nameCache = rv;
@@ -734,8 +733,8 @@ QQmlPropertyPrivate::setBinding(const QQmlProperty &that,
QObject *object = newBinding->object();
int pi = newBinding->propertyIndex();
- int core = pi & 0x0000FFFF;
- int vt = (pi & 0xFFFF0000)?(pi >> 16):-1;
+ int core;
+ int vt = QQmlPropertyData::decodeValueTypePropertyIndex(pi, &core);
return setBinding(object, core, vt, newBinding, flags);
} else {
@@ -776,7 +775,7 @@ QQmlPropertyPrivate::binding(QObject *object, int coreIndex, int valueTypeIndex)
if (binding && valueTypeIndex != -1) {
if (binding->bindingType() == QQmlAbstractBinding::ValueTypeProxy) {
- int index = coreIndex | (valueTypeIndex << 16);
+ int index = QQmlPropertyData::encodeValueTypePropertyIndex(coreIndex, valueTypeIndex);
binding = static_cast<QQmlValueTypeProxyBinding *>(binding)->binding(index);
}
}
@@ -787,8 +786,8 @@ QQmlPropertyPrivate::binding(QObject *object, int coreIndex, int valueTypeIndex)
void QQmlPropertyPrivate::findAliasTarget(QObject *object, int bindingIndex,
QObject **targetObject, int *targetBindingIndex)
{
- int coreIndex = bindingIndex & 0x0000FFFF;
- int valueTypeIndex = (bindingIndex & 0xFFFF0000)?(bindingIndex >> 16):-1;
+ int coreIndex;
+ int valueTypeIndex = QQmlPropertyData::decodeValueTypePropertyIndex(bindingIndex, &coreIndex);
QQmlData *data = QQmlData::get(object, false);
if (data) {
@@ -804,9 +803,9 @@ void QQmlPropertyPrivate::findAliasTarget(QObject *object, int bindingIndex,
int aBindingIndex = aCoreIndex;
if (aValueTypeIndex != -1)
- aBindingIndex |= aValueTypeIndex << 16;
+ aBindingIndex = QQmlPropertyData::encodeValueTypePropertyIndex(aBindingIndex, aValueTypeIndex);
else if (valueTypeIndex != -1)
- aBindingIndex |= valueTypeIndex << 16;
+ aBindingIndex = QQmlPropertyData::encodeValueTypePropertyIndex(aBindingIndex, valueTypeIndex);
findAliasTarget(aObject, aBindingIndex, targetObject, targetBindingIndex);
return;
@@ -853,7 +852,7 @@ QQmlPropertyPrivate::setBinding(QObject *object, int coreIndex, int valueTypeInd
int index = coreIndex;
if (valueTypeIndex != -1)
- index |= (valueTypeIndex << 16);
+ index = QQmlPropertyData::encodeValueTypePropertyIndex(index, valueTypeIndex);
if (binding && valueTypeIndex != -1 && binding->bindingType() == QQmlAbstractBinding::ValueTypeProxy)
binding = static_cast<QQmlValueTypeProxyBinding *>(binding)->binding(index);
@@ -912,7 +911,7 @@ QQmlPropertyPrivate::setBindingNoEnable(QObject *object, int coreIndex, int valu
int index = coreIndex;
if (valueTypeIndex != -1)
- index |= (valueTypeIndex << 16);
+ index = QQmlPropertyData::encodeValueTypePropertyIndex(index, valueTypeIndex);
if (binding && valueTypeIndex != -1 && binding->bindingType() == QQmlAbstractBinding::ValueTypeProxy)
binding = static_cast<QQmlValueTypeProxyBinding *>(binding)->binding(index);
@@ -1305,12 +1304,12 @@ bool QQmlPropertyPrivate::write(QObject *object,
QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, argv);
} else if (variantType == propertyType) {
- void *a[] = { (void *)value.constData(), 0, &status, &flags };
+ void *a[] = { const_cast<void *>(value.constData()), 0, &status, &flags };
QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a);
} else if (qMetaTypeId<QVariant>() == propertyType) {
- void *a[] = { (void *)&value, 0, &status, &flags };
+ void *a[] = { const_cast<QVariant *>(&value), 0, &status, &flags };
QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a);
} else if (property.isQObject()) {
@@ -1320,7 +1319,7 @@ bool QQmlPropertyPrivate::write(QObject *object,
if (valMo.isNull())
return false;
- QObject *o = *(QObject **)value.constData();
+ QObject *o = *(QObject *const *)value.constData();
QQmlMetaObject propMo = rawMetaObjectForType(enginePriv, propertyType);
if (o) valMo = o;
@@ -1389,8 +1388,30 @@ bool QQmlPropertyPrivate::write(QObject *object,
bool ok = false;
QVariant v;
- if (variantType == QVariant::String)
- v = QQmlStringConverters::variantFromString(value.toString(), propertyType, &ok);
+ if (variantType == QVariant::String) {
+ const QString &str = value.toString();
+ const bool targetIsChar = (propertyType == qMetaTypeId<QChar>()
+ || propertyType == qMetaTypeId<char>()
+ || propertyType == qMetaTypeId<unsigned char>());
+ // If the string contains only one character and the target is a char, try converting it.
+ if (targetIsChar) {
+ if (str.size() != 1)
+ return false; // We can only convert if the string contains exactly one character.
+
+ const QChar &qChar = str.at(0);
+ if (propertyType == qMetaTypeId<QChar>()) {
+ v = qChar;
+ ok = true;
+ } else if (propertyType == qMetaTypeId<char>() || propertyType == qMetaTypeId<unsigned char>()) {
+ const char c = qChar.toLatin1();
+ v = c;
+ ok = (qChar == c);
+ }
+ } else {
+ v = QQmlStringConverters::variantFromString(str, propertyType, &ok);
+ }
+ }
+
if (!ok) {
v = value;
if (v.convert(propertyType)) {
@@ -1444,7 +1465,7 @@ bool QQmlPropertyPrivate::write(QObject *object,
}
if (ok) {
- void *a[] = { (void *)v.constData(), 0, &status, &flags};
+ void *a[] = { const_cast<void *>(v.constData()), 0, &status, &flags};
QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a);
} else {
return false;
@@ -1459,7 +1480,7 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object,
const QQmlPropertyData &core,
QQmlContextData *context,
QQmlJavaScriptExpression *expression,
- const QV4::ValueRef result, bool isUndefined,
+ const QV4::Value &result, bool isUndefined,
WriteFlags flags)
{
Q_ASSERT(object);
@@ -1481,24 +1502,29 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object,
if (!isUndefined && !core.isValueTypeVirtual()) {
switch (core.propType) {
case QMetaType::Int:
- if (result->isInteger())
- QUICK_STORE(int, result->integerValue())
- else if (result->isNumber())
- QUICK_STORE(int, result->doubleValue())
+ if (result.isInteger())
+ QUICK_STORE(int, result.integerValue())
+ else if (result.isNumber())
+ QUICK_STORE(int, result.doubleValue())
break;
case QMetaType::Double:
- if (result->isNumber())
- QUICK_STORE(double, result->asDouble())
+ if (result.isNumber())
+ QUICK_STORE(double, result.asDouble())
break;
case QMetaType::Float:
- if (result->isNumber())
- QUICK_STORE(float, result->asDouble())
+ if (result.isNumber())
+ QUICK_STORE(float, result.asDouble())
break;
case QMetaType::QString:
- if (result->isString())
- QUICK_STORE(QString, result->toQStringNoThrow())
+ if (result.isString())
+ QUICK_STORE(QString, result.toQStringNoThrow())
break;
default:
+ if (const QV4::QQmlValueTypeWrapper *vtw = result.as<const QV4::QQmlValueTypeWrapper>()) {
+ if (vtw->d()->valueType->typeId == core.propType) {
+ return vtw->write(object, core.coreIndex);
+ }
+ }
break;
}
}
@@ -1513,20 +1539,20 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object,
if (isUndefined) {
} else if (core.isQList()) {
- value = v8engine->toVariant(result, qMetaTypeId<QList<QObject *> >());
- } else if (result->isNull() && core.isQObject()) {
+ value = QV8Engine::getV4(v8engine)->toVariant(result, qMetaTypeId<QList<QObject *> >());
+ } else if (result.isNull() && core.isQObject()) {
value = QVariant::fromValue((QObject *)0);
} else if (core.propType == qMetaTypeId<QList<QUrl> >()) {
- value = resolvedUrlSequence(v8engine->toVariant(result, qMetaTypeId<QList<QUrl> >()), context);
+ value = resolvedUrlSequence(QV8Engine::getV4(v8engine)->toVariant(result, qMetaTypeId<QList<QUrl> >()), context);
} else if (!isVarProperty && type != qMetaTypeId<QJSValue>()) {
- value = v8engine->toVariant(result, type);
+ value = QV8Engine::getV4(v8engine)->toVariant(result, type);
}
if (expression->hasError()) {
return false;
} else if (isVarProperty) {
- QV4::FunctionObject *f = result->asFunctionObject();
- if (f && f->bindingKeyFlag()) {
+ QV4::FunctionObject *f = result.asFunctionObject();
+ if (f && f->isBinding()) {
// we explicitly disallow this case to avoid confusion. Users can still store one
// in an array in a var property if they need to, but the common case is user error.
expression->delayedError()->setErrorDescription(QLatin1String("Invalid use of Qt.binding() in a binding declaration."));
@@ -1543,14 +1569,14 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object,
} else if (isUndefined && type == qMetaTypeId<QVariant>()) {
writeValueProperty(object, core, QVariant(), context, flags);
} else if (type == qMetaTypeId<QJSValue>()) {
- QV4::FunctionObject *f = result->asFunctionObject();
- if (f && f->bindingKeyFlag()) {
+ QV4::FunctionObject *f = result.asFunctionObject();
+ if (f && f->isBinding()) {
expression->delayedError()->setErrorDescription(QLatin1String("Invalid use of Qt.binding() in a binding declaration."));
expression->delayedError()->setErrorObject(object);
return false;
}
writeValueProperty(object, core, QVariant::fromValue(
- QJSValue(new QJSValuePrivate(QV8Engine::getV4(v8engine), result))),
+ QJSValue(QV8Engine::getV4(v8engine), result.asReturnedValue())),
context, flags);
} else if (isUndefined) {
QString errorStr = QLatin1String("Unable to assign [undefined] to ");
@@ -1561,8 +1587,8 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object,
expression->delayedError()->setErrorDescription(errorStr);
expression->delayedError()->setErrorObject(object);
return false;
- } else if (QV4::FunctionObject *f = result->asFunctionObject()) {
- if (f->bindingKeyFlag())
+ } else if (QV4::FunctionObject *f = result.asFunctionObject()) {
+ if (f->isBinding())
expression->delayedError()->setErrorDescription(QLatin1String("Invalid use of Qt.binding() in a binding declaration."));
else
expression->delayedError()->setErrorDescription(QLatin1String("Unable to assign a function to a property of any type other than var."));
@@ -1577,7 +1603,7 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object,
const char *propertyType = 0;
if (value.userType() == QMetaType::QObjectStar) {
- if (QObject *o = *(QObject **)value.constData()) {
+ if (QObject *o = *(QObject *const *)value.constData()) {
valueType = o->metaObject()->className();
QQmlMetaObject propertyMetaObject = rawMetaObjectForType(QQmlEnginePrivate::get(engine), type);
diff --git a/src/qml/qml/qqmlproperty.h b/src/qml/qml/qqmlproperty.h
index 7fe1f14607..93f5b6f827 100644
--- a/src/qml/qml/qqmlproperty.h
+++ b/src/qml/qml/qqmlproperty.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlproperty_p.h b/src/qml/qml/qqmlproperty_p.h
index 70b632c943..98e310ebce 100644
--- a/src/qml/qml/qqmlproperty_p.h
+++ b/src/qml/qml/qqmlproperty_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -140,7 +140,7 @@ public:
static bool writeBinding(QObject *, const QQmlPropertyData &,
QQmlContextData *context,
QQmlJavaScriptExpression *expression,
- const QV4::ValueRef result, bool isUndefined,
+ const QV4::Value &result, bool isUndefined,
WriteFlags flags);
static int valueTypeCoreIndex(const QQmlProperty &that);
static int bindingIndex(const QQmlProperty &that);
diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp
index dbb85f8b03..0018275b95 100644
--- a/src/qml/qml/qqmlpropertycache.cpp
+++ b/src/qml/qml/qqmlpropertycache.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -140,10 +140,8 @@ QQmlPropertyData::flagsForProperty(const QMetaProperty &p, QQmlEngine *engine)
return fastFlagsForProperty(p) | flagsForPropertyType(p.userType(), engine);
}
-void QQmlPropertyData::lazyLoad(const QMetaProperty &p, QQmlEngine *engine)
+void QQmlPropertyData::lazyLoad(const QMetaProperty &p)
{
- Q_UNUSED(engine);
-
coreIndex = p.propertyIndex();
notifyIndex = QMetaObjectPrivate::signalIndex(p.notifySignal());
Q_ASSERT(p.revision() <= Q_INT16_MAX);
@@ -233,7 +231,7 @@ void QQmlPropertyData::lazyLoad(const QMetaMethod &m)
/*!
Creates a new empty QQmlPropertyCache.
*/
-QQmlPropertyCache::QQmlPropertyCache(QQmlEngine *e)
+QQmlPropertyCache::QQmlPropertyCache(QJSEngine *e)
: engine(e), _parent(0), propertyIndexCacheStart(0), methodIndexCacheStart(0),
signalHandlerIndexCacheStart(0), _hasPropertyOverrides(false), _ownMetaObject(false),
_metaObject(0), argumentsCache(0)
@@ -244,7 +242,7 @@ QQmlPropertyCache::QQmlPropertyCache(QQmlEngine *e)
/*!
Creates a new QQmlPropertyCache of \a metaObject.
*/
-QQmlPropertyCache::QQmlPropertyCache(QQmlEngine *e, const QMetaObject *metaObject)
+QQmlPropertyCache::QQmlPropertyCache(QJSEngine *e, const QMetaObject *metaObject)
: engine(e), _parent(0), propertyIndexCacheStart(0), methodIndexCacheStart(0),
signalHandlerIndexCacheStart(0), _hasPropertyOverrides(false), _ownMetaObject(false),
_metaObject(0), argumentsCache(0)
@@ -252,7 +250,7 @@ QQmlPropertyCache::QQmlPropertyCache(QQmlEngine *e, const QMetaObject *metaObjec
Q_ASSERT(engine);
Q_ASSERT(metaObject);
- update(engine, metaObject);
+ update(metaObject);
}
QQmlPropertyCache::~QQmlPropertyCache()
@@ -273,7 +271,7 @@ QQmlPropertyCache::~QQmlPropertyCache()
stringCache.clear();
if (_parent) _parent->release();
- if (_ownMetaObject) free((void *)_metaObject);
+ if (_ownMetaObject) free(const_cast<QMetaObject *>(_metaObject));
_metaObject = 0;
_parent = 0;
engine = 0;
@@ -281,7 +279,6 @@ QQmlPropertyCache::~QQmlPropertyCache()
void QQmlPropertyCache::destroy()
{
- Q_ASSERT(engine);
delete this;
}
@@ -313,7 +310,7 @@ QQmlPropertyCache *QQmlPropertyCache::copy()
return copy(0);
}
-QQmlPropertyCache *QQmlPropertyCache::copyAndReserve(QQmlEngine *, int propertyCount, int methodCount,
+QQmlPropertyCache *QQmlPropertyCache::copyAndReserve(int propertyCount, int methodCount,
int signalCount)
{
QQmlPropertyCache *rv = copy(propertyCount + methodCount + signalCount);
@@ -548,16 +545,16 @@ const QMetaObject *QQmlPropertyCache::firstCppMetaObject() const
}
QQmlPropertyCache *
-QQmlPropertyCache::copyAndAppend(QQmlEngine *engine, const QMetaObject *metaObject,
+QQmlPropertyCache::copyAndAppend(const QMetaObject *metaObject,
QQmlPropertyData::Flag propertyFlags,
QQmlPropertyData::Flag methodFlags,
QQmlPropertyData::Flag signalFlags)
{
- return copyAndAppend(engine, metaObject, -1, propertyFlags, methodFlags, signalFlags);
+ return copyAndAppend(metaObject, -1, propertyFlags, methodFlags, signalFlags);
}
QQmlPropertyCache *
-QQmlPropertyCache::copyAndAppend(QQmlEngine *engine, const QMetaObject *metaObject,
+QQmlPropertyCache::copyAndAppend(const QMetaObject *metaObject,
int revision,
QQmlPropertyData::Flag propertyFlags,
QQmlPropertyData::Flag methodFlags,
@@ -572,12 +569,12 @@ QQmlPropertyCache::copyAndAppend(QQmlEngine *engine, const QMetaObject *metaObje
QMetaObjectPrivate::get(metaObject)->signalCount +
QMetaObjectPrivate::get(metaObject)->propertyCount);
- rv->append(engine, metaObject, revision, propertyFlags, methodFlags, signalFlags);
+ rv->append(metaObject, revision, propertyFlags, methodFlags, signalFlags);
return rv;
}
-void QQmlPropertyCache::append(QQmlEngine *engine, const QMetaObject *metaObject,
+void QQmlPropertyCache::append(const QMetaObject *metaObject,
int revision,
QQmlPropertyData::Flag propertyFlags,
QQmlPropertyData::Flag methodFlags,
@@ -630,6 +627,8 @@ void QQmlPropertyCache::append(QQmlEngine *engine, const QMetaObject *metaObject
static const int destroyedIdx1 = QObject::staticMetaObject.indexOfSignal("destroyed(QObject*)");
static const int destroyedIdx2 = QObject::staticMetaObject.indexOfSignal("destroyed()");
static const int deleteLaterIdx = QObject::staticMetaObject.indexOfSlot("deleteLater()");
+ // These indices don't apply to gadgets, so don't block them.
+ const bool preventDestruction = metaObject->superClass() || metaObject == &QObject::staticMetaObject;
int methodOffset = metaObject->methodOffset();
int signalOffset = signalCount - QMetaObjectPrivate::get(metaObject)->signalCount;
@@ -640,7 +639,7 @@ void QQmlPropertyCache::append(QQmlEngine *engine, const QMetaObject *metaObject
signalHandlerIndexCache.resize(signalCount - signalHandlerIndexCacheStart);
int signalHandlerIndex = signalOffset;
for (int ii = methodOffset; ii < methodCount; ++ii) {
- if (ii == destroyedIdx1 || ii == destroyedIdx2 || ii == deleteLaterIdx)
+ if (preventDestruction && (ii == destroyedIdx1 || ii == destroyedIdx2 || ii == deleteLaterIdx))
continue;
QMetaMethod m = metaObject->method(ii);
if (m.access() == QMetaMethod::Private)
@@ -745,7 +744,7 @@ void QQmlPropertyCache::append(QQmlEngine *engine, const QMetaObject *metaObject
QQmlPropertyData *data = &propertyIndexCache[ii - propertyIndexCacheStart];
- data->lazyLoad(p, engine);
+ data->lazyLoad(p);
data->flags |= propertyFlags;
if (!dynamicMetaObject)
@@ -797,25 +796,46 @@ void QQmlPropertyCache::resolve(QQmlPropertyData *data) const
data->propType = QMetaType::type(data->propTypeName);
- if (!data->isFunction())
- data->flags |= flagsForPropertyType(data->propType, engine);
+ if (!data->isFunction()) {
+ if (data->propType == QMetaType::UnknownType) {
+ const QMetaObject *mo = _metaObject;
+ QQmlPropertyCache *p = _parent;
+ while (p && (!mo || _ownMetaObject)) {
+ mo = p->_metaObject;
+ p = p->_parent;
+ }
+
+ int propOffset = mo->propertyOffset();
+ if (mo && data->coreIndex < propOffset + mo->propertyCount()) {
+ while (data->coreIndex < propOffset) {
+ mo = mo->superClass();
+ propOffset = mo->propertyOffset();
+ }
+
+ int registerResult = -1;
+ void *argv[] = { &registerResult };
+ mo->static_metacall(QMetaObject::RegisterPropertyMetaType, data->coreIndex - propOffset, argv);
+ data->propType = registerResult == -1 ? QMetaType::UnknownType : registerResult;
+ }
+ }
+ data->flags |= flagsForPropertyType(data->propType, qobject_cast<QQmlEngine*>(engine));
+ }
data->flags &= ~QQmlPropertyData::NotFullyResolved;
}
-void QQmlPropertyCache::updateRecur(QQmlEngine *engine, const QMetaObject *metaObject)
+void QQmlPropertyCache::updateRecur(const QMetaObject *metaObject)
{
if (!metaObject)
return;
- updateRecur(engine, metaObject->superClass());
+ updateRecur(metaObject->superClass());
- append(engine, metaObject, -1);
+ append(metaObject, -1);
}
-void QQmlPropertyCache::update(QQmlEngine *engine, const QMetaObject *metaObject)
+void QQmlPropertyCache::update(const QMetaObject *metaObject)
{
- Q_ASSERT(engine);
Q_ASSERT(metaObject);
Q_ASSERT(stringCache.isEmpty());
@@ -833,14 +853,14 @@ void QQmlPropertyCache::update(QQmlEngine *engine, const QMetaObject *metaObject
// cached in a parent cache.
stringCache.reserve(pc + mc + sc);
- updateRecur(engine,metaObject);
+ updateRecur(metaObject);
}
/*! \internal
invalidates and updates the PropertyCache if the QMetaObject has changed.
This function is used in the tooling to update dynamic properties.
*/
-void QQmlPropertyCache::invalidate(QQmlEngine *engine, const QMetaObject *metaObject)
+void QQmlPropertyCache::invalidate(const QMetaObject *metaObject)
{
stringCache.clear();
propertyIndexCache.clear();
@@ -860,12 +880,12 @@ void QQmlPropertyCache::invalidate(QQmlEngine *engine, const QMetaObject *metaOb
methodIndexCacheStart = parent()->methodIndexCache.count() + parent()->methodIndexCacheStart;
signalHandlerIndexCacheStart = parent()->signalHandlerIndexCache.count() + parent()->signalHandlerIndexCacheStart;
stringCache.linkAndReserve(parent()->stringCache, reserve);
- append(engine, metaObject, -1);
+ append(metaObject, -1);
} else {
propertyIndexCacheStart = 0;
methodIndexCacheStart = 0;
signalHandlerIndexCacheStart = 0;
- update(engine, metaObject);
+ update(metaObject);
}
}
@@ -1033,7 +1053,7 @@ void QQmlPropertyData::markAsOverrideOf(QQmlPropertyData *predecessor)
QStringList QQmlPropertyCache::propertyNames() const
{
QStringList keys;
- for (StringCache::ConstIterator iter = stringCache.begin(); iter != stringCache.end(); ++iter)
+ for (StringCache::ConstIterator iter = stringCache.begin(), cend = stringCache.end(); iter != cend; ++iter)
keys.append(iter.key());
return keys;
}
@@ -1115,7 +1135,7 @@ QString QQmlPropertyCache::signalParameterStringForJS(int index, QString *errorS
}
QString error;
- QString parameters = signalParameterStringForJS(engine, parameterNameList, &error);
+ QString parameters = signalParameterStringForJS(QV8Engine::getV4(engine), parameterNameList, &error);
A *arguments = static_cast<A *>(signalData->arguments);
arguments->signalParameterStringForJS = new QString(!error.isEmpty() ? error : parameters);
@@ -1128,11 +1148,10 @@ QString QQmlPropertyCache::signalParameterStringForJS(int index, QString *errorS
return *arguments->signalParameterStringForJS;
}
-QString QQmlPropertyCache::signalParameterStringForJS(QQmlEngine *engine, const QList<QByteArray> &parameterNameList, QString *errorString)
+QString QQmlPropertyCache::signalParameterStringForJS(QV4::ExecutionEngine *engine, const QList<QByteArray> &parameterNameList, QString *errorString)
{
- QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine);
bool unnamedParameter = false;
- const QSet<QString> &illegalNames = ep->v8engine()->illegalNames();
+ const QSet<QString> &illegalNames = engine->v8Engine->illegalNames();
QString error;
QString parameters;
@@ -1157,146 +1176,6 @@ QString QQmlPropertyCache::signalParameterStringForJS(QQmlEngine *engine, const
return parameters;
}
-// Returns an array of the arguments for method \a index. The first entry in the array
-// is the number of arguments.
-int *QQmlPropertyCache::methodParameterTypes(QObject *object, int index,
- QVarLengthArray<int, 9> &dummy,
- QByteArray *unknownTypeError)
-{
- Q_ASSERT(object && index >= 0);
-
- QQmlData *ddata = QQmlData::get(object, false);
-
- if (ddata && ddata->propertyCache) {
- typedef QQmlPropertyCacheMethodArguments A;
-
- QQmlPropertyCache *c = ddata->propertyCache;
- Q_ASSERT(index < c->methodIndexCacheStart + c->methodIndexCache.count());
-
- while (index < c->methodIndexCacheStart)
- c = c->_parent;
-
- QQmlPropertyData *rv = const_cast<QQmlPropertyData *>(&c->methodIndexCache.at(index - c->methodIndexCacheStart));
-
- if (rv->arguments && static_cast<A *>(rv->arguments)->argumentsValid)
- return static_cast<A *>(rv->arguments)->arguments;
-
- const QMetaObject *metaObject = c->createMetaObject();
- Q_ASSERT(metaObject);
- QMetaMethod m = metaObject->method(index);
-
- int argc = m.parameterCount();
- if (!rv->arguments) {
- A *args = c->createArgumentsObject(argc, m.parameterNames());
- rv->arguments = args;
- }
- A *args = static_cast<A *>(rv->arguments);
-
- QList<QByteArray> argTypeNames; // Only loaded if needed
-
- for (int ii = 0; ii < argc; ++ii) {
- int type = m.parameterType(ii);
- QMetaType::TypeFlags flags = QMetaType::typeFlags(type);
- if (flags & QMetaType::IsEnumeration)
- type = QVariant::Int;
- else if (type == QMetaType::UnknownType ||
- (type >= (int)QVariant::UserType && !(flags & QMetaType::PointerToQObject) &&
- type != qMetaTypeId<QJSValue>())) {
- //the UserType clause is to catch registered QFlags
- if (argTypeNames.isEmpty())
- argTypeNames = m.parameterTypes();
- type = EnumType(object->metaObject(), argTypeNames.at(ii), type);
- }
- if (type == QMetaType::UnknownType) {
- if (unknownTypeError) *unknownTypeError = argTypeNames.at(ii);
- return 0;
- }
- args->arguments[ii + 1] = type;
- }
- args->argumentsValid = true;
- return static_cast<A *>(rv->arguments)->arguments;
-
- } else {
- QMetaMethod m = object->metaObject()->method(index);
- int argc = m.parameterCount();
- dummy.resize(argc + 1);
- dummy[0] = argc;
- QList<QByteArray> argTypeNames; // Only loaded if needed
-
- for (int ii = 0; ii < argc; ++ii) {
- int type = m.parameterType(ii);
- QMetaType::TypeFlags flags = QMetaType::typeFlags(type);
- if (flags & QMetaType::IsEnumeration)
- type = QVariant::Int;
- else if (type == QMetaType::UnknownType ||
- (type >= (int)QVariant::UserType && !(flags & QMetaType::PointerToQObject) &&
- type != qMetaTypeId<QJSValue>())) {
- //the UserType clause is to catch registered QFlags)
- if (argTypeNames.isEmpty())
- argTypeNames = m.parameterTypes();
- type = EnumType(object->metaObject(), argTypeNames.at(ii), type);
- }
- if (type == QMetaType::UnknownType) {
- if (unknownTypeError) *unknownTypeError = argTypeNames.at(ii);
- return 0;
- }
- dummy[ii + 1] = type;
- }
-
- return dummy.data();
- }
-}
-
-// Returns the return type of the method.
-int QQmlPropertyCache::methodReturnType(QObject *object, const QQmlPropertyData &data,
- QByteArray *unknownTypeError)
-{
- Q_ASSERT(object && data.coreIndex >= 0);
-
- int type = data.propType;
-
- const char *propTypeName = 0;
-
- if (type == QMetaType::UnknownType) {
- // Find the return type name from the method info
- QMetaMethod m;
-
- QQmlData *ddata = QQmlData::get(object, false);
- if (ddata && ddata->propertyCache) {
- QQmlPropertyCache *c = ddata->propertyCache;
- Q_ASSERT(data.coreIndex < c->methodIndexCacheStart + c->methodIndexCache.count());
-
- while (data.coreIndex < c->methodIndexCacheStart)
- c = c->_parent;
-
- const QMetaObject *metaObject = c->createMetaObject();
- Q_ASSERT(metaObject);
- m = metaObject->method(data.coreIndex);
- } else {
- m = object->metaObject()->method(data.coreIndex);
- }
-
- type = m.returnType();
- propTypeName = m.typeName();
- }
-
- QMetaType::TypeFlags flags = QMetaType::typeFlags(type);
- if (flags & QMetaType::IsEnumeration) {
- type = QVariant::Int;
- } else if (type == QMetaType::UnknownType ||
- (type >= (int)QVariant::UserType && !(flags & QMetaType::PointerToQObject) &&
- type != qMetaTypeId<QJSValue>())) {
- //the UserType clause is to catch registered QFlags
- type = EnumType(object->metaObject(), propTypeName, type);
- }
-
- if (type == QMetaType::UnknownType) {
- if (unknownTypeError) *unknownTypeError = propTypeName;
- }
-
- return type;
-}
-
int QQmlPropertyCache::originalClone(int index)
{
while (signal(index)->isCloned())
@@ -1332,12 +1211,14 @@ QQmlPropertyData qQmlPropertyCacheCreate(const QMetaObject *metaObject, const QS
static const int destroyedIdx1 = QObject::staticMetaObject.indexOfSignal("destroyed(QObject*)");
static const int destroyedIdx2 = QObject::staticMetaObject.indexOfSignal("destroyed()");
static const int deleteLaterIdx = QObject::staticMetaObject.indexOfSlot("deleteLater()");
+ // These indices don't apply to gadgets, so don't block them.
+ const bool preventDestruction = metaObject->superClass() || metaObject == &QObject::staticMetaObject;
const QByteArray propertyName = property.toUtf8();
int methodCount = metaObject->methodCount();
for (int ii = methodCount - 1; ii >= 0; --ii) {
- if (ii == destroyedIdx1 || ii == destroyedIdx2 || ii == deleteLaterIdx)
+ if (preventDestruction && (ii == destroyedIdx1 || ii == destroyedIdx2 || ii == deleteLaterIdx))
continue;
QMetaMethod m = metaObject->method(ii);
if (m.access() == QMetaMethod::Private)
@@ -1388,7 +1269,7 @@ inline QString qQmlPropertyCacheToString(const QV4::String *string)
template<typename T>
QQmlPropertyData *
-qQmlPropertyCacheProperty(QQmlEngine *engine, QObject *obj, T name,
+qQmlPropertyCacheProperty(QJSEngine *engine, QObject *obj, T name,
QQmlContextData *context, QQmlPropertyData &local)
{
QQmlPropertyCache *cache = 0;
@@ -1398,7 +1279,7 @@ qQmlPropertyCacheProperty(QQmlEngine *engine, QObject *obj, T name,
if (ddata && ddata->propertyCache) {
cache = ddata->propertyCache;
} else if (engine) {
- QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine);
+ QJSEnginePrivate *ep = QJSEnginePrivate::get(engine);
cache = ep->cache(obj);
if (cache) {
ddata = QQmlData::get(obj, true);
@@ -1421,14 +1302,14 @@ qQmlPropertyCacheProperty(QQmlEngine *engine, QObject *obj, T name,
}
QQmlPropertyData *
-QQmlPropertyCache::property(QQmlEngine *engine, QObject *obj, const QV4::String *name,
+QQmlPropertyCache::property(QJSEngine *engine, QObject *obj, const QV4::String *name,
QQmlContextData *context, QQmlPropertyData &local)
{
return qQmlPropertyCacheProperty<const QV4::String *>(engine, obj, name, context, local);
}
QQmlPropertyData *
-QQmlPropertyCache::property(QQmlEngine *engine, QObject *obj,
+QQmlPropertyCache::property(QJSEngine *engine, QObject *obj,
const QString &name, QQmlContextData *context, QQmlPropertyData &local)
{
return qQmlPropertyCacheProperty<const QString &>(engine, obj, name, context, local);
@@ -1493,7 +1374,7 @@ void QQmlPropertyCache::toMetaObjectBuilder(QMetaObjectBuilder &builder)
QList<QPair<QString, QQmlPropertyData *> > properties;
QList<QPair<QString, QQmlPropertyData *> > methods;
- for (StringCache::ConstIterator iter = stringCache.begin(); iter != stringCache.end(); ++iter)
+ for (StringCache::ConstIterator iter = stringCache.begin(), cend = stringCache.end(); iter != cend; ++iter)
Insert::in(this, properties, methods, iter, iter.value().second);
Q_ASSERT(properties.count() == propertyIndexCache.count());
@@ -1629,6 +1510,41 @@ bool QQmlMetaObject::canConvert(const QQmlMetaObject &from, const QQmlMetaObject
return false;
}
+void QQmlMetaObject::resolveGadgetMethodOrPropertyIndex(QMetaObject::Call type, const QMetaObject **metaObject, int *index)
+{
+ int offset;
+
+ switch (type) {
+ case QMetaObject::ReadProperty:
+ case QMetaObject::WriteProperty:
+ case QMetaObject::ResetProperty:
+ case QMetaObject::QueryPropertyDesignable:
+ case QMetaObject::QueryPropertyEditable:
+ case QMetaObject::QueryPropertyScriptable:
+ case QMetaObject::QueryPropertyStored:
+ case QMetaObject::QueryPropertyUser:
+ offset = (*metaObject)->propertyOffset();
+ while (*index < offset) {
+ *metaObject = (*metaObject)->superClass();
+ offset = (*metaObject)->propertyOffset();
+ }
+ break;
+ case QMetaObject::InvokeMetaMethod:
+ offset = (*metaObject)->methodOffset();
+ while (*index < offset) {
+ *metaObject = (*metaObject)->superClass();
+ offset = (*metaObject)->methodOffset();
+ }
+ break;
+ default:
+ offset = 0;
+ Q_UNIMPLEMENTED();
+ offset = INT_MAX;
+ }
+
+ *index -= offset;
+}
+
QQmlPropertyCache *QQmlMetaObject::propertyCache(QQmlEnginePrivate *e) const
{
if (_m.isNull()) return 0;
@@ -1636,4 +1552,146 @@ QQmlPropertyCache *QQmlMetaObject::propertyCache(QQmlEnginePrivate *e) const
else return e->cache(_m.asT2());
}
+int QQmlMetaObject::methodReturnType(const QQmlPropertyData &data, QByteArray *unknownTypeError) const
+{
+ Q_ASSERT(!_m.isNull() && data.coreIndex >= 0);
+
+ int type = data.propType;
+
+ const char *propTypeName = 0;
+
+ if (type == QMetaType::UnknownType) {
+ // Find the return type name from the method info
+ QMetaMethod m;
+
+ if (_m.isT1()) {
+ QQmlPropertyCache *c = _m.asT1();
+ Q_ASSERT(data.coreIndex < c->methodIndexCacheStart + c->methodIndexCache.count());
+
+ while (data.coreIndex < c->methodIndexCacheStart)
+ c = c->_parent;
+
+ const QMetaObject *metaObject = c->createMetaObject();
+ Q_ASSERT(metaObject);
+ m = metaObject->method(data.coreIndex);
+ } else {
+ m = _m.asT2()->method(data.coreIndex);
+ }
+
+ type = m.returnType();
+ propTypeName = m.typeName();
+ }
+
+ QMetaType::TypeFlags flags = QMetaType::typeFlags(type);
+ if (flags & QMetaType::IsEnumeration) {
+ type = QVariant::Int;
+ } else if (type == QMetaType::UnknownType ||
+ (type >= (int)QVariant::UserType && !(flags & QMetaType::PointerToQObject) &&
+ type != qMetaTypeId<QJSValue>())) {
+ //the UserType clause is to catch registered QFlags
+ type = EnumType(metaObject(), propTypeName, type);
+ }
+
+ if (type == QMetaType::UnknownType) {
+ if (unknownTypeError) *unknownTypeError = propTypeName;
+ }
+
+ return type;
+}
+
+int *QQmlMetaObject::methodParameterTypes(int index, QVarLengthArray<int, 9> &dummy, QByteArray *unknownTypeError) const
+{
+ Q_ASSERT(!_m.isNull() && index >= 0);
+
+ if (_m.isT1()) {
+ typedef QQmlPropertyCacheMethodArguments A;
+
+ QQmlPropertyCache *c = _m.asT1();
+ Q_ASSERT(index < c->methodIndexCacheStart + c->methodIndexCache.count());
+
+ while (index < c->methodIndexCacheStart)
+ c = c->_parent;
+
+ QQmlPropertyData *rv = const_cast<QQmlPropertyData *>(&c->methodIndexCache.at(index - c->methodIndexCacheStart));
+
+ if (rv->arguments && static_cast<A *>(rv->arguments)->argumentsValid)
+ return static_cast<A *>(rv->arguments)->arguments;
+
+ const QMetaObject *metaObject = c->createMetaObject();
+ Q_ASSERT(metaObject);
+ QMetaMethod m = metaObject->method(index);
+
+ int argc = m.parameterCount();
+ if (!rv->arguments) {
+ A *args = c->createArgumentsObject(argc, m.parameterNames());
+ rv->arguments = args;
+ }
+ A *args = static_cast<A *>(rv->arguments);
+
+ QList<QByteArray> argTypeNames; // Only loaded if needed
+
+ for (int ii = 0; ii < argc; ++ii) {
+ int type = m.parameterType(ii);
+ QMetaType::TypeFlags flags = QMetaType::typeFlags(type);
+ if (flags & QMetaType::IsEnumeration)
+ type = QVariant::Int;
+ else if (type == QMetaType::UnknownType ||
+ (type >= (int)QVariant::UserType && !(flags & QMetaType::PointerToQObject) &&
+ type != qMetaTypeId<QJSValue>())) {
+ //the UserType clause is to catch registered QFlags
+ if (argTypeNames.isEmpty())
+ argTypeNames = m.parameterTypes();
+ type = EnumType(metaObject, argTypeNames.at(ii), type);
+ }
+ if (type == QMetaType::UnknownType) {
+ if (unknownTypeError) *unknownTypeError = argTypeNames.at(ii);
+ return 0;
+ }
+ args->arguments[ii + 1] = type;
+ }
+ args->argumentsValid = true;
+ return static_cast<A *>(rv->arguments)->arguments;
+
+ } else {
+ QMetaMethod m = _m.asT2()->method(index);
+ int argc = m.parameterCount();
+ dummy.resize(argc + 1);
+ dummy[0] = argc;
+ QList<QByteArray> argTypeNames; // Only loaded if needed
+
+ for (int ii = 0; ii < argc; ++ii) {
+ int type = m.parameterType(ii);
+ QMetaType::TypeFlags flags = QMetaType::typeFlags(type);
+ if (flags & QMetaType::IsEnumeration)
+ type = QVariant::Int;
+ else if (type == QMetaType::UnknownType ||
+ (type >= (int)QVariant::UserType && !(flags & QMetaType::PointerToQObject) &&
+ type != qMetaTypeId<QJSValue>())) {
+ //the UserType clause is to catch registered QFlags)
+ if (argTypeNames.isEmpty())
+ argTypeNames = m.parameterTypes();
+ type = EnumType(_m.asT2(), argTypeNames.at(ii), type);
+ }
+ if (type == QMetaType::UnknownType) {
+ if (unknownTypeError) *unknownTypeError = argTypeNames.at(ii);
+ return 0;
+ }
+ dummy[ii + 1] = type;
+ }
+
+ return dummy.data();
+ }
+}
+
+void QQmlObjectOrGadget::metacall(QMetaObject::Call type, int index, void **argv) const
+{
+ if (ptr.isT1())
+ QMetaObject::metacall(ptr.asT1(), type, index, argv);
+ else {
+ const QMetaObject *metaObject = _m.asT1()->metaObject();
+ QQmlMetaObject::resolveGadgetMethodOrPropertyIndex(type, &metaObject, &index);
+ metaObject->d.static_metacall(reinterpret_cast<QObject*>(ptr.asT2()), type, index, argv);
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/qml/qml/qqmlpropertycache_p.h b/src/qml/qml/qqmlpropertycache_p.h
index 8bd7cd5f56..6ed9ec0d36 100644
--- a/src/qml/qml/qqmlpropertycache_p.h
+++ b/src/qml/qml/qqmlpropertycache_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -61,6 +61,7 @@ QT_BEGIN_NAMESPACE
class QV8Engine;
class QMetaProperty;
class QQmlEngine;
+class QJSEngine;
class QQmlPropertyData;
class QQmlAccessors;
class QMetaObjectBuilder;
@@ -160,8 +161,14 @@ public:
inline int getValueTypeCoreIndex() const;
// Returns the "encoded" index for use with bindings. Encoding is:
- // coreIndex | (valueTypeCoreIndex << 16)
+ // coreIndex | ((valueTypeCoreIndex + 1) << 16)
inline int encodedIndex() const;
+ static int encodeValueTypePropertyIndex(int coreIndex, int valueTypeCoreIndex)
+ { return coreIndex | ((valueTypeCoreIndex + 1) << 16); }
+ static int decodeValueTypePropertyIndex(int index, int *coreIndex = 0) {
+ if (coreIndex) *coreIndex = index & 0xffff;
+ return (index >> 16) - 1;
+ }
union {
int propType; // When !NotFullyResolved
@@ -227,7 +234,7 @@ public:
private:
friend class QQmlPropertyCache;
- void lazyLoad(const QMetaProperty &, QQmlEngine *engine = 0);
+ void lazyLoad(const QMetaProperty &);
void lazyLoad(const QMetaMethod &);
bool notFullyResolved() const { return flags & NotFullyResolved; }
};
@@ -236,25 +243,27 @@ class QQmlPropertyCacheMethodArguments;
class Q_QML_PRIVATE_EXPORT QQmlPropertyCache : public QQmlRefCount, public QQmlCleanup
{
public:
- QQmlPropertyCache(QQmlEngine *);
- QQmlPropertyCache(QQmlEngine *, const QMetaObject *);
+ QQmlPropertyCache(QJSEngine *);
+ QQmlPropertyCache(QJSEngine *, const QMetaObject *);
virtual ~QQmlPropertyCache();
- void update(QQmlEngine *, const QMetaObject *);
- void invalidate(QQmlEngine *, const QMetaObject *);
+ void update(const QMetaObject *);
+ void invalidate(const QMetaObject *);
+ // Used by qmlpuppet. Remove as soon Creator requires Qt 5.5.
+ void invalidate(void *, const QMetaObject *mo) { invalidate(mo); }
QQmlPropertyCache *copy();
- QQmlPropertyCache *copyAndAppend(QQmlEngine *, const QMetaObject *,
+ QQmlPropertyCache *copyAndAppend(const QMetaObject *,
QQmlPropertyData::Flag propertyFlags = QQmlPropertyData::NoFlags,
QQmlPropertyData::Flag methodFlags = QQmlPropertyData::NoFlags,
QQmlPropertyData::Flag signalFlags = QQmlPropertyData::NoFlags);
- QQmlPropertyCache *copyAndAppend(QQmlEngine *, const QMetaObject *, int revision,
+ QQmlPropertyCache *copyAndAppend(const QMetaObject *, int revision,
QQmlPropertyData::Flag propertyFlags = QQmlPropertyData::NoFlags,
QQmlPropertyData::Flag methodFlags = QQmlPropertyData::NoFlags,
QQmlPropertyData::Flag signalFlags = QQmlPropertyData::NoFlags);
- QQmlPropertyCache *copyAndReserve(QQmlEngine *, int propertyCount,
+ QQmlPropertyCache *copyAndReserve(int propertyCount,
int methodCount, int signalCount);
void appendProperty(const QString &,
quint32 flags, int coreIndex, int propType, int notifyIndex);
@@ -294,15 +303,10 @@ public:
inline QQmlPropertyData *overrideData(QQmlPropertyData *) const;
inline bool isAllowedInRevision(QQmlPropertyData *) const;
- inline QQmlEngine *qmlEngine() const;
- static QQmlPropertyData *property(QQmlEngine *, QObject *, const QString &,
+ static QQmlPropertyData *property(QJSEngine *, QObject *, const QString &,
QQmlContextData *, QQmlPropertyData &);
- static QQmlPropertyData *property(QQmlEngine *, QObject *, const QV4::String *,
+ static QQmlPropertyData *property(QJSEngine *, QObject *, const QV4::String *,
QQmlContextData *, QQmlPropertyData &);
- static int *methodParameterTypes(QObject *, int index, QVarLengthArray<int, 9> &dummy,
- QByteArray *unknownTypeError);
- static int methodReturnType(QObject *, const QQmlPropertyData &data,
- QByteArray *unknownTypeError);
//see QMetaObjectPrivate::originalClone
int originalClone(int index);
@@ -310,7 +314,7 @@ public:
QList<QByteArray> signalParameterNames(int index) const;
QString signalParameterStringForJS(int index, QString *errorString = 0);
- static QString signalParameterStringForJS(QQmlEngine *engine, const QList<QByteArray> &parameterNameList, QString *errorString = 0);
+ static QString signalParameterStringForJS(QV4::ExecutionEngine *engine, const QList<QByteArray> &parameterNameList, QString *errorString = 0);
const char *className() const;
@@ -334,10 +338,11 @@ private:
friend class QQmlCompiler;
friend class QQmlPropertyCacheCreator;
friend class QQmlComponentAndAliasResolver;
+ friend class QQmlMetaObject;
inline QQmlPropertyCache *copy(int reserve);
- void append(QQmlEngine *, const QMetaObject *, int revision,
+ void append(const QMetaObject *, int revision,
QQmlPropertyData::Flag propertyFlags = QQmlPropertyData::NoFlags,
QQmlPropertyData::Flag methodFlags = QQmlPropertyData::NoFlags,
QQmlPropertyData::Flag signalFlags = QQmlPropertyData::NoFlags);
@@ -356,7 +361,7 @@ private:
QQmlPropertyData *ensureResolved(QQmlPropertyData*) const;
void resolve(QQmlPropertyData *) const;
- void updateRecur(QQmlEngine *, const QMetaObject *);
+ void updateRecur(const QMetaObject *);
template<typename K>
QQmlPropertyData *findNamedProperty(const K &key)
@@ -372,7 +377,7 @@ private:
_hasPropertyOverrides |= isOverride;
}
- QQmlEngine *engine;
+ QJSEngine *engine;
QQmlPropertyCache *_parent;
int propertyIndexCacheStart;
@@ -422,12 +427,37 @@ public:
QQmlPropertyCache *propertyCache(QQmlEnginePrivate *) const;
+ int methodReturnType(const QQmlPropertyData &data, QByteArray *unknownTypeError) const;
+ int *methodParameterTypes(int index, QVarLengthArray<int, 9> &dummy, QByteArray *unknownTypeError) const;
+
static bool canConvert(const QQmlMetaObject &from, const QQmlMetaObject &to);
-private:
+ // static_metacall (on Gadgets) doesn't call the base implementation and therefore
+ // we need a helper to find the correct meta object and property/method index.
+ static void resolveGadgetMethodOrPropertyIndex(QMetaObject::Call type, const QMetaObject **metaObject, int *index);
+
+protected:
QBiPointer<QQmlPropertyCache, const QMetaObject> _m;
};
+class QQmlObjectOrGadget: public QQmlMetaObject
+{
+public:
+ QQmlObjectOrGadget(QObject *obj)
+ : QQmlMetaObject(obj),
+ ptr(obj)
+ {}
+ QQmlObjectOrGadget(QQmlPropertyCache *propertyCache, void *gadget)
+ : QQmlMetaObject(propertyCache)
+ , ptr(gadget)
+ {}
+
+ void metacall(QMetaObject::Call type, int index, void **argv) const;
+
+private:
+ QBiPointer<QObject, void> ptr;
+};
+
QQmlPropertyData::QQmlPropertyData()
{
propType = 0;
@@ -464,7 +494,7 @@ int QQmlPropertyRawData::getValueTypeCoreIndex() const
int QQmlPropertyRawData::encodedIndex() const
{
- return isValueTypeVirtual()?(coreIndex | (valueTypeCoreIndex << 16)):coreIndex;
+ return isValueTypeVirtual()?QQmlPropertyData::encodeValueTypePropertyIndex(coreIndex, valueTypeCoreIndex):coreIndex;
}
QQmlPropertyData *
@@ -485,11 +515,6 @@ bool QQmlPropertyCache::isAllowedInRevision(QQmlPropertyData *data) const
(allowedRevisionCache[data->metaObjectOffset] >= data->revision);
}
-QQmlEngine *QQmlPropertyCache::qmlEngine() const
-{
- return engine;
-}
-
int QQmlPropertyCache::propertyCount() const
{
return propertyIndexCacheStart + propertyIndexCache.count();
diff --git a/src/qml/qml/qqmlpropertyvalueinterceptor.cpp b/src/qml/qml/qqmlpropertyvalueinterceptor.cpp
index 83352b6fbb..95d3d3ba6d 100644
--- a/src/qml/qml/qqmlpropertyvalueinterceptor.cpp
+++ b/src/qml/qml/qqmlpropertyvalueinterceptor.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlpropertyvalueinterceptor_p.h b/src/qml/qml/qqmlpropertyvalueinterceptor_p.h
index 707f2ac073..ea267f9c30 100644
--- a/src/qml/qml/qqmlpropertyvalueinterceptor_p.h
+++ b/src/qml/qml/qqmlpropertyvalueinterceptor_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlpropertyvaluesource.cpp b/src/qml/qml/qqmlpropertyvaluesource.cpp
index dcdf44b541..c9e9af2822 100644
--- a/src/qml/qml/qqmlpropertyvaluesource.cpp
+++ b/src/qml/qml/qqmlpropertyvaluesource.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlpropertyvaluesource.h b/src/qml/qml/qqmlpropertyvaluesource.h
index 31f581f91f..4307fb3470 100644
--- a/src/qml/qml/qqmlpropertyvaluesource.h
+++ b/src/qml/qml/qqmlpropertyvaluesource.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlproxymetaobject.cpp b/src/qml/qml/qqmlproxymetaobject.cpp
index 5969dc6904..bf735a9f0c 100644
--- a/src/qml/qml/qqmlproxymetaobject.cpp
+++ b/src/qml/qml/qqmlproxymetaobject.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlproxymetaobject_p.h b/src/qml/qml/qqmlproxymetaobject_p.h
index 7ed073fc7f..862b0fb7c2 100644
--- a/src/qml/qml/qqmlproxymetaobject_p.h
+++ b/src/qml/qml/qqmlproxymetaobject_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlscriptstring.cpp b/src/qml/qml/qqmlscriptstring.cpp
index c8227070c5..4013843a14 100644
--- a/src/qml/qml/qqmlscriptstring.cpp
+++ b/src/qml/qml/qqmlscriptstring.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlscriptstring.h b/src/qml/qml/qqmlscriptstring.h
index ccbe90535b..d1f4d47e6e 100644
--- a/src/qml/qml/qqmlscriptstring.h
+++ b/src/qml/qml/qqmlscriptstring.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlscriptstring_p.h b/src/qml/qml/qqmlscriptstring_p.h
index bda0b97cca..24bfdcdd4e 100644
--- a/src/qml/qml/qqmlscriptstring_p.h
+++ b/src/qml/qml/qqmlscriptstring_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlstringconverters.cpp b/src/qml/qml/qqmlstringconverters.cpp
index 842eac6f01..eb0afda927 100644
--- a/src/qml/qml/qqmlstringconverters.cpp
+++ b/src/qml/qml/qqmlstringconverters.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlstringconverters_p.h b/src/qml/qml/qqmlstringconverters_p.h
index 93ec289348..83d1b6f679 100644
--- a/src/qml/qml/qqmlstringconverters_p.h
+++ b/src/qml/qml/qqmlstringconverters_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index 0ac1d7fabd..d713e9ee03 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -79,8 +79,8 @@
#ifdef DATABLOB_DEBUG
-#define ASSERT_MAINTHREAD() do { if(m_thread->isThisThread()) qFatal("QQmlDataLoader: Caller not in main thread"); } while(false)
-#define ASSERT_LOADTHREAD() do { if(!m_thread->isThisThread()) qFatal("QQmlDataLoader: Caller not in load thread"); } while(false)
+#define ASSERT_MAINTHREAD() do { if (m_thread->isThisThread()) qFatal("QQmlTypeLoader: Caller not in main thread"); } while (false)
+#define ASSERT_LOADTHREAD() do { if (!m_thread->isThisThread()) qFatal("QQmlTypeLoader: Caller not in load thread"); } while (false)
#define ASSERT_CALLBACK() do { if(!m_manager || !m_manager->m_thread->isThisThread()) qFatal("QQmlDataBlob: An API call was made outside a callback"); } while(false)
#else
@@ -108,14 +108,14 @@ namespace {
// This is a lame object that we need to ensure that slots connected to
// QNetworkReply get called in the correct thread (the loader thread).
-// As QQmlDataLoader lives in the main thread, and we can't use
+// As QQmlTypeLoader lives in the main thread, and we can't use
// Qt::DirectConnection connections from a QNetworkReply (because then
// sender() wont work), we need to insert this object in the middle.
-class QQmlDataLoaderNetworkReplyProxy : public QObject
+class QQmlTypeLoaderNetworkReplyProxy : public QObject
{
Q_OBJECT
public:
- QQmlDataLoaderNetworkReplyProxy(QQmlDataLoader *l);
+ QQmlTypeLoaderNetworkReplyProxy(QQmlTypeLoader *l);
public slots:
void finished();
@@ -123,17 +123,17 @@ public slots:
void manualFinished(QNetworkReply*);
private:
- QQmlDataLoader *l;
+ QQmlTypeLoader *l;
};
-class QQmlDataLoaderThread : public QQmlThread
+class QQmlTypeLoaderThread : public QQmlThread
{
- typedef QQmlDataLoaderThread This;
+ typedef QQmlTypeLoaderThread This;
public:
- QQmlDataLoaderThread(QQmlDataLoader *loader);
+ QQmlTypeLoaderThread(QQmlTypeLoader *loader);
QNetworkAccessManager *networkAccessManager() const;
- QQmlDataLoaderNetworkReplyProxy *networkReplyProxy() const;
+ QQmlTypeLoaderNetworkReplyProxy *networkReplyProxy() const;
void load(QQmlDataBlob *b);
void loadAsync(QQmlDataBlob *b);
@@ -156,18 +156,18 @@ private:
void callDownloadProgressChangedMain(QQmlDataBlob *b, qreal p);
void initializeEngineMain(QQmlExtensionInterface *iface, const char *uri);
- QQmlDataLoader *m_loader;
+ QQmlTypeLoader *m_loader;
mutable QNetworkAccessManager *m_networkAccessManager;
- mutable QQmlDataLoaderNetworkReplyProxy *m_networkReplyProxy;
+ mutable QQmlTypeLoaderNetworkReplyProxy *m_networkReplyProxy;
};
-QQmlDataLoaderNetworkReplyProxy::QQmlDataLoaderNetworkReplyProxy(QQmlDataLoader *l)
+QQmlTypeLoaderNetworkReplyProxy::QQmlTypeLoaderNetworkReplyProxy(QQmlTypeLoader *l)
: l(l)
{
}
-void QQmlDataLoaderNetworkReplyProxy::finished()
+void QQmlTypeLoaderNetworkReplyProxy::finished()
{
Q_ASSERT(sender());
Q_ASSERT(qobject_cast<QNetworkReply *>(sender()));
@@ -175,7 +175,7 @@ void QQmlDataLoaderNetworkReplyProxy::finished()
l->networkReplyFinished(reply);
}
-void QQmlDataLoaderNetworkReplyProxy::downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
+void QQmlTypeLoaderNetworkReplyProxy::downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
{
Q_ASSERT(sender());
Q_ASSERT(qobject_cast<QNetworkReply *>(sender()));
@@ -184,7 +184,7 @@ void QQmlDataLoaderNetworkReplyProxy::downloadProgress(qint64 bytesReceived, qin
}
// This function is for when you want to shortcut the signals and call directly
-void QQmlDataLoaderNetworkReplyProxy::manualFinished(QNetworkReply *reply)
+void QQmlTypeLoaderNetworkReplyProxy::manualFinished(QNetworkReply *reply)
{
qint64 replySize = reply->size();
l->networkReplyProgress(reply, replySize, replySize);
@@ -194,12 +194,12 @@ void QQmlDataLoaderNetworkReplyProxy::manualFinished(QNetworkReply *reply)
/*!
\class QQmlDataBlob
-\brief The QQmlDataBlob encapsulates a data request that can be issued to a QQmlDataLoader.
+\brief The QQmlDataBlob encapsulates a data request that can be issued to a QQmlTypeLoader.
\internal
-QQmlDataBlob's are loaded by a QQmlDataLoader. The user creates the QQmlDataBlob
-and then calls QQmlDataLoader::load() or QQmlDataLoader::loadWithStaticData() to load it.
-The QQmlDataLoader invokes callbacks on the QQmlDataBlob as data becomes available.
+QQmlDataBlob's are loaded by a QQmlTypeLoader. The user creates the QQmlDataBlob
+and then calls QQmlTypeLoader::load() or QQmlTypeLoader::loadWithStaticData() to load it.
+The QQmlTypeLoader invokes callbacks on the QQmlDataBlob as data becomes available.
*/
/*!
@@ -208,7 +208,7 @@ The QQmlDataLoader invokes callbacks on the QQmlDataBlob as data becomes availab
This enum describes the status of the data blob.
\list
-\li Null The blob has not yet been loaded by a QQmlDataLoader
+\li Null The blob has not yet been loaded by a QQmlTypeLoader
\li Loading The blob is loading network data. The QQmlDataBlob::setData() callback has not yet been
invoked or has not yet returned.
\li WaitingForDependencies The blob is waiting for dependencies to be done before continueing. This status
@@ -234,10 +234,14 @@ This enum describes the type of the data blob.
/*!
Create a new QQmlDataBlob for \a url and of the provided \a type.
*/
-QQmlDataBlob::QQmlDataBlob(const QUrl &url, Type type)
-: m_type(type), m_url(url), m_finalUrl(url), m_manager(0), m_redirectCount(0),
+QQmlDataBlob::QQmlDataBlob(const QUrl &url, Type type, QQmlTypeLoader *manager)
+: m_typeLoader(manager), m_type(type), m_url(url), m_finalUrl(url), m_redirectCount(0),
m_inCallback(false), m_isDone(false)
{
+ //Set here because we need to get the engine from the manager
+ if (m_typeLoader->engine() && m_typeLoader->engine()->urlInterceptor())
+ m_url = m_typeLoader->engine()->urlInterceptor()->intercept(m_url,
+ (QQmlAbstractUrlInterceptor::DataType)m_type);
}
/*! \internal */
@@ -249,20 +253,12 @@ QQmlDataBlob::~QQmlDataBlob()
}
/*!
- Sets the manager, and does stuff like selection which needs access to the manager.
Must be called before loading can occur.
*/
-void QQmlDataBlob::startLoading(QQmlDataLoader *manager)
+void QQmlDataBlob::startLoading()
{
Q_ASSERT(status() == QQmlDataBlob::Null);
- Q_ASSERT(m_manager == 0);
m_data.setStatus(QQmlDataBlob::Loading);
- m_manager = manager;
-
- //Set here because we need to get the engine from the manager
- if (manager && manager->engine() && manager->engine()->urlInterceptor())
- m_url = manager->engine()->urlInterceptor()->intercept(m_url,
- (QQmlAbstractUrlInterceptor::DataType)m_type);
}
/*!
@@ -360,7 +356,7 @@ May only be called from the load thread, or after the blob isCompleteOrError().
*/
QUrl QQmlDataBlob::finalUrl() const
{
- Q_ASSERT(isCompleteOrError() || (m_manager && m_manager->m_thread->isThisThread()));
+ Q_ASSERT(isCompleteOrError() || (m_typeLoader && m_typeLoader->m_thread->isThisThread()));
return m_finalUrl;
}
@@ -369,7 +365,7 @@ Returns the finalUrl() as a string.
*/
QString QQmlDataBlob::finalUrlString() const
{
- Q_ASSERT(isCompleteOrError() || (m_manager && m_manager->m_thread->isThisThread()));
+ Q_ASSERT(isCompleteOrError() || (m_typeLoader && m_typeLoader->m_thread->isThisThread()));
if (m_finalUrlString.isEmpty())
m_finalUrlString = m_finalUrl.toString();
@@ -383,7 +379,7 @@ May only be called from the load thread, or after the blob isCompleteOrError().
*/
QList<QQmlError> QQmlDataBlob::errors() const
{
- Q_ASSERT(isCompleteOrError() || (m_manager && m_manager->m_thread->isThisThread()));
+ Q_ASSERT(isCompleteOrError() || (m_typeLoader && m_typeLoader->m_thread->isThisThread()));
return m_errors;
}
@@ -617,7 +613,7 @@ void QQmlDataBlob::tryDone()
#ifdef DATABLOB_DEBUG
qWarning("QQmlDataBlob: Dispatching completed");
#endif
- m_manager->m_thread->callCompleted(this);
+ m_typeLoader->m_thread->callCompleted(this);
release();
}
@@ -725,86 +721,86 @@ void QQmlDataBlob::ThreadData::setProgress(quint8 v)
}
}
-QQmlDataLoaderThread::QQmlDataLoaderThread(QQmlDataLoader *loader)
+QQmlTypeLoaderThread::QQmlTypeLoaderThread(QQmlTypeLoader *loader)
: m_loader(loader), m_networkAccessManager(0), m_networkReplyProxy(0)
{
// Do that after initializing all the members.
startup();
}
-QNetworkAccessManager *QQmlDataLoaderThread::networkAccessManager() const
+QNetworkAccessManager *QQmlTypeLoaderThread::networkAccessManager() const
{
Q_ASSERT(isThisThread());
if (!m_networkAccessManager) {
m_networkAccessManager = QQmlEnginePrivate::get(m_loader->engine())->createNetworkAccessManager(0);
- m_networkReplyProxy = new QQmlDataLoaderNetworkReplyProxy(m_loader);
+ m_networkReplyProxy = new QQmlTypeLoaderNetworkReplyProxy(m_loader);
}
return m_networkAccessManager;
}
-QQmlDataLoaderNetworkReplyProxy *QQmlDataLoaderThread::networkReplyProxy() const
+QQmlTypeLoaderNetworkReplyProxy *QQmlTypeLoaderThread::networkReplyProxy() const
{
Q_ASSERT(isThisThread());
Q_ASSERT(m_networkReplyProxy); // Must call networkAccessManager() first
return m_networkReplyProxy;
}
-void QQmlDataLoaderThread::load(QQmlDataBlob *b)
+void QQmlTypeLoaderThread::load(QQmlDataBlob *b)
{
b->addref();
callMethodInThread(&This::loadThread, b);
}
-void QQmlDataLoaderThread::loadAsync(QQmlDataBlob *b)
+void QQmlTypeLoaderThread::loadAsync(QQmlDataBlob *b)
{
b->addref();
postMethodToThread(&This::loadThread, b);
}
-void QQmlDataLoaderThread::loadWithStaticData(QQmlDataBlob *b, const QByteArray &d)
+void QQmlTypeLoaderThread::loadWithStaticData(QQmlDataBlob *b, const QByteArray &d)
{
b->addref();
callMethodInThread(&This::loadWithStaticDataThread, b, d);
}
-void QQmlDataLoaderThread::loadWithStaticDataAsync(QQmlDataBlob *b, const QByteArray &d)
+void QQmlTypeLoaderThread::loadWithStaticDataAsync(QQmlDataBlob *b, const QByteArray &d)
{
b->addref();
postMethodToThread(&This::loadWithStaticDataThread, b, d);
}
-void QQmlDataLoaderThread::loadWithCachedUnit(QQmlDataBlob *b, const QQmlPrivate::CachedQmlUnit *unit)
+void QQmlTypeLoaderThread::loadWithCachedUnit(QQmlDataBlob *b, const QQmlPrivate::CachedQmlUnit *unit)
{
b->addref();
callMethodInThread(&This::loadWithCachedUnitThread, b, unit);
}
-void QQmlDataLoaderThread::loadWithCachedUnitAsync(QQmlDataBlob *b, const QQmlPrivate::CachedQmlUnit *unit)
+void QQmlTypeLoaderThread::loadWithCachedUnitAsync(QQmlDataBlob *b, const QQmlPrivate::CachedQmlUnit *unit)
{
b->addref();
postMethodToThread(&This::loadWithCachedUnitThread, b, unit);
}
-void QQmlDataLoaderThread::callCompleted(QQmlDataBlob *b)
+void QQmlTypeLoaderThread::callCompleted(QQmlDataBlob *b)
{
b->addref();
postMethodToMain(&This::callCompletedMain, b);
}
-void QQmlDataLoaderThread::callDownloadProgressChanged(QQmlDataBlob *b, qreal p)
+void QQmlTypeLoaderThread::callDownloadProgressChanged(QQmlDataBlob *b, qreal p)
{
b->addref();
postMethodToMain(&This::callDownloadProgressChangedMain, b, p);
}
-void QQmlDataLoaderThread::initializeEngine(QQmlExtensionInterface *iface,
+void QQmlTypeLoaderThread::initializeEngine(QQmlExtensionInterface *iface,
const char *uri)
{
callMethodInMain(&This::initializeEngineMain, iface, uri);
}
-void QQmlDataLoaderThread::shutdownThread()
+void QQmlTypeLoaderThread::shutdownThread()
{
delete m_networkAccessManager;
m_networkAccessManager = 0;
@@ -812,45 +808,45 @@ void QQmlDataLoaderThread::shutdownThread()
m_networkReplyProxy = 0;
}
-void QQmlDataLoaderThread::loadThread(QQmlDataBlob *b)
+void QQmlTypeLoaderThread::loadThread(QQmlDataBlob *b)
{
m_loader->loadThread(b);
b->release();
}
-void QQmlDataLoaderThread::loadWithStaticDataThread(QQmlDataBlob *b, const QByteArray &d)
+void QQmlTypeLoaderThread::loadWithStaticDataThread(QQmlDataBlob *b, const QByteArray &d)
{
m_loader->loadWithStaticDataThread(b, d);
b->release();
}
-void QQmlDataLoaderThread::loadWithCachedUnitThread(QQmlDataBlob *b, const QQmlPrivate::CachedQmlUnit *unit)
+void QQmlTypeLoaderThread::loadWithCachedUnitThread(QQmlDataBlob *b, const QQmlPrivate::CachedQmlUnit *unit)
{
m_loader->loadWithCachedUnitThread(b, unit);
b->release();
}
-void QQmlDataLoaderThread::callCompletedMain(QQmlDataBlob *b)
+void QQmlTypeLoaderThread::callCompletedMain(QQmlDataBlob *b)
{
QML_MEMORY_SCOPE_URL(b->url());
#ifdef DATABLOB_DEBUG
- qWarning("QQmlDataLoaderThread: %s completed() callback", qPrintable(b->url().toString()));
+ qWarning("QQmlTypeLoaderThread: %s completed() callback", qPrintable(b->url().toString()));
#endif
b->completed();
b->release();
}
-void QQmlDataLoaderThread::callDownloadProgressChangedMain(QQmlDataBlob *b, qreal p)
+void QQmlTypeLoaderThread::callDownloadProgressChangedMain(QQmlDataBlob *b, qreal p)
{
#ifdef DATABLOB_DEBUG
- qWarning("QQmlDataLoaderThread: %s downloadProgressChanged(%f) callback",
+ qWarning("QQmlTypeLoaderThread: %s downloadProgressChanged(%f) callback",
qPrintable(b->url().toString()), p);
#endif
b->downloadProgressChanged(p);
b->release();
}
-void QQmlDataLoaderThread::initializeEngineMain(QQmlExtensionInterface *iface,
+void QQmlTypeLoaderThread::initializeEngineMain(QQmlExtensionInterface *iface,
const char *uri)
{
Q_ASSERT(m_loader->engine()->thread() == QThread::currentThread());
@@ -858,14 +854,14 @@ void QQmlDataLoaderThread::initializeEngineMain(QQmlExtensionInterface *iface,
}
/*!
-\class QQmlDataLoader
-\brief The QQmlDataLoader class abstracts loading files and their dependencies over the network.
+\class QQmlTypeLoader
+\brief The QQmlTypeLoader class abstracts loading files and their dependencies over the network.
\internal
-The QQmlDataLoader class is provided for the exclusive use of the QQmlTypeLoader class.
+The QQmlTypeLoader class is provided for the exclusive use of the QQmlTypeLoader class.
-Clients create QQmlDataBlob instances and submit them to the QQmlDataLoader class
-through the QQmlDataLoader::load() or QQmlDataLoader::loadWithStaticData() methods.
+Clients create QQmlDataBlob instances and submit them to the QQmlTypeLoader class
+through the QQmlTypeLoader::load() or QQmlTypeLoader::loadWithStaticData() methods.
The loader then fetches the data over the network or from the local file system in an efficient way.
QQmlDataBlob is an abstract class, so should always be specialized.
@@ -887,21 +883,7 @@ one of these three preconditions are met.
Thus QQmlDataBlob::done() will always eventually be called, even if the blob has an error set.
*/
-/*!
-Create a new QQmlDataLoader for \a engine.
-*/
-QQmlDataLoader::QQmlDataLoader(QQmlEngine *engine)
-: m_engine(engine), m_thread(new QQmlDataLoaderThread(this))
-{
-}
-
-/*! \internal */
-QQmlDataLoader::~QQmlDataLoader()
-{
- invalidate();
-}
-
-void QQmlDataLoader::invalidate()
+void QQmlTypeLoader::invalidate()
{
if (m_thread) {
shutdownThread();
@@ -917,12 +899,12 @@ void QQmlDataLoader::invalidate()
m_networkReplies.clear();
}
-void QQmlDataLoader::lock()
+void QQmlTypeLoader::lock()
{
m_thread->lock();
}
-void QQmlDataLoader::unlock()
+void QQmlTypeLoader::unlock()
{
m_thread->unlock();
}
@@ -932,13 +914,13 @@ Load the provided \a blob from the network or filesystem.
The loader must be locked.
*/
-void QQmlDataLoader::load(QQmlDataBlob *blob, Mode mode)
+void QQmlTypeLoader::load(QQmlDataBlob *blob, Mode mode)
{
#ifdef DATABLOB_DEBUG
- qWarning("QQmlDataLoader::load(%s): %s thread", qPrintable(blob->m_url.toString()),
+ qWarning("QQmlTypeLoader::load(%s): %s thread", qPrintable(blob->m_url.toString()),
m_thread->isThisThread()?"Compile":"Engine");
#endif
- blob->startLoading(this);
+ blob->startLoading();
if (m_thread->isThisThread()) {
unlock();
@@ -964,14 +946,14 @@ Load the provided \a blob with \a data. The blob's URL is not used by the data
The loader must be locked.
*/
-void QQmlDataLoader::loadWithStaticData(QQmlDataBlob *blob, const QByteArray &data, Mode mode)
+void QQmlTypeLoader::loadWithStaticData(QQmlDataBlob *blob, const QByteArray &data, Mode mode)
{
#ifdef DATABLOB_DEBUG
- qWarning("QQmlDataLoader::loadWithStaticData(%s, data): %s thread", qPrintable(blob->m_url.toString()),
+ qWarning("QQmlTypeLoader::loadWithStaticData(%s, data): %s thread", qPrintable(blob->m_url.toString()),
m_thread->isThisThread()?"Compile":"Engine");
#endif
- blob->startLoading(this);
+ blob->startLoading();
if (m_thread->isThisThread()) {
unlock();
@@ -992,14 +974,14 @@ void QQmlDataLoader::loadWithStaticData(QQmlDataBlob *blob, const QByteArray &da
}
}
-void QQmlDataLoader::loadWithCachedUnit(QQmlDataBlob *blob, const QQmlPrivate::CachedQmlUnit *unit, Mode mode)
+void QQmlTypeLoader::loadWithCachedUnit(QQmlDataBlob *blob, const QQmlPrivate::CachedQmlUnit *unit, Mode mode)
{
#ifdef DATABLOB_DEBUG
- qWarning("QQmlDataLoader::loadWithUnitFcatory(%s, data): %s thread", qPrintable(blob->m_url.toString()),
+ qWarning("QQmlTypeLoader::loadWithUnitFcatory(%s, data): %s thread", qPrintable(blob->m_url.toString()),
m_thread->isThisThread()?"Compile":"Engine");
#endif
- blob->startLoading(this);
+ blob->startLoading();
if (m_thread->isThisThread()) {
unlock();
@@ -1020,21 +1002,21 @@ void QQmlDataLoader::loadWithCachedUnit(QQmlDataBlob *blob, const QQmlPrivate::C
}
}
-void QQmlDataLoader::loadWithStaticDataThread(QQmlDataBlob *blob, const QByteArray &data)
+void QQmlTypeLoader::loadWithStaticDataThread(QQmlDataBlob *blob, const QByteArray &data)
{
ASSERT_LOADTHREAD();
setData(blob, data);
}
-void QQmlDataLoader::loadWithCachedUnitThread(QQmlDataBlob *blob, const QQmlPrivate::CachedQmlUnit *unit)
+void QQmlTypeLoader::loadWithCachedUnitThread(QQmlDataBlob *blob, const QQmlPrivate::CachedQmlUnit *unit)
{
ASSERT_LOADTHREAD();
setCachedUnit(blob, unit);
}
-void QQmlDataLoader::loadThread(QQmlDataBlob *blob)
+void QQmlTypeLoader::loadThread(QQmlDataBlob *blob)
{
ASSERT_LOADTHREAD();
@@ -1089,7 +1071,7 @@ void QQmlDataLoader::loadThread(QQmlDataBlob *blob)
} else {
QNetworkReply *reply = m_thread->networkAccessManager()->get(QNetworkRequest(blob->m_url));
- QQmlDataLoaderNetworkReplyProxy *nrp = m_thread->networkReplyProxy();
+ QQmlTypeLoaderNetworkReplyProxy *nrp = m_thread->networkReplyProxy();
blob->addref();
m_networkReplies.insert(reply, blob);
@@ -1111,7 +1093,7 @@ void QQmlDataLoader::loadThread(QQmlDataBlob *blob)
#define DATALOADER_MAXIMUM_REDIRECT_RECURSION 16
-void QQmlDataLoader::networkReplyFinished(QNetworkReply *reply)
+void QQmlTypeLoader::networkReplyFinished(QNetworkReply *reply)
{
Q_ASSERT(m_thread->isThisThread());
@@ -1150,7 +1132,7 @@ void QQmlDataLoader::networkReplyFinished(QNetworkReply *reply)
blob->release();
}
-void QQmlDataLoader::networkReplyProgress(QNetworkReply *reply,
+void QQmlTypeLoader::networkReplyProgress(QNetworkReply *reply,
qint64 bytesReceived, qint64 bytesTotal)
{
Q_ASSERT(m_thread->isThisThread());
@@ -1170,7 +1152,7 @@ void QQmlDataLoader::networkReplyProgress(QNetworkReply *reply,
/*!
Return the QQmlEngine associated with this loader
*/
-QQmlEngine *QQmlDataLoader::engine() const
+QQmlEngine *QQmlTypeLoader::engine() const
{
return m_engine;
}
@@ -1179,7 +1161,7 @@ QQmlEngine *QQmlDataLoader::engine() const
Call the initializeEngine() method on \a iface. Used by QQmlImportDatabase to ensure it
gets called in the correct thread.
*/
-void QQmlDataLoader::initializeEngine(QQmlExtensionInterface *iface,
+void QQmlTypeLoader::initializeEngine(QQmlExtensionInterface *iface,
const char *uri)
{
Q_ASSERT(m_thread->isThisThread() || engine()->thread() == QThread::currentThread());
@@ -1193,7 +1175,7 @@ void QQmlDataLoader::initializeEngine(QQmlExtensionInterface *iface,
}
-void QQmlDataLoader::setData(QQmlDataBlob *blob, const QByteArray &data)
+void QQmlTypeLoader::setData(QQmlDataBlob *blob, const QByteArray &data)
{
QML_MEMORY_SCOPE_URL(blob->url());
QQmlDataBlob::Data d;
@@ -1201,7 +1183,7 @@ void QQmlDataLoader::setData(QQmlDataBlob *blob, const QByteArray &data)
setData(blob, d);
}
-void QQmlDataLoader::setData(QQmlDataBlob *blob, QQmlFile *file)
+void QQmlTypeLoader::setData(QQmlDataBlob *blob, QQmlFile *file)
{
QML_MEMORY_SCOPE_URL(blob->url());
QQmlDataBlob::Data d;
@@ -1209,7 +1191,7 @@ void QQmlDataLoader::setData(QQmlDataBlob *blob, QQmlFile *file)
setData(blob, d);
}
-void QQmlDataLoader::setData(QQmlDataBlob *blob, const QQmlDataBlob::Data &d)
+void QQmlTypeLoader::setData(QQmlDataBlob *blob, const QQmlDataBlob::Data &d)
{
QML_MEMORY_SCOPE_URL(blob->url());
blob->m_inCallback = true;
@@ -1227,7 +1209,7 @@ void QQmlDataLoader::setData(QQmlDataBlob *blob, const QQmlDataBlob::Data &d)
blob->tryDone();
}
-void QQmlDataLoader::setCachedUnit(QQmlDataBlob *blob, const QQmlPrivate::CachedQmlUnit *unit)
+void QQmlTypeLoader::setCachedUnit(QQmlDataBlob *blob, const QQmlPrivate::CachedQmlUnit *unit)
{
QML_MEMORY_SCOPE_URL(blob->url());
blob->m_inCallback = true;
@@ -1245,14 +1227,14 @@ void QQmlDataLoader::setCachedUnit(QQmlDataBlob *blob, const QQmlPrivate::Cached
blob->tryDone();
}
-void QQmlDataLoader::shutdownThread()
+void QQmlTypeLoader::shutdownThread()
{
if (m_thread && !m_thread->isShutdown())
m_thread->shutdown();
}
QQmlTypeLoader::Blob::Blob(const QUrl &url, QQmlDataBlob::Type type, QQmlTypeLoader *loader)
- : QQmlDataBlob(url, type), m_typeLoader(loader), m_importCache(loader), m_isSingleton(false)
+ : QQmlDataBlob(url, type, loader), m_importCache(loader), m_isSingleton(false)
{
}
@@ -1305,7 +1287,7 @@ bool QQmlTypeLoader::Blob::updateQmldir(QQmlQmldirData *data, const QV4::Compile
if (!importQualifier.isEmpty()) {
// Does this library contain any qualified scripts?
QUrl libraryUrl(qmldirUrl);
- const QmldirContent *qmldir = typeLoader()->qmldirContent(qmldirIdentifier, qmldirUrl);
+ const QmldirContent *qmldir = typeLoader()->qmldirContent(qmldirIdentifier);
foreach (const QQmlDirParser::Script &script, qmldir->scripts()) {
QUrl scriptUrl = libraryUrl.resolved(QUrl(script.fileName));
QQmlScriptBlob *blob = typeLoader()->getScript(scriptUrl);
@@ -1352,7 +1334,7 @@ bool QQmlTypeLoader::Blob::addImport(const QV4::CompiledData::Import *import, QL
if (!importQualifier.isEmpty()) {
// Does this library contain any qualified scripts?
QUrl libraryUrl(qmldirUrl);
- const QmldirContent *qmldir = typeLoader()->qmldirContent(qmldirFilePath, qmldirUrl);
+ const QmldirContent *qmldir = typeLoader()->qmldirContent(qmldirFilePath);
foreach (const QQmlDirParser::Script &script, qmldir->scripts()) {
QUrl scriptUrl = libraryUrl.resolved(QUrl(script.fileName));
QQmlScriptBlob *blob = typeLoader()->getScript(scriptUrl);
@@ -1585,7 +1567,7 @@ bool QQmlTypeLoader::QmldirContent::designerSupported() const
Constructs a new type loader that uses the given \a engine.
*/
QQmlTypeLoader::QQmlTypeLoader(QQmlEngine *engine)
-: QQmlDataLoader(engine)
+ : m_engine(engine), m_thread(new QQmlTypeLoaderThread(this))
{
}
@@ -1599,6 +1581,8 @@ QQmlTypeLoader::~QQmlTypeLoader()
shutdownThread();
clearCache();
+
+ invalidate();
}
QQmlImportDatabase *QQmlTypeLoader::importDatabase()
@@ -1623,10 +1607,10 @@ QQmlTypeData *QQmlTypeLoader::getType(const QUrl &url, Mode mode)
typeData = new QQmlTypeData(url, this);
// TODO: if (compiledData == 0), is it safe to omit this insertion?
m_typeCache.insert(url, typeData);
- if (const QQmlPrivate::CachedQmlUnit *cachedUnit = QQmlMetaType::findCachedCompilationUnit(url)) {
- QQmlDataLoader::loadWithCachedUnit(typeData, cachedUnit, mode);
+ if (const QQmlPrivate::CachedQmlUnit *cachedUnit = QQmlMetaType::findCachedCompilationUnit(typeData->url())) {
+ QQmlTypeLoader::loadWithCachedUnit(typeData, cachedUnit, mode);
} else {
- QQmlDataLoader::load(typeData, mode);
+ QQmlTypeLoader::load(typeData, mode);
}
}
@@ -1644,7 +1628,7 @@ QQmlTypeData *QQmlTypeLoader::getType(const QByteArray &data, const QUrl &url)
LockHolder<QQmlTypeLoader> holder(this);
QQmlTypeData *typeData = new QQmlTypeData(url, this);
- QQmlDataLoader::loadWithStaticData(typeData, data);
+ QQmlTypeLoader::loadWithStaticData(typeData, data);
return typeData;
}
@@ -1666,10 +1650,10 @@ QQmlScriptBlob *QQmlTypeLoader::getScript(const QUrl &url)
scriptBlob = new QQmlScriptBlob(url, this);
m_scriptCache.insert(url, scriptBlob);
- if (const QQmlPrivate::CachedQmlUnit *cachedUnit = QQmlMetaType::findCachedCompilationUnit(url)) {
- QQmlDataLoader::loadWithCachedUnit(scriptBlob, cachedUnit);
+ if (const QQmlPrivate::CachedQmlUnit *cachedUnit = QQmlMetaType::findCachedCompilationUnit(scriptBlob->url())) {
+ QQmlTypeLoader::loadWithCachedUnit(scriptBlob, cachedUnit);
} else {
- QQmlDataLoader::load(scriptBlob);
+ QQmlTypeLoader::load(scriptBlob);
}
}
@@ -1694,7 +1678,7 @@ QQmlQmldirData *QQmlTypeLoader::getQmldir(const QUrl &url)
if (!qmldirData) {
qmldirData = new QQmlQmldirData(url, this);
m_qmldirCache.insert(url, qmldirData);
- QQmlDataLoader::load(qmldirData);
+ QQmlTypeLoader::load(qmldirData);
}
qmldirData->addref();
@@ -1702,82 +1686,15 @@ QQmlQmldirData *QQmlTypeLoader::getQmldir(const QUrl &url)
return qmldirData;
}
+// #### Qt 6: Remove this function, it exists only for binary compatibility.
/*!
-Returns a QQmlBundleData for \a identifier.
-*/
-QQmlBundleData *QQmlTypeLoader::getBundle(const QString &identifier)
-{
- return getBundle(QHashedStringRef(identifier));
-}
-
-QQmlBundleData *QQmlTypeLoader::getBundle(const QHashedStringRef &identifier)
-{
- lock();
-
- QQmlBundleData *rv = 0;
- QQmlBundleData **bundle = m_bundleCache.value(identifier);
- if (bundle) {
- rv = *bundle;
- rv->addref();
- }
-
- unlock();
-
- return rv;
-}
-
-QQmlBundleData::QQmlBundleData(const QString &file)
-: QQmlBundle(file), fileName(file)
-{
-}
-
-// XXX check for errors etc.
-void QQmlTypeLoader::addBundle(const QString &identifier, const QString &fileName)
-{
- lock();
- addBundleNoLock(identifier, fileName);
- unlock();
-}
-
-void QQmlTypeLoader::addBundleNoLock(const QString &identifier, const QString &fileName)
-{
- QQmlBundleData *data = new QQmlBundleData(fileName);
- if (data->open()) {
-
- m_bundleCache.insert(identifier, data);
-
- } else {
- data->release();
- }
-}
-
-QString QQmlTypeLoader::bundleIdForQmldir(const QString &name, const QString &uriHint)
-{
- lock();
- QString *bundleId = m_qmldirBundleIdCache.value(name);
- if (!bundleId) {
- QString newBundleId = QLatin1String("qml.") + uriHint.toLower() /* XXX toLower()? */;
- if (m_qmldirBundleIdCache.contains(newBundleId))
- newBundleId += QString::number(m_qmldirBundleIdCache.count());
- m_qmldirBundleIdCache.insert(name, newBundleId);
- addBundleNoLock(newBundleId, name);
- unlock();
- return newBundleId;
- } else {
- unlock();
- return *bundleId;
- }
-}
-
+ * \internal
+ */
bool QQmlEngine::addNamedBundle(const QString &name, const QString &fileName)
{
- Q_D(QQmlEngine);
-
- if (name.startsWith(QLatin1String("qml."))) // reserved
- return false;
-
- d->typeLoader.addBundle(name, fileName);
- return true;
+ Q_UNUSED(name)
+ Q_UNUSED(fileName)
+ return false;
}
/*!
@@ -1896,20 +1813,20 @@ bool QQmlTypeLoader::directoryExists(const QString &path)
/*!
Return a QmldirContent for absoluteFilePath. The QmldirContent may be cached.
-\a filePath is either a bundle URL, or a local file path.
+\a filePath is a local file path.
It can also be a remote path for a remote directory import, but it will have been cached by now in this case.
*/
-const QQmlTypeLoader::QmldirContent *QQmlTypeLoader::qmldirContent(const QString &filePathIn, const QString &uriHint)
+const QQmlTypeLoader::QmldirContent *QQmlTypeLoader::qmldirContent(const QString &filePathIn)
{
- QUrl url(filePathIn); //May already contain bundle or http scheme
+ QUrl url(filePathIn); //May already contain http scheme
if (url.scheme() == QLatin1String("http") || url.scheme() == QLatin1String("https"))
return *(m_importQmlDirCache.value(filePathIn)); //Can't load the remote here, but should be cached
- else if (!QQmlFile::isBundle(filePathIn))
+ else
url = QUrl::fromLocalFile(filePathIn);
if (engine() && engine()->urlInterceptor())
url = engine()->urlInterceptor()->intercept(url, QQmlAbstractUrlInterceptor::QmldirFile);
- Q_ASSERT(url.scheme() == QLatin1String("file") || url.scheme() == QLatin1String("bundle"));
+ Q_ASSERT(url.scheme() == QLatin1String("file"));
QString filePath;
if (url.scheme() == QLatin1String("file"))
filePath = url.toLocalFile();
@@ -1925,45 +1842,14 @@ const QQmlTypeLoader::QmldirContent *QQmlTypeLoader::qmldirContent(const QString
#define NOT_READABLE_ERROR QString(QLatin1String("module \"$$URI$$\" definition \"%1\" not readable"))
#define CASE_MISMATCH_ERROR QString(QLatin1String("cannot load module \"$$URI$$\": File name case mismatch for \"%1\""))
- if (QQmlFile::isBundle(url.toString())) {
- QQmlFile file(engine(), url);
- if (file.isError()) {
- ERROR(NOT_READABLE_ERROR.arg(url.toString()));
- } else {
- QString content(QString::fromUtf8(file.data(), file.size()));
- qmldir->setContent(filePath, content);
- }
-
+ QFile file(filePath);
+ if (!QQml_isFileCaseCorrect(filePath)) {
+ ERROR(CASE_MISMATCH_ERROR.arg(filePath));
+ } else if (file.open(QFile::ReadOnly)) {
+ QByteArray data = file.readAll();
+ qmldir->setContent(filePath, QString::fromUtf8(data));
} else {
-
- QFile file(filePath);
- if (!QQml_isFileCaseCorrect(filePath)) {
- ERROR(CASE_MISMATCH_ERROR.arg(filePath));
- } else if (file.open(QFile::ReadOnly)) {
- QByteArray data = file.read(QQmlBundle::bundleHeaderLength());
-
- if (QQmlBundle::isBundleHeader(data.constData(), data.length())) {
- QString id = bundleIdForQmldir(filePath, uriHint);
-
- QString bundleUrl = QLatin1String("bundle://") + id + QLatin1Char('/');
-
- QUrl url(bundleUrl + QLatin1String("qmldir"));
-
- QQmlFile file(engine(), url);
- if (file.isError()) {
- ERROR(NOT_READABLE_ERROR.arg(filePath));
- } else {
- QString content(QString::fromUtf8(file.data(), file.size()));
- qmldir->setContent(QQmlFile::bundleFileName(bundleUrl, engine()), content);
- }
- } else {
- data += file.readAll();
- qmldir->setContent(filePath, QString::fromUtf8(data));
- }
- } else {
- ERROR(NOT_READABLE_ERROR.arg(filePath));
- }
-
+ ERROR(NOT_READABLE_ERROR.arg(filePath));
}
#undef ERROR
@@ -1998,11 +1884,11 @@ and qmldir information.
*/
void QQmlTypeLoader::clearCache()
{
- for (TypeCache::Iterator iter = m_typeCache.begin(); iter != m_typeCache.end(); ++iter)
+ for (TypeCache::Iterator iter = m_typeCache.begin(), end = m_typeCache.end(); iter != end; ++iter)
(*iter)->release();
- for (ScriptCache::Iterator iter = m_scriptCache.begin(); iter != m_scriptCache.end(); ++iter)
+ for (ScriptCache::Iterator iter = m_scriptCache.begin(), end = m_scriptCache.end(); iter != end; ++iter)
(*iter)->release();
- for (QmldirCache::Iterator iter = m_qmldirCache.begin(); iter != m_qmldirCache.end(); ++iter)
+ for (QmldirCache::Iterator iter = m_qmldirCache.begin(), end = m_qmldirCache.end(); iter != end; ++iter)
(*iter)->release();
qDeleteAll(m_importDirCache);
qDeleteAll(m_importQmlDirCache);
@@ -2018,7 +1904,7 @@ void QQmlTypeLoader::trimCache()
{
while (true) {
QList<TypeCache::Iterator> unneededTypes;
- for (TypeCache::Iterator iter = m_typeCache.begin(); iter != m_typeCache.end(); ++iter) {
+ for (TypeCache::Iterator iter = m_typeCache.begin(), end = m_typeCache.end(); iter != end; ++iter) {
QQmlTypeData *typeData = iter.value();
if (typeData->m_compiledData && typeData->m_compiledData->count() == 1) {
// There are no live objects of this type
@@ -2223,10 +2109,6 @@ bool QQmlTypeData::loadImplicitImport()
void QQmlTypeData::dataReceived(const Data &data)
{
QString code = QString::fromUtf8(data.data(), data.size());
- QByteArray preparseData;
-
- if (data.isFile()) preparseData = data.asFile()->metaData(QLatin1String("qml:preparse"));
-
QQmlEngine *qmlEngine = typeLoader()->engine();
m_document.reset(new QmlIR::Document(QV8Engine::getV4(qmlEngine)->debugger != 0));
QmlIR::IRBuilder compiler(QV8Engine::get(qmlEngine)->illegalNames());
@@ -2579,7 +2461,6 @@ QV4::PersistentValue QQmlScriptData::scriptValueForContext(QQmlContextData *pare
Q_ASSERT(parentCtxt && parentCtxt->engine);
QQmlEnginePrivate *ep = QQmlEnginePrivate::get(parentCtxt->engine);
- QV8Engine *v8engine = ep->v8engine();
QV4::ExecutionEngine *v4 = QV8Engine::getV4(parentCtxt->engine);
QV4::Scope scope(v4);
@@ -2597,8 +2478,8 @@ QV4::PersistentValue QQmlScriptData::scriptValueForContext(QQmlContextData *pare
ctxt->isPragmaLibraryContext = true;
else
ctxt->isPragmaLibraryContext = parentCtxt->isPragmaLibraryContext;
- ctxt->url = url;
- ctxt->urlString = urlString;
+ ctxt->baseUrl = url;
+ ctxt->baseUrlString = urlString;
// For backward compatibility, if there are no imports, we need to use the
// imports from the parent context. See QTBUG-17518.
@@ -2622,12 +2503,12 @@ QV4::PersistentValue QQmlScriptData::scriptValueForContext(QQmlContextData *pare
QV4::ScopedObject scriptsArray(scope);
if (ctxt->importedScripts.isNullOrUndefined()) {
scriptsArray = v4->newArrayObject(scripts.count());
- ctxt->importedScripts = scriptsArray;
+ ctxt->importedScripts.set(v4, scriptsArray);
} else {
- scriptsArray = ctxt->importedScripts;
+ scriptsArray = ctxt->importedScripts.valueRef();
}
for (int ii = 0; ii < scripts.count(); ++ii)
- scriptsArray->putIndexed(ii, scripts.at(ii)->scriptData()->scriptValueForContext(ctxt));
+ scriptsArray->putIndexed(ii, *scripts.at(ii)->scriptData()->scriptValueForContext(ctxt).valueRef());
if (!hasEngine())
initialize(parentCtxt->engine);
@@ -2638,19 +2519,18 @@ QV4::PersistentValue QQmlScriptData::scriptValueForContext(QQmlContextData *pare
return QV4::PersistentValue();
}
- QV4::ScopedValue qmlglobal(scope, QV4::QmlContextWrapper::qmlScope(v8engine, ctxt, 0));
+ QV4::ScopedValue qmlglobal(scope, QV4::QmlContextWrapper::qmlScope(v4, ctxt, 0));
QV4::QmlContextWrapper::takeContextOwnership(qmlglobal);
- QV4::ExecutionContext *ctx = QV8Engine::getV4(v8engine)->currentContext();
- m_program->qml = qmlglobal;
+ m_program->qml.set(scope.engine, qmlglobal);
m_program->run();
if (scope.engine->hasException) {
- QQmlError error = QV4::ExecutionEngine::catchExceptionAsQmlError(ctx);
+ QQmlError error = scope.engine->catchExceptionAsQmlError();
if (error.isValid())
ep->warning(error);
}
- rv = qmlglobal;
+ rv.set(scope.engine, qmlglobal);
if (shared) {
m_value = rv;
m_loaded = true;
@@ -2692,33 +2572,34 @@ QQmlScriptData *QQmlScriptBlob::scriptData() const
return m_scriptData;
}
+struct EmptyCompilationUnit : public QV4::CompiledData::CompilationUnit
+{
+ virtual void linkBackendToEngine(QV4::ExecutionEngine *) {}
+};
+
void QQmlScriptBlob::dataReceived(const Data &data)
{
QString source = QString::fromUtf8(data.data(), data.size());
QV4::ExecutionEngine *v4 = QV8Engine::getV4(m_typeLoader->engine());
QmlIR::Document irUnit(v4->debugger != 0);
- QQmlJS::DiagnosticMessage metaDataError;
- irUnit.extractScriptMetaData(source, &metaDataError);
- if (!metaDataError.message.isEmpty()) {
- QQmlError e;
- e.setUrl(finalUrl());
- e.setLine(metaDataError.loc.startLine);
- e.setColumn(metaDataError.loc.startColumn);
- e.setDescription(metaDataError.message);
- setError(e);
- return;
- }
+ QmlIR::ScriptDirectivesCollector collector(&irUnit.jsParserEngine, &irUnit.jsGenerator);
QList<QQmlError> errors;
- QQmlRefPointer<QV4::CompiledData::CompilationUnit> unit = QV4::Script::precompile(&irUnit.jsModule, &irUnit.jsGenerator, v4, finalUrl(), source, &errors);
+ QQmlRefPointer<QV4::CompiledData::CompilationUnit> unit = QV4::Script::precompile(&irUnit.jsModule, &irUnit.jsGenerator, v4, finalUrl(), source, &errors, &collector);
// No need to addref on unit, it's initial refcount is 1
source.clear();
if (!errors.isEmpty()) {
setError(errors);
return;
}
+ if (!unit) {
+ unit.take(new EmptyCompilationUnit);
+ }
irUnit.javaScriptCompilationUnit = unit;
+ irUnit.imports = collector.imports;
+ if (collector.hasPragmaLibrary)
+ irUnit.unitFlags |= QV4::CompiledData::Unit::IsSharedLibrary;
QmlIR::QmlUnitGenerator qmlGenerator;
QV4::CompiledData::Unit *unitData = qmlGenerator.generate(irUnit);
diff --git a/src/qml/qml/qqmltypeloader_p.h b/src/qml/qml/qqmltypeloader_p.h
index 3b5aa1ec7a..d9ea273698 100644
--- a/src/qml/qml/qqmltypeloader_p.h
+++ b/src/qml/qml/qqmltypeloader_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -57,7 +57,6 @@
#include <private/qqmlimport_p.h>
#include <private/qqmlcleanup_p.h>
#include <private/qqmldirparser_p.h>
-#include <private/qqmlbundle_p.h>
#include <private/qflagpointer_p.h>
#include <private/qqmlirbuilder_p.h>
@@ -73,7 +72,7 @@ class QQmlTypeLoader;
class QQmlCompiledData;
class QQmlComponentPrivate;
class QQmlTypeData;
-class QQmlDataLoader;
+class QQmlTypeLoader;
class QQmlExtensionInterface;
namespace QmlIR {
@@ -84,7 +83,7 @@ class Q_QML_PRIVATE_EXPORT QQmlDataBlob : public QQmlRefCount
{
public:
enum Status {
- Null, // Prior to QQmlDataLoader::load()
+ Null, // Prior to QQmlTypeLoader::load()
Loading, // Prior to data being received and dataReceived() being called
WaitingForDependencies, // While there are outstanding addDependency()s
Complete, // Finished
@@ -97,10 +96,12 @@ public:
QmldirFile = QQmlAbstractUrlInterceptor::QmldirFile
};
- QQmlDataBlob(const QUrl &, Type);
+ QQmlDataBlob(const QUrl &, Type, QQmlTypeLoader* manager);
virtual ~QQmlDataBlob();
- void startLoading(QQmlDataLoader* manager);
+ void startLoading();
+
+ QQmlTypeLoader *typeLoader() const { return m_typeLoader; }
Type type() const;
@@ -132,7 +133,7 @@ public:
private:
friend class QQmlDataBlob;
- friend class QQmlDataLoader;
+ friend class QQmlTypeLoader;
inline Data();
Data(const Data &);
Data &operator=(const Data &);
@@ -157,9 +158,14 @@ protected:
// Callbacks made in main thread
virtual void downloadProgressChanged(qreal);
virtual void completed();
+
+protected:
+ // Manager that is currently fetching data for me
+ QQmlTypeLoader *m_typeLoader;
+
private:
- friend class QQmlDataLoader;
- friend class QQmlDataLoaderThread;
+ friend class QQmlTypeLoader;
+ friend class QQmlTypeLoaderThread;
void tryDone();
void cancelAllWaitingFor();
@@ -198,80 +204,25 @@ private:
// List of QQmlDataBlob's that I am waiting for to complete.
QList<QQmlDataBlob *> m_waitingFor;
- // Manager that is currently fetching data for me
- QQmlDataLoader *m_manager;
int m_redirectCount:30;
bool m_inCallback:1;
bool m_isDone:1;
};
-class QQmlDataLoaderThread;
-class QQmlDataLoader
-{
-public:
- QQmlDataLoader(QQmlEngine *);
- ~QQmlDataLoader();
-
- void lock();
- void unlock();
-
- bool isConcurrent() const { return true; }
-
- enum Mode { PreferSynchronous, Asynchronous };
-
- void load(QQmlDataBlob *, Mode = PreferSynchronous);
- void loadWithStaticData(QQmlDataBlob *, const QByteArray &, Mode = PreferSynchronous);
- void loadWithCachedUnit(QQmlDataBlob *blob, const QQmlPrivate::CachedQmlUnit *unit, Mode mode = PreferSynchronous);
-
- QQmlEngine *engine() const;
- void initializeEngine(QQmlExtensionInterface *, const char *);
- void invalidate();
-
-protected:
- void shutdownThread();
-
-private:
- friend class QQmlDataBlob;
- friend class QQmlDataLoaderThread;
- friend class QQmlDataLoaderNetworkReplyProxy;
-
- void loadThread(QQmlDataBlob *);
- void loadWithStaticDataThread(QQmlDataBlob *, const QByteArray &);
- void loadWithCachedUnitThread(QQmlDataBlob *blob, const QQmlPrivate::CachedQmlUnit *unit);
- void networkReplyFinished(QNetworkReply *);
- void networkReplyProgress(QNetworkReply *, qint64, qint64);
-
- typedef QHash<QNetworkReply *, QQmlDataBlob *> NetworkReplies;
-
- void setData(QQmlDataBlob *, const QByteArray &);
- void setData(QQmlDataBlob *, QQmlFile *);
- void setData(QQmlDataBlob *, const QQmlDataBlob::Data &);
- void setCachedUnit(QQmlDataBlob *blob, const QQmlPrivate::CachedQmlUnit *unit);
-
- QQmlEngine *m_engine;
- QQmlDataLoaderThread *m_thread;
- NetworkReplies m_networkReplies;
-};
-
-class QQmlBundleData : public QQmlBundle,
- public QQmlRefCount
-{
-public:
- QQmlBundleData(const QString &);
- QString fileName;
-};
+class QQmlTypeLoaderThread;
-class Q_AUTOTEST_EXPORT QQmlTypeLoader : public QQmlDataLoader
+class Q_AUTOTEST_EXPORT QQmlTypeLoader
{
Q_DECLARE_TR_FUNCTIONS(QQmlTypeLoader)
public:
+ enum Mode { PreferSynchronous, Asynchronous };
+
class Q_QML_PRIVATE_EXPORT Blob : public QQmlDataBlob
{
public:
Blob(const QUrl &url, QQmlDataBlob::Type type, QQmlTypeLoader *loader);
~Blob();
- QQmlTypeLoader *typeLoader() const { return m_typeLoader; }
const QQmlImports &imports() const { return m_importCache; }
protected:
@@ -292,7 +243,6 @@ public:
protected:
virtual QString stringAt(int) const { return QString(); }
- QQmlTypeLoader *m_typeLoader;
QQmlImports m_importCache;
bool m_isSingleton;
QHash<const QV4::CompiledData::Import*, int> m_unresolvedImports;
@@ -338,14 +288,10 @@ public:
QQmlScriptBlob *getScript(const QUrl &);
QQmlQmldirData *getQmldir(const QUrl &);
- QQmlBundleData *getBundle(const QString &);
- QQmlBundleData *getBundle(const QHashedStringRef &);
- void addBundle(const QString &, const QString &);
-
QString absoluteFilePath(const QString &path);
bool directoryExists(const QString &path);
- const QmldirContent *qmldirContent(const QString &filePath, const QString &uriHint);
+ const QmldirContent *qmldirContent(const QString &filePath);
void setQmldirContent(const QString &filePath, const QString &content);
void clearCache();
@@ -354,9 +300,36 @@ public:
bool isTypeLoaded(const QUrl &url) const;
bool isScriptLoaded(const QUrl &url) const;
+ void lock();
+ void unlock();
+
+ void load(QQmlDataBlob *, Mode = PreferSynchronous);
+ void loadWithStaticData(QQmlDataBlob *, const QByteArray &, Mode = PreferSynchronous);
+ void loadWithCachedUnit(QQmlDataBlob *blob, const QQmlPrivate::CachedQmlUnit *unit, Mode mode = PreferSynchronous);
+
+ QQmlEngine *engine() const;
+ void initializeEngine(QQmlExtensionInterface *, const char *);
+ void invalidate();
+
private:
- void addBundleNoLock(const QString &, const QString &);
- QString bundleIdForQmldir(const QString &qmldir, const QString &uriHint);
+ friend class QQmlDataBlob;
+ friend class QQmlTypeLoaderThread;
+ friend class QQmlTypeLoaderNetworkReplyProxy;
+
+ void shutdownThread();
+
+ void loadThread(QQmlDataBlob *);
+ void loadWithStaticDataThread(QQmlDataBlob *, const QByteArray &);
+ void loadWithCachedUnitThread(QQmlDataBlob *blob, const QQmlPrivate::CachedQmlUnit *unit);
+ void networkReplyFinished(QNetworkReply *);
+ void networkReplyProgress(QNetworkReply *, qint64, qint64);
+
+ typedef QHash<QNetworkReply *, QQmlDataBlob *> NetworkReplies;
+
+ void setData(QQmlDataBlob *, const QByteArray &);
+ void setData(QQmlDataBlob *, QQmlFile *);
+ void setData(QQmlDataBlob *, const QQmlDataBlob::Data &);
+ void setCachedUnit(QQmlDataBlob *blob, const QQmlPrivate::CachedQmlUnit *unit);
template<typename T>
struct TypedCallback
@@ -380,16 +353,15 @@ private:
typedef QStringHash<bool> StringSet;
typedef QStringHash<StringSet*> ImportDirCache;
typedef QStringHash<QmldirContent *> ImportQmlDirCache;
- typedef QStringHash<QQmlBundleData *> BundleCache;
- typedef QStringHash<QString> QmldirBundleIdCache;
+ QQmlEngine *m_engine;
+ QQmlTypeLoaderThread *m_thread;
+ NetworkReplies m_networkReplies;
TypeCache m_typeCache;
ScriptCache m_scriptCache;
QmldirCache m_qmldirCache;
ImportDirCache m_importDirCache;
ImportQmlDirCache m_importQmlDirCache;
- BundleCache m_bundleCache;
- QmldirBundleIdCache m_qmldirBundleIdCache;
};
class Q_AUTOTEST_EXPORT QQmlTypeData : public QQmlTypeLoader::Blob
diff --git a/src/qml/qml/qqmltypenamecache.cpp b/src/qml/qml/qqmltypenamecache.cpp
index b7bd9fc616..d0658f2c3c 100644
--- a/src/qml/qml/qqmltypenamecache.cpp
+++ b/src/qml/qml/qqmltypenamecache.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmltypenamecache_p.h b/src/qml/qml/qqmltypenamecache_p.h
index cf9a43a0f3..9c62a55fa5 100644
--- a/src/qml/qml/qqmltypenamecache_p.h
+++ b/src/qml/qml/qqmltypenamecache_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmltypenotavailable.cpp b/src/qml/qml/qqmltypenotavailable.cpp
index 3c83cdeef7..5286778910 100644
--- a/src/qml/qml/qqmltypenotavailable.cpp
+++ b/src/qml/qml/qqmltypenotavailable.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmltypenotavailable_p.h b/src/qml/qml/qqmltypenotavailable_p.h
index d74ab34027..f69a4f8732 100644
--- a/src/qml/qml/qqmltypenotavailable_p.h
+++ b/src/qml/qml/qqmltypenotavailable_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmltypewrapper.cpp b/src/qml/qml/qqmltypewrapper.cpp
index d8f282c030..8a2118ef27 100644
--- a/src/qml/qml/qqmltypewrapper.cpp
+++ b/src/qml/qml/qqmltypewrapper.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -48,15 +48,16 @@ using namespace QV4;
DEFINE_OBJECT_VTABLE(QmlTypeWrapper);
-QmlTypeWrapper::Data::Data(QV8Engine *engine)
- : Object::Data(QV8Engine::getV4(engine))
- , v8(engine)
+Heap::QmlTypeWrapper::QmlTypeWrapper(ExecutionEngine *engine)
+ : Heap::Object(engine)
, mode(IncludeEnums)
+ , type(Q_NULLPTR)
+ , typeNamespace(Q_NULLPTR)
+ , importNamespace(Q_NULLPTR)
{
- setVTable(staticVTable());
}
-QmlTypeWrapper::Data::~Data()
+Heap::QmlTypeWrapper::~QmlTypeWrapper()
{
if (typeNamespace)
typeNamespace->release();
@@ -72,7 +73,7 @@ QObject* QmlTypeWrapper::singletonObject() const
if (!isSingleton())
return 0;
- QQmlEngine *e = d()->v8->engine();
+ QQmlEngine *e = engine()->qmlEngine();
QQmlType::SingletonInstanceInfo *siinfo = d()->type->singletonInstanceInfo();
siinfo->init(e);
return siinfo->qobjectApi(e);
@@ -81,7 +82,7 @@ QObject* QmlTypeWrapper::singletonObject() const
QVariant QmlTypeWrapper::toVariant() const
{
if (d()->type && d()->type->isSingleton()) {
- QQmlEngine *e = d()->v8->engine();
+ QQmlEngine *e = engine()->qmlEngine();
QQmlType::SingletonInstanceInfo *siinfo = d()->type->singletonInstanceInfo();
siinfo->init(e); // note: this will also create QJSValue singleton which isn't strictly required.
QObject *qobjectSingleton = siinfo->qobjectApi(e);
@@ -96,27 +97,27 @@ QVariant QmlTypeWrapper::toVariant() const
// Returns a type wrapper for type t on o. This allows access of enums, and attached properties.
-ReturnedValue QmlTypeWrapper::create(QV8Engine *v8, QObject *o, QQmlType *t, TypeNameMode mode)
+ReturnedValue QmlTypeWrapper::create(QV4::ExecutionEngine *engine, QObject *o, QQmlType *t,
+ Heap::QmlTypeWrapper::TypeNameMode mode)
{
Q_ASSERT(t);
- ExecutionEngine *v4 = QV8Engine::getV4(v8);
- Scope scope(v4);
+ Scope scope(engine);
- Scoped<QmlTypeWrapper> w(scope, v4->memoryManager->alloc<QmlTypeWrapper>(v8));
+ Scoped<QmlTypeWrapper> w(scope, engine->memoryManager->alloc<QmlTypeWrapper>(engine));
w->d()->mode = mode; w->d()->object = o; w->d()->type = t;
return w.asReturnedValue();
}
// Returns a type wrapper for importNamespace (of t) on o. This allows nested resolution of a type in a
// namespace.
-ReturnedValue QmlTypeWrapper::create(QV8Engine *v8, QObject *o, QQmlTypeNameCache *t, const void *importNamespace, TypeNameMode mode)
+ReturnedValue QmlTypeWrapper::create(QV4::ExecutionEngine *engine, QObject *o, QQmlTypeNameCache *t, const void *importNamespace,
+ Heap::QmlTypeWrapper::TypeNameMode mode)
{
Q_ASSERT(t);
Q_ASSERT(importNamespace);
- ExecutionEngine *v4 = QV8Engine::getV4(v8);
- Scope scope(v4);
+ Scope scope(engine);
- Scoped<QmlTypeWrapper> w(scope, v4->memoryManager->alloc<QmlTypeWrapper>(v8));
+ Scoped<QmlTypeWrapper> w(scope, engine->memoryManager->alloc<QmlTypeWrapper>(engine));
w->d()->mode = mode; w->d()->object = o; w->d()->typeNamespace = t; w->d()->importNamespace = importNamespace;
t->addref();
return w.asReturnedValue();
@@ -127,16 +128,15 @@ ReturnedValue QmlTypeWrapper::get(Managed *m, String *name, bool *hasProperty)
{
Q_ASSERT(m->as<QmlTypeWrapper>());
- QV4::ExecutionEngine *v4 = m->engine();
+ QV4::ExecutionEngine *v4 = static_cast<QmlTypeWrapper *>(m)->engine();
QV4::Scope scope(v4);
- Scoped<QmlTypeWrapper> w(scope, static_cast<QmlTypeWrapper *>(m));
+ Scoped<QmlTypeWrapper> w(scope, static_cast<QmlTypeWrapper *>(m));
if (hasProperty)
*hasProperty = true;
- QV8Engine *v8engine = w->d()->v8;
- QQmlContextData *context = v8engine->callingContext();
+ QQmlContextData *context = v4->v8Engine->callingContext();
QObject *object = w->d()->object;
@@ -145,7 +145,7 @@ ReturnedValue QmlTypeWrapper::get(Managed *m, String *name, bool *hasProperty)
// singleton types are handled differently to other types.
if (type->isSingleton()) {
- QQmlEngine *e = v8engine->engine();
+ QQmlEngine *e = v4->qmlEngine();
QQmlType::SingletonInstanceInfo *siinfo = type->singletonInstanceInfo();
siinfo->init(e);
@@ -153,7 +153,7 @@ ReturnedValue QmlTypeWrapper::get(Managed *m, String *name, bool *hasProperty)
if (qobjectSingleton) {
// check for enum value
if (name->startsWithUpper()) {
- if (w->d()->mode == IncludeEnums) {
+ if (w->d()->mode == Heap::QmlTypeWrapper::IncludeEnums) {
// ### Optimize
QByteArray enumName = name->toQString().toUtf8();
const QMetaObject *metaObject = qobjectSingleton->metaObject();
@@ -168,10 +168,10 @@ ReturnedValue QmlTypeWrapper::get(Managed *m, String *name, bool *hasProperty)
}
// check for property.
- return QV4::QObjectWrapper::getQmlProperty(v4->currentContext(), context, qobjectSingleton, name, QV4::QObjectWrapper::IgnoreRevision, hasProperty);
+ return QV4::QObjectWrapper::getQmlProperty(v4, context, qobjectSingleton, name, QV4::QObjectWrapper::IgnoreRevision, hasProperty);
} else if (!siinfo->scriptApi(e).isUndefined()) {
// NOTE: if used in a binding, changes will not trigger re-evaluation since non-NOTIFYable.
- QV4::ScopedObject o(scope, QJSValuePrivate::get(siinfo->scriptApi(e))->getValue(v4));
+ QV4::ScopedObject o(scope, QJSValuePrivate::convertedToValue(v4, siinfo->scriptApi(e)));
if (!!o)
return o->get(name);
}
@@ -191,7 +191,7 @@ ReturnedValue QmlTypeWrapper::get(Managed *m, String *name, bool *hasProperty)
} else if (w->d()->object) {
QObject *ao = qmlAttachedPropertiesObjectById(type->attachedPropertiesId(), object);
if (ao)
- return QV4::QObjectWrapper::getQmlProperty(v4->currentContext(), context, ao, name, QV4::QObjectWrapper::IgnoreRevision, hasProperty);
+ return QV4::QObjectWrapper::getQmlProperty(v4, context, ao, name, QV4::QObjectWrapper::IgnoreRevision, hasProperty);
// Fall through to base implementation
}
@@ -206,14 +206,13 @@ ReturnedValue QmlTypeWrapper::get(Managed *m, String *name, bool *hasProperty)
QQmlTypeNameCache::Result r = w->d()->typeNamespace->query(name, w->d()->importNamespace);
if (r.isValid()) {
- QQmlContextData *context = v8engine->callingContext();
if (r.type) {
- return create(w->d()->v8, object, r.type, w->d()->mode);
+ return create(scope.engine, object, r.type, w->d()->mode);
} else if (r.scriptIndex != -1) {
- QV4::ScopedObject scripts(scope, context->importedScripts);
+ QV4::ScopedObject scripts(scope, context->importedScripts.valueRef());
return scripts->getIndexed(r.scriptIndex);
} else if (r.importNamespace) {
- return create(w->d()->v8, object, context->imports, r.importNamespace);
+ return create(scope.engine, object, context->imports, r.importNamespace);
}
return QV4::Encode::undefined();
@@ -232,37 +231,36 @@ ReturnedValue QmlTypeWrapper::get(Managed *m, String *name, bool *hasProperty)
}
-void QmlTypeWrapper::put(Managed *m, String *name, const ValueRef value)
+void QmlTypeWrapper::put(Managed *m, String *name, const Value &value)
{
Q_ASSERT(m->as<QmlTypeWrapper>());
QmlTypeWrapper *w = static_cast<QmlTypeWrapper *>(m);
- QV4::ExecutionEngine *v4 = m->engine();
+ QV4::ExecutionEngine *v4 = w->engine();
if (v4->hasException)
return;
QV4::Scope scope(v4);
- QV8Engine *v8engine = v4->v8Engine;
- QQmlContextData *context = v8engine->callingContext();
+ QQmlContextData *context = v4->v8Engine->callingContext();
QQmlType *type = w->d()->type;
if (type && !type->isSingleton() && w->d()->object) {
QObject *object = w->d()->object;
QObject *ao = qmlAttachedPropertiesObjectById(type->attachedPropertiesId(), object);
if (ao)
- QV4::QObjectWrapper::setQmlProperty(v4->currentContext(), context, ao, name, QV4::QObjectWrapper::IgnoreRevision, value);
+ QV4::QObjectWrapper::setQmlProperty(v4, context, ao, name, QV4::QObjectWrapper::IgnoreRevision, value);
} else if (type && type->isSingleton()) {
- QQmlEngine *e = v8engine->engine();
+ QQmlEngine *e = scope.engine->qmlEngine();
QQmlType::SingletonInstanceInfo *siinfo = type->singletonInstanceInfo();
siinfo->init(e);
QObject *qobjectSingleton = siinfo->qobjectApi(e);
if (qobjectSingleton) {
- QV4::QObjectWrapper::setQmlProperty(v4->currentContext(), context, qobjectSingleton, name, QV4::QObjectWrapper::IgnoreRevision, value);
+ QV4::QObjectWrapper::setQmlProperty(v4, context, qobjectSingleton, name, QV4::QObjectWrapper::IgnoreRevision, value);
} else if (!siinfo->scriptApi(e).isUndefined()) {
- QV4::ScopedObject apiprivate(scope, QJSValuePrivate::get(siinfo->scriptApi(e))->value);
+ QV4::ScopedObject apiprivate(scope, QJSValuePrivate::convertedToValue(v4, siinfo->scriptApi(e)));
if (!apiprivate) {
QString error = QLatin1String("Cannot assign to read-only property \"") + name->toQString() + QLatin1Char('\"');
- v4->currentContext()->throwError(error);
+ v4->throwError(error);
return;
} else {
apiprivate->put(name, value);
@@ -279,11 +277,6 @@ PropertyAttributes QmlTypeWrapper::query(const Managed *m, String *name)
return hasProperty ? Attr_Data : Attr_Invalid;
}
-void QmlTypeWrapper::destroy(Managed *that)
-{
- static_cast<QmlTypeWrapper *>(that)->d()->~Data();
-}
-
bool QmlTypeWrapper::isEqualTo(Managed *a, Managed *b)
{
Q_ASSERT(a->as<QV4::QmlTypeWrapper>());
diff --git a/src/qml/qml/qqmltypewrapper_p.h b/src/qml/qml/qqmltypewrapper_p.h
index 995e88ecf4..660d2836ff 100644
--- a/src/qml/qml/qqmltypewrapper_p.h
+++ b/src/qml/qml/qqmltypewrapper_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -58,40 +58,45 @@ class QQmlTypeNameCache;
namespace QV4 {
-struct Q_QML_EXPORT QmlTypeWrapper : Object
-{
- enum TypeNameMode { IncludeEnums, ExcludeEnums };
-
- struct Data : Object::Data {
- Data(QV8Engine *engine);
- ~Data();
- QV8Engine *v8;
- TypeNameMode mode;
- QPointer<QObject> object;
-
- QQmlType *type;
- QQmlTypeNameCache *typeNamespace;
- const void *importNamespace;
+namespace Heap {
+
+struct QmlTypeWrapper : Object {
+ enum TypeNameMode {
+ IncludeEnums,
+ ExcludeEnums
};
- V4_OBJECT(Object)
-private:
-public:
+ QmlTypeWrapper(QV4::ExecutionEngine *engine);
+ ~QmlTypeWrapper();
+ TypeNameMode mode;
+ QPointer<QObject> object;
+
+ QQmlType *type;
+ QQmlTypeNameCache *typeNamespace;
+ const void *importNamespace;
+};
+
+}
+
+struct Q_QML_EXPORT QmlTypeWrapper : Object
+{
+ V4_OBJECT2(QmlTypeWrapper, Object)
+ V4_NEEDS_DESTROY
bool isSingleton() const;
QObject *singletonObject() const;
QVariant toVariant() const;
- static ReturnedValue create(QV8Engine *, QObject *, QQmlType *, TypeNameMode = IncludeEnums);
- static ReturnedValue create(QV8Engine *, QObject *, QQmlTypeNameCache *, const void *, TypeNameMode = IncludeEnums);
+ static ReturnedValue create(ExecutionEngine *, QObject *, QQmlType *,
+ Heap::QmlTypeWrapper::TypeNameMode = Heap::QmlTypeWrapper::IncludeEnums);
+ static ReturnedValue create(ExecutionEngine *, QObject *, QQmlTypeNameCache *, const void *,
+ Heap::QmlTypeWrapper::TypeNameMode = Heap::QmlTypeWrapper::IncludeEnums);
static ReturnedValue get(Managed *m, String *name, bool *hasProperty);
- static void put(Managed *m, String *name, const ValueRef value);
+ static void put(Managed *m, String *name, const Value &value);
static PropertyAttributes query(const Managed *, String *name);
- static void destroy(Managed *that);
-
static bool isEqualTo(Managed *that, Managed *o);
};
diff --git a/src/qml/qml/qqmlvaluetype.cpp b/src/qml/qml/qqmlvaluetype.cpp
index f73b50ad46..10eaae0c77 100644
--- a/src/qml/qml/qqmlvaluetype.cpp
+++ b/src/qml/qml/qqmlvaluetype.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -36,6 +36,9 @@
#include <private/qqmlglobal_p.h>
#include <QtCore/qdebug.h>
+#include <private/qmetaobjectbuilder_p.h>
+#include <private/qqmlmodelindexvaluetype_p.h>
+#include <private/qmetatype_p.h>
QT_BEGIN_NAMESPACE
@@ -48,7 +51,7 @@ struct QQmlValueTypeFactoryImpl
bool isValueType(int idx);
- QQmlValueType *createValueType(int);
+ const QMetaObject *metaObjectForMetaType(int);
QQmlValueType *valueType(int);
QQmlValueType *valueTypes[QVariant::UserType];
@@ -60,6 +63,9 @@ QQmlValueTypeFactoryImpl::QQmlValueTypeFactoryImpl()
{
for (unsigned int ii = 0; ii < QVariant::UserType; ++ii)
valueTypes[ii] = 0;
+
+ // See types wrapped in qqmlmodelindexvaluetype_p.h
+ qRegisterMetaType<QItemSelectionRange>();
}
QQmlValueTypeFactoryImpl::~QQmlValueTypeFactoryImpl()
@@ -83,39 +89,40 @@ bool QQmlValueTypeFactoryImpl::isValueType(int idx)
return false;
}
-QQmlValueType *QQmlValueTypeFactoryImpl::createValueType(int t)
+const QMetaObject *QQmlValueTypeFactoryImpl::metaObjectForMetaType(int t)
{
- QQmlValueType *rv = 0;
-
switch (t) {
case QVariant::Point:
- rv = new QQmlPointValueType;
- break;
+ return &QQmlPointValueType::staticMetaObject;
case QVariant::PointF:
- rv = new QQmlPointFValueType;
- break;
+ return &QQmlPointFValueType::staticMetaObject;
case QVariant::Size:
- rv = new QQmlSizeValueType;
- break;
+ return &QQmlSizeValueType::staticMetaObject;
case QVariant::SizeF:
- rv = new QQmlSizeFValueType;
- break;
+ return &QQmlSizeFValueType::staticMetaObject;
case QVariant::Rect:
- rv = new QQmlRectValueType;
- break;
+ return &QQmlRectValueType::staticMetaObject;
case QVariant::RectF:
- rv = new QQmlRectFValueType;
- break;
+ return &QQmlRectFValueType::staticMetaObject;
case QVariant::EasingCurve:
- rv = new QQmlEasingValueType;
- break;
+ return &QQmlEasingValueType::staticMetaObject;
+ case QVariant::ModelIndex:
+ return &QQmlModelIndexValueType::staticMetaObject;
+ case QVariant::PersistentModelIndex:
+ return &QQmlPersistentModelIndexValueType::staticMetaObject;
default:
- rv = QQml_valueTypeProvider()->createValueType(t);
+ if (t == qMetaTypeId<QItemSelectionRange>())
+ return &QQmlItemSelectionRangeValueType::staticMetaObject;
+
+ if (const QMetaObject *mo = QQml_valueTypeProvider()->metaObjectForMetaType(t))
+ return mo;
break;
}
- Q_ASSERT(!rv || rv->metaObject()->propertyCount() < 32);
- return rv;
+ QMetaType metaType(t);
+ if (metaType.flags() & QMetaType::IsGadget)
+ return metaType.metaObject();
+ return 0;
}
QQmlValueType *QQmlValueTypeFactoryImpl::valueType(int idx)
@@ -126,7 +133,10 @@ QQmlValueType *QQmlValueTypeFactoryImpl::valueType(int idx)
QHash<int, QQmlValueType *>::iterator it = userTypes.find(idx);
if (it == userTypes.end()) {
- it = userTypes.insert(idx, createValueType(idx));
+ QQmlValueType *vt = 0;
+ if (const QMetaObject *mo = metaObjectForMetaType(idx))
+ vt = new QQmlValueType(idx, mo);
+ it = userTypes.insert(idx, vt);
}
mutex.unlock();
@@ -139,7 +149,8 @@ QQmlValueType *QQmlValueTypeFactoryImpl::valueType(int idx)
// TODO: Investigate the performance/memory characteristics of
// removing the preallocated array
- if ((rv = createValueType(idx))) {
+ if (const QMetaObject *mo = metaObjectForMetaType(idx)) {
+ rv = new QQmlValueType(idx, mo);
valueTypes[idx] = rv;
}
}
@@ -161,22 +172,84 @@ QQmlValueType *QQmlValueTypeFactory::valueType(int idx)
return factoryImpl()->valueType(idx);
}
+const QMetaObject *QQmlValueTypeFactory::metaObjectForMetaType(int type)
+{
+ return factoryImpl()->metaObjectForMetaType(type);
+}
+
void QQmlValueTypeFactory::registerValueTypes(const char *uri, int versionMajor, int versionMinor)
{
qmlRegisterValueTypeEnums<QQmlEasingValueType>(uri, versionMajor, versionMinor, "Easing");
}
+QQmlValueType::QQmlValueType(int typeId, const QMetaObject *gadgetMetaObject)
+ : gadgetPtr(QMetaType::create(typeId))
+ , typeId(typeId)
+ , metaType(typeId)
+{
+ QObjectPrivate *op = QObjectPrivate::get(this);
+ Q_ASSERT(!op->metaObject);
+ op->metaObject = this;
+
+ QMetaObjectBuilder builder(gadgetMetaObject);
+ _metaObject = builder.toMetaObject();
+
+ *static_cast<QMetaObject*>(this) = *_metaObject;
+}
+
+QQmlValueType::~QQmlValueType()
+{
+ QObjectPrivate *op = QObjectPrivate::get(this);
+ Q_ASSERT(op->metaObject == this);
+ op->metaObject = 0;
+ ::free(const_cast<QMetaObject *>(_metaObject));
+ metaType.destroy(gadgetPtr);
+}
+
+void QQmlValueType::read(QObject *obj, int idx)
+{
+ void *a[] = { gadgetPtr, 0 };
+ QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
+}
+
+void QQmlValueType::write(QObject *obj, int idx, QQmlPropertyPrivate::WriteFlags flags)
+{
+ Q_ASSERT(gadgetPtr);
+ int status = -1;
+ void *a[] = { gadgetPtr, 0, &status, &flags };
+ QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
+}
+
+QVariant QQmlValueType::value()
+{
+ Q_ASSERT(gadgetPtr);
+ return QVariant(typeId, gadgetPtr);
+}
+
+void QQmlValueType::setValue(const QVariant &value)
+{
+ Q_ASSERT(typeId == value.userType());
+ metaType.destruct(gadgetPtr);
+ metaType.construct(gadgetPtr, value.constData());
+}
-QQmlValueType::QQmlValueType(int userType, QObject *parent)
-: QObject(parent), m_userType(userType)
+QAbstractDynamicMetaObject *QQmlValueType::toDynamicMetaObject(QObject *)
{
+ return this;
}
-QQmlPointFValueType::QQmlPointFValueType(QObject *parent)
- : QQmlValueTypeBase<QPointF>(QMetaType::QPointF, parent)
+void QQmlValueType::objectDestroyed(QObject *)
{
}
+int QQmlValueType::metaCall(QObject *, QMetaObject::Call type, int _id, void **argv)
+{
+ const QMetaObject *mo = _metaObject;
+ QQmlMetaObject::resolveGadgetMethodOrPropertyIndex(type, &mo, &_id);
+ mo->d.static_metacall(reinterpret_cast<QObject*>(gadgetPtr), type, _id, argv);
+ return _id;
+}
+
QString QQmlPointFValueType::toString() const
{
return QString(QLatin1String("QPointF(%1, %2)")).arg(v.x()).arg(v.y());
@@ -203,16 +276,6 @@ void QQmlPointFValueType::setY(qreal y)
}
-QQmlPointValueType::QQmlPointValueType(QObject *parent)
- : QQmlValueTypeBase<QPoint>(QMetaType::QPoint, parent)
-{
-}
-
-QString QQmlPointValueType::toString() const
-{
- return QString(QLatin1String("QPoint(%1, %2)")).arg(v.x()).arg(v.y());
-}
-
int QQmlPointValueType::x() const
{
return v.x();
@@ -234,11 +297,6 @@ void QQmlPointValueType::setY(int y)
}
-QQmlSizeFValueType::QQmlSizeFValueType(QObject *parent)
- : QQmlValueTypeBase<QSizeF>(QMetaType::QSizeF, parent)
-{
-}
-
QString QQmlSizeFValueType::toString() const
{
return QString(QLatin1String("QSizeF(%1, %2)")).arg(v.width()).arg(v.height());
@@ -265,16 +323,6 @@ void QQmlSizeFValueType::setHeight(qreal h)
}
-QQmlSizeValueType::QQmlSizeValueType(QObject *parent)
- : QQmlValueTypeBase<QSize>(QMetaType::QSize, parent)
-{
-}
-
-QString QQmlSizeValueType::toString() const
-{
- return QString(QLatin1String("QSize(%1, %2)")).arg(v.width()).arg(v.height());
-}
-
int QQmlSizeValueType::width() const
{
return v.width();
@@ -295,12 +343,6 @@ void QQmlSizeValueType::setHeight(int h)
v.setHeight(h);
}
-
-QQmlRectFValueType::QQmlRectFValueType(QObject *parent)
- : QQmlValueTypeBase<QRectF>(QMetaType::QRectF, parent)
-{
-}
-
QString QQmlRectFValueType::toString() const
{
return QString(QLatin1String("QRectF(%1, %2, %3, %4)")).arg(v.x()).arg(v.y()).arg(v.width()).arg(v.height());
@@ -346,15 +388,24 @@ void QQmlRectFValueType::setHeight(qreal h)
v.setHeight(h);
}
+qreal QQmlRectFValueType::left() const
+{
+ return v.left();
+}
+
+qreal QQmlRectFValueType::right() const
+{
+ return v.right();
+}
-QQmlRectValueType::QQmlRectValueType(QObject *parent)
- : QQmlValueTypeBase<QRect>(QMetaType::QRect, parent)
+qreal QQmlRectFValueType::top() const
{
+ return v.top();
}
-QString QQmlRectValueType::toString() const
+qreal QQmlRectFValueType::bottom() const
{
- return QString(QLatin1String("QRect(%1, %2, %3, %4)")).arg(v.x()).arg(v.y()).arg(v.width()).arg(v.height());
+ return v.bottom();
}
int QQmlRectValueType::x() const
@@ -397,15 +448,24 @@ void QQmlRectValueType::setHeight(int h)
v.setHeight(h);
}
+int QQmlRectValueType::left() const
+{
+ return v.left();
+}
+
+int QQmlRectValueType::right() const
+{
+ return v.right();
+}
-QQmlEasingValueType::QQmlEasingValueType(QObject *parent)
- : QQmlValueTypeBase<QEasingCurve>(QMetaType::QEasingCurve, parent)
+int QQmlRectValueType::top() const
{
+ return v.top();
}
-QString QQmlEasingValueType::toString() const
+int QQmlRectValueType::bottom() const
{
- return QString(QLatin1String("QEasingCurve(%1, %2, %3, %4)")).arg(v.type()).arg(v.amplitude()).arg(v.overshoot()).arg(v.period());
+ return v.bottom();
}
QQmlEasingValueType::Type QQmlEasingValueType::type() const
diff --git a/src/qml/qml/qqmlvaluetype_p.h b/src/qml/qml/qqmlvaluetype_p.h
index 5a6bcdd003..2c02cc0aa1 100644
--- a/src/qml/qml/qqmlvaluetype_p.h
+++ b/src/qml/qml/qqmlvaluetype_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -48,7 +48,7 @@
#include "qqml.h"
#include "qqmlproperty.h"
#include "qqmlproperty_p.h"
-#include "qqmlnullablevalue_p_p.h"
+#include <private/qqmlnullablevalue_p.h>
#include <QtCore/qobject.h>
#include <QtCore/qrect.h>
@@ -57,97 +57,29 @@
QT_BEGIN_NAMESPACE
-class Q_QML_PRIVATE_EXPORT QQmlValueType : public QObject
+class Q_QML_PRIVATE_EXPORT QQmlValueType : public QObject, public QAbstractDynamicMetaObject
{
- Q_OBJECT
public:
- QQmlValueType(int userType, QObject *parent = 0);
- virtual void read(QObject *, int) = 0;
- virtual void readVariantValue(QObject *, int, QVariant *) = 0;
- virtual void write(QObject *, int, QQmlPropertyPrivate::WriteFlags flags) = 0;
- virtual void writeVariantValue(QObject *, int, QQmlPropertyPrivate::WriteFlags, QVariant *) = 0;
- virtual QVariant value() = 0;
- virtual void setValue(const QVariant &) = 0;
-
- virtual QString toString() const = 0;
- virtual bool isEqual(const QVariant &value) const = 0;
-
- virtual void onLoad() {}
-
- inline int userType() const
- {
- return m_userType;
- }
-
-protected:
- inline void readProperty(QObject *obj, int idx, void *p)
- {
- void *a[] = { p, 0 };
- QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
- onLoad();
- }
-
- inline void writeProperty(QObject *obj, int idx, QQmlPropertyPrivate::WriteFlags flags, void *p)
- {
- int status = -1;
- void *a[] = { p, 0, &status, &flags };
- QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
- }
+ QQmlValueType(int userType, const QMetaObject *metaObject);
+ ~QQmlValueType();
+ void read(QObject *, int);
+ void write(QObject *, int, QQmlPropertyPrivate::WriteFlags flags);
+ QVariant value();
+ void setValue(const QVariant &);
+
+ // ---- dynamic meta object data interface
+ virtual QAbstractDynamicMetaObject *toDynamicMetaObject(QObject *);
+ virtual void objectDestroyed(QObject *);
+ virtual int metaCall(QObject *obj, QMetaObject::Call type, int _id, void **argv);
+ // ----
private:
- int m_userType;
-};
+ const QMetaObject *_metaObject;
+ void *gadgetPtr;
-template <typename T>
-class QQmlValueTypeBase : public QQmlValueType
-{
public:
- typedef T ValueType;
-
- QQmlValueTypeBase(int userType, QObject *parent)
- : QQmlValueType(userType, parent)
- {
- }
-
- virtual void read(QObject *obj, int idx)
- {
- readProperty(obj, idx, &v);
- }
-
- virtual void readVariantValue(QObject *obj, int idx, QVariant *into)
- {
- // important: must not change the userType of the variant
- readProperty(obj, idx, into);
- }
-
- virtual void write(QObject *obj, int idx, QQmlPropertyPrivate::WriteFlags flags)
- {
- writeProperty(obj, idx, flags, &v);
- }
-
- virtual void writeVariantValue(QObject *obj, int idx, QQmlPropertyPrivate::WriteFlags flags, QVariant *from)
- {
- writeProperty(obj, idx, flags, from);
- }
-
- virtual QVariant value()
- {
- return QVariant::fromValue(v);
- }
-
- virtual void setValue(const QVariant &value)
- {
- v = qvariant_cast<T>(value);
- onLoad();
- }
-
- virtual bool isEqual(const QVariant &other) const
- {
- return QVariant::fromValue(v) == other;
- }
-
-protected:
- ValueType v;
+ int typeId;
+ QMetaType metaType;
};
class Q_QML_PRIVATE_EXPORT QQmlValueTypeFactory
@@ -155,86 +87,79 @@ class Q_QML_PRIVATE_EXPORT QQmlValueTypeFactory
public:
static bool isValueType(int);
static QQmlValueType *valueType(int idx);
+ static const QMetaObject *metaObjectForMetaType(int type);
static void registerValueTypes(const char *uri, int versionMajor, int versionMinor);
};
-class Q_QML_PRIVATE_EXPORT QQmlPointFValueType : public QQmlValueTypeBase<QPointF>
+struct QQmlPointFValueType
{
+ QPointF v;
Q_PROPERTY(qreal x READ x WRITE setX FINAL)
Q_PROPERTY(qreal y READ y WRITE setY FINAL)
- Q_OBJECT
+ Q_GADGET
public:
- QQmlPointFValueType(QObject *parent = 0);
-
- virtual QString toString() const;
-
+ Q_INVOKABLE QString toString() const;
qreal x() const;
qreal y() const;
void setX(qreal);
void setY(qreal);
};
-class Q_QML_PRIVATE_EXPORT QQmlPointValueType : public QQmlValueTypeBase<QPoint>
+struct QQmlPointValueType
{
+ QPoint v;
Q_PROPERTY(int x READ x WRITE setX FINAL)
Q_PROPERTY(int y READ y WRITE setY FINAL)
- Q_OBJECT
+ Q_GADGET
public:
- QQmlPointValueType(QObject *parent = 0);
-
- virtual QString toString() const;
-
int x() const;
int y() const;
void setX(int);
void setY(int);
};
-class Q_QML_PRIVATE_EXPORT QQmlSizeFValueType : public QQmlValueTypeBase<QSizeF>
+struct QQmlSizeFValueType
{
+ QSizeF v;
Q_PROPERTY(qreal width READ width WRITE setWidth FINAL)
Q_PROPERTY(qreal height READ height WRITE setHeight FINAL)
- Q_OBJECT
+ Q_GADGET
public:
- QQmlSizeFValueType(QObject *parent = 0);
-
- virtual QString toString() const;
-
+ Q_INVOKABLE QString toString() const;
qreal width() const;
qreal height() const;
void setWidth(qreal);
void setHeight(qreal);
};
-class Q_QML_PRIVATE_EXPORT QQmlSizeValueType : public QQmlValueTypeBase<QSize>
+struct QQmlSizeValueType
{
+ QSize v;
Q_PROPERTY(int width READ width WRITE setWidth FINAL)
Q_PROPERTY(int height READ height WRITE setHeight FINAL)
- Q_OBJECT
+ Q_GADGET
public:
- QQmlSizeValueType(QObject *parent = 0);
-
- virtual QString toString() const;
-
int width() const;
int height() const;
void setWidth(int);
void setHeight(int);
};
-class Q_QML_PRIVATE_EXPORT QQmlRectFValueType : public QQmlValueTypeBase<QRectF>
+struct QQmlRectFValueType
{
+ QRectF v;
Q_PROPERTY(qreal x READ x WRITE setX FINAL)
Q_PROPERTY(qreal y READ y WRITE setY FINAL)
Q_PROPERTY(qreal width READ width WRITE setWidth FINAL)
Q_PROPERTY(qreal height READ height WRITE setHeight FINAL)
- Q_OBJECT
+ Q_PROPERTY(qreal left READ left DESIGNABLE false FINAL)
+ Q_PROPERTY(qreal right READ right DESIGNABLE false FINAL)
+ Q_PROPERTY(qreal top READ top DESIGNABLE false FINAL)
+ Q_PROPERTY(qreal bottom READ bottom DESIGNABLE false FINAL)
+ Q_GADGET
public:
- QQmlRectFValueType(QObject *parent = 0);
-
- virtual QString toString() const;
-
+ Q_INVOKABLE QString toString() const;
qreal x() const;
qreal y() const;
void setX(qreal);
@@ -244,20 +169,26 @@ public:
qreal height() const;
void setWidth(qreal);
void setHeight(qreal);
+
+ qreal left() const;
+ qreal right() const;
+ qreal top() const;
+ qreal bottom() const;
};
-class Q_QML_PRIVATE_EXPORT QQmlRectValueType : public QQmlValueTypeBase<QRect>
+struct QQmlRectValueType
{
+ QRect v;
Q_PROPERTY(int x READ x WRITE setX FINAL)
Q_PROPERTY(int y READ y WRITE setY FINAL)
Q_PROPERTY(int width READ width WRITE setWidth FINAL)
Q_PROPERTY(int height READ height WRITE setHeight FINAL)
- Q_OBJECT
+ Q_PROPERTY(int left READ left DESIGNABLE false FINAL)
+ Q_PROPERTY(int right READ right DESIGNABLE false FINAL)
+ Q_PROPERTY(int top READ top DESIGNABLE false FINAL)
+ Q_PROPERTY(int bottom READ bottom DESIGNABLE false FINAL)
+ Q_GADGET
public:
- QQmlRectValueType(QObject *parent = 0);
-
- virtual QString toString() const;
-
int x() const;
int y() const;
void setX(int);
@@ -267,11 +198,17 @@ public:
int height() const;
void setWidth(int);
void setHeight(int);
+
+ int left() const;
+ int right() const;
+ int top() const;
+ int bottom() const;
};
-class Q_QML_PRIVATE_EXPORT QQmlEasingValueType : public QQmlValueTypeBase<QEasingCurve>
+struct QQmlEasingValueType
{
- Q_OBJECT
+ QEasingCurve v;
+ Q_GADGET
Q_ENUMS(Type)
Q_PROPERTY(QQmlEasingValueType::Type type READ type WRITE setType FINAL)
@@ -307,10 +244,6 @@ public:
Bezier = QEasingCurve::BezierSpline
};
- QQmlEasingValueType(QObject *parent = 0);
-
- virtual QString toString() const;
-
Type type() const;
qreal amplitude() const;
qreal overshoot() const;
diff --git a/src/qml/qml/qqmlvaluetypeproxybinding.cpp b/src/qml/qml/qqmlvaluetypeproxybinding.cpp
index 9e8d9198ee..cfc9b196d2 100644
--- a/src/qml/qml/qqmlvaluetypeproxybinding.cpp
+++ b/src/qml/qml/qqmlvaluetypeproxybinding.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -123,7 +123,8 @@ void QQmlValueTypeProxyBinding::removeBindings(quint32 mask)
QQmlAbstractBinding *lastBinding = 0;
while (binding) {
- if (mask & (1 << (binding->propertyIndex() >> 16))) {
+ int valueTypeIndex = QQmlPropertyData::decodeValueTypePropertyIndex(binding->propertyIndex());
+ if (valueTypeIndex != -1 && (mask & (1 << valueTypeIndex))) {
QQmlAbstractBinding *remove = binding;
binding = remove->nextBinding();
diff --git a/src/qml/qml/qqmlvaluetypeproxybinding_p.h b/src/qml/qml/qqmlvaluetypeproxybinding_p.h
index 39d8959293..873fbb4af1 100644
--- a/src/qml/qml/qqmlvaluetypeproxybinding_p.h
+++ b/src/qml/qml/qqmlvaluetypeproxybinding_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlvaluetypewrapper.cpp b/src/qml/qml/qqmlvaluetypewrapper.cpp
index b0125b4c13..e87d9ede77 100644
--- a/src/qml/qml/qqmlvaluetypewrapper.cpp
+++ b/src/qml/qml/qqmlvaluetypewrapper.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -44,376 +44,442 @@
#include <private/qv4functionobject_p.h>
#include <private/qv4variantobject_p.h>
#include <private/qv4qmlextensions_p.h>
+#include <private/qv4alloca_p.h>
QT_BEGIN_NAMESPACE
-using namespace QV4;
-DEFINE_OBJECT_VTABLE(QmlValueTypeWrapper);
+DEFINE_OBJECT_VTABLE(QV4::QQmlValueTypeWrapper);
+
+namespace QV4 {
+namespace Heap {
-struct QmlValueTypeReference : public QmlValueTypeWrapper
+struct QQmlValueTypeReference : QQmlValueTypeWrapper
{
- struct Data : QmlValueTypeWrapper::Data
- {
- Data(QV8Engine *engine);
- QPointer<QObject> object;
- int property;
- };
- V4_OBJECT(QmlValueTypeWrapper)
+ QQmlValueTypeReference(ExecutionEngine *engine);
+ QPointer<QObject> object;
+ int property;
};
-DEFINE_OBJECT_VTABLE(QmlValueTypeReference);
+}
-struct QmlValueTypeCopy : public QmlValueTypeWrapper
+struct QQmlValueTypeReference : public QQmlValueTypeWrapper
{
- struct Data : QmlValueTypeWrapper::Data
- {
- Data(QV8Engine *engine);
- QVariant value;
- };
- V4_OBJECT(QmlValueTypeWrapper)
+ V4_OBJECT2(QQmlValueTypeReference, QQmlValueTypeWrapper)
+
+ static void destroy(Heap::Base *that);
+
+ bool readReferenceValue() const;
};
-DEFINE_OBJECT_VTABLE(QmlValueTypeCopy);
+}
+
+DEFINE_OBJECT_VTABLE(QV4::QQmlValueTypeReference);
+
+using namespace QV4;
+
+Heap::QQmlValueTypeWrapper::QQmlValueTypeWrapper(ExecutionEngine *engine)
+ : Heap::Object(engine)
+{
+}
-QmlValueTypeWrapper::Data::Data(QV8Engine *engine, ObjectType objectType)
- : Object::Data(QV8Engine::getV4(engine))
- , v8(engine)
- , objectType(objectType)
+Heap::QQmlValueTypeWrapper::~QQmlValueTypeWrapper()
{
- setVTable(staticVTable());
+ if (gadgetPtr) {
+ valueType->metaType.destruct(gadgetPtr);
+ ::operator delete(gadgetPtr);
+ }
}
-QmlValueTypeReference::Data::Data(QV8Engine *engine)
- : QmlValueTypeWrapper::Data(engine, Reference)
+void Heap::QQmlValueTypeWrapper::setValue(const QVariant &value) const
{
+ Q_ASSERT(valueType->typeId == value.userType());
+ if (gadgetPtr)
+ valueType->metaType.destruct(gadgetPtr);
+ if (!gadgetPtr)
+ gadgetPtr = ::operator new(valueType->metaType.sizeOf());
+ valueType->metaType.construct(gadgetPtr, value.constData());
}
-QmlValueTypeCopy::Data::Data(QV8Engine *engine)
- : QmlValueTypeWrapper::Data(engine, Copy)
+QVariant Heap::QQmlValueTypeWrapper::toVariant() const
{
+ Q_ASSERT(gadgetPtr);
+ return QVariant(valueType->typeId, gadgetPtr);
}
-static bool readReferenceValue(const QmlValueTypeReference *reference)
+Heap::QQmlValueTypeReference::QQmlValueTypeReference(ExecutionEngine *engine)
+ : Heap::QQmlValueTypeWrapper(engine)
+{
+}
+
+bool QQmlValueTypeReference::readReferenceValue() const
{
+ if (!d()->object)
+ return false;
// A reference resource may be either a "true" reference (eg, to a QVector3D property)
// or a "variant" reference (eg, to a QVariant property which happens to contain a value-type).
- QMetaProperty writebackProperty = reference->d()->object->metaObject()->property(reference->d()->property);
+ QMetaProperty writebackProperty = d()->object->metaObject()->property(d()->property);
if (writebackProperty.userType() == QMetaType::QVariant) {
// variant-containing-value-type reference
QVariant variantReferenceValue;
- reference->d()->type->readVariantValue(reference->d()->object, reference->d()->property, &variantReferenceValue);
+
+ void *a[] = { &variantReferenceValue, 0 };
+ QMetaObject::metacall(d()->object, QMetaObject::ReadProperty, d()->property, a);
+
int variantReferenceType = variantReferenceValue.userType();
- if (variantReferenceType != reference->d()->type->userType()) {
+ if (variantReferenceType != typeId()) {
// This is a stale VariantReference. That is, the variant has been
// overwritten with a different type in the meantime.
// We need to modify this reference to the updated value type, if
// possible, or return false if it is not a value type.
if (QQmlValueTypeFactory::isValueType(variantReferenceType)) {
- reference->d()->type = QQmlValueTypeFactory::valueType(variantReferenceType);
- if (!reference->d()->type) {
- return false;
+ QQmlPropertyCache *cache = 0;
+ if (const QMetaObject *mo = QQmlValueTypeFactory::metaObjectForMetaType(variantReferenceType))
+ cache = QJSEnginePrivate::get(engine())->cache(mo);
+ if (d()->gadgetPtr) {
+ d()->valueType->metaType.destruct(d()->gadgetPtr);
+ ::operator delete(d()->gadgetPtr);
}
+ d()->gadgetPtr =0;
+ d()->propertyCache = cache;
+ d()->valueType = QQmlValueTypeFactory::valueType(variantReferenceType);
+ if (!cache)
+ return false;
} else {
return false;
}
}
- reference->d()->type->setValue(variantReferenceValue);
+ d()->setValue(variantReferenceValue);
} else {
+ if (!d()->gadgetPtr) {
+ d()->gadgetPtr = ::operator new(d()->valueType->metaType.sizeOf());
+ d()->valueType->metaType.construct(d()->gadgetPtr, 0);
+ }
// value-type reference
- reference->d()->type->read(reference->d()->object, reference->d()->property);
+ void *args[] = { d()->gadgetPtr, 0 };
+ QMetaObject::metacall(d()->object, QMetaObject::ReadProperty, d()->property, args);
}
return true;
}
-void QmlValueTypeWrapper::initProto(ExecutionEngine *v4)
+void QQmlValueTypeWrapper::initProto(ExecutionEngine *v4)
{
if (v4->qmlExtensions()->valueTypeWrapperPrototype)
return;
Scope scope(v4);
- Scoped<Object> o(scope, v4->newObject());
+ ScopedObject o(scope, v4->newObject());
o->defineDefaultProperty(v4->id_toString, method_toString, 1);
- v4->qmlExtensions()->valueTypeWrapperPrototype = o.getPointer();
+ v4->qmlExtensions()->valueTypeWrapperPrototype = o->d();
}
-ReturnedValue QmlValueTypeWrapper::create(QV8Engine *v8, QObject *object, int property, QQmlValueType *type)
+ReturnedValue QQmlValueTypeWrapper::create(ExecutionEngine *engine, QObject *object, int property, const QMetaObject *metaObject, int typeId)
{
- ExecutionEngine *v4 = QV8Engine::getV4(v8);
- Scope scope(v4);
- initProto(v4);
-
- QmlValueTypeReference *r = v4->memoryManager->alloc<QmlValueTypeReference>(v8);
- r->d()->internalClass = r->d()->internalClass->changePrototype(v4->qmlExtensions()->valueTypeWrapperPrototype);
- r->d()->type = type; r->d()->object = object; r->d()->property = property;
+ Scope scope(engine);
+ initProto(engine);
+
+ Scoped<QQmlValueTypeReference> r(scope, engine->memoryManager->alloc<QQmlValueTypeReference>(engine));
+ ScopedObject proto(scope, engine->qmlExtensions()->valueTypeWrapperPrototype);
+ r->setPrototype(proto);
+ r->d()->object = object; r->d()->property = property;
+ r->d()->propertyCache = QJSEnginePrivate::get(engine)->cache(metaObject);
+ r->d()->valueType = QQmlValueTypeFactory::valueType(typeId);
+ r->d()->gadgetPtr = 0;
return r->asReturnedValue();
}
-ReturnedValue QmlValueTypeWrapper::create(QV8Engine *v8, const QVariant &value, QQmlValueType *type)
+ReturnedValue QQmlValueTypeWrapper::create(ExecutionEngine *engine, const QVariant &value, const QMetaObject *metaObject, int typeId)
{
- ExecutionEngine *v4 = QV8Engine::getV4(v8);
- Scope scope(v4);
- initProto(v4);
-
- QmlValueTypeCopy *r = v4->memoryManager->alloc<QmlValueTypeCopy>(v8);
- r->d()->internalClass = r->d()->internalClass->changePrototype(v4->qmlExtensions()->valueTypeWrapperPrototype);
- r->d()->type = type; r->d()->value = value;
+ Scope scope(engine);
+ initProto(engine);
+
+ Scoped<QQmlValueTypeWrapper> r(scope, engine->memoryManager->alloc<QQmlValueTypeWrapper>(engine));
+ ScopedObject proto(scope, engine->qmlExtensions()->valueTypeWrapperPrototype);
+ r->setPrototype(proto);
+ r->d()->propertyCache = QJSEnginePrivate::get(engine)->cache(metaObject);
+ r->d()->valueType = QQmlValueTypeFactory::valueType(typeId);
+ r->d()->gadgetPtr = 0;
+ r->d()->setValue(value);
return r->asReturnedValue();
}
-QVariant QmlValueTypeWrapper::toVariant() const
+QVariant QQmlValueTypeWrapper::toVariant() const
{
- if (d()->objectType == QmlValueTypeWrapper::Reference) {
- const QmlValueTypeReference *reference = static_cast<const QmlValueTypeReference *>(this);
-
- if (reference->d()->object && readReferenceValue(reference)) {
- return reference->d()->type->value();
- } else {
+ if (const QQmlValueTypeReference *ref = as<const QQmlValueTypeReference>())
+ if (!ref->readReferenceValue())
return QVariant();
- }
- } else {
- Q_ASSERT(d()->objectType == QmlValueTypeWrapper::Copy);
- return static_cast<const QmlValueTypeCopy *>(this)->d()->value;
- }
+ return d()->toVariant();
+}
+
+bool QQmlValueTypeWrapper::toGadget(void *data) const
+{
+ if (const QQmlValueTypeReference *ref = as<const QQmlValueTypeReference>())
+ if (!ref->readReferenceValue())
+ return false;
+ const int typeId = d()->valueType->typeId;
+ QMetaType::destruct(typeId, data);
+ QMetaType::construct(typeId, data, d()->gadgetPtr);
+ return true;
}
-void QmlValueTypeWrapper::destroy(Managed *that)
+void QQmlValueTypeWrapper::destroy(Heap::Base *that)
{
- Q_ASSERT(that->as<QmlValueTypeWrapper>());
- QmlValueTypeWrapper *w = static_cast<QmlValueTypeWrapper *>(that);
- if (w->d()->objectType == Reference)
- static_cast<QmlValueTypeReference *>(w)->d()->~Data();
- else
- static_cast<QmlValueTypeCopy *>(w)->d()->~Data();
+ Heap::QQmlValueTypeWrapper *w = static_cast<Heap::QQmlValueTypeWrapper *>(that);
+ w->Heap::QQmlValueTypeWrapper::~QQmlValueTypeWrapper();
}
-bool QmlValueTypeWrapper::isEqualTo(Managed *m, Managed *other)
+bool QQmlValueTypeWrapper::isEqualTo(Managed *m, Managed *other)
{
- Q_ASSERT(m && m->as<QmlValueTypeWrapper>() && other);
- QV4::QmlValueTypeWrapper *lv = static_cast<QmlValueTypeWrapper *>(m);
+ Q_ASSERT(m && m->as<QQmlValueTypeWrapper>() && other);
+ QV4::QQmlValueTypeWrapper *lv = static_cast<QQmlValueTypeWrapper *>(m);
if (QV4::VariantObject *rv = other->as<VariantObject>())
return lv->isEqual(rv->d()->data);
- if (QV4::QmlValueTypeWrapper *v = other->as<QmlValueTypeWrapper>())
+ if (QV4::QQmlValueTypeWrapper *v = other->as<QQmlValueTypeWrapper>())
return lv->isEqual(v->toVariant());
return false;
}
-PropertyAttributes QmlValueTypeWrapper::query(const Managed *m, String *name)
+PropertyAttributes QQmlValueTypeWrapper::query(const Managed *m, String *name)
{
- Q_ASSERT(m->as<const QmlValueTypeWrapper>());
- const QmlValueTypeWrapper *r = static_cast<const QmlValueTypeWrapper *>(m);
-
- QQmlPropertyData local;
- QQmlPropertyData *result = 0;
- {
- QQmlData *ddata = QQmlData::get(r->d()->type, false);
- if (ddata && ddata->propertyCache)
- result = ddata->propertyCache->property(name, 0, 0);
- else
- result = QQmlPropertyCache::property(r->d()->v8->engine(), r->d()->type, name, 0, local);
- }
+ Q_ASSERT(m->as<const QQmlValueTypeWrapper>());
+ const QQmlValueTypeWrapper *r = static_cast<const QQmlValueTypeWrapper *>(m);
+
+ QQmlPropertyData *result = r->d()->propertyCache->property(name, 0, 0);
return result ? Attr_Data : Attr_Invalid;
}
-bool QmlValueTypeWrapper::isEqual(const QVariant& value)
+bool QQmlValueTypeWrapper::isEqual(const QVariant& value)
{
- if (d()->objectType == QmlValueTypeWrapper::Reference) {
- QmlValueTypeReference *reference = static_cast<QmlValueTypeReference *>(this);
- if (reference->d()->object && readReferenceValue(reference)) {
- return reference->d()->type->isEqual(value);
- } else {
+ if (QQmlValueTypeReference *ref = as<QQmlValueTypeReference>())
+ if (!ref->readReferenceValue())
return false;
+ return (value == d()->toVariant());
+}
+
+int QQmlValueTypeWrapper::typeId() const
+{
+ return d()->valueType->typeId;
+}
+
+bool QQmlValueTypeWrapper::write(QObject *target, int propertyIndex) const
+{
+ bool destructGadgetOnExit = false;
+ if (const QQmlValueTypeReference *ref = as<const QQmlValueTypeReference>()) {
+ if (!d()->gadgetPtr) {
+ d()->gadgetPtr = alloca(d()->valueType->metaType.sizeOf());
+ d()->valueType->metaType.construct(d()->gadgetPtr, 0);
+ destructGadgetOnExit = true;
}
- } else {
- Q_ASSERT(d()->objectType == QmlValueTypeWrapper::Copy);
- QmlValueTypeCopy *copy = static_cast<QmlValueTypeCopy *>(this);
- d()->type->setValue(copy->d()->value);
- if (d()->type->isEqual(value))
- return true;
- return (value == copy->d()->value);
+ if (!ref->readReferenceValue())
+ return false;
+ }
+
+ int flags = 0;
+ int status = -1;
+ void *a[] = { d()->gadgetPtr, 0, &status, &flags };
+ QMetaObject::metacall(target, QMetaObject::WriteProperty, propertyIndex, a);
+
+ if (destructGadgetOnExit) {
+ d()->valueType->metaType.destruct(d()->gadgetPtr);
+ d()->gadgetPtr = 0;
}
+ return true;
}
-ReturnedValue QmlValueTypeWrapper::method_toString(CallContext *ctx)
+ReturnedValue QQmlValueTypeWrapper::method_toString(CallContext *ctx)
{
- Object *o = ctx->d()->callData->thisObject.asObject();
+ Object *o = ctx->thisObject().asObject();
if (!o)
- return ctx->throwTypeError();
- QmlValueTypeWrapper *w = o->as<QmlValueTypeWrapper>();
+ return ctx->engine()->throwTypeError();
+ QQmlValueTypeWrapper *w = o->as<QQmlValueTypeWrapper>();
if (!w)
- return ctx->throwTypeError();
-
- if (w->d()->objectType == QmlValueTypeWrapper::Reference) {
- QmlValueTypeReference *reference = static_cast<QmlValueTypeReference *>(w);
- if (reference->d()->object && readReferenceValue(reference)) {
- return w->d()->v8->toString(w->d()->type->toString());
- } else {
- return QV4::Encode::undefined();
- }
+ return ctx->engine()->throwTypeError();
+
+ if (QQmlValueTypeReference *ref = w->as<QQmlValueTypeReference>())
+ if (!ref->readReferenceValue())
+ return Encode::undefined();
+
+ QString result;
+ // Prepare a buffer to pass to QMetaType::convert()
+ QString convertResult;
+ convertResult.~QString();
+ if (QMetaType::convert(w->d()->gadgetPtr, w->d()->valueType->typeId, &convertResult, QMetaType::QString)) {
+ result = convertResult;
} else {
- Q_ASSERT(w->d()->objectType == QmlValueTypeWrapper::Copy);
- QmlValueTypeCopy *copy = static_cast<QmlValueTypeCopy *>(w);
- w->d()->type->setValue(copy->d()->value);
- return w->d()->v8->toString(w->d()->type->toString());
+ result = QString::fromUtf8(QMetaType::typeName(w->d()->valueType->typeId));
+ result += QLatin1Char('(');
+ const QMetaObject *mo = w->d()->propertyCache->metaObject();
+ const int propCount = mo->propertyCount();
+ for (int i = 0; i < propCount; ++i) {
+ if (mo->property(i).isDesignable()) {
+ QVariant value = mo->property(i).readOnGadget(w->d()->gadgetPtr);
+ if (i > 0)
+ result += QLatin1String(", ");
+ result += value.toString();
+ }
+ }
+ result += QLatin1Char(')');
}
+ return Encode(ctx->engine()->newString(result));
}
-ReturnedValue QmlValueTypeWrapper::get(Managed *m, String *name, bool *hasProperty)
+ReturnedValue QQmlValueTypeWrapper::get(Managed *m, String *name, bool *hasProperty)
{
- Q_ASSERT(m->as<QmlValueTypeWrapper>());
- QmlValueTypeWrapper *r = static_cast<QmlValueTypeWrapper *>(m);
- QV4::ExecutionEngine *v4 = m->engine();
+ Q_ASSERT(m->as<QQmlValueTypeWrapper>());
+ QQmlValueTypeWrapper *r = static_cast<QQmlValueTypeWrapper *>(m);
+ QV4::ExecutionEngine *v4 = r->engine();
// Note: readReferenceValue() can change the reference->type.
- if (r->d()->objectType == QmlValueTypeWrapper::Reference) {
- QmlValueTypeReference *reference = static_cast<QmlValueTypeReference *>(r);
-
- if (!reference->d()->object || !readReferenceValue(reference))
+ if (QQmlValueTypeReference *reference = r->as<QQmlValueTypeReference>()) {
+ if (!reference->readReferenceValue())
return Primitive::undefinedValue().asReturnedValue();
-
- } else {
- Q_ASSERT(r->d()->objectType == QmlValueTypeWrapper::Copy);
-
- QmlValueTypeCopy *copy = static_cast<QmlValueTypeCopy *>(r);
-
- r->d()->type->setValue(copy->d()->value);
- }
-
- QQmlPropertyData local;
- QQmlPropertyData *result = 0;
- {
- QQmlData *ddata = QQmlData::get(r->d()->type, false);
- if (ddata && ddata->propertyCache)
- result = ddata->propertyCache->property(name, 0, 0);
- else
- result = QQmlPropertyCache::property(r->d()->v8->engine(), r->d()->type, name, 0, local);
}
+ QQmlPropertyData *result = r->d()->propertyCache->property(name, 0, 0);
if (!result)
return Object::get(m, name, hasProperty);
+ if (hasProperty)
+ *hasProperty = true;
+
if (result->isFunction()) {
// calling a Q_INVOKABLE function of a value type
- QQmlContextData *qmlContext = QV4::QmlContextWrapper::callingContext(v4);
- return QV4::QObjectWrapper::getQmlProperty(v4->currentContext(), qmlContext, r->d()->type, name, QV4::QObjectWrapper::IgnoreRevision);
+ Scope scope(v4);
+ ScopedContext c(scope, v4->rootContext());
+ return QV4::QObjectMethod::create(c, r, result->coreIndex);
}
#define VALUE_TYPE_LOAD(metatype, cpptype, constructor) \
if (result->propType == metatype) { \
cpptype v; \
void *args[] = { &v, 0 }; \
- r->d()->type->qt_metacall(QMetaObject::ReadProperty, result->coreIndex, args); \
- return constructor(v); \
+ metaObject->d.static_metacall(reinterpret_cast<QObject*>(gadget), QMetaObject::ReadProperty, index, args); \
+ return QV4::Encode(constructor(v)); \
}
+ const QMetaObject *metaObject = r->d()->propertyCache->metaObject();
+
+ int index = result->coreIndex;
+ QQmlMetaObject::resolveGadgetMethodOrPropertyIndex(QMetaObject::ReadProperty, &metaObject, &index);
+
+ void *gadget = r->d()->gadgetPtr;
+
// These four types are the most common used by the value type wrappers
- VALUE_TYPE_LOAD(QMetaType::QReal, qreal, QV4::Encode);
- VALUE_TYPE_LOAD(QMetaType::Int, int, QV4::Encode);
- VALUE_TYPE_LOAD(QMetaType::QString, QString, r->d()->v8->toString);
- VALUE_TYPE_LOAD(QMetaType::Bool, bool, QV4::Encode);
+ VALUE_TYPE_LOAD(QMetaType::QReal, qreal, qreal);
+ VALUE_TYPE_LOAD(QMetaType::Int, int, int);
+ VALUE_TYPE_LOAD(QMetaType::QString, QString, v4->newString);
+ VALUE_TYPE_LOAD(QMetaType::Bool, bool, bool);
QVariant v(result->propType, (void *)0);
void *args[] = { v.data(), 0 };
- r->d()->type->qt_metacall(QMetaObject::ReadProperty, result->coreIndex, args);
- return r->d()->v8->fromVariant(v);
+ metaObject->d.static_metacall(reinterpret_cast<QObject*>(gadget), QMetaObject::ReadProperty, index, args);
+ return v4->fromVariant(v);
#undef VALUE_TYPE_ACCESSOR
}
-void QmlValueTypeWrapper::put(Managed *m, String *name, const ValueRef value)
+void QQmlValueTypeWrapper::put(Managed *m, String *name, const Value &value)
{
- Q_ASSERT(m->as<QmlValueTypeWrapper>());
- ExecutionEngine *v4 = m->engine();
+ Q_ASSERT(m->as<QQmlValueTypeWrapper>());
+ ExecutionEngine *v4 = static_cast<QQmlValueTypeWrapper *>(m)->engine();
Scope scope(v4);
if (scope.hasException())
return;
- Scoped<QmlValueTypeWrapper> r(scope, static_cast<QmlValueTypeWrapper *>(m));
+ Scoped<QQmlValueTypeWrapper> r(scope, static_cast<QQmlValueTypeWrapper *>(m));
+ Scoped<QQmlValueTypeReference> reference(scope, m->d());
- QByteArray propName = name->toQString().toUtf8();
- if (r->d()->objectType == QmlValueTypeWrapper::Reference) {
- QmlValueTypeReference *reference = static_cast<QmlValueTypeReference *>(r.getPointer());
+ int writeBackPropertyType = -1;
+
+ if (reference) {
QMetaProperty writebackProperty = reference->d()->object->metaObject()->property(reference->d()->property);
- if (!reference->d()->object || !writebackProperty.isWritable() || !readReferenceValue(reference))
+ if (!writebackProperty.isWritable() || !reference->readReferenceValue())
return;
- // we lookup the index after readReferenceValue() since it can change the reference->type.
- int index = r->d()->type->metaObject()->indexOfProperty(propName.constData());
- if (index == -1)
+ writeBackPropertyType = writebackProperty.userType();
+ }
+
+ const QMetaObject *metaObject = r->d()->propertyCache->metaObject();
+ const QQmlPropertyData *pd = r->d()->propertyCache->property(name, 0, 0);
+ if (!pd)
+ return;
+ QMetaProperty property = metaObject->property(pd->coreIndex);
+ Q_ASSERT(property.isValid());
+
+ QQmlBinding *newBinding = 0;
+
+ QV4::ScopedFunctionObject f(scope, value);
+ if (reference && f) {
+ if (!f->isBinding()) {
+ // assigning a JS function to a non-var-property is not allowed.
+ QString error = QStringLiteral("Cannot assign JavaScript function to value-type property");
+ ScopedString e(scope, v4->newString(error));
+ v4->throwError(e);
return;
- QMetaProperty p = r->d()->type->metaObject()->property(index);
-
- QQmlBinding *newBinding = 0;
-
- QV4::ScopedFunctionObject f(scope, value);
- if (f) {
- if (!f->bindingKeyFlag()) {
- // assigning a JS function to a non-var-property is not allowed.
- QString error = QLatin1String("Cannot assign JavaScript function to value-type property");
- Scoped<String> e(scope, r->d()->v8->toString(error));
- v4->currentContext()->throwError(e);
- return;
- }
+ }
- QQmlContextData *context = r->d()->v8->callingContext();
+ QQmlContextData *context = QmlContextWrapper::callingContext(v4);
- QQmlPropertyData cacheData;
- cacheData.setFlags(QQmlPropertyData::IsWritable |
- QQmlPropertyData::IsValueTypeVirtual);
- cacheData.propType = reference->d()->object->metaObject()->property(reference->d()->property).userType();
- cacheData.coreIndex = reference->d()->property;
- cacheData.valueTypeFlags = 0;
- cacheData.valueTypeCoreIndex = index;
- cacheData.valueTypePropType = p.userType();
+ QQmlPropertyData cacheData;
+ cacheData.setFlags(QQmlPropertyData::IsWritable |
+ QQmlPropertyData::IsValueTypeVirtual);
+ cacheData.propType = writeBackPropertyType;
+ cacheData.coreIndex = reference->d()->property;
+ cacheData.valueTypeFlags = 0;
+ cacheData.valueTypeCoreIndex = pd->coreIndex;
+ cacheData.valueTypePropType = property.userType();
- QV4::Scoped<QQmlBindingFunction> bindingFunction(scope, f);
- bindingFunction->initBindingLocation();
+ QV4::Scoped<QQmlBindingFunction> bindingFunction(scope, (const Value &)f);
+ bindingFunction->initBindingLocation();
- newBinding = new QQmlBinding(value, reference->d()->object, context);
- newBinding->setTarget(reference->d()->object, cacheData, context);
- }
+ newBinding = new QQmlBinding(value, reference->d()->object, context);
+ newBinding->setTarget(reference->d()->object, cacheData, context);
+ }
+ if (reference) {
QQmlAbstractBinding *oldBinding =
- QQmlPropertyPrivate::setBinding(reference->d()->object, reference->d()->property, index, newBinding);
+ QQmlPropertyPrivate::setBinding(reference->d()->object, reference->d()->property, pd->coreIndex, newBinding);
if (oldBinding)
oldBinding->destroy();
+ }
- if (!f) {
- QVariant v = r->d()->v8->toVariant(value, -1);
+ if (newBinding)
+ return;
- if (p.isEnumType() && (QMetaType::Type)v.type() == QMetaType::Double)
- v = v.toInt();
+ QVariant v = v4->toVariant(value, property.userType());
- p.write(reference->d()->type, v);
+ if (property.isEnumType() && (QMetaType::Type)v.type() == QMetaType::Double)
+ v = v.toInt();
- if (writebackProperty.userType() == QMetaType::QVariant) {
- QVariant variantReferenceValue = r->d()->type->value();
- reference->d()->type->writeVariantValue(reference->d()->object, reference->d()->property, 0, &variantReferenceValue);
- } else {
- reference->d()->type->write(reference->d()->object, reference->d()->property, 0);
- }
- }
+ void *gadget = r->d()->gadgetPtr;
+ property.writeOnGadget(gadget, v);
- } else {
- Q_ASSERT(r->d()->objectType == QmlValueTypeWrapper::Copy);
- QmlValueTypeCopy *copy = static_cast<QmlValueTypeCopy *>(r.getPointer());
-
- int index = r->d()->type->metaObject()->indexOfProperty(propName.constData());
- if (index == -1)
- return;
+ if (reference) {
+ if (writeBackPropertyType == QMetaType::QVariant) {
+ QVariant variantReferenceValue = r->d()->toVariant();
- QVariant v = r->d()->v8->toVariant(value, -1);
+ int flags = 0;
+ int status = -1;
+ void *a[] = { &variantReferenceValue, 0, &status, &flags };
+ QMetaObject::metacall(reference->d()->object, QMetaObject::WriteProperty, reference->d()->property, a);
- r->d()->type->setValue(copy->d()->value);
- QMetaProperty p = r->d()->type->metaObject()->property(index);
- p.write(r->d()->type, v);
- copy->d()->value = r->d()->type->value();
+ } else {
+ int flags = 0;
+ int status = -1;
+ void *a[] = { r->d()->gadgetPtr, 0, &status, &flags };
+ QMetaObject::metacall(reference->d()->object, QMetaObject::WriteProperty, reference->d()->property, a);
+ }
}
}
+void QQmlValueTypeReference::destroy(Heap::Base *that)
+{
+ static_cast<Heap::QQmlValueTypeReference*>(that)->Heap::QQmlValueTypeReference::~QQmlValueTypeReference();
+}
+
QT_END_NAMESPACE
diff --git a/src/qml/qml/qqmlvaluetypewrapper_p.h b/src/qml/qml/qqmlvaluetypewrapper_p.h
index c155b88cc0..cad48e661c 100644
--- a/src/qml/qml/qqmlvaluetypewrapper_p.h
+++ b/src/qml/qml/qqmlvaluetypewrapper_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -53,33 +53,44 @@
QT_BEGIN_NAMESPACE
-class QQmlValueType;
class QV8Engine;
+class QQmlValueType;
namespace QV4 {
-struct Q_QML_EXPORT QmlValueTypeWrapper : Object
+namespace Heap {
+
+struct QQmlValueTypeWrapper : Object {
+ QQmlValueTypeWrapper(ExecutionEngine *engine);
+ ~QQmlValueTypeWrapper();
+ QQmlRefPointer<QQmlPropertyCache> propertyCache;
+ mutable void *gadgetPtr;
+ QQmlValueType *valueType;
+
+ void setValue(const QVariant &value) const;
+ QVariant toVariant() const;
+};
+
+}
+
+struct Q_QML_EXPORT QQmlValueTypeWrapper : Object
{
- enum ObjectType { Reference, Copy };
- struct Data : Object::Data {
- Data(QV8Engine *engine, ObjectType type);
- QV8Engine *v8;
- ObjectType objectType;
- mutable QQmlValueType *type;
- };
- V4_OBJECT(Object)
+ V4_OBJECT2(QQmlValueTypeWrapper, Object)
+ static void destroy(Heap::Base *b);
public:
- static ReturnedValue create(QV8Engine *v8, QObject *, int, QQmlValueType *);
- static ReturnedValue create(QV8Engine *v8, const QVariant &, QQmlValueType *);
+ static ReturnedValue create(ExecutionEngine *engine, QObject *, int, const QMetaObject *metaObject, int typeId);
+ static ReturnedValue create(ExecutionEngine *engine, const QVariant &, const QMetaObject *metaObject, int typeId);
QVariant toVariant() const;
+ bool toGadget(void *data) const;
bool isEqual(const QVariant& value);
+ int typeId() const;
+ bool write(QObject *target, int propertyIndex) const;
static ReturnedValue get(Managed *m, String *name, bool *hasProperty);
- static void put(Managed *m, String *name, const ValueRef value);
- static void destroy(Managed *that);
+ static void put(Managed *m, String *name, const Value &value);
static bool isEqualTo(Managed *m, Managed *other);
static PropertyAttributes query(const Managed *, String *name);
diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp
index 6ecc3bda2e..6b8f679848 100644
--- a/src/qml/qml/qqmlvme.cpp
+++ b/src/qml/qml/qqmlvme.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlvme_p.h b/src/qml/qml/qqmlvme_p.h
index e819a19ebf..4f289751a5 100644
--- a/src/qml/qml/qqmlvme_p.h
+++ b/src/qml/qml/qqmlvme_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -58,7 +58,6 @@
#include <private/qqmlengine_p.h>
#include <private/qfinitestack_p.h>
-#include <private/qqmltrace_p.h>
#include <private/qqmlprofiler_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp
index f6d72c00b1..97fc382c33 100644
--- a/src/qml/qml/qqmlvmemetaobject.cpp
+++ b/src/qml/qml/qqmlvmemetaobject.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -608,7 +608,7 @@ QQmlVMEMetaObject::QQmlVMEMetaObject(QObject *obj,
QV4::Function *runtimeFunction = compilationUnit->runtimeFunctions[data->runtimeFunctionIndex];
o = QV4::FunctionObject::createScriptFunction(qmlBindingContext, runtimeFunction);
- v8methods[index] = o;
+ v8methods[index].set(qmlBindingContext->engine(), o);
}
}
}
@@ -772,7 +772,7 @@ int QQmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a)
int listIndex = data[id].asInt();
const List *list = &listProperties.at(listIndex);
*reinterpret_cast<QQmlListProperty<QObject> *>(a[0]) =
- QQmlListProperty<QObject>(object, (void *)list,
+ QQmlListProperty<QObject>(object, const_cast<List *>(list),
list_append, list_count, list_at,
list_clear);
}
@@ -926,7 +926,7 @@ int QQmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a)
QV4::Scope scope(ep->v4engine());
- QV4::Scoped<QV4::FunctionObject> function(scope, method(id));
+ QV4::ScopedFunctionObject function(scope, method(id));
if (!function) {
// The function was not compiled. There are some exceptional cases which the
// expression rewriter does not rewrite properly (e.g., \r-terminated lines
@@ -945,18 +945,17 @@ int QQmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a)
callData->thisObject = ep->v8engine()->global();
for (int ii = 0; ii < data->parameterCount; ++ii)
- callData->args[ii] = ep->v8engine()->fromVariant(*(QVariant *)a[ii + 1]);
+ callData->args[ii] = scope.engine->fromVariant(*(QVariant *)a[ii + 1]);
QV4::ScopedValue result(scope);
- QV4::ExecutionContext *ctx = function->engine()->currentContext();
result = function->call(callData);
if (scope.hasException()) {
- QQmlError error = QV4::ExecutionEngine::catchExceptionAsQmlError(ctx);
+ QQmlError error = scope.engine->catchExceptionAsQmlError();
if (error.isValid())
ep->warning(error);
if (a[0]) *(QVariant *)a[0] = QVariant();
} else {
- if (a[0]) *(QVariant *)a[0] = ep->v8engine()->toVariant(result, 0);
+ if (a[0]) *(QVariant *)a[0] = scope.engine->toVariant(result, 0);
}
ep->dereferenceScarceResources(); // "release" scarce resources if top-level expression evaluation is complete.
@@ -1005,7 +1004,7 @@ QVariant QQmlVMEMetaObject::readPropertyAsVariant(int id)
QV4::Scope scope(v4);
QV4::ScopedObject o(scope, varProperties.value());
QV4::ScopedValue val(scope, o->getIndexed(id - firstVarPropertyIndex));
- return v4->v8Engine->toVariant(val, -1);
+ return scope.engine->toVariant(val, -1);
}
return QVariant();
} else {
@@ -1017,7 +1016,7 @@ QVariant QQmlVMEMetaObject::readPropertyAsVariant(int id)
}
}
-void QQmlVMEMetaObject::writeVarProperty(int id, const QV4::ValueRef value)
+void QQmlVMEMetaObject::writeVarProperty(int id, const QV4::Value &value)
{
Q_ASSERT(id >= firstVarPropertyIndex);
if (!ensureVarPropertiesAllocated())
@@ -1078,7 +1077,7 @@ void QQmlVMEMetaObject::writeProperty(int id, const QVariant &value)
// And, if the new value is a scarce resource, we need to ensure that it does not get
// automatically released by the engine until no other references to it exist.
- QV4::ScopedValue newv(scope, QQmlEnginePrivate::get(ctxt->engine)->v8engine()->fromVariant(value));
+ QV4::ScopedValue newv(scope, scope.engine->fromVariant(value));
QV4::Scoped<QV4::VariantObject> v(scope, newv);
if (!!v)
v->addVmePropertyReference();
@@ -1091,7 +1090,7 @@ void QQmlVMEMetaObject::writeProperty(int id, const QVariant &value)
} else {
bool needActivate = false;
if (value.userType() == QMetaType::QObjectStar) {
- QObject *o = *(QObject **)value.data();
+ QObject *o = *(QObject *const *)value.data();
needActivate = (data[id].dataType() != QMetaType::QObjectStar || data[id].asQObject() != o);
data[id].setValue(o, this, id);
} else {
@@ -1171,7 +1170,7 @@ QV4::ReturnedValue QQmlVMEMetaObject::vmeMethod(int index)
}
// Used by debugger
-void QQmlVMEMetaObject::setVmeMethod(int index, QV4::ValueRef function)
+void QQmlVMEMetaObject::setVmeMethod(int index, const QV4::Value &function)
{
if (index < methodOffset()) {
Q_ASSERT(parentVMEMetaObject());
@@ -1184,7 +1183,7 @@ void QQmlVMEMetaObject::setVmeMethod(int index, QV4::ValueRef function)
v8methods = new QV4::PersistentValue[metaData->methodCount];
int methodIndex = index - methodOffset() - plainSignals;
- v8methods[methodIndex] = function;
+ v8methods[methodIndex].set(function.asObject()->engine(), function);
}
QV4::ReturnedValue QQmlVMEMetaObject::vmeProperty(int index)
@@ -1196,7 +1195,7 @@ QV4::ReturnedValue QQmlVMEMetaObject::vmeProperty(int index)
return readVarProperty(index - propOffset());
}
-void QQmlVMEMetaObject::setVMEProperty(int index, const QV4::ValueRef v)
+void QQmlVMEMetaObject::setVMEProperty(int index, const QV4::Value &v)
{
if (index < propOffset()) {
Q_ASSERT(parentVMEMetaObject());
@@ -1228,6 +1227,11 @@ void QQmlVMEMetaObject::ensureQObjectWrapper()
void QQmlVMEMetaObject::mark(QV4::ExecutionEngine *e)
{
+ QQmlEnginePrivate *ep = (ctxt == 0 || ctxt->engine == 0) ? 0 : QQmlEnginePrivate::get(ctxt->engine);
+ QV4::ExecutionEngine *v4 = (ep == 0) ? 0 : ep->v4engine();
+ if (v4 != e)
+ return;
+
varProperties.markOnce(e);
// add references created by VMEVariant properties
@@ -1235,12 +1239,8 @@ void QQmlVMEMetaObject::mark(QV4::ExecutionEngine *e)
for (int ii = 0; ii < maxDataIdx; ++ii) { // XXX TODO: optimize?
if (data[ii].dataType() == QMetaType::QObjectStar) {
// possible QObject reference.
- QObject *ref = data[ii].asQObject();
- if (ref) {
- QQmlData *ddata = QQmlData::get(ref);
- if (ddata)
- ddata->jsWrapper.markOnce(e);
- }
+ if (QObject *ref = data[ii].asQObject())
+ QV4::QObjectWrapper::markWrapper(ref, e);
}
}
@@ -1254,7 +1254,7 @@ void QQmlVMEMetaObject::allocateVarPropertiesArray()
assert(qml);
QV4::ExecutionEngine *v4 = QV8Engine::getV4(qml->handle());
QV4::Scope scope(v4);
- varProperties = QV4::ScopedValue(scope, v4->newArrayObject(metaData->varPropertyCount));
+ varProperties.set(scope.engine, v4->newArrayObject(metaData->varPropertyCount));
varPropertiesInitialized = true;
}
diff --git a/src/qml/qml/qqmlvmemetaobject_p.h b/src/qml/qml/qqmlvmemetaobject_p.h
index a8a9a02102..f3048d426a 100644
--- a/src/qml/qml/qqmlvmemetaobject_p.h
+++ b/src/qml/qml/qqmlvmemetaobject_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -90,19 +90,21 @@ struct QQmlVMEMetaData
return propertyIdx == -1;
}
bool isPropertyAlias() const {
- return !isObjectAlias() && !(propertyIdx & 0xFFFF0000);
+ return !isObjectAlias() && valueTypeIndex() == -1;
}
bool isValueTypeAlias() const {
- return !isObjectAlias() && (propertyIdx & 0xFFFF0000);
+ return !isObjectAlias() && valueTypeIndex() != -1;
}
int propertyIndex() const {
- return propertyIdx & 0x0000FFFF;
+ int index;
+ QQmlPropertyData::decodeValueTypePropertyIndex(propertyIdx, &index);
+ return index;
}
int valueTypeIndex() const {
- return (propertyIdx & 0xFFFF0000) >> 16;
+ return QQmlPropertyData::decodeValueTypePropertyIndex(propertyIdx);
}
int valueType() const {
- return (propertyIdx & 0xFFFF0000) ? propType : 0;
+ return (valueTypeIndex() != -1) ? propType : 0;
}
};
@@ -117,7 +119,7 @@ struct QQmlVMEMetaData
};
PropertyData *propertyData() const {
- return (PropertyData *)(((const char *)this) + sizeof(QQmlVMEMetaData));
+ return (PropertyData *)(((char *)const_cast<QQmlVMEMetaData *>(this)) + sizeof(QQmlVMEMetaData));
}
AliasData *aliasData() const {
@@ -158,9 +160,9 @@ public:
void registerInterceptor(int index, int valueIndex, QQmlPropertyValueInterceptor *interceptor);
QV4::ReturnedValue vmeMethod(int index);
quint16 vmeMethodLineNumber(int index);
- void setVmeMethod(int index, QV4::ValueRef function);
+ void setVmeMethod(int index, const QV4::Value &function);
QV4::ReturnedValue vmeProperty(int index);
- void setVMEProperty(int index, const QV4::ValueRef v);
+ void setVMEProperty(int index, const QV4::Value &v);
void connectAliasSignal(int index, bool indexInSignalRange);
@@ -215,7 +217,7 @@ public:
QV4::ReturnedValue method(int);
QV4::ReturnedValue readVarProperty(int);
- void writeVarProperty(int, const QV4::ValueRef);
+ void writeVarProperty(int, const QV4::Value &);
QVariant readPropertyAsVariant(int);
void writeProperty(int, const QVariant &);
diff --git a/src/qml/qml/qqmlwatcher.cpp b/src/qml/qml/qqmlwatcher.cpp
index c20290e5e1..9726b6f3b9 100644
--- a/src/qml/qml/qqmlwatcher.cpp
+++ b/src/qml/qml/qqmlwatcher.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlwatcher_p.h b/src/qml/qml/qqmlwatcher_p.h
index f103144b11..a7bb3c3418 100644
--- a/src/qml/qml/qqmlwatcher_p.h
+++ b/src/qml/qml/qqmlwatcher_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp
index 0730cbc363..2a3ede6a22 100644
--- a/src/qml/qml/qqmlxmlhttprequest.cpp
+++ b/src/qml/qml/qqmlxmlhttprequest.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -55,17 +55,19 @@
#include <QtCore/qxmlstream.h>
#include <QtCore/qstack.h>
#include <QtCore/qdebug.h>
+#include <QtCore/qbuffer.h>
#include <private/qv4objectproto_p.h>
#include <private/qv4scopedvalue_p.h>
+#include <private/qv4arraybuffer_p.h>
using namespace QV4;
#ifndef QT_NO_XMLSTREAMREADER
#define V4THROW_REFERENCE(string) { \
- Scoped<Object> error(scope, ctx->engine()->newReferenceErrorObject(QStringLiteral(string))); \
- return ctx->throwError(error); \
+ ScopedObject error(scope, ctx->engine()->newReferenceErrorObject(QStringLiteral(string))); \
+ return ctx->engine()->throwError(error); \
}
QT_BEGIN_NAMESPACE
@@ -87,19 +89,18 @@ struct QQmlXMLHttpRequestData {
PersistentValue documentPrototype;
};
-static inline QQmlXMLHttpRequestData *xhrdata(QV8Engine *engine)
+static inline QQmlXMLHttpRequestData *xhrdata(ExecutionEngine *v4)
{
- return (QQmlXMLHttpRequestData *)engine->xmlHttpRequestData();
+ return (QQmlXMLHttpRequestData *)v4->v8Engine->xmlHttpRequestData();
}
-static ReturnedValue constructMeObject(const ValueRef thisObj, QV8Engine *e)
+static ReturnedValue constructMeObject(const Value &thisObj, ExecutionEngine *v4)
{
- ExecutionEngine *v4 = QV8Engine::getV4(e);
Scope scope(v4);
- Scoped<Object> meObj(scope, v4->newObject());
- meObj->put(ScopedString(scope, v4->newString(QStringLiteral("ThisObject"))).getPointer(), thisObj);
- ScopedValue v(scope, QmlContextWrapper::qmlScope(e, e->callingContext(), 0));
- meObj->put(ScopedString(scope, v4->newString(QStringLiteral("ActivationObject"))).getPointer(), v);
+ ScopedObject meObj(scope, v4->newObject());
+ meObj->put(ScopedString(scope, v4->newString(QStringLiteral("ThisObject"))), thisObj);
+ ScopedValue v(scope, QmlContextWrapper::qmlScope(v4, v4->v8Engine->callingContext(), 0));
+ meObj->put(ScopedString(scope, v4->newString(QStringLiteral("ActivationObject"))), v);
return meObj.asReturnedValue();
}
@@ -111,7 +112,7 @@ QQmlXMLHttpRequestData::~QQmlXMLHttpRequestData()
{
}
-namespace {
+namespace QV4 {
class DocumentImpl;
class NodeImpl
@@ -175,103 +176,96 @@ public:
void release() { QQmlRefCount::release(); }
};
+namespace Heap {
+
+struct NamedNodeMap : Object {
+ NamedNodeMap(ExecutionEngine *engine, NodeImpl *data, const QList<NodeImpl *> &list);
+ ~NamedNodeMap() {
+ if (d)
+ d->release();
+ }
+ QList<NodeImpl *> list; // Only used in NamedNodeMap
+ NodeImpl *d;
+};
+
+struct NodeList : Object {
+ NodeList(ExecutionEngine *engine, NodeImpl *data);
+ ~NodeList() {
+ if (d)
+ d->release();
+ }
+ NodeImpl *d;
+};
+
+struct NodePrototype : Object {
+ NodePrototype(ExecutionEngine *engine);
+};
+
+struct Node : Object {
+ Node(ExecutionEngine *engine, NodeImpl *data);
+ ~Node() {
+ if (d)
+ d->release();
+ }
+ NodeImpl *d;
+};
+
+}
+
class NamedNodeMap : public Object
{
public:
- struct Data : Object::Data {
- Data(ExecutionEngine *engine, NodeImpl *data, const QList<NodeImpl *> &list)
- : Object::Data(engine)
- , list(list)
- , d(data)
- {
- setVTable(staticVTable());
-
- if (d)
- d->addref();
- }
- ~Data() {
- if (d)
- d->release();
- }
- QList<NodeImpl *> list; // Only used in NamedNodeMap
- NodeImpl *d;
- };
- V4_OBJECT(Object)
+ V4_OBJECT2(NamedNodeMap, Object)
+ V4_NEEDS_DESTROY
// C++ API
- static ReturnedValue create(QV8Engine *, NodeImpl *, const QList<NodeImpl *> &);
+ static ReturnedValue create(ExecutionEngine *, NodeImpl *, const QList<NodeImpl *> &);
// JS API
- static void destroy(Managed *that) {
- static_cast<NamedNodeMap *>(that)->d()->~Data();
- }
static ReturnedValue get(Managed *m, String *name, bool *hasProperty);
static ReturnedValue getIndexed(Managed *m, uint index, bool *hasProperty);
};
+Heap::NamedNodeMap::NamedNodeMap(ExecutionEngine *engine, NodeImpl *data, const QList<NodeImpl *> &list)
+ : Heap::Object(engine)
+ , list(list)
+ , d(data)
+{
+ if (d)
+ d->addref();
+}
+
DEFINE_OBJECT_VTABLE(NamedNodeMap);
class NodeList : public Object
{
public:
- struct Data : Object::Data {
- Data(ExecutionEngine *engine, NodeImpl *data)
- : Object::Data(engine)
- , d(data)
- {
- setVTable(staticVTable());
-
- if (d)
- d->addref();
- }
- ~Data() {
- if (d)
- d->release();
- }
- NodeImpl *d;
- };
- V4_OBJECT(Object)
+ V4_OBJECT2(NodeList, Object)
+ V4_NEEDS_DESTROY
// JS API
- static void destroy(Managed *that) {
- static_cast<NodeList *>(that)->d()->~Data();
- }
static ReturnedValue get(Managed *m, String *name, bool *hasProperty);
static ReturnedValue getIndexed(Managed *m, uint index, bool *hasProperty);
// C++ API
- static ReturnedValue create(QV8Engine *, NodeImpl *);
+ static ReturnedValue create(ExecutionEngine *, NodeImpl *);
};
+Heap::NodeList::NodeList(ExecutionEngine *engine, NodeImpl *data)
+ : Heap::Object(engine)
+ , d(data)
+{
+ if (d)
+ d->addref();
+}
+
DEFINE_OBJECT_VTABLE(NodeList);
class NodePrototype : public Object
{
public:
- struct Data : Object::Data {
- Data(ExecutionEngine *engine)
- : Object::Data(engine)
- {
- setVTable(staticVTable());
-
- Scope scope(engine);
- ScopedObject o(scope, this);
-
- o->defineAccessorProperty(QStringLiteral("nodeName"), method_get_nodeName, 0);
- o->defineAccessorProperty(QStringLiteral("nodeValue"), method_get_nodeValue, 0);
- o->defineAccessorProperty(QStringLiteral("nodeType"), method_get_nodeType, 0);
-
- o->defineAccessorProperty(QStringLiteral("parentNode"), method_get_parentNode, 0);
- o->defineAccessorProperty(QStringLiteral("childNodes"), method_get_childNodes, 0);
- o->defineAccessorProperty(QStringLiteral("firstChild"), method_get_firstChild, 0);
- o->defineAccessorProperty(QStringLiteral("lastChild"), method_get_lastChild, 0);
- o->defineAccessorProperty(QStringLiteral("previousSibling"), method_get_previousSibling, 0);
- o->defineAccessorProperty(QStringLiteral("nextSibling"), method_get_nextSibling, 0);
- o->defineAccessorProperty(QStringLiteral("attributes"), method_get_attributes, 0);
- }
- };
- V4_OBJECT(Object)
+ V4_OBJECT2(NodePrototype, Object)
static void initClass(ExecutionEngine *engine);
@@ -299,36 +293,35 @@ public:
};
-DEFINE_OBJECT_VTABLE(NodePrototype);
-
-struct Node : public Object
+Heap::NodePrototype::NodePrototype(ExecutionEngine *engine)
+ : Heap::Object(engine)
{
- struct Data : Object::Data {
- Data(ExecutionEngine *engine, NodeImpl *data)
- : Object::Data(engine)
- , d(data)
- {
- setVTable(staticVTable());
+ Scope scope(engine);
+ ScopedObject o(scope, this);
- if (d)
- d->addref();
- }
- ~Data() {
- if (d)
- d->release();
- }
- NodeImpl *d;
- };
- V4_OBJECT(Object)
+ o->defineAccessorProperty(QStringLiteral("nodeName"), QV4::NodePrototype::method_get_nodeName, 0);
+ o->defineAccessorProperty(QStringLiteral("nodeValue"), QV4::NodePrototype::method_get_nodeValue, 0);
+ o->defineAccessorProperty(QStringLiteral("nodeType"), QV4::NodePrototype::method_get_nodeType, 0);
+ o->defineAccessorProperty(QStringLiteral("parentNode"), QV4::NodePrototype::method_get_parentNode, 0);
+ o->defineAccessorProperty(QStringLiteral("childNodes"), QV4::NodePrototype::method_get_childNodes, 0);
+ o->defineAccessorProperty(QStringLiteral("firstChild"), QV4::NodePrototype::method_get_firstChild, 0);
+ o->defineAccessorProperty(QStringLiteral("lastChild"), QV4::NodePrototype::method_get_lastChild, 0);
+ o->defineAccessorProperty(QStringLiteral("previousSibling"), QV4::NodePrototype::method_get_previousSibling, 0);
+ o->defineAccessorProperty(QStringLiteral("nextSibling"), QV4::NodePrototype::method_get_nextSibling, 0);
+ o->defineAccessorProperty(QStringLiteral("attributes"), QV4::NodePrototype::method_get_attributes, 0);
+}
- // JS API
- static void destroy(Managed *that) {
- static_cast<Node *>(that)->d()->~Data();
- }
+
+DEFINE_OBJECT_VTABLE(NodePrototype);
+
+struct Node : public Object
+{
+ V4_OBJECT2(Node, Object)
+ V4_NEEDS_DESTROY
// C++ API
- static ReturnedValue create(QV8Engine *, NodeImpl *);
+ static ReturnedValue create(ExecutionEngine *v4, NodeImpl *);
bool isNull() const;
@@ -337,6 +330,14 @@ private:
Node(const Node &o);
};
+Heap::Node::Node(ExecutionEngine *engine, NodeImpl *data)
+ : Heap::Object(engine)
+ , d(data)
+{
+ if (d)
+ d->addref();
+}
+
DEFINE_OBJECT_VTABLE(Node);
class Element : public Node
@@ -400,7 +401,7 @@ public:
// C++ API
static ReturnedValue prototype(ExecutionEngine *);
- static ReturnedValue load(QV8Engine *engine, const QByteArray &data);
+ static ReturnedValue load(ExecutionEngine *engine, const QByteArray &data);
};
}
@@ -418,9 +419,9 @@ void NodeImpl::release()
ReturnedValue NodePrototype::method_get_nodeName(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
QString name;
switch (r->d()->d->type) {
@@ -443,9 +444,9 @@ ReturnedValue NodePrototype::method_get_nodeName(CallContext *ctx)
ReturnedValue NodePrototype::method_get_nodeValue(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
if (r->d()->d->type == NodeImpl::Document ||
r->d()->d->type == NodeImpl::DocumentFragment ||
@@ -462,9 +463,9 @@ ReturnedValue NodePrototype::method_get_nodeValue(CallContext *ctx)
ReturnedValue NodePrototype::method_get_nodeType(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
return Encode(r->d()->d->type);
}
@@ -472,14 +473,12 @@ ReturnedValue NodePrototype::method_get_nodeType(CallContext *ctx)
ReturnedValue NodePrototype::method_get_parentNode(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r)
- return ctx->throwTypeError();
-
- QV8Engine *engine = ctx->d()->engine->v8Engine;
+ return ctx->engine()->throwTypeError();
if (r->d()->d->parent)
- return Node::create(engine, r->d()->d->parent);
+ return Node::create(scope.engine, r->d()->d->parent);
else
return Encode::null();
}
@@ -487,53 +486,45 @@ ReturnedValue NodePrototype::method_get_parentNode(CallContext *ctx)
ReturnedValue NodePrototype::method_get_childNodes(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
- QV8Engine *engine = ctx->d()->engine->v8Engine;
-
- return NodeList::create(engine, r->d()->d);
+ return NodeList::create(scope.engine, r->d()->d);
}
ReturnedValue NodePrototype::method_get_firstChild(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r)
- return ctx->throwTypeError();
-
- QV8Engine *engine = ctx->d()->engine->v8Engine;
+ return ctx->engine()->throwTypeError();
if (r->d()->d->children.isEmpty())
return Encode::null();
else
- return Node::create(engine, r->d()->d->children.first());
+ return Node::create(scope.engine, r->d()->d->children.first());
}
ReturnedValue NodePrototype::method_get_lastChild(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r)
- return ctx->throwTypeError();
-
- QV8Engine *engine = ctx->d()->engine->v8Engine;
+ return ctx->engine()->throwTypeError();
if (r->d()->d->children.isEmpty())
return Encode::null();
else
- return Node::create(engine, r->d()->d->children.last());
+ return Node::create(scope.engine, r->d()->d->children.last());
}
ReturnedValue NodePrototype::method_get_previousSibling(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r)
- return ctx->throwTypeError();
-
- QV8Engine *engine = ctx->d()->engine->v8Engine;
+ return ctx->engine()->throwTypeError();
if (!r->d()->d->parent)
return Encode::null();
@@ -543,7 +534,7 @@ ReturnedValue NodePrototype::method_get_previousSibling(CallContext *ctx)
if (ii == 0)
return Encode::null();
else
- return Node::create(engine, r->d()->d->parent->children.at(ii - 1));
+ return Node::create(scope.engine, r->d()->d->parent->children.at(ii - 1));
}
}
@@ -553,11 +544,9 @@ ReturnedValue NodePrototype::method_get_previousSibling(CallContext *ctx)
ReturnedValue NodePrototype::method_get_nextSibling(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r)
- return ctx->throwTypeError();
-
- QV8Engine *engine = ctx->d()->engine->v8Engine;
+ return ctx->engine()->throwTypeError();
if (!r->d()->d->parent)
return Encode::null();
@@ -567,7 +556,7 @@ ReturnedValue NodePrototype::method_get_nextSibling(CallContext *ctx)
if ((ii + 1) == r->d()->d->parent->children.count())
return Encode::null();
else
- return Node::create(engine, r->d()->d->parent->children.at(ii + 1));
+ return Node::create(scope.engine, r->d()->d->parent->children.at(ii + 1));
}
}
@@ -577,33 +566,30 @@ ReturnedValue NodePrototype::method_get_nextSibling(CallContext *ctx)
ReturnedValue NodePrototype::method_get_attributes(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r)
- return ctx->throwTypeError();
-
- QV8Engine *engine = ctx->d()->engine->v8Engine;
+ return ctx->engine()->throwTypeError();
if (r->d()->d->type != NodeImpl::Element)
return Encode::null();
else
- return NamedNodeMap::create(engine, r->d()->d, r->d()->d->attributes);
+ return NamedNodeMap::create(scope.engine, r->d()->d, r->d()->d->attributes);
}
ReturnedValue NodePrototype::getProto(ExecutionEngine *v4)
{
Scope scope(v4);
- QQmlXMLHttpRequestData *d = xhrdata(v4->v8Engine);
+ QQmlXMLHttpRequestData *d = xhrdata(v4);
if (d->nodePrototype.isUndefined()) {
ScopedObject p(scope, v4->memoryManager->alloc<NodePrototype>(v4));
- d->nodePrototype = p;
+ d->nodePrototype.set(v4, p);
v4->v8Engine->freezeObject(p);
}
return d->nodePrototype.value();
}
-ReturnedValue Node::create(QV8Engine *engine, NodeImpl *data)
+ReturnedValue Node::create(ExecutionEngine *v4, NodeImpl *data)
{
- ExecutionEngine *v4 = QV8Engine::getV4(engine);
Scope scope(v4);
Scoped<Node> instance(scope, v4->memoryManager->alloc<Node>(v4, data));
@@ -611,7 +597,7 @@ ReturnedValue Node::create(QV8Engine *engine, NodeImpl *data)
switch (data->type) {
case NodeImpl::Attr:
- instance->setPrototype((p = Attr::prototype(v4)).getPointer());
+ instance->setPrototype((p = Attr::prototype(v4)));
break;
case NodeImpl::Comment:
case NodeImpl::Document:
@@ -623,13 +609,13 @@ ReturnedValue Node::create(QV8Engine *engine, NodeImpl *data)
case NodeImpl::ProcessingInstruction:
return Encode::undefined();
case NodeImpl::CDATA:
- instance->setPrototype((p = CDATA::prototype(v4)).getPointer());
+ instance->setPrototype((p = CDATA::prototype(v4)));
break;
case NodeImpl::Text:
- instance->setPrototype((p = Text::prototype(v4)).getPointer());
+ instance->setPrototype((p = Text::prototype(v4)));
break;
case NodeImpl::Element:
- instance->setPrototype((p = Element::prototype(v4)).getPointer());
+ instance->setPrototype((p = Element::prototype(v4)));
break;
}
@@ -638,14 +624,14 @@ ReturnedValue Node::create(QV8Engine *engine, NodeImpl *data)
ReturnedValue Element::prototype(ExecutionEngine *engine)
{
- QQmlXMLHttpRequestData *d = xhrdata(engine->v8Engine);
+ QQmlXMLHttpRequestData *d = xhrdata(engine);
if (d->elementPrototype.isUndefined()) {
Scope scope(engine);
ScopedObject p(scope, engine->newObject());
ScopedObject pp(scope);
- p->setPrototype((pp = NodePrototype::getProto(engine)).getPointer());
+ p->setPrototype((pp = NodePrototype::getProto(engine)));
p->defineAccessorProperty(QStringLiteral("tagName"), NodePrototype::method_get_nodeName, 0);
- d->elementPrototype = p;
+ d->elementPrototype.set(engine, p);
engine->v8Engine->freezeObject(p);
}
return d->elementPrototype.value();
@@ -653,16 +639,16 @@ ReturnedValue Element::prototype(ExecutionEngine *engine)
ReturnedValue Attr::prototype(ExecutionEngine *engine)
{
- QQmlXMLHttpRequestData *d = xhrdata(engine->v8Engine);
+ QQmlXMLHttpRequestData *d = xhrdata(engine);
if (d->attrPrototype.isUndefined()) {
Scope scope(engine);
- Scoped<Object> p(scope, engine->newObject());
+ ScopedObject p(scope, engine->newObject());
ScopedObject pp(scope);
- p->setPrototype((pp = NodePrototype::getProto(engine)).getPointer());
+ p->setPrototype((pp = NodePrototype::getProto(engine)));
p->defineAccessorProperty(QStringLiteral("name"), method_name, 0);
p->defineAccessorProperty(QStringLiteral("value"), method_value, 0);
p->defineAccessorProperty(QStringLiteral("ownerElement"), method_ownerElement, 0);
- d->attrPrototype = p;
+ d->attrPrototype.set(engine, p);
engine->v8Engine->freezeObject(p);
}
return d->attrPrototype.value();
@@ -671,58 +657,54 @@ ReturnedValue Attr::prototype(ExecutionEngine *engine)
ReturnedValue Attr::method_name(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r)
return Encode::undefined();
- QV8Engine *engine = ctx->d()->engine->v8Engine;
- return engine->toString(r->d()->d->name);
+ return QV4::Encode(scope.engine->newString(r->d()->d->name));
}
ReturnedValue Attr::method_value(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r)
return Encode::undefined();
- QV8Engine *engine = ctx->d()->engine->v8Engine;
- return engine->toString(r->d()->d->data);
+ return QV4::Encode(scope.engine->newString(r->d()->d->data));
}
ReturnedValue Attr::method_ownerElement(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r)
return Encode::undefined();
- QV8Engine *engine = ctx->d()->engine->v8Engine;
- return Node::create(engine, r->d()->d->parent);
+ return Node::create(scope.engine, r->d()->d->parent);
}
ReturnedValue CharacterData::method_length(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r)
return Encode::undefined();
- QV8Engine *engine = ctx->d()->engine->v8Engine;
- Q_UNUSED(engine)
+
return Encode(r->d()->d->data.length());
}
ReturnedValue CharacterData::prototype(ExecutionEngine *v4)
{
- QQmlXMLHttpRequestData *d = xhrdata(v4->v8Engine);
+ QQmlXMLHttpRequestData *d = xhrdata(v4);
if (d->characterDataPrototype.isUndefined()) {
Scope scope(v4);
- Scoped<Object> p(scope, v4->newObject());
+ ScopedObject p(scope, v4->newObject());
ScopedObject pp(scope);
- p->setPrototype((pp = NodePrototype::getProto(v4)).getPointer());
+ p->setPrototype((pp = NodePrototype::getProto(v4)));
p->defineAccessorProperty(QStringLiteral("data"), NodePrototype::method_get_nodeValue, 0);
p->defineAccessorProperty(QStringLiteral("length"), method_length, 0);
- d->characterDataPrototype = p;
+ d->characterDataPrototype.set(v4, p);
v4->v8Engine->freezeObject(p);
}
return d->characterDataPrototype.value();
@@ -731,7 +713,7 @@ ReturnedValue CharacterData::prototype(ExecutionEngine *v4)
ReturnedValue Text::method_isElementContentWhitespace(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r) return Encode::undefined();
return Encode(r->d()->d->data.trimmed().isEmpty());
@@ -740,25 +722,24 @@ ReturnedValue Text::method_isElementContentWhitespace(CallContext *ctx)
ReturnedValue Text::method_wholeText(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r)
return Encode::undefined();
- QV8Engine *engine = ctx->d()->engine->v8Engine;
- return engine->toString(r->d()->d->data);
+ return QV4::Encode(scope.engine->newString(r->d()->d->data));
}
ReturnedValue Text::prototype(ExecutionEngine *v4)
{
- QQmlXMLHttpRequestData *d = xhrdata(v4->v8Engine);
+ QQmlXMLHttpRequestData *d = xhrdata(v4);
if (d->textPrototype.isUndefined()) {
Scope scope(v4);
- Scoped<Object> p(scope, v4->newObject());
+ ScopedObject p(scope, v4->newObject());
ScopedObject pp(scope);
- p->setPrototype((pp = CharacterData::prototype(v4)).getPointer());
+ p->setPrototype((pp = CharacterData::prototype(v4)));
p->defineAccessorProperty(QStringLiteral("isElementContentWhitespace"), method_isElementContentWhitespace, 0);
p->defineAccessorProperty(QStringLiteral("wholeText"), method_wholeText, 0);
- d->textPrototype = p;
+ d->textPrototype.set(v4, p);
v4->v8Engine->freezeObject(p);
}
return d->textPrototype.value();
@@ -767,13 +748,13 @@ ReturnedValue Text::prototype(ExecutionEngine *v4)
ReturnedValue CDATA::prototype(ExecutionEngine *v4)
{
// ### why not just use TextProto???
- QQmlXMLHttpRequestData *d = xhrdata(v4->v8Engine);
+ QQmlXMLHttpRequestData *d = xhrdata(v4);
if (d->cdataPrototype.isUndefined()) {
Scope scope(v4);
- Scoped<Object> p(scope, v4->newObject());
+ ScopedObject p(scope, v4->newObject());
ScopedObject pp(scope);
- p->setPrototype((pp = Text::prototype(v4)).getPointer());
- d->cdataPrototype = p;
+ p->setPrototype((pp = Text::prototype(v4)));
+ d->cdataPrototype.set(v4, p);
v4->v8Engine->freezeObject(p);
}
return d->cdataPrototype.value();
@@ -781,26 +762,24 @@ ReturnedValue CDATA::prototype(ExecutionEngine *v4)
ReturnedValue Document::prototype(ExecutionEngine *v4)
{
- QQmlXMLHttpRequestData *d = xhrdata(v4->v8Engine);
+ QQmlXMLHttpRequestData *d = xhrdata(v4);
if (d->documentPrototype.isUndefined()) {
Scope scope(v4);
- Scoped<Object> p(scope, v4->newObject());
+ ScopedObject p(scope, v4->newObject());
ScopedObject pp(scope);
- p->setPrototype((pp = NodePrototype::getProto(v4)).getPointer());
+ p->setPrototype((pp = NodePrototype::getProto(v4)));
p->defineAccessorProperty(QStringLiteral("xmlVersion"), method_xmlVersion, 0);
p->defineAccessorProperty(QStringLiteral("xmlEncoding"), method_xmlEncoding, 0);
p->defineAccessorProperty(QStringLiteral("xmlStandalone"), method_xmlStandalone, 0);
p->defineAccessorProperty(QStringLiteral("documentElement"), method_documentElement, 0);
- d->documentPrototype = p;
+ d->documentPrototype.set(v4, p);
v4->v8Engine->freezeObject(p);
}
return d->documentPrototype.value();
}
-ReturnedValue Document::load(QV8Engine *engine, const QByteArray &data)
+ReturnedValue Document::load(ExecutionEngine *v4, const QByteArray &data)
{
- Q_ASSERT(engine);
- ExecutionEngine *v4 = QV8Engine::getV4(engine);
Scope scope(v4);
DocumentImpl *document = 0;
@@ -883,7 +862,7 @@ ReturnedValue Document::load(QV8Engine *engine, const QByteArray &data)
ScopedObject instance(scope, v4->memoryManager->alloc<Node>(v4, document));
ScopedObject p(scope);
- instance->setPrototype((p = Document::prototype(v4)).getPointer());
+ instance->setPrototype((p = Document::prototype(v4)));
return instance.asReturnedValue();
}
@@ -894,20 +873,14 @@ bool Node::isNull() const
ReturnedValue NamedNodeMap::getIndexed(Managed *m, uint index, bool *hasProperty)
{
- QV4::ExecutionEngine *v4 = m->engine();
- NamedNodeMap *r = m->as<NamedNodeMap>();
- if (!r) {
- if (hasProperty)
- *hasProperty = false;
- return v4->currentContext()->throwTypeError();
- }
-
- QV8Engine *engine = v4->v8Engine;
+ Q_ASSERT(m->as<NamedNodeMap>());
+ NamedNodeMap *r = static_cast<NamedNodeMap *>(m);
+ QV4::ExecutionEngine *v4 = r->engine();
if ((int)index < r->d()->list.count()) {
if (hasProperty)
*hasProperty = true;
- return Node::create(engine, r->d()->list.at(index));
+ return Node::create(v4, r->d()->list.at(index));
}
if (hasProperty)
*hasProperty = false;
@@ -918,20 +891,18 @@ ReturnedValue NamedNodeMap::get(Managed *m, String *name, bool *hasProperty)
{
Q_ASSERT(m->as<NamedNodeMap>());
NamedNodeMap *r = static_cast<NamedNodeMap *>(m);
- QV4::ExecutionEngine *v4 = m->engine();
+ QV4::ExecutionEngine *v4 = r->engine();
- name->makeIdentifier();
+ name->makeIdentifier(v4);
if (name->equals(v4->id_length))
return Primitive::fromInt32(r->d()->list.count()).asReturnedValue();
- QV8Engine *engine = v4->v8Engine;
-
QString str = name->toQString();
for (int ii = 0; ii < r->d()->list.count(); ++ii) {
if (r->d()->list.at(ii)->name == str) {
if (hasProperty)
*hasProperty = true;
- return Node::create(engine, r->d()->list.at(ii));
+ return Node::create(v4, r->d()->list.at(ii));
}
}
@@ -940,24 +911,21 @@ ReturnedValue NamedNodeMap::get(Managed *m, String *name, bool *hasProperty)
return Encode::undefined();
}
-ReturnedValue NamedNodeMap::create(QV8Engine *engine, NodeImpl *data, const QList<NodeImpl *> &list)
+ReturnedValue NamedNodeMap::create(ExecutionEngine *v4, NodeImpl *data, const QList<NodeImpl *> &list)
{
- ExecutionEngine *v4 = QV8Engine::getV4(engine);
return (v4->memoryManager->alloc<NamedNodeMap>(v4, data, list))->asReturnedValue();
}
ReturnedValue NodeList::getIndexed(Managed *m, uint index, bool *hasProperty)
{
Q_ASSERT(m->as<NodeList>());
- QV4::ExecutionEngine *v4 = m->engine();
NodeList *r = static_cast<NodeList *>(m);
-
- QV8Engine *engine = v4->v8Engine;
+ QV4::ExecutionEngine *v4 = r->engine();
if ((int)index < r->d()->d->children.count()) {
if (hasProperty)
*hasProperty = true;
- return Node::create(engine, r->d()->d->children.at(index));
+ return Node::create(v4, r->d()->d->children.at(index));
}
if (hasProperty)
*hasProperty = false;
@@ -967,75 +935,74 @@ ReturnedValue NodeList::getIndexed(Managed *m, uint index, bool *hasProperty)
ReturnedValue NodeList::get(Managed *m, String *name, bool *hasProperty)
{
Q_ASSERT(m->as<NodeList>());
- QV4::ExecutionEngine *v4 = m->engine();
NodeList *r = static_cast<NodeList *>(m);
+ QV4::ExecutionEngine *v4 = r->engine();
- name->makeIdentifier();
+ name->makeIdentifier(v4);
if (name->equals(v4->id_length))
return Primitive::fromInt32(r->d()->d->children.count()).asReturnedValue();
return Object::get(m, name, hasProperty);
}
-ReturnedValue NodeList::create(QV8Engine *engine, NodeImpl *data)
+ReturnedValue NodeList::create(ExecutionEngine *v4, NodeImpl *data)
{
- ExecutionEngine *v4 = QV8Engine::getV4(engine);
return (v4->memoryManager->alloc<NodeList>(v4, data))->asReturnedValue();
}
ReturnedValue Document::method_documentElement(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r || r->d()->d->type != NodeImpl::Document)
return Encode::undefined();
- QV8Engine *engine = ctx->d()->engine->v8Engine;
- return Node::create(engine, static_cast<DocumentImpl *>(r->d()->d)->root);
+ return Node::create(scope.engine, static_cast<DocumentImpl *>(r->d()->d)->root);
}
ReturnedValue Document::method_xmlStandalone(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r || r->d()->d->type != NodeImpl::Document)
return Encode::undefined();
- QV8Engine *engine = ctx->d()->engine->v8Engine;
- Q_UNUSED(engine)
+
return Encode(static_cast<DocumentImpl *>(r->d()->d)->isStandalone);
}
ReturnedValue Document::method_xmlVersion(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r || r->d()->d->type != NodeImpl::Document)
return Encode::undefined();
- QV8Engine *engine = ctx->d()->engine->v8Engine;
- return engine->toString(static_cast<DocumentImpl *>(r->d()->d)->version);
+ return QV4::Encode(scope.engine->newString(static_cast<DocumentImpl *>(r->d()->d)->version));
}
ReturnedValue Document::method_xmlEncoding(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<Node> r(scope, ctx->d()->callData->thisObject.as<Node>());
+ Scoped<Node> r(scope, ctx->thisObject().as<Node>());
if (!r || r->d()->d->type != NodeImpl::Document)
return Encode::undefined();
- QV8Engine *engine = ctx->d()->engine->v8Engine;
- return engine->toString(static_cast<DocumentImpl *>(r->d()->d)->encoding);
+ return QV4::Encode(scope.engine->newString(static_cast<DocumentImpl *>(r->d()->d)->encoding));
}
class QQmlXMLHttpRequest : public QObject
{
Q_OBJECT
public:
+ enum LoadType {
+ AsynchronousLoad,
+ SynchronousLoad
+ };
enum State { Unsent = 0,
Opened = 1, HeadersReceived = 2,
Loading = 3, Done = 4 };
- QQmlXMLHttpRequest(QV8Engine *engine, QNetworkAccessManager *manager);
+ QQmlXMLHttpRequest(ExecutionEngine *engine, QNetworkAccessManager *manager);
virtual ~QQmlXMLHttpRequest();
bool sendFlag() const;
@@ -1044,9 +1011,9 @@ public:
int replyStatus() const;
QString replyStatusText() const;
- ReturnedValue open(const ValueRef me, const QString &, const QUrl &);
- ReturnedValue send(const ValueRef me, const QByteArray &);
- ReturnedValue abort(const ValueRef me);
+ ReturnedValue open(const Value &me, const QString &, const QUrl &, LoadType);
+ ReturnedValue send(const Value &me, const QByteArray &);
+ ReturnedValue abort(const Value &me);
void addHeader(const QString &, const QString &);
QString header(const QString &name);
@@ -1056,6 +1023,9 @@ public:
QString responseBody();
const QByteArray & rawResponseBody() const;
bool receivedXml() const;
+
+ const QString & responseType() const;
+ void setResponseType(const QString &);
private slots:
void readyRead();
void error(QNetworkReply::NetworkError);
@@ -1089,11 +1059,11 @@ private:
void readEncoding();
ReturnedValue getMe() const;
- void setMe(const ValueRef me);
+ void setMe(const Value &me);
PersistentValue m_me;
- void dispatchCallbackImpl(const ValueRef me);
- void dispatchCallback(const ValueRef me);
+ void dispatchCallbackImpl(const Value &me);
+ void dispatchCallback(const Value &me);
int m_status;
QString m_statusText;
@@ -1104,12 +1074,15 @@ private:
QNetworkAccessManager *m_nam;
QNetworkAccessManager *networkAccessManager() { return m_nam; }
+
+ QString m_responseType;
};
-QQmlXMLHttpRequest::QQmlXMLHttpRequest(QV8Engine *engine, QNetworkAccessManager *manager)
- : v4(QV8Engine::getV4(engine))
+QQmlXMLHttpRequest::QQmlXMLHttpRequest(ExecutionEngine *engine, QNetworkAccessManager *manager)
+ : v4(engine)
, m_state(Unsent), m_errorFlag(false), m_sendFlag(false)
, m_redirectCount(0), m_gotXml(false), m_textCodec(0), m_network(0), m_nam(manager)
+ , m_responseType()
{
}
@@ -1143,7 +1116,7 @@ QString QQmlXMLHttpRequest::replyStatusText() const
return m_statusText;
}
-ReturnedValue QQmlXMLHttpRequest::open(const ValueRef me, const QString &method, const QUrl &url)
+ReturnedValue QQmlXMLHttpRequest::open(const Value &me, const QString &method, const QUrl &url, LoadType loadType)
{
destroyNetwork();
m_sendFlag = false;
@@ -1151,6 +1124,7 @@ ReturnedValue QQmlXMLHttpRequest::open(const ValueRef me, const QString &method,
m_responseEntityBody = QByteArray();
m_method = method;
m_url = url;
+ m_request.setAttribute(QNetworkRequest::SynchronousRequestAttribute, loadType == SynchronousLoad);
m_state = Opened;
m_addedHeaders.clear();
dispatchCallback(me);
@@ -1249,26 +1223,45 @@ void QQmlXMLHttpRequest::requestFromUrl(const QUrl &url)
}
}
- if (m_method == QLatin1String("GET"))
+ if (m_method == QLatin1String("GET")) {
m_network = networkAccessManager()->get(request);
- else if (m_method == QLatin1String("HEAD"))
+ } else if (m_method == QLatin1String("HEAD")) {
m_network = networkAccessManager()->head(request);
- else if (m_method == QLatin1String("POST"))
+ } else if (m_method == QLatin1String("POST")) {
m_network = networkAccessManager()->post(request, m_data);
- else if (m_method == QLatin1String("PUT"))
+ } else if (m_method == QLatin1String("PUT")) {
m_network = networkAccessManager()->put(request, m_data);
- else if (m_method == QLatin1String("DELETE"))
+ } else if (m_method == QLatin1String("DELETE")) {
m_network = networkAccessManager()->deleteResource(request);
+ } else if (m_method == QLatin1String("OPTIONS")) {
+ QBuffer *buffer = new QBuffer;
+ buffer->setData(m_data);
+ buffer->open(QIODevice::ReadOnly);
+ m_network = networkAccessManager()->sendCustomRequest(request, QByteArrayLiteral("OPTIONS"), buffer);
+ buffer->setParent(m_network);
+ }
+
+ if (m_request.attribute(QNetworkRequest::SynchronousRequestAttribute).toBool()) {
+ if (m_network->bytesAvailable() > 0)
+ readyRead();
- QObject::connect(m_network, SIGNAL(readyRead()),
- this, SLOT(readyRead()));
- QObject::connect(m_network, SIGNAL(error(QNetworkReply::NetworkError)),
- this, SLOT(error(QNetworkReply::NetworkError)));
- QObject::connect(m_network, SIGNAL(finished()),
- this, SLOT(finished()));
+ QNetworkReply::NetworkError networkError = m_network->error();
+ if (networkError != QNetworkReply::NoError) {
+ error(networkError);
+ } else {
+ finished();
+ }
+ } else {
+ QObject::connect(m_network, SIGNAL(readyRead()),
+ this, SLOT(readyRead()));
+ QObject::connect(m_network, SIGNAL(error(QNetworkReply::NetworkError)),
+ this, SLOT(error(QNetworkReply::NetworkError)));
+ QObject::connect(m_network, SIGNAL(finished()),
+ this, SLOT(finished()));
+ }
}
-ReturnedValue QQmlXMLHttpRequest::send(const ValueRef me, const QByteArray &data)
+ReturnedValue QQmlXMLHttpRequest::send(const Value &me, const QByteArray &data)
{
m_errorFlag = false;
m_sendFlag = true;
@@ -1282,7 +1275,7 @@ ReturnedValue QQmlXMLHttpRequest::send(const ValueRef me, const QByteArray &data
return Encode::undefined();
}
-ReturnedValue QQmlXMLHttpRequest::abort(const ValueRef me)
+ReturnedValue QQmlXMLHttpRequest::abort(const Value &me)
{
destroyNetwork();
m_responseEntityBody = QByteArray();
@@ -1308,9 +1301,9 @@ ReturnedValue QQmlXMLHttpRequest::getMe() const
return m_me.value();
}
-void QQmlXMLHttpRequest::setMe(const ValueRef me)
+void QQmlXMLHttpRequest::setMe(const Value &me)
{
- m_me = me;
+ m_me.set(v4, me);
}
void QQmlXMLHttpRequest::readyRead()
@@ -1417,7 +1410,7 @@ void QQmlXMLHttpRequest::finished()
if (m_state < HeadersReceived) {
m_state = HeadersReceived;
fillHeadersList ();
- dispatchCallback(m_me);
+ dispatchCallback(*m_me.valueRef());
}
m_responseEntityBody.append(m_network->readAll());
readEncoding();
@@ -1434,11 +1427,11 @@ void QQmlXMLHttpRequest::finished()
destroyNetwork();
if (m_state < Loading) {
m_state = Loading;
- dispatchCallback(m_me);
+ dispatchCallback(*m_me.valueRef());
}
m_state = Done;
- dispatchCallback(m_me);
+ dispatchCallback(*m_me.valueRef());
Scope scope(v4);
ScopedValue v(scope, Primitive::undefinedValue());
@@ -1475,6 +1468,16 @@ bool QQmlXMLHttpRequest::receivedXml() const
return m_gotXml;
}
+const QString & QQmlXMLHttpRequest::responseType() const
+{
+ return m_responseType;
+}
+
+void QQmlXMLHttpRequest::setResponseType(const QString &responseType)
+{
+ m_responseType = responseType;
+}
+
#ifndef QT_NO_TEXTCODEC
QTextCodec* QQmlXMLHttpRequest::findTextCodec() const
@@ -1520,40 +1523,39 @@ const QByteArray &QQmlXMLHttpRequest::rawResponseBody() const
return m_responseEntityBody;
}
-void QQmlXMLHttpRequest::dispatchCallbackImpl(const ValueRef me)
+void QQmlXMLHttpRequest::dispatchCallbackImpl(const Value &me)
{
- ExecutionContext *ctx = v4->currentContext();
QV4::Scope scope(v4);
- Scoped<Object> o(scope, me);
+ ScopedObject o(scope, me);
if (!o) {
- ctx->throwError(QStringLiteral("QQmlXMLHttpRequest: internal error: empty ThisObject"));
+ v4->throwError(QStringLiteral("QQmlXMLHttpRequest: internal error: empty ThisObject"));
return;
}
ScopedString s(scope, v4->newString(QStringLiteral("ThisObject")));
- Scoped<Object> thisObj(scope, o->get(s.getPointer()));
+ ScopedObject thisObj(scope, o->get(s));
if (!thisObj) {
- ctx->throwError(QStringLiteral("QQmlXMLHttpRequest: internal error: empty ThisObject"));
+ v4->throwError(QStringLiteral("QQmlXMLHttpRequest: internal error: empty ThisObject"));
return;
}
s = v4->newString(QStringLiteral("onreadystatechange"));
- Scoped<FunctionObject> callback(scope, thisObj->get(s.getPointer()));
+ ScopedFunctionObject callback(scope, thisObj->get(s));
if (!callback) {
// not an error, but no onreadystatechange function to call.
return;
}
s = v4->newString(QStringLiteral("ActivationObject"));
- Scoped<Object> activationObject(scope, o->get(s.getPointer()));
+ ScopedObject activationObject(scope, o->get(s));
if (!activationObject) {
- v4->currentContext()->throwError(QStringLiteral("QQmlXMLHttpRequest: internal error: empty ActivationObject"));
+ v4->throwError(QStringLiteral("QQmlXMLHttpRequest: internal error: empty ActivationObject"));
return;
}
QQmlContextData *callingContext = QmlContextWrapper::getContext(activationObject);
if (callingContext) {
- QV4::ScopedCallData callData(scope, 0);
+ QV4::ScopedCallData callData(scope);
callData->thisObject = activationObject.asReturnedValue();
callback->call(callData);
}
@@ -1565,13 +1567,12 @@ void QQmlXMLHttpRequest::dispatchCallbackImpl(const ValueRef me)
}
-void QQmlXMLHttpRequest::dispatchCallback(const ValueRef me)
+void QQmlXMLHttpRequest::dispatchCallback(const Value &me)
{
- ExecutionContext *ctx = v4->currentContext();
dispatchCallbackImpl(me);
if (v4->hasException) {
- QQmlError error = QV4::ExecutionEngine::catchExceptionAsQmlError(ctx);
- QQmlEnginePrivate::warning(QQmlEnginePrivate::get(v4->v8Engine->engine()), error);
+ QQmlError error = v4->catchExceptionAsQmlError();
+ QQmlEnginePrivate::warning(QQmlEnginePrivate::get(v4->qmlEngine()), error);
}
}
@@ -1584,70 +1585,57 @@ void QQmlXMLHttpRequest::destroyNetwork()
}
}
+namespace QV4 {
+namespace Heap {
+
+struct QQmlXMLHttpRequestWrapper : Object {
+ QQmlXMLHttpRequestWrapper(ExecutionEngine *engine, QQmlXMLHttpRequest *request);
+ ~QQmlXMLHttpRequestWrapper() {
+ delete request;
+ }
+ QQmlXMLHttpRequest *request;
+};
+
+struct QQmlXMLHttpRequestCtor : FunctionObject {
+ QQmlXMLHttpRequestCtor(ExecutionEngine *engine);
+
+ Object *proto;
+};
+
+}
struct QQmlXMLHttpRequestWrapper : public Object
{
- struct Data : Object::Data {
- Data(ExecutionEngine *engine, QQmlXMLHttpRequest *request)
- : Object::Data(engine)
- , request(request)
- {
- setVTable(staticVTable());
- }
- ~Data() {
- delete request;
- }
- QQmlXMLHttpRequest *request;
- };
- V4_OBJECT(Object)
-
- static void destroy(Managed *that) {
- static_cast<QQmlXMLHttpRequestWrapper *>(that)->d()->~Data();
- }
+ V4_OBJECT2(QQmlXMLHttpRequestWrapper, Object)
+ V4_NEEDS_DESTROY
};
-DEFINE_OBJECT_VTABLE(QQmlXMLHttpRequestWrapper);
+Heap::QQmlXMLHttpRequestWrapper::QQmlXMLHttpRequestWrapper(ExecutionEngine *engine, QQmlXMLHttpRequest *request)
+ : Heap::Object(engine)
+ , request(request)
+{
+}
struct QQmlXMLHttpRequestCtor : public FunctionObject
{
- struct Data : FunctionObject::Data {
- Data(ExecutionEngine *engine)
- : FunctionObject::Data(engine->rootContext, QStringLiteral("XMLHttpRequest"))
- {
- setVTable(staticVTable());
- Scope scope(engine);
- Scoped<QQmlXMLHttpRequestCtor> ctor(scope, this);
-
- ctor->defineReadonlyProperty(QStringLiteral("UNSENT"), Primitive::fromInt32(0));
- ctor->defineReadonlyProperty(QStringLiteral("OPENED"), Primitive::fromInt32(1));
- ctor->defineReadonlyProperty(QStringLiteral("HEADERS_RECEIVED"), Primitive::fromInt32(2));
- ctor->defineReadonlyProperty(QStringLiteral("LOADING"), Primitive::fromInt32(3));
- ctor->defineReadonlyProperty(QStringLiteral("DONE"), Primitive::fromInt32(4));
- if (!ctor->d()->proto)
- ctor->setupProto();
- ScopedString s(scope, engine->id_prototype);
- ctor->defineDefaultProperty(s.getPointer(), ScopedObject(scope, ctor->d()->proto));
- }
- Object *proto;
- };
- V4_OBJECT(FunctionObject)
- static void markObjects(Managed *that, ExecutionEngine *e) {
- QQmlXMLHttpRequestCtor *c = static_cast<QQmlXMLHttpRequestCtor *>(that);
- if (c->d()->proto)
- c->d()->proto->mark(e);
+ V4_OBJECT2(QQmlXMLHttpRequestCtor, FunctionObject)
+ static void markObjects(Heap::Base *that, ExecutionEngine *e) {
+ QQmlXMLHttpRequestCtor::Data *c = static_cast<QQmlXMLHttpRequestCtor::Data *>(that);
+ if (c->proto)
+ c->proto->mark(e);
FunctionObject::markObjects(that, e);
}
static ReturnedValue construct(Managed *that, QV4::CallData *)
{
- Scope scope(that->engine());
+ Scope scope(static_cast<QQmlXMLHttpRequestCtor *>(that)->engine());
Scoped<QQmlXMLHttpRequestCtor> ctor(scope, that->as<QQmlXMLHttpRequestCtor>());
if (!ctor)
- return that->engine()->currentContext()->throwTypeError();
+ return scope.engine->throwTypeError();
- QV8Engine *engine = that->engine()->v8Engine;
- QQmlXMLHttpRequest *r = new QQmlXMLHttpRequest(engine, engine->networkAccessManager());
- Scoped<QQmlXMLHttpRequestWrapper> w(scope, that->engine()->memoryManager->alloc<QQmlXMLHttpRequestWrapper>(that->engine(), r));
- w->setPrototype(ctor->d()->proto);
+ QQmlXMLHttpRequest *r = new QQmlXMLHttpRequest(scope.engine, scope.engine->v8Engine->networkAccessManager());
+ Scoped<QQmlXMLHttpRequestWrapper> w(scope, scope.engine->memoryManager->alloc<QQmlXMLHttpRequestWrapper>(scope.engine, r));
+ ScopedObject proto(scope, ctor->d()->proto);
+ w->setPrototype(proto);
return w.asReturnedValue();
}
@@ -1669,38 +1657,66 @@ struct QQmlXMLHttpRequestCtor : public FunctionObject
static ReturnedValue method_get_statusText(CallContext *ctx);
static ReturnedValue method_get_responseText(CallContext *ctx);
static ReturnedValue method_get_responseXML(CallContext *ctx);
+ static ReturnedValue method_get_response(CallContext *ctx);
+ static ReturnedValue method_get_responseType(CallContext *ctx);
+ static ReturnedValue method_set_responseType(CallContext *ctx);
};
+}
+
+DEFINE_OBJECT_VTABLE(QQmlXMLHttpRequestWrapper);
+
+Heap::QQmlXMLHttpRequestCtor::QQmlXMLHttpRequestCtor(ExecutionEngine *engine)
+ : Heap::FunctionObject(engine->rootContext(), QStringLiteral("XMLHttpRequest"))
+{
+ Scope scope(engine);
+ Scoped<QV4::QQmlXMLHttpRequestCtor> ctor(scope, this);
+
+ ctor->defineReadonlyProperty(QStringLiteral("UNSENT"), Primitive::fromInt32(0));
+ ctor->defineReadonlyProperty(QStringLiteral("OPENED"), Primitive::fromInt32(1));
+ ctor->defineReadonlyProperty(QStringLiteral("HEADERS_RECEIVED"), Primitive::fromInt32(2));
+ ctor->defineReadonlyProperty(QStringLiteral("LOADING"), Primitive::fromInt32(3));
+ ctor->defineReadonlyProperty(QStringLiteral("DONE"), Primitive::fromInt32(4));
+ if (!ctor->d()->proto)
+ ctor->setupProto();
+ ScopedString s(scope, engine->id_prototype);
+ ctor->defineDefaultProperty(s, ScopedObject(scope, ctor->d()->proto));
+}
+
DEFINE_OBJECT_VTABLE(QQmlXMLHttpRequestCtor);
void QQmlXMLHttpRequestCtor::setupProto()
{
ExecutionEngine *v4 = engine();
Scope scope(v4);
- Scoped<Object> p(scope, v4->newObject());
- d()->proto = p.getPointer();
+ ScopedObject p(scope, v4->newObject());
+ d()->proto = p->d();
// Methods
- d()->proto->defineDefaultProperty(QStringLiteral("open"), method_open);
- d()->proto->defineDefaultProperty(QStringLiteral("setRequestHeader"), method_setRequestHeader);
- d()->proto->defineDefaultProperty(QStringLiteral("send"), method_send);
- d()->proto->defineDefaultProperty(QStringLiteral("abort"), method_abort);
- d()->proto->defineDefaultProperty(QStringLiteral("getResponseHeader"), method_getResponseHeader);
- d()->proto->defineDefaultProperty(QStringLiteral("getAllResponseHeaders"), method_getAllResponseHeaders);
+ p->defineDefaultProperty(QStringLiteral("open"), method_open);
+ p->defineDefaultProperty(QStringLiteral("setRequestHeader"), method_setRequestHeader);
+ p->defineDefaultProperty(QStringLiteral("send"), method_send);
+ p->defineDefaultProperty(QStringLiteral("abort"), method_abort);
+ p->defineDefaultProperty(QStringLiteral("getResponseHeader"), method_getResponseHeader);
+ p->defineDefaultProperty(QStringLiteral("getAllResponseHeaders"), method_getAllResponseHeaders);
// Read-only properties
- d()->proto->defineAccessorProperty(QStringLiteral("readyState"), method_get_readyState, 0);
- d()->proto->defineAccessorProperty(QStringLiteral("status"),method_get_status, 0);
- d()->proto->defineAccessorProperty(QStringLiteral("statusText"),method_get_statusText, 0);
- d()->proto->defineAccessorProperty(QStringLiteral("responseText"),method_get_responseText, 0);
- d()->proto->defineAccessorProperty(QStringLiteral("responseXML"),method_get_responseXML, 0);
+ p->defineAccessorProperty(QStringLiteral("readyState"), method_get_readyState, 0);
+ p->defineAccessorProperty(QStringLiteral("status"),method_get_status, 0);
+ p->defineAccessorProperty(QStringLiteral("statusText"),method_get_statusText, 0);
+ p->defineAccessorProperty(QStringLiteral("responseText"),method_get_responseText, 0);
+ p->defineAccessorProperty(QStringLiteral("responseXML"),method_get_responseXML, 0);
+ p->defineAccessorProperty(QStringLiteral("response"),method_get_response, 0);
+
+ // Read-write properties
+ p->defineAccessorProperty(QStringLiteral("responseType"), method_get_responseType, method_set_responseType);
// State values
- d()->proto->defineReadonlyProperty(QStringLiteral("UNSENT"), Primitive::fromInt32(0));
- d()->proto->defineReadonlyProperty(QStringLiteral("OPENED"), Primitive::fromInt32(1));
- d()->proto->defineReadonlyProperty(QStringLiteral("HEADERS_RECEIVED"), Primitive::fromInt32(2));
- d()->proto->defineReadonlyProperty(QStringLiteral("LOADING"), Primitive::fromInt32(3));
- d()->proto->defineReadonlyProperty(QStringLiteral("DONE"), Primitive::fromInt32(4));
+ p->defineReadonlyProperty(QStringLiteral("UNSENT"), Primitive::fromInt32(0));
+ p->defineReadonlyProperty(QStringLiteral("OPENED"), Primitive::fromInt32(1));
+ p->defineReadonlyProperty(QStringLiteral("HEADERS_RECEIVED"), Primitive::fromInt32(2));
+ p->defineReadonlyProperty(QStringLiteral("LOADING"), Primitive::fromInt32(3));
+ p->defineReadonlyProperty(QStringLiteral("DONE"), Primitive::fromInt32(4));
}
@@ -1708,41 +1724,42 @@ void QQmlXMLHttpRequestCtor::setupProto()
ReturnedValue QQmlXMLHttpRequestCtor::method_open(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->d()->callData->thisObject.as<QQmlXMLHttpRequestWrapper>());
+ Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->thisObject().as<QQmlXMLHttpRequestWrapper>());
if (!w)
V4THROW_REFERENCE("Not an XMLHttpRequest object");
QQmlXMLHttpRequest *r = w->d()->request;
- if (ctx->d()->callData->argc < 2 || ctx->d()->callData->argc > 5)
+ if (ctx->argc() < 2 || ctx->argc() > 5)
V4THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Incorrect argument count");
- QV8Engine *engine = ctx->d()->engine->v8Engine;
-
// Argument 0 - Method
- QString method = ctx->d()->callData->args[0].toQStringNoThrow().toUpper();
+ QString method = ctx->args()[0].toQStringNoThrow().toUpper();
if (method != QLatin1String("GET") &&
method != QLatin1String("PUT") &&
method != QLatin1String("HEAD") &&
method != QLatin1String("POST") &&
- method != QLatin1String("DELETE"))
+ method != QLatin1String("DELETE") &&
+ method != QLatin1String("OPTIONS"))
V4THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Unsupported HTTP method type");
// Argument 1 - URL
- QUrl url = QUrl(ctx->d()->callData->args[1].toQStringNoThrow());
+ QUrl url = QUrl(ctx->args()[1].toQStringNoThrow());
if (url.isRelative())
- url = engine->callingContext()->resolvedUrl(url);
+ url = scope.engine->v8Engine->callingContext()->resolvedUrl(url);
+ bool async = true;
// Argument 2 - async (optional)
- if (ctx->d()->callData->argc > 2 && !ctx->d()->callData->args[2].booleanValue())
- V4THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "Synchronous XMLHttpRequest calls are not supported");
+ if (ctx->argc() > 2) {
+ async = ctx->args()[2].booleanValue();
+ }
// Argument 3/4 - user/pass (optional)
QString username, password;
- if (ctx->d()->callData->argc > 3)
- username = ctx->d()->callData->args[3].toQStringNoThrow();
- if (ctx->d()->callData->argc > 4)
- password = ctx->d()->callData->args[4].toQStringNoThrow();
+ if (ctx->argc() > 3)
+ username = ctx->args()[3].toQStringNoThrow();
+ if (ctx->argc() > 4)
+ password = ctx->args()[4].toQStringNoThrow();
// Clear the fragment (if any)
url.setFragment(QString());
@@ -1751,26 +1768,26 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_open(CallContext *ctx)
if (!username.isNull()) url.setUserName(username);
if (!password.isNull()) url.setPassword(password);
- ScopedValue meObject(scope, constructMeObject(ctx->d()->callData->thisObject, engine));
- return r->open(meObject, method, url);
+ ScopedValue meObject(scope, constructMeObject(ctx->thisObject(), scope.engine));
+ return r->open(meObject, method, url, async ? QQmlXMLHttpRequest::AsynchronousLoad : QQmlXMLHttpRequest::SynchronousLoad);
}
ReturnedValue QQmlXMLHttpRequestCtor::method_setRequestHeader(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->d()->callData->thisObject.as<QQmlXMLHttpRequestWrapper>());
+ Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->thisObject().as<QQmlXMLHttpRequestWrapper>());
if (!w)
V4THROW_REFERENCE("Not an XMLHttpRequest object");
QQmlXMLHttpRequest *r = w->d()->request;
- if (ctx->d()->callData->argc != 2)
+ if (ctx->argc() != 2)
V4THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Incorrect argument count");
if (r->readyState() != QQmlXMLHttpRequest::Opened || r->sendFlag())
V4THROW_DOM(DOMEXCEPTION_INVALID_STATE_ERR, "Invalid state");
- QString name = ctx->d()->callData->args[0].toQStringNoThrow();
- QString value = ctx->d()->callData->args[1].toQStringNoThrow();
+ QString name = ctx->args()[0].toQStringNoThrow();
+ QString value = ctx->args()[1].toQStringNoThrow();
// ### Check that name and value are well formed
@@ -1805,48 +1822,44 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_setRequestHeader(CallContext *ctx)
ReturnedValue QQmlXMLHttpRequestCtor::method_send(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->d()->callData->thisObject.as<QQmlXMLHttpRequestWrapper>());
+ Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->thisObject().as<QQmlXMLHttpRequestWrapper>());
if (!w)
V4THROW_REFERENCE("Not an XMLHttpRequest object");
QQmlXMLHttpRequest *r = w->d()->request;
- QV8Engine *engine = ctx->d()->engine->v8Engine;
-
if (r->readyState() != QQmlXMLHttpRequest::Opened ||
r->sendFlag())
V4THROW_DOM(DOMEXCEPTION_INVALID_STATE_ERR, "Invalid state");
QByteArray data;
- if (ctx->d()->callData->argc > 0)
- data = ctx->d()->callData->args[0].toQStringNoThrow().toUtf8();
+ if (ctx->argc() > 0)
+ data = ctx->args()[0].toQStringNoThrow().toUtf8();
- ScopedValue meObject(scope, constructMeObject(ctx->d()->callData->thisObject, engine));
+ ScopedValue meObject(scope, constructMeObject(ctx->thisObject(), scope.engine));
return r->send(meObject, data);
}
ReturnedValue QQmlXMLHttpRequestCtor::method_abort(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->d()->callData->thisObject.as<QQmlXMLHttpRequestWrapper>());
+ Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->thisObject().as<QQmlXMLHttpRequestWrapper>());
if (!w)
V4THROW_REFERENCE("Not an XMLHttpRequest object");
QQmlXMLHttpRequest *r = w->d()->request;
- ScopedValue meObject(scope, constructMeObject(ctx->d()->callData->thisObject, ctx->d()->engine->v8Engine));
+ ScopedValue meObject(scope, constructMeObject(ctx->thisObject(), scope.engine));
return r->abort(meObject);
}
ReturnedValue QQmlXMLHttpRequestCtor::method_getResponseHeader(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->d()->callData->thisObject.as<QQmlXMLHttpRequestWrapper>());
+ Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->thisObject().as<QQmlXMLHttpRequestWrapper>());
if (!w)
V4THROW_REFERENCE("Not an XMLHttpRequest object");
QQmlXMLHttpRequest *r = w->d()->request;
- QV8Engine *engine = ctx->d()->engine->v8Engine;
-
- if (ctx->d()->callData->argc != 1)
+ if (ctx->argc() != 1)
V4THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Incorrect argument count");
if (r->readyState() != QQmlXMLHttpRequest::Loading &&
@@ -1854,20 +1867,18 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_getResponseHeader(CallContext *ctx)
r->readyState() != QQmlXMLHttpRequest::HeadersReceived)
V4THROW_DOM(DOMEXCEPTION_INVALID_STATE_ERR, "Invalid state");
- return engine->toString(r->header(ctx->d()->callData->args[0].toQStringNoThrow()));
+ return QV4::Encode(scope.engine->newString(r->header(ctx->args()[0].toQStringNoThrow())));
}
ReturnedValue QQmlXMLHttpRequestCtor::method_getAllResponseHeaders(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->d()->callData->thisObject.as<QQmlXMLHttpRequestWrapper>());
+ Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->thisObject().as<QQmlXMLHttpRequestWrapper>());
if (!w)
V4THROW_REFERENCE("Not an XMLHttpRequest object");
QQmlXMLHttpRequest *r = w->d()->request;
- QV8Engine *engine = ctx->d()->engine->v8Engine;
-
- if (ctx->d()->callData->argc != 0)
+ if (ctx->argc() != 0)
V4THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Incorrect argument count");
if (r->readyState() != QQmlXMLHttpRequest::Loading &&
@@ -1875,14 +1886,14 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_getAllResponseHeaders(CallContext *
r->readyState() != QQmlXMLHttpRequest::HeadersReceived)
V4THROW_DOM(DOMEXCEPTION_INVALID_STATE_ERR, "Invalid state");
- return engine->toString(r->headers());
+ return QV4::Encode(scope.engine->newString(r->headers()));
}
// XMLHttpRequest properties
ReturnedValue QQmlXMLHttpRequestCtor::method_get_readyState(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->d()->callData->thisObject.as<QQmlXMLHttpRequestWrapper>());
+ Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->thisObject().as<QQmlXMLHttpRequestWrapper>());
if (!w)
V4THROW_REFERENCE("Not an XMLHttpRequest object");
QQmlXMLHttpRequest *r = w->d()->request;
@@ -1893,7 +1904,7 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_get_readyState(CallContext *ctx)
ReturnedValue QQmlXMLHttpRequestCtor::method_get_status(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->d()->callData->thisObject.as<QQmlXMLHttpRequestWrapper>());
+ Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->thisObject().as<QQmlXMLHttpRequestWrapper>());
if (!w)
V4THROW_REFERENCE("Not an XMLHttpRequest object");
QQmlXMLHttpRequest *r = w->d()->request;
@@ -1911,44 +1922,40 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_get_status(CallContext *ctx)
ReturnedValue QQmlXMLHttpRequestCtor::method_get_statusText(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->d()->callData->thisObject.as<QQmlXMLHttpRequestWrapper>());
+ Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->thisObject().as<QQmlXMLHttpRequestWrapper>());
if (!w)
V4THROW_REFERENCE("Not an XMLHttpRequest object");
QQmlXMLHttpRequest *r = w->d()->request;
- QV8Engine *engine = ctx->d()->engine->v8Engine;
-
if (r->readyState() == QQmlXMLHttpRequest::Unsent ||
r->readyState() == QQmlXMLHttpRequest::Opened)
V4THROW_DOM(DOMEXCEPTION_INVALID_STATE_ERR, "Invalid state");
if (r->errorFlag())
- return engine->toString(QString());
+ return QV4::Encode(scope.engine->newString(QString()));
else
- return engine->toString(r->replyStatusText());
+ return QV4::Encode(scope.engine->newString(r->replyStatusText()));
}
ReturnedValue QQmlXMLHttpRequestCtor::method_get_responseText(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->d()->callData->thisObject.as<QQmlXMLHttpRequestWrapper>());
+ Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->thisObject().as<QQmlXMLHttpRequestWrapper>());
if (!w)
V4THROW_REFERENCE("Not an XMLHttpRequest object");
QQmlXMLHttpRequest *r = w->d()->request;
- QV8Engine *engine = ctx->d()->engine->v8Engine;
-
if (r->readyState() != QQmlXMLHttpRequest::Loading &&
r->readyState() != QQmlXMLHttpRequest::Done)
- return engine->toString(QString());
+ return QV4::Encode(scope.engine->newString(QString()));
else
- return engine->toString(r->responseBody());
+ return QV4::Encode(scope.engine->newString(r->responseBody()));
}
ReturnedValue QQmlXMLHttpRequestCtor::method_get_responseXML(CallContext *ctx)
{
Scope scope(ctx);
- Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->d()->callData->thisObject.as<QQmlXMLHttpRequestWrapper>());
+ Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->thisObject().as<QQmlXMLHttpRequestWrapper>());
if (!w)
V4THROW_REFERENCE("Not an XMLHttpRequest object");
QQmlXMLHttpRequest *r = w->d()->request;
@@ -1958,24 +1965,75 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_get_responseXML(CallContext *ctx)
r->readyState() != QQmlXMLHttpRequest::Done)) {
return Encode::null();
} else {
- return Document::load(ctx->d()->engine->v8Engine, r->rawResponseBody());
+ return Document::load(scope.engine, r->rawResponseBody());
}
}
-void qt_rem_qmlxmlhttprequest(QV8Engine * /* engine */, void *d)
+ReturnedValue QQmlXMLHttpRequestCtor::method_get_response(CallContext *ctx)
+{
+ Scope scope(ctx);
+ Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->thisObject().as<QQmlXMLHttpRequestWrapper>());
+ if (!w)
+ V4THROW_REFERENCE("Not an XMLHttpRequest object");
+ QQmlXMLHttpRequest *r = w->d()->request;
+
+ if (r->readyState() != QQmlXMLHttpRequest::Loading &&
+ r->readyState() != QQmlXMLHttpRequest::Done)
+ return QV4::Encode(scope.engine->newString(QString()));
+
+ const QString& responseType = r->responseType();
+ if (responseType.compare(QLatin1String("text"), Qt::CaseInsensitive) == 0 || responseType.isEmpty()) {
+ return QV4::Encode(scope.engine->newString(r->responseBody()));
+ } else if (responseType.compare(QLatin1String("arraybuffer"), Qt::CaseInsensitive) == 0) {
+ return QV4::Encode(scope.engine->newArrayBuffer(r->rawResponseBody()));
+ } else {
+ return QV4::Encode(scope.engine->newString(QString()));
+ }
+
+ return Encode::undefined();
+}
+
+
+ReturnedValue QQmlXMLHttpRequestCtor::method_get_responseType(CallContext *ctx)
+{
+ Scope scope(ctx);
+ Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->thisObject().as<QQmlXMLHttpRequestWrapper>());
+ if (!w)
+ V4THROW_REFERENCE("Not an XMLHttpRequest object");
+ QQmlXMLHttpRequest *r = w->d()->request;
+ return QV4::Encode(scope.engine->newString(r->responseType()));
+}
+
+ReturnedValue QQmlXMLHttpRequestCtor::method_set_responseType(CallContext *ctx)
+{
+ Scope scope(ctx);
+ Scoped<QQmlXMLHttpRequestWrapper> w(scope, ctx->thisObject().as<QQmlXMLHttpRequestWrapper>());
+ if (!w)
+ V4THROW_REFERENCE("Not an XMLHttpRequest object");
+ QQmlXMLHttpRequest *r = w->d()->request;
+
+ if (ctx->argc() < 1)
+ V4THROW_DOM(DOMEXCEPTION_SYNTAX_ERR, "Incorrect argument count");
+
+ // Argument 0 - response type
+ r->setResponseType(ctx->args()[0].toQStringNoThrow());
+
+ return Encode::undefined();
+}
+
+void qt_rem_qmlxmlhttprequest(ExecutionEngine * /* engine */, void *d)
{
QQmlXMLHttpRequestData *data = (QQmlXMLHttpRequestData *)d;
delete data;
}
-void *qt_add_qmlxmlhttprequest(QV8Engine *engine)
+void *qt_add_qmlxmlhttprequest(ExecutionEngine *v4)
{
- ExecutionEngine *v4 = QV8Engine::getV4(engine);
Scope scope(v4);
Scoped<QQmlXMLHttpRequestCtor> ctor(scope, v4->memoryManager->alloc<QQmlXMLHttpRequestCtor>(v4));
ScopedString s(scope, v4->newString(QStringLiteral("XMLHttpRequest")));
- v4->globalObject->defineReadonlyProperty(s.getPointer(), ctor);
+ v4->globalObject()->defineReadonlyProperty(s, ctor);
QQmlXMLHttpRequestData *data = new QQmlXMLHttpRequestData;
return data;
diff --git a/src/qml/qml/qqmlxmlhttprequest_p.h b/src/qml/qml/qqmlxmlhttprequest_p.h
index a876c9381b..69847f14c1 100644
--- a/src/qml/qml/qqmlxmlhttprequest_p.h
+++ b/src/qml/qml/qqmlxmlhttprequest_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -47,6 +47,7 @@
//
#include <QtCore/qglobal.h>
+#include <private/qqmlglobal_p.h>
#ifndef QT_NO_XMLSTREAMREADER
@@ -54,8 +55,8 @@ QT_BEGIN_NAMESPACE
class QV8Engine;
-void *qt_add_qmlxmlhttprequest(QV8Engine *engine);
-void qt_rem_qmlxmlhttprequest(QV8Engine *engine, void *);
+void *qt_add_qmlxmlhttprequest(QV4::ExecutionEngine *engine);
+void qt_rem_qmlxmlhttprequest(QV4::ExecutionEngine *engine, void *);
QT_END_NAMESPACE
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
index d4e0d53cf5..f53b9a0c7d 100644
--- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
+++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -78,11 +78,9 @@ struct StaticQtMetaObject : public QObject
{ return &staticQtMetaObject; }
};
-QV4::QtObject::Data::Data(ExecutionEngine *v4, QQmlEngine *qmlEngine)
- : Object::Data(v4)
+Heap::QtObject::QtObject(ExecutionEngine *v4, QQmlEngine *qmlEngine)
+ : Heap::Object(v4)
{
- setVTable(staticVTable());
-
Scope scope(v4);
ScopedObject o(scope, this);
@@ -93,55 +91,57 @@ QV4::QtObject::Data::Data(ExecutionEngine *v4, QQmlEngine *qmlEngine)
for (int ii = 0; ii < qtMetaObject->enumeratorCount(); ++ii) {
QMetaEnum enumerator = qtMetaObject->enumerator(ii);
for (int jj = 0; jj < enumerator.keyCount(); ++jj) {
- o->put((str = v4->newString(QString::fromUtf8(enumerator.key(jj)))).getPointer(), (v = QV4::Primitive::fromInt32(enumerator.value(jj))));
+ o->put((str = v4->newString(QString::fromUtf8(enumerator.key(jj)))), (v = QV4::Primitive::fromInt32(enumerator.value(jj))));
}
}
- o->put((str = v4->newString(QStringLiteral("Asynchronous"))).getPointer(), (v = QV4::Primitive::fromInt32(0)));
- o->put((str = v4->newString(QStringLiteral("Synchronous"))).getPointer(), (v = QV4::Primitive::fromInt32(1)));
+ o->put((str = v4->newString(QStringLiteral("Asynchronous"))), (v = QV4::Primitive::fromInt32(0)));
+ o->put((str = v4->newString(QStringLiteral("Synchronous"))), (v = QV4::Primitive::fromInt32(1)));
o->defineDefaultProperty(QStringLiteral("include"), QV4Include::method_include);
- o->defineDefaultProperty(QStringLiteral("isQtObject"), method_isQtObject);
- o->defineDefaultProperty(QStringLiteral("rgba"), method_rgba);
- o->defineDefaultProperty(QStringLiteral("hsla"), method_hsla);
- o->defineDefaultProperty(QStringLiteral("colorEqual"), method_colorEqual);
- o->defineDefaultProperty(QStringLiteral("rect"), method_rect);
- o->defineDefaultProperty(QStringLiteral("point"), method_point);
- o->defineDefaultProperty(QStringLiteral("size"), method_size);
- o->defineDefaultProperty(QStringLiteral("font"), method_font);
-
- o->defineDefaultProperty(QStringLiteral("vector2d"), method_vector2d);
- o->defineDefaultProperty(QStringLiteral("vector3d"), method_vector3d);
- o->defineDefaultProperty(QStringLiteral("vector4d"), method_vector4d);
- o->defineDefaultProperty(QStringLiteral("quaternion"), method_quaternion);
- o->defineDefaultProperty(QStringLiteral("matrix4x4"), method_matrix4x4);
-
- o->defineDefaultProperty(QStringLiteral("formatDate"), method_formatDate);
- o->defineDefaultProperty(QStringLiteral("formatTime"), method_formatTime);
- o->defineDefaultProperty(QStringLiteral("formatDateTime"), method_formatDateTime);
-
- o->defineDefaultProperty(QStringLiteral("openUrlExternally"), method_openUrlExternally);
- o->defineDefaultProperty(QStringLiteral("fontFamilies"), method_fontFamilies);
- o->defineDefaultProperty(QStringLiteral("md5"), method_md5);
- o->defineDefaultProperty(QStringLiteral("btoa"), method_btoa);
- o->defineDefaultProperty(QStringLiteral("atob"), method_atob);
- o->defineDefaultProperty(QStringLiteral("resolvedUrl"), method_resolvedUrl);
- o->defineDefaultProperty(QStringLiteral("locale"), method_locale);
- o->defineDefaultProperty(QStringLiteral("binding"), method_binding);
+ o->defineDefaultProperty(QStringLiteral("isQtObject"), QV4::QtObject::method_isQtObject);
+ o->defineDefaultProperty(QStringLiteral("rgba"), QV4::QtObject::method_rgba);
+ o->defineDefaultProperty(QStringLiteral("hsla"), QV4::QtObject::method_hsla);
+ o->defineDefaultProperty(QStringLiteral("hsva"), QV4::QtObject::method_hsva);
+ o->defineDefaultProperty(QStringLiteral("colorEqual"), QV4::QtObject::method_colorEqual);
+ o->defineDefaultProperty(QStringLiteral("rect"), QV4::QtObject::method_rect);
+ o->defineDefaultProperty(QStringLiteral("point"), QV4::QtObject::method_point);
+ o->defineDefaultProperty(QStringLiteral("size"), QV4::QtObject::method_size);
+ o->defineDefaultProperty(QStringLiteral("font"), QV4::QtObject::method_font);
+
+ o->defineDefaultProperty(QStringLiteral("vector2d"), QV4::QtObject::method_vector2d);
+ o->defineDefaultProperty(QStringLiteral("vector3d"), QV4::QtObject::method_vector3d);
+ o->defineDefaultProperty(QStringLiteral("vector4d"), QV4::QtObject::method_vector4d);
+ o->defineDefaultProperty(QStringLiteral("quaternion"), QV4::QtObject::method_quaternion);
+ o->defineDefaultProperty(QStringLiteral("matrix4x4"), QV4::QtObject::method_matrix4x4);
+
+ o->defineDefaultProperty(QStringLiteral("formatDate"), QV4::QtObject::method_formatDate);
+ o->defineDefaultProperty(QStringLiteral("formatTime"), QV4::QtObject::method_formatTime);
+ o->defineDefaultProperty(QStringLiteral("formatDateTime"), QV4::QtObject::method_formatDateTime);
+
+ o->defineDefaultProperty(QStringLiteral("openUrlExternally"), QV4::QtObject::method_openUrlExternally);
+ o->defineDefaultProperty(QStringLiteral("fontFamilies"), QV4::QtObject::method_fontFamilies);
+ o->defineDefaultProperty(QStringLiteral("md5"), QV4::QtObject::method_md5);
+ o->defineDefaultProperty(QStringLiteral("btoa"), QV4::QtObject::method_btoa);
+ o->defineDefaultProperty(QStringLiteral("atob"), QV4::QtObject::method_atob);
+ o->defineDefaultProperty(QStringLiteral("resolvedUrl"), QV4::QtObject::method_resolvedUrl);
+ o->defineDefaultProperty(QStringLiteral("locale"), QV4::QtObject::method_locale);
+ o->defineDefaultProperty(QStringLiteral("binding"), QV4::QtObject::method_binding);
if (qmlEngine) {
- o->defineDefaultProperty(QStringLiteral("lighter"), method_lighter);
- o->defineDefaultProperty(QStringLiteral("darker"), method_darker);
- o->defineDefaultProperty(QStringLiteral("tint"), method_tint);
- o->defineDefaultProperty(QStringLiteral("quit"), method_quit);
- o->defineDefaultProperty(QStringLiteral("createQmlObject"), method_createQmlObject);
- o->defineDefaultProperty(QStringLiteral("createComponent"), method_createComponent);
+ o->defineDefaultProperty(QStringLiteral("lighter"), QV4::QtObject::method_lighter);
+ o->defineDefaultProperty(QStringLiteral("darker"), QV4::QtObject::method_darker);
+ o->defineDefaultProperty(QStringLiteral("tint"), QV4::QtObject::method_tint);
+ o->defineDefaultProperty(QStringLiteral("quit"), QV4::QtObject::method_quit);
+ o->defineDefaultProperty(QStringLiteral("createQmlObject"), QV4::QtObject::method_createQmlObject);
+ o->defineDefaultProperty(QStringLiteral("createComponent"), QV4::QtObject::method_createComponent);
}
- o->defineAccessorProperty(QStringLiteral("platform"), method_get_platform, 0);
- o->defineAccessorProperty(QStringLiteral("application"), method_get_application, 0);
+ o->defineAccessorProperty(QStringLiteral("platform"), QV4::QtObject::method_get_platform, 0);
+ o->defineAccessorProperty(QStringLiteral("application"), QV4::QtObject::method_get_application, 0);
#ifndef QT_NO_IM
- o->defineAccessorProperty(QStringLiteral("inputMethod"), method_get_inputMethod, 0);
+ o->defineAccessorProperty(QStringLiteral("inputMethod"), QV4::QtObject::method_get_inputMethod, 0);
#endif
+ o->defineAccessorProperty(QStringLiteral("styleHints"), QV4::QtObject::method_get_styleHints, 0);
}
@@ -151,10 +151,10 @@ Returns true if \c object is a valid reference to a Qt or QML object, otherwise
*/
ReturnedValue QtObject::method_isQtObject(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc == 0)
+ if (ctx->argc() == 0)
return QV4::Encode(false);
- return QV4::Encode(ctx->d()->callData->args[0].as<QV4::QObjectWrapper>() != 0);
+ return QV4::Encode(ctx->args()[0].as<QV4::QObjectWrapper>() != 0);
}
/*!
@@ -165,14 +165,14 @@ All components should be in the range 0-1 inclusive.
*/
ReturnedValue QtObject::method_rgba(QV4::CallContext *ctx)
{
- int argCount = ctx->d()->callData->argc;
+ int argCount = ctx->argc();
if (argCount < 3 || argCount > 4)
V4THROW_ERROR("Qt.rgba(): Invalid arguments");
- double r = ctx->d()->callData->args[0].toNumber();
- double g = ctx->d()->callData->args[1].toNumber();
- double b = ctx->d()->callData->args[2].toNumber();
- double a = (argCount == 4) ? ctx->d()->callData->args[3].toNumber() : 1;
+ double r = ctx->args()[0].toNumber();
+ double g = ctx->args()[1].toNumber();
+ double b = ctx->args()[2].toNumber();
+ double a = (argCount == 4) ? ctx->args()[3].toNumber() : 1;
if (r < 0.0) r=0.0;
if (r > 1.0) r=1.0;
@@ -183,7 +183,7 @@ ReturnedValue QtObject::method_rgba(QV4::CallContext *ctx)
if (a < 0.0) a=0.0;
if (a > 1.0) a=1.0;
- return ctx->d()->engine->v8Engine->fromVariant(QQml_colorProvider()->fromRgbF(r, g, b, a));
+ return ctx->engine()->fromVariant(QQml_colorProvider()->fromRgbF(r, g, b, a));
}
/*!
@@ -194,14 +194,14 @@ All components should be in the range 0-1 inclusive.
*/
ReturnedValue QtObject::method_hsla(QV4::CallContext *ctx)
{
- int argCount = ctx->d()->callData->argc;
+ int argCount = ctx->argc();
if (argCount < 3 || argCount > 4)
V4THROW_ERROR("Qt.hsla(): Invalid arguments");
- double h = ctx->d()->callData->args[0].toNumber();
- double s = ctx->d()->callData->args[1].toNumber();
- double l = ctx->d()->callData->args[2].toNumber();
- double a = (argCount == 4) ? ctx->d()->callData->args[3].toNumber() : 1;
+ double h = ctx->args()[0].toNumber();
+ double s = ctx->args()[1].toNumber();
+ double l = ctx->args()[2].toNumber();
+ double a = (argCount == 4) ? ctx->args()[3].toNumber() : 1;
if (h < 0.0) h=0.0;
if (h > 1.0) h=1.0;
@@ -212,7 +212,34 @@ ReturnedValue QtObject::method_hsla(QV4::CallContext *ctx)
if (a < 0.0) a=0.0;
if (a > 1.0) a=1.0;
- return ctx->d()->engine->v8Engine->fromVariant(QQml_colorProvider()->fromHslF(h, s, l, a));
+ return ctx->engine()->fromVariant(QQml_colorProvider()->fromHslF(h, s, l, a));
+}
+
+/*!
+\qmlmethod color Qt::hsva(real hue, real saturation, real value, real alpha)
+
+Returns a color with the specified \c hue, \c saturation, \c value and \c alpha components.
+All components should be in the range 0-1 inclusive.
+
+\since 5.5
+*/
+ReturnedValue QtObject::method_hsva(QV4::CallContext *ctx)
+{
+ int argCount = ctx->argc();
+ if (argCount < 3 || argCount > 4)
+ V4THROW_ERROR("Qt.hsva(): Invalid arguments");
+
+ double h = ctx->args()[0].toNumber();
+ double s = ctx->args()[1].toNumber();
+ double v = ctx->args()[2].toNumber();
+ double a = (argCount == 4) ? ctx->args()[3].toNumber() : 1;
+
+ h = qBound(0.0, h, 1.0);
+ s = qBound(0.0, s, 1.0);
+ v = qBound(0.0, v, 1.0);
+ a = qBound(0.0, a, 1.0);
+
+ return ctx->engine()->fromVariant(QQml_colorProvider()->fromHsvF(h, s, v, a));
}
/*!
@@ -225,14 +252,12 @@ basic type.
*/
ReturnedValue QtObject::method_colorEqual(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc != 2)
+ if (ctx->argc() != 2)
V4THROW_ERROR("Qt.colorEqual(): Invalid arguments");
bool ok = false;
- QV8Engine *v8engine = ctx->d()->engine->v8Engine;
-
- QVariant lhs = v8engine->toVariant(ctx->d()->callData->args[0], -1);
+ QVariant lhs = ctx->d()->engine->toVariant(ctx->args()[0], -1);
if (lhs.userType() == QVariant::String) {
lhs = QQmlStringConverters::colorFromString(lhs.toString(), &ok);
if (!ok) {
@@ -242,7 +267,7 @@ ReturnedValue QtObject::method_colorEqual(QV4::CallContext *ctx)
V4THROW_ERROR("Qt.colorEqual(): Invalid arguments");
}
- QVariant rhs = v8engine->toVariant(ctx->d()->callData->args[1], -1);
+ QVariant rhs = ctx->engine()->toVariant(ctx->args()[1], -1);
if (rhs.userType() == QVariant::String) {
rhs = QQmlStringConverters::colorFromString(rhs.toString(), &ok);
if (!ok) {
@@ -265,15 +290,15 @@ The returned object has \c x, \c y, \c width and \c height attributes with the g
*/
ReturnedValue QtObject::method_rect(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc != 4)
+ if (ctx->argc() != 4)
V4THROW_ERROR("Qt.rect(): Invalid arguments");
- double x = ctx->d()->callData->args[0].toNumber();
- double y = ctx->d()->callData->args[1].toNumber();
- double w = ctx->d()->callData->args[2].toNumber();
- double h = ctx->d()->callData->args[3].toNumber();
+ double x = ctx->args()[0].toNumber();
+ double y = ctx->args()[1].toNumber();
+ double w = ctx->args()[2].toNumber();
+ double h = ctx->args()[3].toNumber();
- return ctx->d()->engine->v8Engine->fromVariant(QVariant::fromValue(QRectF(x, y, w, h)));
+ return ctx->engine()->fromVariant(QVariant::fromValue(QRectF(x, y, w, h)));
}
/*!
@@ -282,13 +307,13 @@ Returns a Point with the specified \c x and \c y coordinates.
*/
ReturnedValue QtObject::method_point(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc != 2)
+ if (ctx->argc() != 2)
V4THROW_ERROR("Qt.point(): Invalid arguments");
- double x = ctx->d()->callData->args[0].toNumber();
- double y = ctx->d()->callData->args[1].toNumber();
+ double x = ctx->args()[0].toNumber();
+ double y = ctx->args()[1].toNumber();
- return ctx->d()->engine->v8Engine->fromVariant(QVariant::fromValue(QPointF(x, y)));
+ return ctx->engine()->fromVariant(QVariant::fromValue(QPointF(x, y)));
}
/*!
@@ -297,13 +322,13 @@ Returns a Size with the specified \c width and \c height.
*/
ReturnedValue QtObject::method_size(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc != 2)
+ if (ctx->argc() != 2)
V4THROW_ERROR("Qt.size(): Invalid arguments");
- double w = ctx->d()->callData->args[0].toNumber();
- double h = ctx->d()->callData->args[1].toNumber();
+ double w = ctx->args()[0].toNumber();
+ double h = ctx->args()[1].toNumber();
- return ctx->d()->engine->v8Engine->fromVariant(QVariant::fromValue(QSizeF(w, h)));
+ return ctx->engine()->fromVariant(QVariant::fromValue(QSizeF(w, h)));
}
/*!
@@ -316,15 +341,15 @@ Invalid keys will be ignored.
*/
ReturnedValue QtObject::method_font(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc != 1 || !ctx->d()->callData->args[0].isObject())
+ if (ctx->argc() != 1 || !ctx->args()[0].isObject())
V4THROW_ERROR("Qt.font(): Invalid arguments");
- QV8Engine *v8engine = ctx->d()->engine->v8Engine;
+ QV4::ExecutionEngine *v4 = ctx->d()->engine;
bool ok = false;
- QVariant v = QQml_valueTypeProvider()->createVariantFromJsObject(QMetaType::QFont, QQmlV4Handle(ctx->d()->callData->args[0]), v8engine, &ok);
+ QVariant v = QQml_valueTypeProvider()->createVariantFromJsObject(QMetaType::QFont, QQmlV4Handle(ctx->args()[0]), v4, &ok);
if (!ok)
V4THROW_ERROR("Qt.font(): Invalid argument: no valid font subproperties specified");
- return v8engine->fromVariant(v);
+ return ctx->engine()->fromVariant(v);
}
@@ -335,16 +360,15 @@ Returns a Vector2D with the specified \c x and \c y.
*/
ReturnedValue QtObject::method_vector2d(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc != 2)
+ if (ctx->argc() != 2)
V4THROW_ERROR("Qt.vector2d(): Invalid arguments");
float xy[3]; // qvector2d uses float internally
- xy[0] = ctx->d()->callData->args[0].toNumber();
- xy[1] = ctx->d()->callData->args[1].toNumber();
+ xy[0] = ctx->args()[0].toNumber();
+ xy[1] = ctx->args()[1].toNumber();
const void *params[] = { xy };
- QV8Engine *v8engine = ctx->d()->engine->v8Engine;
- return v8engine->fromVariant(QQml_valueTypeProvider()->createValueType(QMetaType::QVector2D, 1, params));
+ return ctx->engine()->fromVariant(QQml_valueTypeProvider()->createValueType(QMetaType::QVector2D, 1, params));
}
/*!
@@ -353,17 +377,16 @@ Returns a Vector3D with the specified \c x, \c y and \c z.
*/
ReturnedValue QtObject::method_vector3d(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc != 3)
+ if (ctx->argc() != 3)
V4THROW_ERROR("Qt.vector3d(): Invalid arguments");
float xyz[3]; // qvector3d uses float internally
- xyz[0] = ctx->d()->callData->args[0].toNumber();
- xyz[1] = ctx->d()->callData->args[1].toNumber();
- xyz[2] = ctx->d()->callData->args[2].toNumber();
+ xyz[0] = ctx->args()[0].toNumber();
+ xyz[1] = ctx->args()[1].toNumber();
+ xyz[2] = ctx->args()[2].toNumber();
const void *params[] = { xyz };
- QV8Engine *v8engine = ctx->d()->engine->v8Engine;
- return v8engine->fromVariant(QQml_valueTypeProvider()->createValueType(QMetaType::QVector3D, 1, params));
+ return ctx->engine()->fromVariant(QQml_valueTypeProvider()->createValueType(QMetaType::QVector3D, 1, params));
}
/*!
@@ -372,18 +395,17 @@ Returns a Vector4D with the specified \c x, \c y, \c z and \c w.
*/
ReturnedValue QtObject::method_vector4d(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc != 4)
+ if (ctx->argc() != 4)
V4THROW_ERROR("Qt.vector4d(): Invalid arguments");
float xyzw[4]; // qvector4d uses float internally
- xyzw[0] = ctx->d()->callData->args[0].toNumber();
- xyzw[1] = ctx->d()->callData->args[1].toNumber();
- xyzw[2] = ctx->d()->callData->args[2].toNumber();
- xyzw[3] = ctx->d()->callData->args[3].toNumber();
+ xyzw[0] = ctx->args()[0].toNumber();
+ xyzw[1] = ctx->args()[1].toNumber();
+ xyzw[2] = ctx->args()[2].toNumber();
+ xyzw[3] = ctx->args()[3].toNumber();
const void *params[] = { xyzw };
- QV8Engine *v8engine = ctx->d()->engine->v8Engine;
- return v8engine->fromVariant(QQml_valueTypeProvider()->createValueType(QMetaType::QVector4D, 1, params));
+ return ctx->engine()->fromVariant(QQml_valueTypeProvider()->createValueType(QMetaType::QVector4D, 1, params));
}
/*!
@@ -392,18 +414,17 @@ Returns a Quaternion with the specified \c scalar, \c x, \c y, and \c z.
*/
ReturnedValue QtObject::method_quaternion(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc != 4)
+ if (ctx->argc() != 4)
V4THROW_ERROR("Qt.quaternion(): Invalid arguments");
qreal sxyz[4]; // qquaternion uses qreal internally
- sxyz[0] = ctx->d()->callData->args[0].toNumber();
- sxyz[1] = ctx->d()->callData->args[1].toNumber();
- sxyz[2] = ctx->d()->callData->args[2].toNumber();
- sxyz[3] = ctx->d()->callData->args[3].toNumber();
+ sxyz[0] = ctx->args()[0].toNumber();
+ sxyz[1] = ctx->args()[1].toNumber();
+ sxyz[2] = ctx->args()[2].toNumber();
+ sxyz[3] = ctx->args()[3].toNumber();
const void *params[] = { sxyz };
- QV8Engine *v8engine = ctx->d()->engine->v8Engine;
- return v8engine->fromVariant(QQml_valueTypeProvider()->createValueType(QMetaType::QQuaternion, 1, params));
+ return ctx->engine()->fromVariant(QQml_valueTypeProvider()->createValueType(QMetaType::QQuaternion, 1, params));
}
/*!
@@ -415,39 +436,39 @@ matrix values.
*/
ReturnedValue QtObject::method_matrix4x4(QV4::CallContext *ctx)
{
- QV8Engine *v8engine = ctx->d()->engine->v8Engine;
+ QV4::ExecutionEngine *v4 = ctx->d()->engine;
- if (ctx->d()->callData->argc == 1 && ctx->d()->callData->args[0].isObject()) {
+ if (ctx->argc() == 1 && ctx->args()[0].isObject()) {
bool ok = false;
- QVariant v = QQml_valueTypeProvider()->createVariantFromJsObject(QMetaType::QMatrix4x4, QQmlV4Handle(ctx->d()->callData->args[0]), v8engine, &ok);
+ QVariant v = QQml_valueTypeProvider()->createVariantFromJsObject(QMetaType::QMatrix4x4, QQmlV4Handle(ctx->args()[0]), v4, &ok);
if (!ok)
V4THROW_ERROR("Qt.matrix4x4(): Invalid argument: not a valid matrix4x4 values array");
- return v8engine->fromVariant(v);
+ return ctx->engine()->fromVariant(v);
}
- if (ctx->d()->callData->argc != 16)
+ if (ctx->argc() != 16)
V4THROW_ERROR("Qt.matrix4x4(): Invalid arguments");
qreal vals[16]; // qmatrix4x4 uses qreal internally
- vals[0] = ctx->d()->callData->args[0].toNumber();
- vals[1] = ctx->d()->callData->args[1].toNumber();
- vals[2] = ctx->d()->callData->args[2].toNumber();
- vals[3] = ctx->d()->callData->args[3].toNumber();
- vals[4] = ctx->d()->callData->args[4].toNumber();
- vals[5] = ctx->d()->callData->args[5].toNumber();
- vals[6] = ctx->d()->callData->args[6].toNumber();
- vals[7] = ctx->d()->callData->args[7].toNumber();
- vals[8] = ctx->d()->callData->args[8].toNumber();
- vals[9] = ctx->d()->callData->args[9].toNumber();
- vals[10] = ctx->d()->callData->args[10].toNumber();
- vals[11] = ctx->d()->callData->args[11].toNumber();
- vals[12] = ctx->d()->callData->args[12].toNumber();
- vals[13] = ctx->d()->callData->args[13].toNumber();
- vals[14] = ctx->d()->callData->args[14].toNumber();
- vals[15] = ctx->d()->callData->args[15].toNumber();
+ vals[0] = ctx->args()[0].toNumber();
+ vals[1] = ctx->args()[1].toNumber();
+ vals[2] = ctx->args()[2].toNumber();
+ vals[3] = ctx->args()[3].toNumber();
+ vals[4] = ctx->args()[4].toNumber();
+ vals[5] = ctx->args()[5].toNumber();
+ vals[6] = ctx->args()[6].toNumber();
+ vals[7] = ctx->args()[7].toNumber();
+ vals[8] = ctx->args()[8].toNumber();
+ vals[9] = ctx->args()[9].toNumber();
+ vals[10] = ctx->args()[10].toNumber();
+ vals[11] = ctx->args()[11].toNumber();
+ vals[12] = ctx->args()[12].toNumber();
+ vals[13] = ctx->args()[13].toNumber();
+ vals[14] = ctx->args()[14].toNumber();
+ vals[15] = ctx->args()[15].toNumber();
const void *params[] = { vals };
- return v8engine->fromVariant(QQml_valueTypeProvider()->createValueType(QMetaType::QMatrix4x4, 1, params));
+ return ctx->engine()->fromVariant(QQml_valueTypeProvider()->createValueType(QMetaType::QMatrix4x4, 1, params));
}
/*!
@@ -466,11 +487,10 @@ If \c factor is not supplied, returns a color 50% lighter than \c baseColor (fac
*/
ReturnedValue QtObject::method_lighter(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc != 1 && ctx->d()->callData->argc != 2)
+ if (ctx->argc() != 1 && ctx->argc() != 2)
V4THROW_ERROR("Qt.lighter(): Invalid arguments");
- QV8Engine *v8engine = ctx->d()->engine->v8Engine;
- QVariant v = v8engine->toVariant(ctx->d()->callData->args[0], -1);
+ QVariant v = ctx->engine()->toVariant(ctx->args()[0], -1);
if (v.userType() == QVariant::String) {
bool ok = false;
v = QQmlStringConverters::colorFromString(v.toString(), &ok);
@@ -482,10 +502,10 @@ ReturnedValue QtObject::method_lighter(QV4::CallContext *ctx)
}
qreal factor = 1.5;
- if (ctx->d()->callData->argc == 2)
- factor = ctx->d()->callData->args[1].toNumber();
+ if (ctx->argc() == 2)
+ factor = ctx->args()[1].toNumber();
- return v8engine->fromVariant(QQml_colorProvider()->lighter(v, factor));
+ return ctx->engine()->fromVariant(QQml_colorProvider()->lighter(v, factor));
}
/*!
@@ -505,11 +525,10 @@ If \c factor is not supplied, returns a color 50% darker than \c baseColor (fact
*/
ReturnedValue QtObject::method_darker(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc != 1 && ctx->d()->callData->argc != 2)
+ if (ctx->argc() != 1 && ctx->argc() != 2)
V4THROW_ERROR("Qt.darker(): Invalid arguments");
- QV8Engine *v8engine = ctx->d()->engine->v8Engine;
- QVariant v = v8engine->toVariant(ctx->d()->callData->args[0], -1);
+ QVariant v = ctx->engine()->toVariant(ctx->args()[0], -1);
if (v.userType() == QVariant::String) {
bool ok = false;
v = QQmlStringConverters::colorFromString(v.toString(), &ok);
@@ -521,10 +540,10 @@ ReturnedValue QtObject::method_darker(QV4::CallContext *ctx)
}
qreal factor = 2.0;
- if (ctx->d()->callData->argc == 2)
- factor = ctx->d()->callData->args[1].toNumber();
+ if (ctx->argc() == 2)
+ factor = ctx->args()[1].toNumber();
- return v8engine->fromVariant(QQml_colorProvider()->darker(v, factor));
+ return ctx->engine()->fromVariant(QQml_colorProvider()->darker(v, factor));
}
/*!
@@ -553,13 +572,11 @@ ReturnedValue QtObject::method_darker(QV4::CallContext *ctx)
*/
ReturnedValue QtObject::method_tint(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc != 2)
+ if (ctx->argc() != 2)
V4THROW_ERROR("Qt.tint(): Invalid arguments");
- QV8Engine *v8engine = ctx->d()->engine->v8Engine;
-
// base color
- QVariant v1 = v8engine->toVariant(ctx->d()->callData->args[0], -1);
+ QVariant v1 = ctx->engine()->toVariant(ctx->args()[0], -1);
if (v1.userType() == QVariant::String) {
bool ok = false;
v1 = QQmlStringConverters::colorFromString(v1.toString(), &ok);
@@ -571,7 +588,7 @@ ReturnedValue QtObject::method_tint(QV4::CallContext *ctx)
}
// tint color
- QVariant v2 = v8engine->toVariant(ctx->d()->callData->args[1], -1);
+ QVariant v2 = ctx->engine()->toVariant(ctx->args()[1], -1);
if (v2.userType() == QVariant::String) {
bool ok = false;
v2 = QQmlStringConverters::colorFromString(v2.toString(), &ok);
@@ -582,7 +599,7 @@ ReturnedValue QtObject::method_tint(QV4::CallContext *ctx)
return QV4::Encode::null();
}
- return v8engine->fromVariant(QQml_colorProvider()->tint(v1, v2));
+ return ctx->engine()->fromVariant(QQml_colorProvider()->tint(v1, v2));
}
/*!
@@ -603,22 +620,20 @@ If \a format is not specified, \a date is formatted using
*/
ReturnedValue QtObject::method_formatDate(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc < 1 || ctx->d()->callData->argc > 2)
+ if (ctx->argc() < 1 || ctx->argc() > 2)
V4THROW_ERROR("Qt.formatDate(): Invalid arguments");
QV4::Scope scope(ctx);
- QV8Engine *v8engine = ctx->d()->engine->v8Engine;
-
Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate;
- QDate date = v8engine->toVariant(ctx->d()->callData->args[0], -1).toDateTime().date();
+ QDate date = ctx->engine()->toVariant(ctx->args()[0], -1).toDateTime().date();
QString formattedDate;
- if (ctx->d()->callData->argc == 2) {
- QV4::ScopedString s(scope, ctx->d()->callData->args[1]);
+ if (ctx->argc() == 2) {
+ QV4::ScopedString s(scope, ctx->args()[1]);
if (s) {
QString format = s->toQString();
formattedDate = date.toString(format);
- } else if (ctx->d()->callData->args[1].isNumber()) {
- quint32 intFormat = ctx->d()->callData->args[1].asDouble();
+ } else if (ctx->args()[1].isNumber()) {
+ quint32 intFormat = ctx->args()[1].asDouble();
Qt::DateFormat format = Qt::DateFormat(intFormat);
formattedDate = date.toString(format);
} else {
@@ -648,28 +663,26 @@ If \a format is not specified, \a time is formatted using
*/
ReturnedValue QtObject::method_formatTime(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc < 1 || ctx->d()->callData->argc > 2)
+ if (ctx->argc() < 1 || ctx->argc() > 2)
V4THROW_ERROR("Qt.formatTime(): Invalid arguments");
QV4::Scope scope(ctx);
- QV8Engine *v8engine = ctx->d()->engine->v8Engine;
-
- QVariant argVariant = v8engine->toVariant(ctx->d()->callData->args[0], -1);
+ QVariant argVariant = ctx->engine()->toVariant(ctx->args()[0], -1);
QTime time;
- if (ctx->d()->callData->args[0].asDateObject() || (argVariant.type() == QVariant::String))
+ if (ctx->args()[0].asDateObject() || (argVariant.type() == QVariant::String))
time = argVariant.toDateTime().time();
else // if (argVariant.type() == QVariant::Time), or invalid.
time = argVariant.toTime();
Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate;
QString formattedTime;
- if (ctx->d()->callData->argc == 2) {
- QV4::ScopedString s(scope, ctx->d()->callData->args[1]);
+ if (ctx->argc() == 2) {
+ QV4::ScopedString s(scope, ctx->args()[1]);
if (s) {
QString format = s->toQString();
formattedTime = time.toString(format);
- } else if (ctx->d()->callData->args[1].isNumber()) {
- quint32 intFormat = ctx->d()->callData->args[1].asDouble();
+ } else if (ctx->args()[1].isNumber()) {
+ quint32 intFormat = ctx->args()[1].asDouble();
Qt::DateFormat format = Qt::DateFormat(intFormat);
formattedTime = time.toString(format);
} else {
@@ -774,22 +787,20 @@ with the \a format values below to produce the following results:
*/
ReturnedValue QtObject::method_formatDateTime(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc < 1 || ctx->d()->callData->argc > 2)
+ if (ctx->argc() < 1 || ctx->argc() > 2)
V4THROW_ERROR("Qt.formatDateTime(): Invalid arguments");
QV4::Scope scope(ctx);
- QV8Engine *v8engine = ctx->d()->engine->v8Engine;
-
Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate;
- QDateTime dt = v8engine->toVariant(ctx->d()->callData->args[0], -1).toDateTime();
+ QDateTime dt = ctx->engine()->toVariant(ctx->args()[0], -1).toDateTime();
QString formattedDt;
- if (ctx->d()->callData->argc == 2) {
- QV4::ScopedString s(scope, ctx->d()->callData->args[1]);
+ if (ctx->argc() == 2) {
+ QV4::ScopedString s(scope, ctx->args()[1]);
if (s) {
QString format = s->toQString();
formattedDt = dt.toString(format);
- } else if (ctx->d()->callData->args[1].isNumber()) {
- quint32 intFormat = ctx->d()->callData->args[1].asDouble();
+ } else if (ctx->args()[1].isNumber()) {
+ quint32 intFormat = ctx->args()[1].asDouble();
Qt::DateFormat format = Qt::DateFormat(intFormat);
formattedDt = dt.toString(format);
} else {
@@ -815,13 +826,11 @@ ReturnedValue QtObject::method_formatDateTime(QV4::CallContext *ctx)
*/
ReturnedValue QtObject::method_openUrlExternally(QV4::CallContext *ctx)
{
- if (ctx->d()->callData->argc != 1)
+ if (ctx->argc() != 1)
return QV4::Encode(false);
- QV8Engine *v8engine = ctx->d()->engine->v8Engine;
-
QUrl url(Value::fromReturnedValue(method_resolvedUrl(ctx)).toQStringNoThrow());
- return v8engine->fromVariant(QQml_guiProvider()->openUrlExternally(url));
+ return ctx->engine()->fromVariant(QQml_guiProvider()->openUrlExternally(url));
}
/*!
@@ -832,7 +841,7 @@ ReturnedValue QtObject::method_resolvedUrl(QV4::CallContext *ctx)
{
QV8Engine *v8engine = ctx->d()->engine->v8Engine;
- QUrl url = v8engine->toVariant(ctx->d()->callData->args[0], -1).toUrl();
+ QUrl url = ctx->engine()->toVariant(ctx->args()[0], -1).toUrl();
QQmlEngine *e = v8engine->engine();
QQmlEnginePrivate *p = 0;
if (e) p = QQmlEnginePrivate::get(e);
@@ -853,11 +862,10 @@ Returns a list of the font families available to the application.
*/
ReturnedValue QtObject::method_fontFamilies(CallContext *ctx)
{
- if (ctx->d()->callData->argc != 0)
+ if (ctx->argc() != 0)
V4THROW_ERROR("Qt.fontFamilies(): Invalid arguments");
- QV8Engine *v8engine = ctx->d()->engine->v8Engine;
- return v8engine->fromVariant(QVariant(QQml_guiProvider()->fontFamilies()));
+ return ctx->engine()->fromVariant(QVariant(QQml_guiProvider()->fontFamilies()));
}
/*!
@@ -866,10 +874,10 @@ Returns a hex string of the md5 hash of \c data.
*/
ReturnedValue QtObject::method_md5(CallContext *ctx)
{
- if (ctx->d()->callData->argc != 1)
+ if (ctx->argc() != 1)
V4THROW_ERROR("Qt.md5(): Invalid arguments");
- QByteArray data = ctx->d()->callData->args[0].toQStringNoThrow().toUtf8();
+ QByteArray data = ctx->args()[0].toQStringNoThrow().toUtf8();
QByteArray result = QCryptographicHash::hash(data, QCryptographicHash::Md5);
return ctx->d()->engine->newString(QLatin1String(result.toHex()))->asReturnedValue();
}
@@ -880,10 +888,10 @@ Binary to ASCII - this function returns a base64 encoding of \c data.
*/
ReturnedValue QtObject::method_btoa(CallContext *ctx)
{
- if (ctx->d()->callData->argc != 1)
+ if (ctx->argc() != 1)
V4THROW_ERROR("Qt.btoa(): Invalid arguments");
- QByteArray data = ctx->d()->callData->args[0].toQStringNoThrow().toUtf8();
+ QByteArray data = ctx->args()[0].toQStringNoThrow().toUtf8();
return ctx->d()->engine->newString(QLatin1String(data.toBase64()))->asReturnedValue();
}
@@ -894,10 +902,10 @@ ASCII to binary - this function returns a base64 decoding of \c data.
*/
ReturnedValue QtObject::method_atob(CallContext *ctx)
{
- if (ctx->d()->callData->argc != 1)
+ if (ctx->argc() != 1)
V4THROW_ERROR("Qt.atob(): Invalid arguments");
- QByteArray data = ctx->d()->callData->args[0].toQStringNoThrow().toLatin1();
+ QByteArray data = ctx->args()[0].toQStringNoThrow().toLatin1();
return ctx->d()->engine->newString(QString::fromUtf8(QByteArray::fromBase64(data)))->asReturnedValue();
}
@@ -911,9 +919,7 @@ QQmlEngine::quit() signal to the QCoreApplication::quit() slot.
*/
ReturnedValue QtObject::method_quit(CallContext *ctx)
{
- QV8Engine *v8engine = ctx->d()->engine->v8Engine;
-
- QQmlEnginePrivate::get(v8engine->engine())->sendQuit();
+ QQmlEnginePrivate::get(ctx->engine()->qmlEngine())->sendQuit();
return QV4::Encode::undefined();
}
@@ -944,7 +950,7 @@ See \l {Dynamic QML Object Creation from JavaScript} for more information on usi
ReturnedValue QtObject::method_createQmlObject(CallContext *ctx)
{
Scope scope(ctx);
- if (ctx->d()->callData->argc < 2 || ctx->d()->callData->argc > 3)
+ if (ctx->argc() < 2 || ctx->argc() > 3)
V4THROW_ERROR("Qt.createQmlObject(): Invalid arguments");
struct Error {
@@ -952,7 +958,7 @@ ReturnedValue QtObject::method_createQmlObject(CallContext *ctx)
Scope scope(v4);
QString errorstr = QLatin1String("Qt.createQmlObject(): failed to create object: ");
- QV4::Scoped<ArrayObject> qmlerrors(scope, v4->newArrayObject());
+ QV4::ScopedArrayObject qmlerrors(scope, v4->newArrayObject());
QV4::ScopedObject qmlerror(scope);
QV4::ScopedString s(scope);
QV4::ScopedValue v(scope);
@@ -960,16 +966,16 @@ ReturnedValue QtObject::method_createQmlObject(CallContext *ctx)
const QQmlError &error = errors.at(ii);
errorstr += QLatin1String("\n ") + error.toString();
qmlerror = v4->newObject();
- qmlerror->put((s = v4->newString(QStringLiteral("lineNumber"))).getPointer(), (v = QV4::Primitive::fromInt32(error.line())));
- qmlerror->put((s = v4->newString(QStringLiteral("columnNumber"))).getPointer(), (v = QV4::Primitive::fromInt32(error.column())));
- qmlerror->put((s = v4->newString(QStringLiteral("fileName"))).getPointer(), (v = v4->newString(error.url().toString())));
- qmlerror->put((s = v4->newString(QStringLiteral("message"))).getPointer(), (v = v4->newString(error.description())));
+ qmlerror->put((s = v4->newString(QStringLiteral("lineNumber"))), (v = QV4::Primitive::fromInt32(error.line())));
+ qmlerror->put((s = v4->newString(QStringLiteral("columnNumber"))), (v = QV4::Primitive::fromInt32(error.column())));
+ qmlerror->put((s = v4->newString(QStringLiteral("fileName"))), (v = v4->newString(error.url().toString())));
+ qmlerror->put((s = v4->newString(QStringLiteral("message"))), (v = v4->newString(error.description())));
qmlerrors->putIndexed(ii, qmlerror);
}
v = v4->newString(errorstr);
- Scoped<Object> errorObject(scope, v4->newErrorObject(v));
- errorObject->put((s = v4->newString(QStringLiteral("qmlErrors"))).getPointer(), qmlerrors);
+ ScopedObject errorObject(scope, v4->newErrorObject(v));
+ errorObject->put((s = v4->newString(QStringLiteral("qmlErrors"))), qmlerrors);
return errorObject.asReturnedValue();
}
};
@@ -986,13 +992,13 @@ ReturnedValue QtObject::method_createQmlObject(CallContext *ctx)
effectiveContext = context->asQQmlContext();
Q_ASSERT(effectiveContext);
- QString qml = ctx->d()->callData->args[0].toQStringNoThrow();
+ QString qml = ctx->args()[0].toQStringNoThrow();
if (qml.isEmpty())
return QV4::Encode::null();
QUrl url;
- if (ctx->d()->callData->argc > 2)
- url = QUrl(ctx->d()->callData->args[2].toQStringNoThrow());
+ if (ctx->argc() > 2)
+ url = QUrl(ctx->args()[2].toQStringNoThrow());
else
url = QUrl(QLatin1String("inline"));
@@ -1000,7 +1006,7 @@ ReturnedValue QtObject::method_createQmlObject(CallContext *ctx)
url = context->resolvedUrl(url);
QObject *parentArg = 0;
- QV4::Scoped<QV4::QObjectWrapper> qobjectWrapper(scope, ctx->d()->callData->args[1]);
+ QV4::Scoped<QV4::QObjectWrapper> qobjectWrapper(scope, ctx->args()[1]);
if (!!qobjectWrapper)
parentArg = qobjectWrapper->object();
if (!parentArg)
@@ -1011,7 +1017,7 @@ ReturnedValue QtObject::method_createQmlObject(CallContext *ctx)
if (component.isError()) {
ScopedValue v(scope, Error::create(ctx->d()->engine, component.errors()));
- return ctx->throwError(v);
+ return ctx->engine()->throwError(v);
}
if (!component.isReady())
@@ -1035,7 +1041,7 @@ ReturnedValue QtObject::method_createQmlObject(CallContext *ctx)
if (component.isError()) {
ScopedValue v(scope, Error::create(ctx->d()->engine, component.errors()));
- return ctx->throwError(v);
+ return ctx->engine()->throwError(v);
}
Q_ASSERT(obj);
@@ -1076,8 +1082,8 @@ use \l{QtQml::Qt::createQmlObject()}{Qt.createQmlObject()}.
*/
ReturnedValue QtObject::method_createComponent(CallContext *ctx)
{
- if (ctx->d()->callData->argc < 1 || ctx->d()->callData->argc > 3)
- return ctx->throwError(QStringLiteral("Qt.createComponent(): Invalid arguments"));
+ if (ctx->argc() < 1 || ctx->argc() > 3)
+ return ctx->engine()->throwError(QStringLiteral("Qt.createComponent(): Invalid arguments"));
Scope scope(ctx);
@@ -1090,7 +1096,7 @@ ReturnedValue QtObject::method_createComponent(CallContext *ctx)
if (context->isPragmaLibraryContext)
effectiveContext = 0;
- QString arg = ctx->d()->callData->args[0].toQStringNoThrow();
+ QString arg = ctx->args()[0].toQStringNoThrow();
if (arg.isEmpty())
return QV4::Encode::null();
@@ -1098,33 +1104,33 @@ ReturnedValue QtObject::method_createComponent(CallContext *ctx)
QObject *parentArg = 0;
int consumedCount = 1;
- if (ctx->d()->callData->argc > 1) {
- ScopedValue lastArg(scope, ctx->d()->callData->args[ctx->d()->callData->argc-1]);
+ if (ctx->argc() > 1) {
+ ScopedValue lastArg(scope, ctx->args()[ctx->argc()-1]);
// The second argument could be the mode enum
- if (ctx->d()->callData->args[1].isInteger()) {
- int mode = ctx->d()->callData->args[1].integerValue();
+ if (ctx->args()[1].isInteger()) {
+ int mode = ctx->args()[1].integerValue();
if (mode != int(QQmlComponent::PreferSynchronous) && mode != int(QQmlComponent::Asynchronous))
- return ctx->throwError(QStringLiteral("Qt.createComponent(): Invalid arguments"));
+ return ctx->engine()->throwError(QStringLiteral("Qt.createComponent(): Invalid arguments"));
compileMode = QQmlComponent::CompilationMode(mode);
consumedCount += 1;
} else {
// The second argument could be the parent only if there are exactly two args
- if ((ctx->d()->callData->argc != 2) || !(lastArg->isObject() || lastArg->isNull()))
- return ctx->throwError(QStringLiteral("Qt.createComponent(): Invalid arguments"));
+ if ((ctx->argc() != 2) || !(lastArg->isObject() || lastArg->isNull()))
+ return ctx->engine()->throwError(QStringLiteral("Qt.createComponent(): Invalid arguments"));
}
- if (consumedCount < ctx->d()->callData->argc) {
+ if (consumedCount < ctx->argc()) {
if (lastArg->isObject()) {
Scoped<QObjectWrapper> qobjectWrapper(scope, lastArg);
if (qobjectWrapper)
parentArg = qobjectWrapper->object();
if (!parentArg)
- return ctx->throwError(QStringLiteral("Qt.createComponent(): Invalid parent object"));
+ return ctx->engine()->throwError(QStringLiteral("Qt.createComponent(): Invalid parent object"));
} else if (lastArg->isNull()) {
parentArg = 0;
} else {
- return ctx->throwError(QStringLiteral("Qt.createComponent(): Invalid parent object"));
+ return ctx->engine()->throwError(QStringLiteral("Qt.createComponent(): Invalid parent object"));
}
}
}
@@ -1161,24 +1167,21 @@ ReturnedValue QtObject::method_createComponent(CallContext *ctx)
ReturnedValue QtObject::method_locale(CallContext *ctx)
{
QString code;
- if (ctx->d()->callData->argc > 1)
+ if (ctx->argc() > 1)
V4THROW_ERROR("locale() requires 0 or 1 argument");
- if (ctx->d()->callData->argc == 1 && !ctx->d()->callData->args[0].isString())
+ if (ctx->argc() == 1 && !ctx->args()[0].isString())
V4THROW_TYPE("locale(): argument (locale code) must be a string");
- QV8Engine *v8engine = ctx->d()->engine->v8Engine;
- if (ctx->d()->callData->argc == 1)
- code = ctx->d()->callData->args[0].toQStringNoThrow();
+ if (ctx->argc() == 1)
+ code = ctx->args()[0].toQStringNoThrow();
- return QQmlLocale::locale(v8engine, code);
+ return QQmlLocale::locale(ctx->engine(), code);
}
-QQmlBindingFunction::Data::Data(FunctionObject *originalFunction)
- : QV4::FunctionObject::Data(originalFunction->scope(), originalFunction->name())
- , originalFunction(originalFunction)
+Heap::QQmlBindingFunction::QQmlBindingFunction(QV4::FunctionObject *originalFunction)
+ : QV4::Heap::FunctionObject(originalFunction->scope(), originalFunction->name())
+ , originalFunction(originalFunction->d())
{
- setVTable(staticVTable());
- bindingKeyFlag = true;
}
void QQmlBindingFunction::initBindingLocation()
@@ -1190,14 +1193,16 @@ void QQmlBindingFunction::initBindingLocation()
ReturnedValue QQmlBindingFunction::call(Managed *that, CallData *callData)
{
- QQmlBindingFunction *This = static_cast<QQmlBindingFunction*>(that);
- return This->d()->originalFunction->call(callData);
+ Scope scope(static_cast<QQmlBindingFunction*>(that)->engine());
+ ScopedFunctionObject function(scope, static_cast<QQmlBindingFunction*>(that)->d()->originalFunction);
+ return function->call(callData);
}
-void QQmlBindingFunction::markObjects(Managed *that, ExecutionEngine *e)
+void QQmlBindingFunction::markObjects(Heap::Base *that, ExecutionEngine *e)
{
- QQmlBindingFunction *This = static_cast<QQmlBindingFunction*>(that);
- This->d()->originalFunction->mark(e);
+ QQmlBindingFunction::Data *This = static_cast<QQmlBindingFunction::Data *>(that);
+ if (This->originalFunction)
+ This->originalFunction->mark(e);
QV4::FunctionObject::markObjects(that, e);
}
@@ -1249,9 +1254,9 @@ DEFINE_OBJECT_VTABLE(QQmlBindingFunction);
*/
ReturnedValue QtObject::method_binding(CallContext *ctx)
{
- if (ctx->d()->callData->argc != 1)
+ if (ctx->argc() != 1)
V4THROW_ERROR("binding() requires 1 argument");
- QV4::FunctionObject *f = ctx->d()->callData->args[0].asFunctionObject();
+ QV4::FunctionObject *f = ctx->args()[0].asFunctionObject();
if (!f)
V4THROW_TYPE("binding(): argument (binding expression) must be a function");
@@ -1262,16 +1267,16 @@ ReturnedValue QtObject::method_binding(CallContext *ctx)
ReturnedValue QtObject::method_get_platform(CallContext *ctx)
{
// ### inefficient. Should be just a value based getter
- Object *o = ctx->d()->callData->thisObject.asObject();
+ Object *o = ctx->thisObject().asObject();
if (!o)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
QtObject *qt = o->as<QtObject>();
if (!qt)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
if (!qt->d()->platform)
// Only allocate a platform object once
- qt->d()->platform = new QQmlPlatform(ctx->d()->engine->v8Engine->publicEngine());
+ qt->d()->platform = new QQmlPlatform(ctx->d()->engine->jsEngine());
return QV4::QObjectWrapper::wrap(ctx->d()->engine, qt->d()->platform);
}
@@ -1279,16 +1284,16 @@ ReturnedValue QtObject::method_get_platform(CallContext *ctx)
ReturnedValue QtObject::method_get_application(CallContext *ctx)
{
// ### inefficient. Should be just a value based getter
- Object *o = ctx->d()->callData->thisObject.asObject();
+ Object *o = ctx->thisObject().asObject();
if (!o)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
QtObject *qt = o->as<QtObject>();
if (!qt)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
if (!qt->d()->application)
// Only allocate an application object once
- qt->d()->application = QQml_guiProvider()->application(ctx->d()->engine->v8Engine->publicEngine());
+ qt->d()->application = QQml_guiProvider()->application(ctx->d()->engine->jsEngine());
return QV4::QObjectWrapper::wrap(ctx->d()->engine, qt->d()->application);
}
@@ -1297,37 +1302,43 @@ ReturnedValue QtObject::method_get_application(CallContext *ctx)
ReturnedValue QtObject::method_get_inputMethod(CallContext *ctx)
{
QObject *o = QQml_guiProvider()->inputMethod();
- QQmlEngine::setObjectOwnership(o, QQmlEngine::CppOwnership);
return QV4::QObjectWrapper::wrap(ctx->d()->engine, o);
}
#endif
+ReturnedValue QtObject::method_get_styleHints(CallContext *ctx)
+{
+ QObject *o = QQml_guiProvider()->styleHints();
+ return QV4::QObjectWrapper::wrap(ctx->d()->engine, o);
+}
+
-QV4::ConsoleObject::Data::Data(ExecutionEngine *v4)
- : Object::Data(v4)
+QV4::Heap::ConsoleObject::ConsoleObject(ExecutionEngine *v4)
+ : Heap::Object(v4)
{
QV4::Scope scope(v4);
QV4::ScopedObject o(scope, this);
- o->defineDefaultProperty(QStringLiteral("debug"), method_log);
- o->defineDefaultProperty(QStringLiteral("log"), method_log);
- o->defineDefaultProperty(QStringLiteral("info"), method_log);
- o->defineDefaultProperty(QStringLiteral("warn"), method_warn);
- o->defineDefaultProperty(QStringLiteral("error"), method_error);
- o->defineDefaultProperty(QStringLiteral("assert"), method_assert);
-
- o->defineDefaultProperty(QStringLiteral("count"), method_count);
- o->defineDefaultProperty(QStringLiteral("profile"), method_profile);
- o->defineDefaultProperty(QStringLiteral("profileEnd"), method_profileEnd);
- o->defineDefaultProperty(QStringLiteral("time"), method_time);
- o->defineDefaultProperty(QStringLiteral("timeEnd"), method_timeEnd);
- o->defineDefaultProperty(QStringLiteral("trace"), method_trace);
- o->defineDefaultProperty(QStringLiteral("exception"), method_exception);
+ o->defineDefaultProperty(QStringLiteral("debug"), QV4::ConsoleObject::method_log);
+ o->defineDefaultProperty(QStringLiteral("log"), QV4::ConsoleObject::method_log);
+ o->defineDefaultProperty(QStringLiteral("info"), QV4::ConsoleObject::method_info);
+ o->defineDefaultProperty(QStringLiteral("warn"), QV4::ConsoleObject::method_warn);
+ o->defineDefaultProperty(QStringLiteral("error"), QV4::ConsoleObject::method_error);
+ o->defineDefaultProperty(QStringLiteral("assert"), QV4::ConsoleObject::method_assert);
+
+ o->defineDefaultProperty(QStringLiteral("count"), QV4::ConsoleObject::method_count);
+ o->defineDefaultProperty(QStringLiteral("profile"), QV4::ConsoleObject::method_profile);
+ o->defineDefaultProperty(QStringLiteral("profileEnd"), QV4::ConsoleObject::method_profileEnd);
+ o->defineDefaultProperty(QStringLiteral("time"), QV4::ConsoleObject::method_time);
+ o->defineDefaultProperty(QStringLiteral("timeEnd"), QV4::ConsoleObject::method_timeEnd);
+ o->defineDefaultProperty(QStringLiteral("trace"), QV4::ConsoleObject::method_trace);
+ o->defineDefaultProperty(QStringLiteral("exception"), QV4::ConsoleObject::method_exception);
}
enum ConsoleLogTypes {
Log,
+ Info,
Warn,
Error
};
@@ -1364,14 +1375,14 @@ static QV4::ReturnedValue writeToConsole(ConsoleLogTypes logType, CallContext *c
QString result;
QV4::ExecutionEngine *v4 = ctx->d()->engine;
- for (int i = 0; i < ctx->d()->callData->argc; ++i) {
+ for (int i = 0; i < ctx->argc(); ++i) {
if (i != 0)
result.append(QLatin1Char(' '));
- if (ctx->d()->callData->args[i].asArrayObject())
- result.append(QStringLiteral("[") + ctx->d()->callData->args[i].toQStringNoThrow() + QStringLiteral("]"));
+ if (ctx->args()[i].asArrayObject())
+ result.append(QStringLiteral("[") + ctx->args()[i].toQStringNoThrow() + QStringLiteral("]"));
else
- result.append(ctx->d()->callData->args[i].toQStringNoThrow());
+ result.append(ctx->args()[i].toQStringNoThrow());
}
if (printStack) {
@@ -1390,6 +1401,10 @@ static QV4::ReturnedValue writeToConsole(ConsoleLogTypes logType, CallContext *c
if (loggingCategory.isDebugEnabled())
logger.debug("%s", result.toUtf8().constData());
break;
+ case Info:
+ if (loggingCategory.isInfoEnabled())
+ logger.info("%s", result.toUtf8().constData());
+ break;
case Warn:
if (loggingCategory.isWarningEnabled())
logger.warning("%s", result.toUtf8().constData());
@@ -1414,11 +1429,15 @@ QV4::ReturnedValue ConsoleObject::method_log(CallContext *ctx)
{
//console.log
//console.debug
- //console.info
//print
return writeToConsole(Log, ctx);
}
+QV4::ReturnedValue ConsoleObject::method_info(CallContext *ctx)
+{
+ return writeToConsole(Info, ctx);
+}
+
QV4::ReturnedValue ConsoleObject::method_profile(CallContext *ctx)
{
QV4::ExecutionEngine *v4 = ctx->d()->engine;
@@ -1430,7 +1449,7 @@ QV4::ReturnedValue ConsoleObject::method_profile(CallContext *ctx)
if (!QQmlDebugService::isDebuggingEnabled()) {
logger.warning("Cannot start profiling because debug service is disabled. Start with -qmljsdebugger=port:XXXXX.");
} else {
- QQmlProfilerService::instance()->startProfiling(v4->v8Engine->engine());
+ QQmlProfilerService::instance()->startProfiling(v4->qmlEngine());
logger.debug("Profiling started.");
}
@@ -1449,7 +1468,7 @@ QV4::ReturnedValue ConsoleObject::method_profileEnd(CallContext *ctx)
if (!QQmlDebugService::isDebuggingEnabled()) {
logger.warning("Ignoring console.profileEnd(): the debug service is disabled.");
} else {
- QQmlProfilerService::instance()->stopProfiling(v4->v8Engine->engine());
+ QQmlProfilerService::instance()->stopProfiling(v4->qmlEngine());
logger.debug("Profiling ended.");
}
@@ -1458,24 +1477,24 @@ QV4::ReturnedValue ConsoleObject::method_profileEnd(CallContext *ctx)
QV4::ReturnedValue ConsoleObject::method_time(CallContext *ctx)
{
- if (ctx->d()->callData->argc != 1)
+ if (ctx->argc() != 1)
V4THROW_ERROR("console.time(): Invalid arguments");
QV8Engine *v8engine = ctx->d()->engine->v8Engine;
- QString name = ctx->d()->callData->args[0].toQStringNoThrow();
+ QString name = ctx->args()[0].toQStringNoThrow();
v8engine->startTimer(name);
return QV4::Encode::undefined();
}
QV4::ReturnedValue ConsoleObject::method_timeEnd(CallContext *ctx)
{
- if (ctx->d()->callData->argc != 1)
- V4THROW_ERROR("console.time(): Invalid arguments");
+ if (ctx->argc() != 1)
+ V4THROW_ERROR("console.timeEnd(): Invalid arguments");
QV8Engine *v8engine = ctx->d()->engine->v8Engine;
- QString name = ctx->d()->callData->args[0].toQStringNoThrow();
+ QString name = ctx->args()[0].toQStringNoThrow();
bool wasRunning;
qint64 elapsed = v8engine->stopTimer(name, &wasRunning);
if (wasRunning) {
@@ -1488,8 +1507,8 @@ QV4::ReturnedValue ConsoleObject::method_count(CallContext *ctx)
{
// first argument: name to print. Ignore any additional arguments
QString name;
- if (ctx->d()->callData->argc > 0)
- name = ctx->d()->callData->args[0].toQStringNoThrow();
+ if (ctx->argc() > 0)
+ name = ctx->args()[0].toQStringNoThrow();
QV4::ExecutionEngine *v4 = ctx->d()->engine;
QV8Engine *v8engine = ctx->d()->engine->v8Engine;
@@ -1510,7 +1529,7 @@ QV4::ReturnedValue ConsoleObject::method_count(CallContext *ctx)
QV4::ReturnedValue ConsoleObject::method_trace(CallContext *ctx)
{
- if (ctx->d()->callData->argc != 0)
+ if (ctx->argc() != 0)
V4THROW_ERROR("console.trace(): Invalid arguments");
QV4::ExecutionEngine *v4 = ctx->d()->engine;
@@ -1532,18 +1551,18 @@ QV4::ReturnedValue ConsoleObject::method_warn(CallContext *ctx)
QV4::ReturnedValue ConsoleObject::method_assert(CallContext *ctx)
{
- if (ctx->d()->callData->argc == 0)
+ if (ctx->argc() == 0)
V4THROW_ERROR("console.assert(): Missing argument");
QV4::ExecutionEngine *v4 = ctx->d()->engine;
- if (!ctx->d()->callData->args[0].toBoolean()) {
+ if (!ctx->args()[0].toBoolean()) {
QString message;
- for (int i = 1; i < ctx->d()->callData->argc; ++i) {
+ for (int i = 1; i < ctx->argc(); ++i) {
if (i != 1)
message.append(QLatin1Char(' '));
- message.append(ctx->d()->callData->args[i].toQStringNoThrow());
+ message.append(ctx->args()[i].toQStringNoThrow());
}
QString stack = jsStack(v4);
@@ -1559,7 +1578,7 @@ QV4::ReturnedValue ConsoleObject::method_assert(CallContext *ctx)
QV4::ReturnedValue ConsoleObject::method_exception(CallContext *ctx)
{
- if (ctx->d()->callData->argc == 0)
+ if (ctx->argc() == 0)
V4THROW_ERROR("console.exception(): Missing argument");
writeToConsole(Error, ctx, true);
@@ -1593,7 +1612,7 @@ void QV4::GlobalExtensions::init(QQmlEngine *qmlEngine, Object *globalObject)
globalObject->defineDefaultProperty(QStringLiteral("Qt"), qt);
// string prototype extension
- v4->stringObjectClass->prototype->defineDefaultProperty(QStringLiteral("arg"), method_string_arg);
+ v4->stringPrototype.asObject()->defineDefaultProperty(QStringLiteral("arg"), method_string_arg);
}
@@ -1617,29 +1636,29 @@ void QV4::GlobalExtensions::init(QQmlEngine *qmlEngine, Object *globalObject)
*/
ReturnedValue GlobalExtensions::method_qsTranslate(CallContext *ctx)
{
- if (ctx->d()->callData->argc < 2)
+ if (ctx->argc() < 2)
V4THROW_ERROR("qsTranslate() requires at least two arguments");
- if (!ctx->d()->callData->args[0].isString())
+ if (!ctx->args()[0].isString())
V4THROW_ERROR("qsTranslate(): first argument (context) must be a string");
- if (!ctx->d()->callData->args[1].isString())
+ if (!ctx->args()[1].isString())
V4THROW_ERROR("qsTranslate(): second argument (sourceText) must be a string");
- if ((ctx->d()->callData->argc > 2) && !ctx->d()->callData->args[2].isString())
+ if ((ctx->argc() > 2) && !ctx->args()[2].isString())
V4THROW_ERROR("qsTranslate(): third argument (disambiguation) must be a string");
- QString context = ctx->d()->callData->args[0].toQStringNoThrow();
- QString text = ctx->d()->callData->args[1].toQStringNoThrow();
+ QString context = ctx->args()[0].toQStringNoThrow();
+ QString text = ctx->args()[1].toQStringNoThrow();
QString comment;
- if (ctx->d()->callData->argc > 2) comment = ctx->d()->callData->args[2].toQStringNoThrow();
+ if (ctx->argc() > 2) comment = ctx->args()[2].toQStringNoThrow();
int i = 3;
- if (ctx->d()->callData->argc > i && ctx->d()->callData->args[i].isString()) {
+ if (ctx->argc() > i && ctx->args()[i].isString()) {
qWarning("qsTranslate(): specifying the encoding as fourth argument is deprecated");
++i;
}
int n = -1;
- if (ctx->d()->callData->argc > i)
- n = ctx->d()->callData->args[i].toInt32();
+ if (ctx->argc() > i)
+ n = ctx->args()[i].toInt32();
QString result = QCoreApplication::translate(context.toUtf8().constData(),
text.toUtf8().constData(),
@@ -1673,9 +1692,9 @@ ReturnedValue GlobalExtensions::method_qsTranslate(CallContext *ctx)
*/
ReturnedValue GlobalExtensions::method_qsTranslateNoOp(CallContext *ctx)
{
- if (ctx->d()->callData->argc < 2)
+ if (ctx->argc() < 2)
return QV4::Encode::undefined();
- return ctx->d()->callData->args[1].asReturnedValue();
+ return ctx->args()[1].asReturnedValue();
}
/*!
@@ -1697,24 +1716,26 @@ ReturnedValue GlobalExtensions::method_qsTranslateNoOp(CallContext *ctx)
*/
ReturnedValue GlobalExtensions::method_qsTr(CallContext *ctx)
{
- if (ctx->d()->callData->argc < 1)
+ if (ctx->argc() < 1)
V4THROW_ERROR("qsTr() requires at least one argument");
- if (!ctx->d()->callData->args[0].isString())
+ if (!ctx->args()[0].isString())
V4THROW_ERROR("qsTr(): first argument (sourceText) must be a string");
- if ((ctx->d()->callData->argc > 1) && !ctx->d()->callData->args[1].isString())
+ if ((ctx->argc() > 1) && !ctx->args()[1].isString())
V4THROW_ERROR("qsTr(): second argument (disambiguation) must be a string");
- if ((ctx->d()->callData->argc > 2) && !ctx->d()->callData->args[2].isNumber())
+ if ((ctx->argc() > 2) && !ctx->args()[2].isNumber())
V4THROW_ERROR("qsTr(): third argument (n) must be a number");
+ Scope scope(ctx);
QV8Engine *v8engine = ctx->d()->engine->v8Engine;
QString context;
if (QQmlContextData *ctxt = v8engine->callingContext()) {
- QString path = ctxt->url.toString();
+ QString path = ctxt->urlString();
int lastSlash = path.lastIndexOf(QLatin1Char('/'));
int lastDot = path.lastIndexOf(QLatin1Char('.'));
int length = lastDot - (lastSlash + 1);
context = (lastSlash > -1) ? path.mid(lastSlash + 1, (length > -1) ? length : -1) : QString();
- } else if (QV4::ExecutionContext *parentCtx = ctx->d()->parent) {
+ } else if (ctx->d()->parent) {
+ ScopedContext parentCtx(scope, ctx->d()->parent);
// The first non-empty source URL in the call stack determines the translation context.
while (parentCtx && context.isEmpty()) {
if (QV4::CompiledData::CompilationUnit *unit = parentCtx->d()->compilationUnit) {
@@ -1733,13 +1754,13 @@ ReturnedValue GlobalExtensions::method_qsTr(CallContext *ctx)
}
}
- QString text = ctx->d()->callData->args[0].toQStringNoThrow();
+ QString text = ctx->args()[0].toQStringNoThrow();
QString comment;
- if (ctx->d()->callData->argc > 1)
- comment = ctx->d()->callData->args[1].toQStringNoThrow();
+ if (ctx->argc() > 1)
+ comment = ctx->args()[1].toQStringNoThrow();
int n = -1;
- if (ctx->d()->callData->argc > 2)
- n = ctx->d()->callData->args[2].toInt32();
+ if (ctx->argc() > 2)
+ n = ctx->args()[2].toInt32();
QString result = QCoreApplication::translate(context.toUtf8().constData(), text.toUtf8().constData(),
comment.toUtf8().constData(), n);
@@ -1771,9 +1792,9 @@ ReturnedValue GlobalExtensions::method_qsTr(CallContext *ctx)
*/
ReturnedValue GlobalExtensions::method_qsTrNoOp(CallContext *ctx)
{
- if (ctx->d()->callData->argc < 1)
+ if (ctx->argc() < 1)
return QV4::Encode::undefined();
- return ctx->d()->callData->args[0].asReturnedValue();
+ return ctx->args()[0].asReturnedValue();
}
/*!
@@ -1808,18 +1829,18 @@ ReturnedValue GlobalExtensions::method_qsTrNoOp(CallContext *ctx)
*/
ReturnedValue GlobalExtensions::method_qsTrId(CallContext *ctx)
{
- if (ctx->d()->callData->argc < 1)
+ if (ctx->argc() < 1)
V4THROW_ERROR("qsTrId() requires at least one argument");
- if (!ctx->d()->callData->args[0].isString())
+ if (!ctx->args()[0].isString())
V4THROW_TYPE("qsTrId(): first argument (id) must be a string");
- if (ctx->d()->callData->argc > 1 && !ctx->d()->callData->args[1].isNumber())
+ if (ctx->argc() > 1 && !ctx->args()[1].isNumber())
V4THROW_TYPE("qsTrId(): second argument (n) must be a number");
int n = -1;
- if (ctx->d()->callData->argc > 1)
- n = ctx->d()->callData->args[1].toInt32();
+ if (ctx->argc() > 1)
+ n = ctx->args()[1].toInt32();
- return ctx->d()->engine->newString(qtTrId(ctx->d()->callData->args[0].toQStringNoThrow().toUtf8().constData(), n))->asReturnedValue();
+ return ctx->d()->engine->newString(qtTrId(ctx->args()[0].toQStringNoThrow().toUtf8().constData(), n))->asReturnedValue();
}
/*!
@@ -1840,9 +1861,9 @@ ReturnedValue GlobalExtensions::method_qsTrId(CallContext *ctx)
*/
ReturnedValue GlobalExtensions::method_qsTrIdNoOp(CallContext *ctx)
{
- if (ctx->d()->callData->argc < 1)
+ if (ctx->argc() < 1)
return QV4::Encode::undefined();
- return ctx->d()->callData->args[0].asReturnedValue();
+ return ctx->args()[0].asReturnedValue();
}
#endif // QT_NO_TRANSLATION
@@ -1858,13 +1879,13 @@ QV4::ReturnedValue GlobalExtensions::method_gc(CallContext *ctx)
ReturnedValue GlobalExtensions::method_string_arg(CallContext *ctx)
{
- if (ctx->d()->callData->argc != 1)
+ if (ctx->argc() != 1)
V4THROW_ERROR("String.arg(): Invalid arguments");
- QString value = ctx->d()->callData->thisObject.toQString();
+ QString value = ctx->thisObject().toQString();
QV4::Scope scope(ctx);
- QV4::ScopedValue arg(scope, ctx->d()->callData->args[0]);
+ QV4::ScopedValue arg(scope, ctx->args()[0]);
if (arg->isInteger())
return ctx->d()->engine->newString(value.arg(arg->integerValue()))->asReturnedValue();
else if (arg->isDouble())
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions_p.h b/src/qml/qml/v8/qqmlbuiltinfunctions_p.h
index f7728aa120..b78375118b 100644
--- a/src/qml/qml/v8/qqmlbuiltinfunctions_p.h
+++ b/src/qml/qml/v8/qqmlbuiltinfunctions_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -55,19 +55,35 @@ class QV8Engine;
namespace QV4 {
+namespace Heap {
+
+struct QtObject : Object {
+ QtObject(ExecutionEngine *v4, QQmlEngine *qmlEngine);
+ QObject *platform;
+ QObject *application;
+};
+
+struct ConsoleObject : Object {
+ ConsoleObject(ExecutionEngine *engine);
+};
+
+struct QQmlBindingFunction : FunctionObject {
+ QQmlBindingFunction(QV4::FunctionObject *originalFunction);
+ FunctionObject *originalFunction;
+ // Set when the binding is created later
+ QQmlSourceLocation bindingLocation;
+};
+
+}
+
struct QtObject : Object
{
- struct Data : Object::Data {
- Data(ExecutionEngine *v4, QQmlEngine *qmlEngine);
- QObject *platform;
- QObject *application;
- };
- V4_OBJECT(Object)
-
+ V4_OBJECT2(QtObject, Object)
static ReturnedValue method_isQtObject(CallContext *ctx);
static ReturnedValue method_rgba(CallContext *ctx);
static ReturnedValue method_hsla(CallContext *ctx);
+ static ReturnedValue method_hsva(CallContext *ctx);
static ReturnedValue method_colorEqual(CallContext *ctx);
static ReturnedValue method_font(CallContext *ctx);
static ReturnedValue method_rect(CallContext *ctx);
@@ -101,16 +117,18 @@ struct QtObject : Object
#ifndef QT_NO_IM
static ReturnedValue method_get_inputMethod(CallContext *ctx);
#endif
+ static ReturnedValue method_get_styleHints(CallContext *ctx);
};
struct ConsoleObject : Object
{
- struct Data : Object::Data {
- Data(ExecutionEngine *engine);
- };
+ typedef Heap::ConsoleObject Data;
+ const Data *d() const { return static_cast<const Data *>(Object::d()); }
+ Data *d() { return static_cast<Data *>(Object::d()); }
static ReturnedValue method_error(CallContext *ctx);
static ReturnedValue method_log(CallContext *ctx);
+ static ReturnedValue method_info(CallContext *ctx);
static ReturnedValue method_profile(CallContext *ctx);
static ReturnedValue method_profileEnd(CallContext *ctx);
static ReturnedValue method_time(CallContext *ctx);
@@ -143,23 +161,14 @@ struct GlobalExtensions {
struct QQmlBindingFunction : public QV4::FunctionObject
{
- struct Data : FunctionObject::Data {
- Data(FunctionObject *originalFunction);
- QV4::FunctionObject *originalFunction;
- // Set when the binding is created later
- QQmlSourceLocation bindingLocation;
- };
- V4_OBJECT(QV4::FunctionObject)
+ V4_OBJECT2(QQmlBindingFunction, FunctionObject)
+ V4_NEEDS_DESTROY
void initBindingLocation(); // from caller stack trace
static ReturnedValue call(Managed *that, CallData *callData);
- static void markObjects(Managed *that, ExecutionEngine *e);
- static void destroy(Managed *that) {
- static_cast<QQmlBindingFunction *>(that)->d()->~Data();
- }
-
+ static void markObjects(Heap::Base *that, ExecutionEngine *e);
};
}
diff --git a/src/qml/qml/v8/qv4domerrors.cpp b/src/qml/qml/v8/qv4domerrors.cpp
index cc7a6546f9..c318e2e550 100644
--- a/src/qml/qml/v8/qv4domerrors.cpp
+++ b/src/qml/qml/v8/qv4domerrors.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -41,7 +41,7 @@ using namespace QV4;
void qt_add_domexceptions(ExecutionEngine *e)
{
Scope scope(e);
- Scoped<Object> domexception(scope, e->newObject());
+ ScopedObject domexception(scope, e->newObject());
domexception->defineReadonlyProperty(QStringLiteral("INDEX_SIZE_ERR"), Primitive::fromInt32(DOMEXCEPTION_INDEX_SIZE_ERR));
domexception->defineReadonlyProperty(QStringLiteral("DOMSTRING_SIZE_ERR"), Primitive::fromInt32(DOMEXCEPTION_DOMSTRING_SIZE_ERR));
domexception->defineReadonlyProperty(QStringLiteral("HIERARCHY_REQUEST_ERR"), Primitive::fromInt32(DOMEXCEPTION_HIERARCHY_REQUEST_ERR));
@@ -59,7 +59,7 @@ void qt_add_domexceptions(ExecutionEngine *e)
domexception->defineReadonlyProperty(QStringLiteral("INVALID_ACCESS_ERR"), Primitive::fromInt32(DOMEXCEPTION_INVALID_ACCESS_ERR));
domexception->defineReadonlyProperty(QStringLiteral("VALIDATION_ERR"), Primitive::fromInt32(DOMEXCEPTION_VALIDATION_ERR));
domexception->defineReadonlyProperty(QStringLiteral("TYPE_MISMATCH_ERR"), Primitive::fromInt32(DOMEXCEPTION_TYPE_MISMATCH_ERR));
- e->globalObject->defineDefaultProperty(QStringLiteral("DOMException"), domexception);
+ e->globalObject()->defineDefaultProperty(QStringLiteral("DOMException"), domexception);
}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v8/qv4domerrors_p.h b/src/qml/qml/v8/qv4domerrors_p.h
index 59ed744f5e..a9406045cf 100644
--- a/src/qml/qml/v8/qv4domerrors_p.h
+++ b/src/qml/qml/v8/qv4domerrors_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -70,9 +70,9 @@ QT_BEGIN_NAMESPACE
#define V4THROW_DOM(error, string) { \
QV4::ScopedValue v(scope, scope.engine->newString(QStringLiteral(string))); \
- QV4::Scoped<Object> ex(scope, scope.engine->newErrorObject(v)); \
- ex->put(QV4::ScopedString(scope, scope.engine->newIdentifier(QStringLiteral("code"))).getPointer(), QV4::ScopedValue(scope, QV4::Primitive::fromInt32(error))); \
- return ctx->throwError(ex); \
+ QV4::ScopedObject ex(scope, scope.engine->newErrorObject(v)); \
+ ex->put(QV4::ScopedString(scope, scope.engine->newIdentifier(QStringLiteral("code"))), QV4::ScopedValue(scope, QV4::Primitive::fromInt32(error))); \
+ return ctx->engine()->throwError(ex); \
}
namespace QV4 {
diff --git a/src/qml/qml/v8/qv4sqlerrors.cpp b/src/qml/qml/v8/qv4sqlerrors.cpp
index e8e0462b6e..b7a5b71540 100644
--- a/src/qml/qml/v8/qv4sqlerrors.cpp
+++ b/src/qml/qml/v8/qv4sqlerrors.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -42,7 +42,7 @@ using namespace QV4;
void qt_add_sqlexceptions(QV4::ExecutionEngine *engine)
{
Scope scope(engine);
- Scoped<Object> sqlexception(scope, engine->newObject());
+ ScopedObject sqlexception(scope, engine->newObject());
sqlexception->defineReadonlyProperty(QStringLiteral("UNKNOWN_ERR"), Primitive::fromInt32(SQLEXCEPTION_UNKNOWN_ERR));
sqlexception->defineReadonlyProperty(QStringLiteral("DATABASE_ERR"), Primitive::fromInt32(SQLEXCEPTION_DATABASE_ERR));
sqlexception->defineReadonlyProperty(QStringLiteral("VERSION_ERR"), Primitive::fromInt32(SQLEXCEPTION_VERSION_ERR));
@@ -51,7 +51,7 @@ void qt_add_sqlexceptions(QV4::ExecutionEngine *engine)
sqlexception->defineReadonlyProperty(QStringLiteral("SYNTAX_ERR"), Primitive::fromInt32(SQLEXCEPTION_SYNTAX_ERR));
sqlexception->defineReadonlyProperty(QStringLiteral("CONSTRAINT_ERR"), Primitive::fromInt32(SQLEXCEPTION_CONSTRAINT_ERR));
sqlexception->defineReadonlyProperty(QStringLiteral("TIMEOUT_ERR"), Primitive::fromInt32(SQLEXCEPTION_TIMEOUT_ERR));
- engine->globalObject->defineDefaultProperty(QStringLiteral("SQLException"), sqlexception);
+ engine->globalObject()->defineDefaultProperty(QStringLiteral("SQLException"), sqlexception);
}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v8/qv4sqlerrors_p.h b/src/qml/qml/v8/qv4sqlerrors_p.h
index 5dbe145817..e5240d5769 100644
--- a/src/qml/qml/v8/qv4sqlerrors_p.h
+++ b/src/qml/qml/v8/qv4sqlerrors_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qml/v8/qv8debug_p.h b/src/qml/qml/v8/qv8debug_p.h
deleted file mode 100644
index 75342aa070..0000000000
--- a/src/qml/qml/v8/qv8debug_p.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//#include <private/v8-debug.h>
diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp
index 39b816f97c..a7c63c9df1 100644
--- a/src/qml/qml/v8/qv8engine.cpp
+++ b/src/qml/qml/v8/qv8engine.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -58,6 +58,7 @@
#include <QtCore/qjsonobject.h>
#include <QtCore/qjsonvalue.h>
#include <QtCore/qdatetime.h>
+#include <QtCore/qdatastream.h>
#include <private/qsimd_p.h>
#include <private/qv4value_inl_p.h>
@@ -101,17 +102,18 @@ static void saveJSValue(QDataStream &stream, const void *data)
static void restoreJSValue(QDataStream &stream, void *data)
{
QJSValue *jsv = reinterpret_cast<QJSValue*>(data);
- QJSValuePrivate *d = QJSValuePrivate::get(*jsv);
quint32 isNullOrUndefined;
stream >> isNullOrUndefined;
+
if (isNullOrUndefined & 0x1) {
- d->value = QV4::Primitive::nullValue().asReturnedValue();
+ *jsv = QJSValue(QJSValue::NullValue);
} else if (isNullOrUndefined & 0x2) {
- d->value = QV4::Primitive::undefinedValue().asReturnedValue();
+ *jsv = QJSValue();
} else {
- d->value = QV4::Primitive::emptyValue().asReturnedValue();
- d->unboundData.load(stream);
+ QVariant v;
+ v.load(stream);
+ QJSValuePrivate::setVariant(jsv, v);
}
}
@@ -151,7 +153,7 @@ QV8Engine::~QV8Engine()
delete m_extensionData[ii];
m_extensionData.clear();
- qt_rem_qmlxmlhttprequest(this, m_xmlHttpRequestData);
+ qt_rem_qmlxmlhttprequest(m_v4Engine, m_xmlHttpRequestData);
m_xmlHttpRequestData = 0;
delete m_listModelData;
m_listModelData = 0;
@@ -159,326 +161,6 @@ QV8Engine::~QV8Engine()
delete m_v4Engine;
}
-QVariant QV8Engine::toVariant(const QV4::ValueRef value, int typeHint, bool createJSValueForObjects, V8ObjectSet *visitedObjects)
-{
- Q_ASSERT (!value->isEmpty());
- QV4::Scope scope(m_v4Engine);
-
- if (QV4::VariantObject *v = value->as<QV4::VariantObject>())
- return v->d()->data;
-
- if (typeHint == QVariant::Bool)
- return QVariant(value->toBoolean());
-
- if (typeHint == QMetaType::QJsonValue)
- return QVariant::fromValue(QV4::JsonObject::toJsonValue(value));
-
- if (typeHint == qMetaTypeId<QJSValue>())
- return QVariant::fromValue(QJSValue(new QJSValuePrivate(m_v4Engine, value)));
-
- if (value->asObject()) {
- QV4::ScopedObject object(scope, value);
- if (typeHint == QMetaType::QJsonObject
- && !value->asArrayObject() && !value->asFunctionObject()) {
- return QVariant::fromValue(QV4::JsonObject::toJsonObject(object));
- } else if (QV4::QObjectWrapper *wrapper = object->as<QV4::QObjectWrapper>()) {
- return qVariantFromValue<QObject *>(wrapper->object());
- } else if (object->as<QV4::QmlContextWrapper>()) {
- return QVariant();
- } else if (QV4::QmlTypeWrapper *w = object->as<QV4::QmlTypeWrapper>()) {
- return w->toVariant();
- } else if (QV4::QmlValueTypeWrapper *v = object->as<QV4::QmlValueTypeWrapper>()) {
- return v->toVariant();
- } else if (QV4::QmlListWrapper *l = object->as<QV4::QmlListWrapper>()) {
- return l->toVariant();
- } else if (object->isListType())
- return QV4::SequencePrototype::toVariant(object);
- }
-
- if (value->asArrayObject()) {
- QV4::ScopedArrayObject a(scope, value);
- if (typeHint == qMetaTypeId<QList<QObject *> >()) {
- QList<QObject *> list;
- uint32_t length = a->getLength();
- QV4::Scoped<QV4::QObjectWrapper> qobjectWrapper(scope);
- for (uint32_t ii = 0; ii < length; ++ii) {
- qobjectWrapper = a->getIndexed(ii);
- if (!!qobjectWrapper) {
- list << qobjectWrapper->object();
- } else {
- list << 0;
- }
- }
-
- return qVariantFromValue<QList<QObject*> >(list);
- } else if (typeHint == QMetaType::QJsonArray) {
- return QVariant::fromValue(QV4::JsonObject::toJsonArray(a));
- }
-
- bool succeeded = false;
- QVariant retn = QV4::SequencePrototype::toVariant(value, typeHint, &succeeded);
- if (succeeded)
- return retn;
- }
-
- if (value->isUndefined())
- return QVariant();
- if (value->isNull())
- return QVariant(QMetaType::VoidStar, (void *)0);
- if (value->isBoolean())
- return value->booleanValue();
- if (value->isInteger())
- return value->integerValue();
- if (value->isNumber())
- return value->asDouble();
- if (value->isString())
- return value->stringValue()->toQString();
- if (QQmlLocaleData *ld = value->as<QQmlLocaleData>())
- return ld->d()->locale;
- if (QV4::DateObject *d = value->asDateObject())
- return d->toQDateTime();
- // NOTE: since we convert QTime to JS Date, round trip will change the variant type (to QDateTime)!
-
- QV4::ScopedObject o(scope, value);
- Q_ASSERT(o);
-
- if (QV4::RegExpObject *re = o->as<QV4::RegExpObject>())
- return re->toQRegExp();
-
- if (createJSValueForObjects)
- return QVariant::fromValue(QJSValue(new QJSValuePrivate(o->asReturnedValue())));
-
- return objectToVariant(o, visitedObjects);
-}
-
-QVariant QV8Engine::objectToVariant(QV4::Object *o, V8ObjectSet *visitedObjects)
-{
- Q_ASSERT(o);
-
- V8ObjectSet recursionGuardSet;
- if (!visitedObjects) {
- visitedObjects = &recursionGuardSet;
- } else if (visitedObjects->contains(o)) {
- // Avoid recursion.
- // For compatibility with QVariant{List,Map} conversion, we return an
- // empty object (and no error is thrown).
- if (o->asArrayObject())
- return QVariantList();
- return QVariantMap();
- }
- visitedObjects->insert(o);
-
- QVariant result;
-
- if (o->asArrayObject()) {
- QV4::Scope scope(m_v4Engine);
- QV4::ScopedArrayObject a(scope, o->asReturnedValue());
- QV4::ScopedValue v(scope);
- QVariantList list;
-
- int length = a->getLength();
- for (int ii = 0; ii < length; ++ii) {
- v = a->getIndexed(ii);
- list << toVariant(v, -1, /*createJSValueForObjects*/false, visitedObjects);
- }
-
- result = list;
- } else if (!o->asFunctionObject()) {
- QVariantMap map;
- QV4::Scope scope(m_v4Engine);
- QV4::ObjectIterator it(scope, o, QV4::ObjectIterator::EnumerableOnly);
- QV4::ScopedValue name(scope);
- QV4::ScopedValue val(scope);
- while (1) {
- name = it.nextPropertyNameAsString(val);
- if (name->isNull())
- break;
-
- QString key = name->toQStringNoThrow();
- map.insert(key, toVariant(val, /*type hint*/-1, /*createJSValueForObjects*/false, visitedObjects));
- }
-
- result = map;
- }
-
- visitedObjects->remove(o);
- return result;
-}
-
-static QV4::ReturnedValue arrayFromStringList(QV8Engine *engine, const QStringList &list)
-{
- QV4::ExecutionEngine *e = QV8Engine::getV4(engine);
- QV4::Scope scope(e);
- QV4::Scoped<QV4::ArrayObject> a(scope, e->newArrayObject());
- int len = list.count();
- a->arrayReserve(len);
- QV4::ScopedValue v(scope);
- for (int ii = 0; ii < len; ++ii)
- a->arrayPut(ii, (v = QV4::Encode(e->newString(list.at(ii)))));
-
- a->setArrayLengthUnchecked(len);
- return a.asReturnedValue();
-}
-
-static QV4::ReturnedValue arrayFromVariantList(QV8Engine *engine, const QVariantList &list)
-{
- QV4::ExecutionEngine *e = QV8Engine::getV4(engine);
- QV4::Scope scope(e);
- QV4::Scoped<QV4::ArrayObject> a(scope, e->newArrayObject());
- int len = list.count();
- a->arrayReserve(len);
- QV4::ScopedValue v(scope);
- for (int ii = 0; ii < len; ++ii)
- a->arrayPut(ii, (v = engine->fromVariant(list.at(ii))));
-
- a->setArrayLengthUnchecked(len);
- return a.asReturnedValue();
-}
-
-static QV4::ReturnedValue objectFromVariantMap(QV8Engine *engine, const QVariantMap &map)
-{
- QV4::ExecutionEngine *e = QV8Engine::getV4(engine);
- QV4::Scope scope(e);
- QV4::ScopedObject o(scope, e->newObject());
- QV4::ScopedString s(scope);
- QV4::ScopedValue v(scope);
- for (QVariantMap::ConstIterator iter = map.begin(); iter != map.end(); ++iter) {
- s = e->newString(iter.key());
- uint idx = s->asArrayIndex();
- if (idx > 16 && (!o->arrayData() || idx > o->arrayData()->length() * 2))
- o->initSparseArray();
- o->put(s.getPointer(), (v = engine->fromVariant(iter.value())));
- }
- return o.asReturnedValue();
-}
-
-Q_CORE_EXPORT QString qt_regexp_toCanonical(const QString &, QRegExp::PatternSyntax);
-
-QV4::ReturnedValue QV8Engine::fromVariant(const QVariant &variant)
-{
- int type = variant.userType();
- const void *ptr = variant.constData();
-
- if (type < QMetaType::User) {
- switch (QMetaType::Type(type)) {
- case QMetaType::UnknownType:
- case QMetaType::Void:
- return QV4::Encode::undefined();
- case QMetaType::VoidStar:
- return QV4::Encode::null();
- case QMetaType::Bool:
- return QV4::Encode(*reinterpret_cast<const bool*>(ptr));
- case QMetaType::Int:
- return QV4::Encode(*reinterpret_cast<const int*>(ptr));
- case QMetaType::UInt:
- return QV4::Encode(*reinterpret_cast<const uint*>(ptr));
- case QMetaType::LongLong:
- return QV4::Encode((double)*reinterpret_cast<const qlonglong*>(ptr));
- case QMetaType::ULongLong:
- return QV4::Encode((double)*reinterpret_cast<const qulonglong*>(ptr));
- case QMetaType::Double:
- return QV4::Encode(*reinterpret_cast<const double*>(ptr));
- case QMetaType::QString:
- return m_v4Engine->currentContext()->d()->engine->newString(*reinterpret_cast<const QString*>(ptr))->asReturnedValue();
- case QMetaType::Float:
- return QV4::Encode(*reinterpret_cast<const float*>(ptr));
- case QMetaType::Short:
- return QV4::Encode((int)*reinterpret_cast<const short*>(ptr));
- case QMetaType::UShort:
- return QV4::Encode((int)*reinterpret_cast<const unsigned short*>(ptr));
- case QMetaType::Char:
- return QV4::Encode((int)*reinterpret_cast<const char*>(ptr));
- case QMetaType::UChar:
- return QV4::Encode((int)*reinterpret_cast<const unsigned char*>(ptr));
- case QMetaType::QChar:
- return QV4::Encode((int)(*reinterpret_cast<const QChar*>(ptr)).unicode());
- case QMetaType::QDateTime:
- return QV4::Encode(m_v4Engine->newDateObject(*reinterpret_cast<const QDateTime *>(ptr)));
- case QMetaType::QDate:
- return QV4::Encode(m_v4Engine->newDateObject(QDateTime(*reinterpret_cast<const QDate *>(ptr))));
- case QMetaType::QTime:
- return QV4::Encode(m_v4Engine->newDateObject(QDateTime(QDate(1970,1,1), *reinterpret_cast<const QTime *>(ptr))));
- case QMetaType::QRegExp:
- return QV4::Encode(m_v4Engine->newRegExpObject(*reinterpret_cast<const QRegExp *>(ptr)));
- case QMetaType::QObjectStar:
- return QV4::QObjectWrapper::wrap(m_v4Engine, *reinterpret_cast<QObject* const *>(ptr));
- case QMetaType::QStringList:
- {
- bool succeeded = false;
- QV4::Scope scope(m_v4Engine);
- QV4::ScopedValue retn(scope, QV4::SequencePrototype::fromVariant(m_v4Engine, variant, &succeeded));
- if (succeeded)
- return retn.asReturnedValue();
- return arrayFromStringList(this, *reinterpret_cast<const QStringList *>(ptr));
- }
- case QMetaType::QVariantList:
- return arrayFromVariantList(this, *reinterpret_cast<const QVariantList *>(ptr));
- case QMetaType::QVariantMap:
- return objectFromVariantMap(this, *reinterpret_cast<const QVariantMap *>(ptr));
- case QMetaType::QJsonValue:
- return QV4::JsonObject::fromJsonValue(m_v4Engine, *reinterpret_cast<const QJsonValue *>(ptr));
- case QMetaType::QJsonObject:
- return QV4::JsonObject::fromJsonObject(m_v4Engine, *reinterpret_cast<const QJsonObject *>(ptr));
- case QMetaType::QJsonArray:
- return QV4::JsonObject::fromJsonArray(m_v4Engine, *reinterpret_cast<const QJsonArray *>(ptr));
- case QMetaType::QLocale:
- return QQmlLocale::wrap(this, *reinterpret_cast<const QLocale*>(ptr));
- default:
- break;
- }
-
- if (QQmlValueType *vt = QQmlValueTypeFactory::valueType(type))
- return QV4::QmlValueTypeWrapper::create(this, variant, vt);
- } else {
- QV4::Scope scope(m_v4Engine);
- if (type == qMetaTypeId<QQmlListReference>()) {
- typedef QQmlListReferencePrivate QDLRP;
- QDLRP *p = QDLRP::get((QQmlListReference*)ptr);
- if (p->object) {
- return QV4::QmlListWrapper::create(this, p->property, p->propertyType);
- } else {
- return QV4::Encode::null();
- }
- } else if (type == qMetaTypeId<QJSValue>()) {
- const QJSValue *value = reinterpret_cast<const QJSValue *>(ptr);
- QJSValuePrivate *valuep = QJSValuePrivate::get(*value);
- return valuep->getValue(m_v4Engine);
- } else if (type == qMetaTypeId<QList<QObject *> >()) {
- // XXX Can this be made more by using Array as a prototype and implementing
- // directly against QList<QObject*>?
- const QList<QObject *> &list = *(QList<QObject *>*)ptr;
- QV4::Scoped<QV4::ArrayObject> a(scope, m_v4Engine->newArrayObject());
- a->arrayReserve(list.count());
- QV4::ScopedValue v(scope);
- for (int ii = 0; ii < list.count(); ++ii)
- a->arrayPut(ii, (v = QV4::QObjectWrapper::wrap(m_v4Engine, list.at(ii))));
- a->setArrayLengthUnchecked(list.count());
- return a.asReturnedValue();
- } else if (QMetaType::typeFlags(type) & QMetaType::PointerToQObject) {
- return QV4::QObjectWrapper::wrap(m_v4Engine, *reinterpret_cast<QObject* const *>(ptr));
- }
-
- bool objOk;
- QObject *obj = QQmlMetaType::toQObject(variant, &objOk);
- if (objOk)
- return QV4::QObjectWrapper::wrap(m_v4Engine, obj);
-
- bool succeeded = false;
- QV4::ScopedValue retn(scope, QV4::SequencePrototype::fromVariant(m_v4Engine, variant, &succeeded));
- if (succeeded)
- return retn.asReturnedValue();
-
- if (QQmlValueType *vt = QQmlValueTypeFactory::valueType(type))
- return QV4::QmlValueTypeWrapper::create(this, variant, vt);
- }
-
- // XXX TODO: To be compatible, we still need to handle:
- // + QObjectList
- // + QList<int>
-
- return QV4::Encode(m_v4Engine->newVariantObject(variant));
-}
-
QNetworkAccessManager *QV8Engine::networkAccessManager()
{
return QQmlEnginePrivate::get(m_engine)->getNetworkAccessManager();
@@ -497,21 +179,21 @@ QQmlContextData *QV8Engine::callingContext()
void QV8Engine::initializeGlobal()
{
QV4::Scope scope(m_v4Engine);
- QV4::GlobalExtensions::init(m_engine, m_v4Engine->globalObject);
+ QV4::GlobalExtensions::init(m_engine, m_v4Engine->globalObject());
QQmlLocale::registerStringLocaleCompare(m_v4Engine);
QQmlDateExtension::registerExtension(m_v4Engine);
QQmlNumberExtension::registerExtension(m_v4Engine);
qt_add_domexceptions(m_v4Engine);
- m_xmlHttpRequestData = qt_add_qmlxmlhttprequest(this);
+ m_xmlHttpRequestData = qt_add_qmlxmlhttprequest(m_v4Engine);
qt_add_sqlexceptions(m_v4Engine);
{
- for (uint i = 0; i < m_v4Engine->globalObject->internalClass()->size; ++i) {
- if (m_v4Engine->globalObject->internalClass()->nameMap.at(i))
- m_illegalNames.insert(m_v4Engine->globalObject->internalClass()->nameMap.at(i)->toQString());
+ for (uint i = 0; i < m_v4Engine->globalObject()->internalClass()->size; ++i) {
+ if (m_v4Engine->globalObject()->internalClass()->nameMap.at(i))
+ m_illegalNames.insert(m_v4Engine->globalObject()->internalClass()->nameMap.at(i)->string);
}
}
@@ -534,20 +216,20 @@ void QV8Engine::initializeGlobal()
" }"\
"})"
- QV4::Scoped<QV4::FunctionObject> result(scope, QV4::Script::evaluate(m_v4Engine, QString::fromUtf8(FREEZE_SOURCE), 0));
+ QV4::ScopedFunctionObject result(scope, QV4::Script::evaluate(m_v4Engine, QString::fromUtf8(FREEZE_SOURCE), 0));
Q_ASSERT(!!result);
- m_freezeObject = result;
+ m_freezeObject.set(scope.engine, result);
#undef FREEZE_SOURCE
}
}
-void QV8Engine::freezeObject(const QV4::ValueRef value)
+void QV8Engine::freezeObject(const QV4::Value &value)
{
QV4::Scope scope(m_v4Engine);
QV4::ScopedFunctionObject f(scope, m_freezeObject.value());
QV4::ScopedCallData callData(scope, 1);
callData->args[0] = value;
- callData->thisObject = m_v4Engine->globalObject;
+ callData->thisObject = m_v4Engine->globalObject();
f->call(callData);
}
@@ -585,7 +267,7 @@ void QV8Engine::initQmlGlobalObject()
{
initializeGlobal();
QV4::Scope scope(m_v4Engine);
- QV4::ScopedValue v(scope, m_v4Engine->globalObject);
+ QV4::ScopedValue v(scope, m_v4Engine->globalObject());
freezeObject(v);
}
@@ -597,365 +279,7 @@ void QV8Engine::setEngine(QQmlEngine *engine)
QV4::ReturnedValue QV8Engine::global()
{
- return m_v4Engine->globalObject->asReturnedValue();
-}
-
-// Converts a QVariantList to JS.
-// The result is a new Array object with length equal to the length
-// of the QVariantList, and the elements being the QVariantList's
-// elements converted to JS, recursively.
-QV4::ReturnedValue QV8Engine::variantListToJS(const QVariantList &lst)
-{
- QV4::Scope scope(m_v4Engine);
- QV4::Scoped<QV4::ArrayObject> a(scope, m_v4Engine->newArrayObject());
- a->arrayReserve(lst.size());
- QV4::ScopedValue v(scope);
- for (int i = 0; i < lst.size(); i++)
- a->arrayPut(i, (v = variantToJS(lst.at(i))));
- a->setArrayLengthUnchecked(lst.size());
- return a.asReturnedValue();
-}
-
-// Converts a QVariantMap to JS.
-// The result is a new Object object with property names being
-// the keys of the QVariantMap, and values being the values of
-// the QVariantMap converted to JS, recursively.
-QV4::ReturnedValue QV8Engine::variantMapToJS(const QVariantMap &vmap)
-{
- QV4::Scope scope(m_v4Engine);
- QV4::Scoped<QV4::Object> o(scope, m_v4Engine->newObject());
- QVariantMap::const_iterator it;
- QV4::ScopedString s(scope);
- QV4::ScopedValue v(scope);
- for (it = vmap.constBegin(); it != vmap.constEnd(); ++it) {
- s = m_v4Engine->newIdentifier(it.key());
- v = variantToJS(it.value());
- uint idx = s->asArrayIndex();
- if (idx < UINT_MAX)
- o->arraySet(idx, v);
- else
- o->insertMember(s.getPointer(), v);
- }
- return o.asReturnedValue();
-}
-
-// Converts the meta-type defined by the given type and data to JS.
-// Returns the value if conversion succeeded, an empty handle otherwise.
-QV4::ReturnedValue QV8Engine::metaTypeToJS(int type, const void *data)
-{
- Q_ASSERT(data != 0);
-
- // check if it's one of the types we know
- switch (QMetaType::Type(type)) {
- case QMetaType::UnknownType:
- case QMetaType::Void:
- return QV4::Encode::undefined();
- case QMetaType::VoidStar:
- return QV4::Encode::null();
- case QMetaType::Bool:
- return QV4::Encode(*reinterpret_cast<const bool*>(data));
- case QMetaType::Int:
- return QV4::Encode(*reinterpret_cast<const int*>(data));
- case QMetaType::UInt:
- return QV4::Encode(*reinterpret_cast<const uint*>(data));
- case QMetaType::LongLong:
- return QV4::Encode(double(*reinterpret_cast<const qlonglong*>(data)));
- case QMetaType::ULongLong:
-#if defined(Q_OS_WIN) && defined(_MSC_FULL_VER) && _MSC_FULL_VER <= 12008804
-#pragma message("** NOTE: You need the Visual Studio Processor Pack to compile support for 64bit unsigned integers.")
- return QV4::Encode(double((qlonglong)*reinterpret_cast<const qulonglong*>(data)));
-#elif defined(Q_CC_MSVC) && !defined(Q_CC_MSVC_NET)
- return QV4::Encode(double((qlonglong)*reinterpret_cast<const qulonglong*>(data)));
-#else
- return QV4::Encode(double(*reinterpret_cast<const qulonglong*>(data)));
-#endif
- case QMetaType::Double:
- return QV4::Encode(*reinterpret_cast<const double*>(data));
- case QMetaType::QString:
- return m_v4Engine->currentContext()->d()->engine->newString(*reinterpret_cast<const QString*>(data))->asReturnedValue();
- case QMetaType::Float:
- return QV4::Encode(*reinterpret_cast<const float*>(data));
- case QMetaType::Short:
- return QV4::Encode((int)*reinterpret_cast<const short*>(data));
- case QMetaType::UShort:
- return QV4::Encode((int)*reinterpret_cast<const unsigned short*>(data));
- case QMetaType::Char:
- return QV4::Encode((int)*reinterpret_cast<const char*>(data));
- case QMetaType::UChar:
- return QV4::Encode((int)*reinterpret_cast<const unsigned char*>(data));
- case QMetaType::QChar:
- return QV4::Encode((int)(*reinterpret_cast<const QChar*>(data)).unicode());
- case QMetaType::QStringList:
- return QV4::Encode(m_v4Engine->newArrayObject(*reinterpret_cast<const QStringList *>(data)));
- case QMetaType::QVariantList:
- return variantListToJS(*reinterpret_cast<const QVariantList *>(data));
- case QMetaType::QVariantMap:
- return variantMapToJS(*reinterpret_cast<const QVariantMap *>(data));
- case QMetaType::QDateTime:
- return QV4::Encode(m_v4Engine->newDateObject(*reinterpret_cast<const QDateTime *>(data)));
- case QMetaType::QDate:
- return QV4::Encode(m_v4Engine->newDateObject(QDateTime(*reinterpret_cast<const QDate *>(data))));
- case QMetaType::QRegExp:
- return QV4::Encode(m_v4Engine->newRegExpObject(*reinterpret_cast<const QRegExp *>(data)));
- case QMetaType::QObjectStar:
- return QV4::QObjectWrapper::wrap(m_v4Engine, *reinterpret_cast<QObject* const *>(data));
- case QMetaType::QVariant:
- return variantToJS(*reinterpret_cast<const QVariant*>(data));
- case QMetaType::QJsonValue:
- return QV4::JsonObject::fromJsonValue(m_v4Engine, *reinterpret_cast<const QJsonValue *>(data));
- case QMetaType::QJsonObject:
- return QV4::JsonObject::fromJsonObject(m_v4Engine, *reinterpret_cast<const QJsonObject *>(data));
- case QMetaType::QJsonArray:
- return QV4::JsonObject::fromJsonArray(m_v4Engine, *reinterpret_cast<const QJsonArray *>(data));
- default:
- if (type == qMetaTypeId<QJSValue>()) {
- return QJSValuePrivate::get(*reinterpret_cast<const QJSValue*>(data))->getValue(m_v4Engine);
- } else {
- QByteArray typeName = QMetaType::typeName(type);
- if (typeName.endsWith('*') && !*reinterpret_cast<void* const *>(data)) {
- return QV4::Encode::null();
- } else {
- // Fall back to wrapping in a QVariant.
- return QV4::Encode(m_v4Engine->newVariantObject(QVariant(type, data)));
- }
- }
- }
- Q_UNREACHABLE();
- return 0;
-}
-
-// Converts a JS value to a meta-type.
-// data must point to a place that can store a value of the given type.
-// Returns true if conversion succeeded, false otherwise.
-bool QV8Engine::metaTypeFromJS(const QV4::ValueRef value, int type, void *data)
-{
- QV4::Scope scope(QV8Engine::getV4(this));
-
- // check if it's one of the types we know
- switch (QMetaType::Type(type)) {
- case QMetaType::Bool:
- *reinterpret_cast<bool*>(data) = value->toBoolean();
- return true;
- case QMetaType::Int:
- *reinterpret_cast<int*>(data) = value->toInt32();
- return true;
- case QMetaType::UInt:
- *reinterpret_cast<uint*>(data) = value->toUInt32();
- return true;
- case QMetaType::LongLong:
- *reinterpret_cast<qlonglong*>(data) = qlonglong(value->toInteger());
- return true;
- case QMetaType::ULongLong:
- *reinterpret_cast<qulonglong*>(data) = qulonglong(value->toInteger());
- return true;
- case QMetaType::Double:
- *reinterpret_cast<double*>(data) = value->toNumber();
- return true;
- case QMetaType::QString:
- if (value->isUndefined() || value->isNull())
- *reinterpret_cast<QString*>(data) = QString();
- else
- *reinterpret_cast<QString*>(data) = value->toString(m_v4Engine->currentContext())->toQString();
- return true;
- case QMetaType::Float:
- *reinterpret_cast<float*>(data) = value->toNumber();
- return true;
- case QMetaType::Short:
- *reinterpret_cast<short*>(data) = short(value->toInt32());
- return true;
- case QMetaType::UShort:
- *reinterpret_cast<unsigned short*>(data) = value->toUInt16();
- return true;
- case QMetaType::Char:
- *reinterpret_cast<char*>(data) = char(value->toInt32());
- return true;
- case QMetaType::UChar:
- *reinterpret_cast<unsigned char*>(data) = (unsigned char)(value->toInt32());
- return true;
- case QMetaType::QChar:
- if (value->isString()) {
- QString str = value->stringValue()->toQString();
- *reinterpret_cast<QChar*>(data) = str.isEmpty() ? QChar() : str.at(0);
- } else {
- *reinterpret_cast<QChar*>(data) = QChar(ushort(value->toUInt16()));
- }
- return true;
- case QMetaType::QDateTime:
- if (QV4::DateObject *d = value->asDateObject()) {
- *reinterpret_cast<QDateTime *>(data) = d->toQDateTime();
- return true;
- } break;
- case QMetaType::QDate:
- if (QV4::DateObject *d = value->asDateObject()) {
- *reinterpret_cast<QDate *>(data) = d->toQDateTime().date();
- return true;
- } break;
- case QMetaType::QRegExp:
- if (QV4::RegExpObject *r = value->as<QV4::RegExpObject>()) {
- *reinterpret_cast<QRegExp *>(data) = r->toQRegExp();
- return true;
- } break;
- case QMetaType::QObjectStar: {
- QV4::QObjectWrapper *qobjectWrapper = value->as<QV4::QObjectWrapper>();
- if (qobjectWrapper || value->isNull()) {
- *reinterpret_cast<QObject* *>(data) = qtObjectFromJS(value);
- return true;
- } break;
- }
- case QMetaType::QStringList: {
- QV4::ScopedArrayObject a(scope, value);
- if (a) {
- *reinterpret_cast<QStringList *>(data) = a->toQStringList();
- return true;
- }
- break;
- }
- case QMetaType::QVariantList: {
- QV4::ScopedArrayObject a(scope, value);
- if (a) {
- *reinterpret_cast<QVariantList *>(data) = toVariant(a, /*typeHint*/-1, /*createJSValueForObjects*/false).toList();
- return true;
- }
- break;
- }
- case QMetaType::QVariantMap: {
- QV4::ScopedObject o(scope, value);
- if (o) {
- *reinterpret_cast<QVariantMap *>(data) = variantMapFromJS(o);
- return true;
- }
- break;
- }
- case QMetaType::QVariant:
- *reinterpret_cast<QVariant*>(data) = toVariant(value, /*typeHint*/-1, /*createJSValueForObjects*/false);
- return true;
- case QMetaType::QJsonValue:
- *reinterpret_cast<QJsonValue *>(data) = QV4::JsonObject::toJsonValue(value);
- return true;
- case QMetaType::QJsonObject: {
- QV4::ScopedObject o(scope, value);
- *reinterpret_cast<QJsonObject *>(data) = QV4::JsonObject::toJsonObject(o);
- return true;
- }
- case QMetaType::QJsonArray: {
- QV4::ScopedArrayObject a(scope, value);
- if (a) {
- *reinterpret_cast<QJsonArray *>(data) = QV4::JsonObject::toJsonArray(a);
- return true;
- }
- break;
- }
- default:
- ;
- }
-
-#if 0
- if (isQtVariant(value)) {
- const QVariant &var = variantValue(value);
- // ### Enable once constructInPlace() is in qt master.
- if (var.userType() == type) {
- QMetaType::constructInPlace(type, data, var.constData());
- return true;
- }
- if (var.canConvert(type)) {
- QVariant vv = var;
- vv.convert(type);
- Q_ASSERT(vv.userType() == type);
- QMetaType::constructInPlace(type, data, vv.constData());
- return true;
- }
-
- }
-#endif
-
- // Try to use magic; for compatibility with qscriptvalue_cast.
-
- QByteArray name = QMetaType::typeName(type);
- if (convertToNativeQObject(value, name, reinterpret_cast<void* *>(data)))
- return true;
- if (value->as<QV4::VariantObject>() && name.endsWith('*')) {
- int valueType = QMetaType::type(name.left(name.size()-1));
- QVariant &var = value->as<QV4::VariantObject>()->d()->data;
- if (valueType == var.userType()) {
- // We have T t, T* is requested, so return &t.
- *reinterpret_cast<void* *>(data) = var.data();
- return true;
- } else if (value->isObject()) {
- // Look in the prototype chain.
- QV4::ScopedObject proto(scope, value->objectValue()->prototype());
- while (proto) {
- bool canCast = false;
- if (QV4::VariantObject *vo = proto->as<QV4::VariantObject>()) {
- const QVariant &v = vo->d()->data;
- canCast = (type == v.userType()) || (valueType && (valueType == v.userType()));
- }
- else if (proto->as<QV4::QObjectWrapper>()) {
- QByteArray className = name.left(name.size()-1);
- QV4::ScopedObject p(scope, proto.getPointer());
- if (QObject *qobject = qtObjectFromJS(p))
- canCast = qobject->qt_metacast(className) != 0;
- }
- if (canCast) {
- QByteArray varTypeName = QMetaType::typeName(var.userType());
- if (varTypeName.endsWith('*'))
- *reinterpret_cast<void* *>(data) = *reinterpret_cast<void* *>(var.data());
- else
- *reinterpret_cast<void* *>(data) = var.data();
- return true;
- }
- proto = proto->prototype();
- }
- }
- } else if (value->isNull() && name.endsWith('*')) {
- *reinterpret_cast<void* *>(data) = 0;
- return true;
- } else if (type == qMetaTypeId<QJSValue>()) {
- *reinterpret_cast<QJSValue*>(data) = QJSValuePrivate::get(new QJSValuePrivate(m_v4Engine, value));
- return true;
- }
-
- return false;
-}
-
-// Converts a QVariant to JS.
-QV4::ReturnedValue QV8Engine::variantToJS(const QVariant &value)
-{
- return metaTypeToJS(value.userType(), value.constData());
-}
-
-bool QV8Engine::convertToNativeQObject(const QV4::ValueRef value, const QByteArray &targetType, void **result)
-{
- if (!targetType.endsWith('*'))
- return false;
- if (QObject *qobject = qtObjectFromJS(value)) {
- int start = targetType.startsWith("const ") ? 6 : 0;
- QByteArray className = targetType.mid(start, targetType.size()-start-1);
- if (void *instance = qobject->qt_metacast(className)) {
- *result = instance;
- return true;
- }
- }
- return false;
-}
-
-QObject *QV8Engine::qtObjectFromJS(const QV4::ValueRef value)
-{
- if (!value->isObject())
- return 0;
-
- QV4::Scope scope(m_v4Engine);
- QV4::Scoped<QV4::VariantObject> v(scope, value);
-
- if (v) {
- QVariant variant = v->d()->data;
- int type = variant.userType();
- if (type == QMetaType::QObjectStar)
- return *reinterpret_cast<QObject* const *>(variant.constData());
- }
- QV4::Scoped<QV4::QObjectWrapper> wrapper(scope, value);
- if (!wrapper)
- return 0;
- return wrapper->object();
+ return m_v4Engine->globalObject()->asReturnedValue();
}
void QV8Engine::startTimer(const QString &timerName)
@@ -985,10 +309,5 @@ int QV8Engine::consoleCountHelper(const QString &file, quint16 line, quint16 col
return number;
}
-QV4::ReturnedValue QV8Engine::toString(const QString &string)
-{
- return QV4::Encode(m_v4Engine->newString(string));
-}
-
QT_END_NAMESPACE
diff --git a/src/qml/qml/v8/qv8engine_p.h b/src/qml/qml/v8/qv8engine_p.h
index 51e857c8a2..fb538772d1 100644
--- a/src/qml/qml/v8/qv8engine_p.h
+++ b/src/qml/qml/v8/qv8engine_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -78,13 +78,13 @@ namespace QV4 {
// #define QML_GLOBAL_HANDLE_DEBUGGING
#define V4THROW_ERROR(string) \
- return ctx->throwError(QString::fromUtf8(string));
+ return ctx->engine()->throwError(QString::fromUtf8(string));
#define V4THROW_TYPE(string) \
- return ctx->throwTypeError(QStringLiteral(string));
+ return ctx->engine()->throwTypeError(QStringLiteral(string));
-#define V8_DEFINE_EXTENSION(dataclass, datafunction) \
- static inline dataclass *datafunction(QV8Engine *engine) \
+#define V4_DEFINE_EXTENSION(dataclass, datafunction) \
+ static inline dataclass *datafunction(QV4::ExecutionEngine *engine) \
{ \
static int extensionId = -1; \
if (extensionId == -1) { \
@@ -93,10 +93,10 @@ namespace QV4 {
extensionId = QV8Engine::registerExtension(); \
QV8Engine::registrationMutex()->unlock(); \
} \
- dataclass *rv = (dataclass *)engine->extensionData(extensionId); \
+ dataclass *rv = (dataclass *)engine->v8Engine->extensionData(extensionId); \
if (!rv) { \
rv = new dataclass(engine); \
- engine->setExtensionData(extensionId, rv); \
+ engine->v8Engine->setExtensionData(extensionId, rv); \
} \
return rv; \
} \
@@ -121,33 +121,32 @@ public:
QV4::ReturnedValue operator[](int idx) { return (idx < callData->argc ? callData->args[idx].asReturnedValue() : QV4::Encode::undefined()); }
QQmlContextData *context() { return ctx; }
QV4::ReturnedValue qmlGlobal() { return callData->thisObject.asReturnedValue(); }
- void setReturnValue(QV4::ReturnedValue rv) { retVal = rv; }
- QV8Engine *engine() const { return e; }
- QV4::ExecutionEngine *v4engine() const;
+ void setReturnValue(QV4::ReturnedValue rv) { *retVal = rv; }
+ QV4::ExecutionEngine *v4engine() const { return e; }
private:
friend struct QV4::QObjectMethod;
QQmlV4Function();
QQmlV4Function(const QQmlV4Function &);
QQmlV4Function &operator=(const QQmlV4Function &);
- QQmlV4Function(QV4::CallData *callData, QV4::ValueRef retVal,
- const QV4::ValueRef global, QQmlContextData *c, QV8Engine *e)
+ QQmlV4Function(QV4::CallData *callData, QV4::Value *retVal,
+ const QV4::Value &global, QQmlContextData *c, QV4::ExecutionEngine *e)
: callData(callData), retVal(retVal), ctx(c), e(e)
{
callData->thisObject.val = global.asReturnedValue();
}
QV4::CallData *callData;
- QV4::ValueRef retVal;
+ QV4::Value *retVal;
QQmlContextData *ctx;
- QV8Engine *e;
+ QV4::ExecutionEngine *e;
};
class Q_QML_PRIVATE_EXPORT QQmlV4Handle
{
public:
QQmlV4Handle() : d(QV4::Encode::undefined()) {}
- explicit QQmlV4Handle(QV4::ValueRef v) : d(v.asReturnedValue()) {}
+ explicit QQmlV4Handle(const QV4::Value &v) : d(v.asReturnedValue()) {}
explicit QQmlV4Handle(QV4::ReturnedValue v) : d(v) {}
operator QV4::ReturnedValue() const { return d; }
@@ -158,14 +157,14 @@ private:
class QObject;
class QQmlEngine;
-class QQmlValueType;
class QNetworkAccessManager;
class QQmlContextData;
class Q_QML_PRIVATE_EXPORT QV8Engine
{
friend class QJSEngine;
- typedef QSet<QV4::Object *> V8ObjectSet;
+ // ### GC
+ typedef QSet<QV4::Heap::Object *> V8ObjectSet;
public:
static QV8Engine* get(QJSEngine* q) { Q_ASSERT(q); return q->handle(); }
// static QJSEngine* get(QV8Engine* d) { Q_ASSERT(d); return d->q; }
@@ -195,17 +194,7 @@ public:
QQmlContextData *callingContext();
- void freezeObject(const QV4::ValueRef value);
-
- QVariant toVariant(const QV4::ValueRef value, int typeHint, bool createJSValueForObjects = true, V8ObjectSet *visitedObjects = 0);
- QVariant objectToVariant(QV4::Object *o, V8ObjectSet *visitedObjects = 0);
- QV4::ReturnedValue fromVariant(const QVariant &);
-
- QVariantMap variantMapFromJS(QV4::Object *o)
- { return objectToVariant(o).toMap(); }
-
- // Return a JS string for the given QString \a string
- QV4::ReturnedValue toString(const QString &string);
+ void freezeObject(const QV4::Value &value);
// Return the network access manager for this engine. By default this returns the network
// access manager of the QQmlEngine. It is overridden in the case of a threaded v8
@@ -221,17 +210,7 @@ public:
inline Deletable *extensionData(int) const;
void setExtensionData(int, Deletable *);
- QV4::ReturnedValue variantListToJS(const QVariantList &lst);
- QV4::ReturnedValue variantMapToJS(const QVariantMap &vmap);
- QV4::ReturnedValue variantToJS(const QVariant &value);
-
- QV4::ReturnedValue metaTypeToJS(int type, const void *data);
- bool metaTypeFromJS(const QV4::ValueRef value, int type, void *data);
-
- bool convertToNativeQObject(const QV4::ValueRef value,
- const QByteArray &targetType,
- void **result);
-
+public:
// used for console.time(), console.timeEnd()
void startTimer(const QString &timerName);
qint64 stopTimer(const QString &timerName, bool *wasRunning);
@@ -239,8 +218,6 @@ public:
// used for console.count()
int consoleCountHelper(const QString &file, quint16 line, quint16 column);
- QObject *qtObjectFromJS(const QV4::ValueRef value);
-
protected:
QJSEngine* q;
QQmlEngine *m_engine;
@@ -275,10 +252,6 @@ inline QV8Engine::Deletable *QV8Engine::extensionData(int index) const
return 0;
}
-inline QV4::ExecutionEngine *QQmlV4Function::v4engine() const
-{
- return QV8Engine::getV4(e);
-}
QT_END_NAMESPACE
diff --git a/src/qml/qml/v8/v8.pri b/src/qml/qml/v8/v8.pri
index b4eb706574..3d6a012481 100644
--- a/src/qml/qml/v8/v8.pri
+++ b/src/qml/qml/v8/v8.pri
@@ -1,5 +1,4 @@
HEADERS += \
- $$PWD/qv8debug_p.h \
$$PWD/qv8engine_p.h \
$$PWD/qv4domerrors_p.h \
$$PWD/qv4sqlerrors_p.h \
diff --git a/src/qml/qtqmlglobal.h b/src/qml/qtqmlglobal.h
index b965346dc0..fd8fa39f23 100644
--- a/src/qml/qtqmlglobal.h
+++ b/src/qml/qtqmlglobal.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/qtqmlglobal_p.h b/src/qml/qtqmlglobal_p.h
index f38cbbb13a..9fa47a411e 100644
--- a/src/qml/qtqmlglobal_p.h
+++ b/src/qml/qtqmlglobal_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/types/qqmlbind.cpp b/src/qml/types/qqmlbind.cpp
index 9ba610b9ba..7814fa6d56 100644
--- a/src/qml/types/qqmlbind.cpp
+++ b/src/qml/types/qqmlbind.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -33,7 +33,7 @@
#include "qqmlbind_p.h"
-#include <private/qqmlnullablevalue_p_p.h>
+#include <private/qqmlnullablevalue_p.h>
#include <private/qqmlproperty_p.h>
#include <private/qqmlbinding_p.h>
diff --git a/src/qml/types/qqmlbind_p.h b/src/qml/types/qqmlbind_p.h
index 9d8bf50e8b..6d7eea4014 100644
--- a/src/qml/types/qqmlbind_p.h
+++ b/src/qml/types/qqmlbind_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/types/qqmlconnections.cpp b/src/qml/types/qqmlconnections.cpp
index 489c68bfab..0c81855e49 100644
--- a/src/qml/types/qqmlconnections.cpp
+++ b/src/qml/types/qqmlconnections.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/types/qqmlconnections_p.h b/src/qml/types/qqmlconnections_p.h
index 912b69f208..170f47b54f 100644
--- a/src/qml/types/qqmlconnections_p.h
+++ b/src/qml/types/qqmlconnections_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp
index 79f150ce05..201fd4572c 100644
--- a/src/qml/types/qqmldelegatemodel.cpp
+++ b/src/qml/types/qqmldelegatemodel.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -46,59 +46,82 @@
#include <private/qv4value_inl_p.h>
#include <private/qv4functionobject_p.h>
+#include <qv4objectiterator_p.h>
QT_BEGIN_NAMESPACE
class QQmlDelegateModelItem;
-struct DelegateModelGroupFunction: QV4::FunctionObject
-{
- struct Data : FunctionObject::Data {
- Data(QV4::ExecutionContext *scope, uint flag, QV4::ReturnedValue (*code)(QQmlDelegateModelItem *item, uint flag, const QV4::ValueRef arg))
- : FunctionObject::Data(scope, QStringLiteral("DelegateModelGroupFunction"))
- , flag(flag)
- , code(code)
- {
- setVTable(staticVTable());
- }
+namespace QV4 {
+
+namespace Heap {
+
+struct DelegateModelGroupFunction : FunctionObject {
+ DelegateModelGroupFunction(QV4::ExecutionContext *scope, uint flag, QV4::ReturnedValue (*code)(QQmlDelegateModelItem *item, uint flag, const QV4::Value &arg));
+
+ uint flag;
+ QV4::ReturnedValue (*code)(QQmlDelegateModelItem *item, uint flag, const QV4::Value &arg);
+};
+
+struct QQmlDelegateModelGroupChange : Object {
+ QQmlDelegateModelGroupChange(QV4::ExecutionEngine *engine);
- uint flag;
- QV4::ReturnedValue (*code)(QQmlDelegateModelItem *item, uint flag, const QV4::ValueRef arg);
- };
- V4_OBJECT(QV4::FunctionObject)
+ QQmlChangeSet::Change change;
+};
+
+struct QQmlDelegateModelGroupChangeArray : Object {
+ QQmlDelegateModelGroupChangeArray(QV4::ExecutionEngine *engine, const QVector<QQmlChangeSet::Change> &changes);
+ QVector<QQmlChangeSet::Change> changes;
+};
- static DelegateModelGroupFunction *create(QV4::ExecutionContext *scope, uint flag, QV4::ReturnedValue (*code)(QQmlDelegateModelItem *item, uint flag, const QV4::ValueRef arg))
+
+}
+
+struct DelegateModelGroupFunction : QV4::FunctionObject
+{
+ V4_OBJECT2(DelegateModelGroupFunction, FunctionObject)
+
+ static Heap::DelegateModelGroupFunction *create(QV4::ExecutionContext *scope, uint flag, QV4::ReturnedValue (*code)(QQmlDelegateModelItem *item, uint flag, const QV4::Value &arg))
{
return scope->engine()->memoryManager->alloc<DelegateModelGroupFunction>(scope, flag, code);
}
static QV4::ReturnedValue construct(QV4::Managed *m, QV4::CallData *)
{
- return m->engine()->currentContext()->throwTypeError();
+ return static_cast<DelegateModelGroupFunction *>(m)->engine()->throwTypeError();
}
static QV4::ReturnedValue call(QV4::Managed *that, QV4::CallData *callData)
{
- QV4::ExecutionEngine *v4 = that->engine();
+ QV4::ExecutionEngine *v4 = static_cast<DelegateModelGroupFunction *>(that)->engine();
QV4::Scope scope(v4);
- QV4::Scoped<DelegateModelGroupFunction> f(scope, that, QV4::Scoped<DelegateModelGroupFunction>::Cast);
+ QV4::Scoped<DelegateModelGroupFunction> f(scope, static_cast<DelegateModelGroupFunction *>(that));
QV4::Scoped<QQmlDelegateModelItemObject> o(scope, callData->thisObject);
if (!o)
- return v4->currentContext()->throwTypeError(QStringLiteral("Not a valid VisualData object"));
+ return v4->throwTypeError(QStringLiteral("Not a valid VisualData object"));
QV4::ScopedValue v(scope, callData->argument(0));
return f->d()->code(o->d()->item, f->d()->flag, v);
}
};
-DEFINE_OBJECT_VTABLE(DelegateModelGroupFunction);
+Heap::DelegateModelGroupFunction::DelegateModelGroupFunction(QV4::ExecutionContext *scope, uint flag, QV4::ReturnedValue (*code)(QQmlDelegateModelItem *item, uint flag, const QV4::Value &arg))
+ : QV4::Heap::FunctionObject(scope, QStringLiteral("DelegateModelGroupFunction"))
+ , flag(flag)
+ , code(code)
+{
+}
+
+}
+
+DEFINE_OBJECT_VTABLE(QV4::DelegateModelGroupFunction);
class QQmlDelegateModelEngineData : public QV8Engine::Deletable
{
public:
- QQmlDelegateModelEngineData(QV8Engine *engine);
+ QQmlDelegateModelEngineData(QV4::ExecutionEngine *v4);
~QQmlDelegateModelEngineData();
QV4::ReturnedValue array(QV8Engine *engine, const QVector<QQmlChangeSet::Change> &changes);
@@ -106,7 +129,7 @@ public:
QV4::PersistentValue changeProto;
};
-V8_DEFINE_EXTENSION(QQmlDelegateModelEngineData, engineData)
+V4_DEFINE_EXTENSION(QQmlDelegateModelEngineData, engineData)
void QQmlDelegateModelPartsMetaObject::propertyCreated(int, QMetaPropertyBuilder &prop)
@@ -1603,7 +1626,7 @@ QQmlDelegateModelAttached *QQmlDelegateModel::qmlAttachedProperties(QObject *obj
return new QQmlDelegateModelAttached(obj);
}
-bool QQmlDelegateModelPrivate::insert(Compositor::insert_iterator &before, const QV4::ValueRef object, int groups)
+bool QQmlDelegateModelPrivate::insert(Compositor::insert_iterator &before, const QV4::Value &object, int groups)
{
if (!m_context || !m_context->isValid())
return false;
@@ -1611,10 +1634,10 @@ bool QQmlDelegateModelPrivate::insert(Compositor::insert_iterator &before, const
QQmlDelegateModelItem *cacheItem = m_adaptorModel.createItem(m_cacheMetaType, m_context->engine(), -1);
if (!cacheItem)
return false;
- QV4::ExecutionEngine *v4 = object->engine();
- if (!v4)
+ if (!object.isObject())
return false;
+ QV4::ExecutionEngine *v4 = object.asObject()->engine();
QV4::Scope scope(v4);
QV4::ScopedObject o(scope, object);
if (!o)
@@ -1627,7 +1650,7 @@ bool QQmlDelegateModelPrivate::insert(Compositor::insert_iterator &before, const
propertyName = it.nextPropertyNameAsString(v);
if (propertyName->isNull())
break;
- cacheItem->setValue(propertyName->toQStringNoThrow(), m_cacheMetaType->v8Engine->toVariant(v, QVariant::Invalid));
+ cacheItem->setValue(propertyName->toQStringNoThrow(), scope.engine->toVariant(v, QVariant::Invalid));
}
cacheItem->groups = groups | Compositor::UnresolvedFlag | Compositor::CacheFlag;
@@ -1691,7 +1714,7 @@ void QQmlDelegateModelItemMetaType::initializePrototype()
QV4::ExecutionEngine *v4 = QV8Engine::getV4(v8Engine);
QV4::Scope scope(v4);
- QV4::Scoped<QV4::Object> proto(scope, v4->newObject());
+ QV4::ScopedObject proto(scope, v4->newObject());
proto->defineAccessorProperty(QStringLiteral("model"), QQmlDelegateModelItem::get_model, 0);
proto->defineAccessorProperty(QStringLiteral("groups"), QQmlDelegateModelItem::get_groups, QQmlDelegateModelItem::set_groups);
QV4::ScopedString s(scope);
@@ -1699,45 +1722,46 @@ void QQmlDelegateModelItemMetaType::initializePrototype()
s = v4->newString(QStringLiteral("isUnresolved"));
QV4::ScopedFunctionObject f(scope);
- p->setGetter((f = DelegateModelGroupFunction::create(v4->rootContext, 30, QQmlDelegateModelItem::get_member)));
+ QV4::ScopedContext global(scope, scope.engine->rootContext());
+ p->setGetter((f = QV4::DelegateModelGroupFunction::create(global, 30, QQmlDelegateModelItem::get_member)));
p->setSetter(0);
- proto->insertMember(s.getPointer(), p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
+ proto->insertMember(s, p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
s = v4->newString(QStringLiteral("inItems"));
- p->setGetter((f = DelegateModelGroupFunction::create(v4->rootContext, QQmlListCompositor::Default, QQmlDelegateModelItem::get_member)));
- p->setSetter((f = DelegateModelGroupFunction::create(v4->rootContext, QQmlListCompositor::Default, QQmlDelegateModelItem::set_member)));
- proto->insertMember(s.getPointer(), p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
+ p->setGetter((f = QV4::DelegateModelGroupFunction::create(global, QQmlListCompositor::Default, QQmlDelegateModelItem::get_member)));
+ p->setSetter((f = QV4::DelegateModelGroupFunction::create(global, QQmlListCompositor::Default, QQmlDelegateModelItem::set_member)));
+ proto->insertMember(s, p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
s = v4->newString(QStringLiteral("inPersistedItems"));
- p->setGetter((f = DelegateModelGroupFunction::create(v4->rootContext, QQmlListCompositor::Persisted, QQmlDelegateModelItem::get_member)));
- p->setSetter((f = DelegateModelGroupFunction::create(v4->rootContext, QQmlListCompositor::Persisted, QQmlDelegateModelItem::set_member)));
- proto->insertMember(s.getPointer(), p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
+ p->setGetter((f = QV4::DelegateModelGroupFunction::create(global, QQmlListCompositor::Persisted, QQmlDelegateModelItem::get_member)));
+ p->setSetter((f = QV4::DelegateModelGroupFunction::create(global, QQmlListCompositor::Persisted, QQmlDelegateModelItem::set_member)));
+ proto->insertMember(s, p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
s = v4->newString(QStringLiteral("itemsIndex"));
- p->setGetter((f = DelegateModelGroupFunction::create(v4->rootContext, QQmlListCompositor::Default, QQmlDelegateModelItem::get_index)));
- proto->insertMember(s.getPointer(), p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
+ p->setGetter((f = QV4::DelegateModelGroupFunction::create(global, QQmlListCompositor::Default, QQmlDelegateModelItem::get_index)));
+ proto->insertMember(s, p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
s = v4->newString(QStringLiteral("persistedItemsIndex"));
- p->setGetter((f = DelegateModelGroupFunction::create(v4->rootContext, QQmlListCompositor::Persisted, QQmlDelegateModelItem::get_index)));
+ p->setGetter((f = QV4::DelegateModelGroupFunction::create(global, QQmlListCompositor::Persisted, QQmlDelegateModelItem::get_index)));
p->setSetter(0);
- proto->insertMember(s.getPointer(), p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
+ proto->insertMember(s, p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
for (int i = 2; i < groupNames.count(); ++i) {
QString propertyName = QStringLiteral("in") + groupNames.at(i);
propertyName.replace(2, 1, propertyName.at(2).toUpper());
s = v4->newString(propertyName);
- p->setGetter((f = DelegateModelGroupFunction::create(v4->rootContext, i + 1, QQmlDelegateModelItem::get_member)));
- p->setSetter((f = DelegateModelGroupFunction::create(v4->rootContext, i + 1, QQmlDelegateModelItem::set_member)));
- proto->insertMember(s.getPointer(), p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
+ p->setGetter((f = QV4::DelegateModelGroupFunction::create(global, i + 1, QQmlDelegateModelItem::get_member)));
+ p->setSetter((f = QV4::DelegateModelGroupFunction::create(global, i + 1, QQmlDelegateModelItem::set_member)));
+ proto->insertMember(s, p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
}
for (int i = 2; i < groupNames.count(); ++i) {
const QString propertyName = groupNames.at(i) + QStringLiteral("Index");
s = v4->newString(propertyName);
- p->setGetter((f = DelegateModelGroupFunction::create(v4->rootContext, i + 1, QQmlDelegateModelItem::get_index)));
+ p->setGetter((f = QV4::DelegateModelGroupFunction::create(global, i + 1, QQmlDelegateModelItem::get_index)));
p->setSetter(0);
- proto->insertMember(s.getPointer(), p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
+ proto->insertMember(s, p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
}
- modelItemProto = proto;
+ modelItemProto.set(v4, proto);
}
int QQmlDelegateModelItemMetaType::parseGroups(const QStringList &groups) const
@@ -1751,7 +1775,7 @@ int QQmlDelegateModelItemMetaType::parseGroups(const QStringList &groups) const
return groupFlags;
}
-int QQmlDelegateModelItemMetaType::parseGroups(const QV4::ValueRef groups) const
+int QQmlDelegateModelItemMetaType::parseGroups(const QV4::Value &groups) const
{
int groupFlags = 0;
QV4::Scope scope(QV8Engine::getV4(v8Engine));
@@ -1783,9 +1807,9 @@ int QQmlDelegateModelItemMetaType::parseGroups(const QV4::ValueRef groups) const
QV4::ReturnedValue QQmlDelegateModelItem::get_model(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->d()->callData->thisObject.as<QQmlDelegateModelItemObject>());
+ QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->thisObject().as<QQmlDelegateModelItemObject>());
if (!o)
- return ctx->throwTypeError(QStringLiteral("Not a valid VisualData object"));
+ return ctx->engine()->throwTypeError(QStringLiteral("Not a valid VisualData object"));
if (!o->d()->item->metaType->model)
return QV4::Encode::undefined();
@@ -1795,9 +1819,9 @@ QV4::ReturnedValue QQmlDelegateModelItem::get_model(QV4::CallContext *ctx)
QV4::ReturnedValue QQmlDelegateModelItem::get_groups(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->d()->callData->thisObject.as<QQmlDelegateModelItemObject>());
+ QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->thisObject().as<QQmlDelegateModelItemObject>());
if (!o)
- return ctx->throwTypeError(QStringLiteral("Not a valid VisualData object"));
+ return ctx->engine()->throwTypeError(QStringLiteral("Not a valid VisualData object"));
QStringList groups;
for (int i = 1; i < o->d()->item->metaType->groupCount; ++i) {
@@ -1805,42 +1829,42 @@ QV4::ReturnedValue QQmlDelegateModelItem::get_groups(QV4::CallContext *ctx)
groups.append(o->d()->item->metaType->groupNames.at(i - 1));
}
- return scope.engine->v8Engine->fromVariant(groups);
+ return scope.engine->fromVariant(groups);
}
QV4::ReturnedValue QQmlDelegateModelItem::set_groups(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->d()->callData->thisObject.as<QQmlDelegateModelItemObject>());
+ QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->thisObject().as<QQmlDelegateModelItemObject>());
if (!o)
- return ctx->throwTypeError(QStringLiteral("Not a valid VisualData object"));
- if (!ctx->d()->callData->argc)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError(QStringLiteral("Not a valid VisualData object"));
+ if (!ctx->argc())
+ return ctx->engine()->throwTypeError();
if (!o->d()->item->metaType->model)
return QV4::Encode::undefined();
QQmlDelegateModelPrivate *model = QQmlDelegateModelPrivate::get(o->d()->item->metaType->model);
- const int groupFlags = model->m_cacheMetaType->parseGroups(ctx->d()->callData->args[0]);
+ const int groupFlags = model->m_cacheMetaType->parseGroups(ctx->args()[0]);
const int cacheIndex = model->m_cache.indexOf(o->d()->item);
Compositor::iterator it = model->m_compositor.find(Compositor::Cache, cacheIndex);
model->setGroups(it, 1, Compositor::Cache, groupFlags);
return QV4::Encode::undefined();
}
-QV4::ReturnedValue QQmlDelegateModelItem::get_member(QQmlDelegateModelItem *thisItem, uint flag, const QV4::ValueRef)
+QV4::ReturnedValue QQmlDelegateModelItem::get_member(QQmlDelegateModelItem *thisItem, uint flag, const QV4::Value &)
{
return QV4::Encode(bool(thisItem->groups & (1 << flag)));
}
-QV4::ReturnedValue QQmlDelegateModelItem::set_member(QQmlDelegateModelItem *cacheItem, uint flag, const QV4::ValueRef arg)
+QV4::ReturnedValue QQmlDelegateModelItem::set_member(QQmlDelegateModelItem *cacheItem, uint flag, const QV4::Value &arg)
{
if (!cacheItem->metaType->model)
return QV4::Encode::undefined();
QQmlDelegateModelPrivate *model = QQmlDelegateModelPrivate::get(cacheItem->metaType->model);
- bool member = arg->toBoolean();
+ bool member = arg.toBoolean();
uint groupFlag = (1 << flag);
if (member == ((cacheItem->groups & groupFlag) != 0))
return QV4::Encode::undefined();
@@ -1854,7 +1878,7 @@ QV4::ReturnedValue QQmlDelegateModelItem::set_member(QQmlDelegateModelItem *cach
return QV4::Encode::undefined();
}
-QV4::ReturnedValue QQmlDelegateModelItem::get_index(QQmlDelegateModelItem *thisItem, uint flag, const QV4::ValueRef)
+QV4::ReturnedValue QQmlDelegateModelItem::get_index(QQmlDelegateModelItem *thisItem, uint flag, const QV4::Value &)
{
return QV4::Encode((int)thisItem->groupIndex(Compositor::Group(flag)));
}
@@ -1864,17 +1888,11 @@ QV4::ReturnedValue QQmlDelegateModelItem::get_index(QQmlDelegateModelItem *thisI
DEFINE_OBJECT_VTABLE(QQmlDelegateModelItemObject);
-QQmlDelegateModelItemObject::Data::~Data()
+QV4::Heap::QQmlDelegateModelItemObject::~QQmlDelegateModelItemObject()
{
item->Dispose();
}
-void QQmlDelegateModelItemObject::destroy(Managed *that)
-{
- static_cast<QQmlDelegateModelItemObject *>(that)->d()->~Data();
-}
-
-
QQmlDelegateModelItem::QQmlDelegateModelItem(
QQmlDelegateModelItemMetaType *metaType, int modelIndex)
@@ -2242,8 +2260,8 @@ void QQmlDelegateModelGroupPrivate::emitChanges(QV8Engine *engine)
Q_Q(QQmlDelegateModelGroup);
if (isChangedConnected() && !changeSet.isEmpty()) {
QV4::Scope scope(QV8Engine::getV4(engine));
- QV4::ScopedValue removed(scope, engineData(engine)->array(engine, changeSet.removes()));
- QV4::ScopedValue inserted(scope, engineData(engine)->array(engine, changeSet.inserts()));
+ QV4::ScopedValue removed(scope, engineData(scope.engine)->array(engine, changeSet.removes()));
+ QV4::ScopedValue inserted(scope, engineData(scope.engine)->array(engine, changeSet.inserts()));
emit q->changed(QQmlV4Handle(removed), QQmlV4Handle(inserted));
}
if (changeSet.difference() != 0)
@@ -2257,21 +2275,23 @@ void QQmlDelegateModelGroupPrivate::emitModelUpdated(bool reset)
changeSet.clear();
}
+typedef QQmlDelegateModelGroupEmitterList::iterator GroupEmitterListIt;
+
void QQmlDelegateModelGroupPrivate::createdPackage(int index, QQuickPackage *package)
{
- for (QQmlDelegateModelGroupEmitterList::iterator it = emitters.begin(); it != emitters.end(); ++it)
+ for (GroupEmitterListIt it = emitters.begin(), end = emitters.end(); it != end; ++it)
it->createdPackage(index, package);
}
void QQmlDelegateModelGroupPrivate::initPackage(int index, QQuickPackage *package)
{
- for (QQmlDelegateModelGroupEmitterList::iterator it = emitters.begin(); it != emitters.end(); ++it)
+ for (GroupEmitterListIt it = emitters.begin(), end = emitters.end(); it != end; ++it)
it->initPackage(index, package);
}
void QQmlDelegateModelGroupPrivate::destroyingPackage(QQuickPackage *package)
{
- for (QQmlDelegateModelGroupEmitterList::iterator it = emitters.begin(); it != emitters.end(); ++it)
+ for (GroupEmitterListIt it = emitters.begin(), end = emitters.end(); it != end; ++it)
it->destroyingPackage(package);
}
@@ -2475,23 +2495,23 @@ QQmlV4Handle QQmlDelegateModelGroup::get(int index)
QV4::Scope scope(v4);
QV4::ScopedObject o(scope, v4->memoryManager->alloc<QQmlDelegateModelItemObject>(v4, cacheItem));
QV4::ScopedObject p(scope, model->m_cacheMetaType->modelItemProto.value());
- o->setPrototype(p.getPointer());
+ o->setPrototype(p);
++cacheItem->scriptRef;
return QQmlV4Handle(o);
}
-bool QQmlDelegateModelGroupPrivate::parseIndex(const QV4::ValueRef value, int *index, Compositor::Group *group) const
+bool QQmlDelegateModelGroupPrivate::parseIndex(const QV4::Value &value, int *index, Compositor::Group *group) const
{
- if (value->isNumber()) {
- *index = value->toInt32();
+ if (value.isNumber()) {
+ *index = value.toInt32();
return true;
}
- QV4::ExecutionEngine *v4 = value->engine();
- if (!v4)
+ if (!value.isObject())
return false;
+ QV4::ExecutionEngine *v4 = value.asObject()->engine();
QV4::Scope scope(v4);
QV4::Scoped<QQmlDelegateModelItemObject> object(scope, value);
@@ -2639,7 +2659,7 @@ void QQmlDelegateModelGroup::create(QQmlV4Function *args)
model->m_cache.at(it.cacheIndex)->releaseObject();
}
- args->setReturnValue(QV4::QObjectWrapper::wrap(QV8Engine::getV4(args->engine()), object));
+ args->setReturnValue(QV4::QObjectWrapper::wrap(args->v4engine(), object));
model->emitChanges();
}
@@ -3215,64 +3235,50 @@ void QQmlPartsModel::emitModelUpdated(const QQmlChangeSet &changeSet, bool reset
struct QQmlDelegateModelGroupChange : QV4::Object
{
- struct Data : QV4::Object::Data {
- Data(QV4::ExecutionEngine *engine)
- : Object::Data(engine)
- {
- setVTable(staticVTable());
- }
- QQmlChangeSet::Change change;
- };
- V4_OBJECT(QV4::Object)
+ V4_OBJECT2(QQmlDelegateModelGroupChange, QV4::Object)
- static QQmlDelegateModelGroupChange *create(QV4::ExecutionEngine *e) {
+ static QV4::Heap::QQmlDelegateModelGroupChange *create(QV4::ExecutionEngine *e) {
return e->memoryManager->alloc<QQmlDelegateModelGroupChange>(e);
}
static QV4::ReturnedValue method_get_index(QV4::CallContext *ctx) {
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlDelegateModelGroupChange> that(scope, ctx->d()->callData->thisObject.as<QQmlDelegateModelGroupChange>());
+ QV4::Scoped<QQmlDelegateModelGroupChange> that(scope, ctx->thisObject().as<QQmlDelegateModelGroupChange>());
if (!that)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
return QV4::Encode(that->d()->change.index);
}
static QV4::ReturnedValue method_get_count(QV4::CallContext *ctx) {
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlDelegateModelGroupChange> that(scope, ctx->d()->callData->thisObject.as<QQmlDelegateModelGroupChange>());
+ QV4::Scoped<QQmlDelegateModelGroupChange> that(scope, ctx->thisObject().as<QQmlDelegateModelGroupChange>());
if (!that)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
return QV4::Encode(that->d()->change.count);
}
static QV4::ReturnedValue method_get_moveId(QV4::CallContext *ctx) {
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlDelegateModelGroupChange> that(scope, ctx->d()->callData->thisObject.as<QQmlDelegateModelGroupChange>());
+ QV4::Scoped<QQmlDelegateModelGroupChange> that(scope, ctx->thisObject().as<QQmlDelegateModelGroupChange>());
if (!that)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
if (that->d()->change.moveId < 0)
return QV4::Encode::undefined();
return QV4::Encode(that->d()->change.moveId);
}
};
+QV4::Heap::QQmlDelegateModelGroupChange::QQmlDelegateModelGroupChange(QV4::ExecutionEngine *engine)
+ : QV4::Heap::Object(engine)
+{
+}
+
DEFINE_OBJECT_VTABLE(QQmlDelegateModelGroupChange);
struct QQmlDelegateModelGroupChangeArray : public QV4::Object
{
- struct Data : QV4::Object::Data {
- Data(QV4::ExecutionEngine *engine, const QVector<QQmlChangeSet::Change> &changes)
- : Object::Data(engine)
- , changes(changes)
- {
- setVTable(staticVTable());
- QV4::Scope scope(engine);
- QV4::ScopedObject o(scope, this);
- o->setArrayType(QV4::ArrayData::Custom);
- }
- QVector<QQmlChangeSet::Change> changes;
- };
- V4_OBJECT(QV4::Object)
+ V4_OBJECT2(QQmlDelegateModelGroupChangeArray, QV4::Object)
+ V4_NEEDS_DESTROY
public:
- static QQmlDelegateModelGroupChangeArray *create(QV4::ExecutionEngine *engine, const QVector<QQmlChangeSet::Change> &changes)
+ static QV4::Heap::QQmlDelegateModelGroupChangeArray *create(QV4::ExecutionEngine *engine, const QVector<QQmlChangeSet::Change> &changes)
{
return engine->memoryManager->alloc<QQmlDelegateModelGroupChangeArray>(engine, changes);
}
@@ -3283,7 +3289,7 @@ public:
static QV4::ReturnedValue getIndexed(QV4::Managed *m, uint index, bool *hasProperty)
{
Q_ASSERT(m->as<QQmlDelegateModelGroupChangeArray>());
- QV4::ExecutionEngine *v4 = m->engine();
+ QV4::ExecutionEngine *v4 = static_cast<QQmlDelegateModelGroupChangeArray *>(m)->engine();
QV4::Scope scope(v4);
QV4::Scoped<QQmlDelegateModelGroupChangeArray> array(scope, static_cast<QQmlDelegateModelGroupChangeArray *>(m));
@@ -3295,9 +3301,9 @@ public:
const QQmlChangeSet::Change &change = array->at(index);
- QV4::ScopedObject changeProto(scope, engineData(v4->v8Engine)->changeProto.value());
+ QV4::ScopedObject changeProto(scope, engineData(v4)->changeProto.value());
QV4::Scoped<QQmlDelegateModelGroupChange> object(scope, QQmlDelegateModelGroupChange::create(v4));
- object->setPrototype(changeProto.getPointer());
+ object->setPrototype(changeProto);
object->d()->change = change;
if (hasProperty)
@@ -3310,7 +3316,7 @@ public:
Q_ASSERT(m->as<QQmlDelegateModelGroupChangeArray>());
QQmlDelegateModelGroupChangeArray *array = static_cast<QQmlDelegateModelGroupChangeArray *>(m);
- if (name->equals(m->engine()->id_length)) {
+ if (name->equals(array->engine()->id_length)) {
if (hasProperty)
*hasProperty = true;
return QV4::Encode(array->count());
@@ -3318,24 +3324,28 @@ public:
return Object::get(m, name, hasProperty);
}
- static void destroy(Managed *that) {
- static_cast<QQmlDelegateModelGroupChangeArray *>(that)->d()->~Data();
- }
-
};
+QV4::Heap::QQmlDelegateModelGroupChangeArray::QQmlDelegateModelGroupChangeArray(QV4::ExecutionEngine *engine, const QVector<QQmlChangeSet::Change> &changes)
+ : QV4::Heap::Object(engine)
+ , changes(changes)
+{
+ QV4::Scope scope(engine);
+ QV4::ScopedObject o(scope, this);
+ o->setArrayType(QV4::Heap::ArrayData::Custom);
+}
+
DEFINE_OBJECT_VTABLE(QQmlDelegateModelGroupChangeArray);
-QQmlDelegateModelEngineData::QQmlDelegateModelEngineData(QV8Engine *e)
+QQmlDelegateModelEngineData::QQmlDelegateModelEngineData(QV4::ExecutionEngine *v4)
{
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(e);
QV4::Scope scope(v4);
- QV4::Scoped<QV4::Object> proto(scope, v4->newObject());
+ QV4::ScopedObject proto(scope, v4->newObject());
proto->defineAccessorProperty(QStringLiteral("index"), QQmlDelegateModelGroupChange::method_get_index, 0);
proto->defineAccessorProperty(QStringLiteral("count"), QQmlDelegateModelGroupChange::method_get_count, 0);
proto->defineAccessorProperty(QStringLiteral("moveId"), QQmlDelegateModelGroupChange::method_get_moveId, 0);
- changeProto = proto;
+ changeProto.set(v4, proto);
}
QQmlDelegateModelEngineData::~QQmlDelegateModelEngineData()
diff --git a/src/qml/types/qqmldelegatemodel_p.h b/src/qml/types/qqmldelegatemodel_p.h
index a2715bf0a8..5ebffd5b9d 100644
--- a/src/qml/types/qqmldelegatemodel_p.h
+++ b/src/qml/types/qqmldelegatemodel_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -44,8 +44,6 @@
#include <private/qv8engine_p.h>
#include <private/qqmlglobal_p.h>
-Q_DECLARE_METATYPE(QModelIndex)
-
QT_BEGIN_NAMESPACE
class QQmlChangeSet;
diff --git a/src/qml/types/qqmldelegatemodel_p_p.h b/src/qml/types/qqmldelegatemodel_p_p.h
index a7def0ad50..dc289eb35e 100644
--- a/src/qml/types/qqmldelegatemodel_p_p.h
+++ b/src/qml/types/qqmldelegatemodel_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -70,7 +70,7 @@ public:
void initializePrototype();
int parseGroups(const QStringList &groupNames) const;
- int parseGroups(const QV4::ValueRef groupNames) const;
+ int parseGroups(const QV4::Value &groupNames) const;
QPointer<QQmlDelegateModel> model;
const int groupCount;
@@ -128,9 +128,9 @@ public:
static QV4::ReturnedValue get_model(QV4::CallContext *ctx);
static QV4::ReturnedValue get_groups(QV4::CallContext *ctx);
static QV4::ReturnedValue set_groups(QV4::CallContext *ctx);
- static QV4::ReturnedValue get_member(QQmlDelegateModelItem *thisItem, uint flag, const QV4::ValueRef);
- static QV4::ReturnedValue set_member(QQmlDelegateModelItem *thisItem, uint flag, const QV4::ValueRef arg);
- static QV4::ReturnedValue get_index(QQmlDelegateModelItem *thisItem, uint flag, const QV4::ValueRef arg);
+ static QV4::ReturnedValue get_member(QQmlDelegateModelItem *thisItem, uint flag, const QV4::Value &);
+ static QV4::ReturnedValue set_member(QQmlDelegateModelItem *thisItem, uint flag, const QV4::Value &arg);
+ static QV4::ReturnedValue get_index(QQmlDelegateModelItem *thisItem, uint flag, const QV4::Value &arg);
QV4::ExecutionEngine *v4;
QQmlDelegateModelItemMetaType * const metaType;
@@ -151,23 +151,29 @@ protected:
void objectDestroyed(QObject *);
};
+namespace QV4 {
+namespace Heap {
+struct QQmlDelegateModelItemObject : Object {
+ inline QQmlDelegateModelItemObject(QV4::ExecutionEngine *engine, QQmlDelegateModelItem *item);
+ ~QQmlDelegateModelItemObject();
+ QQmlDelegateModelItem *item;
+};
+
+}
+}
+
struct QQmlDelegateModelItemObject : QV4::Object
{
- struct Data : QV4::Object::Data {
- Data(QV4::ExecutionEngine *engine, QQmlDelegateModelItem *item)
- : Object::Data(engine)
- , item(item)
- {
- setVTable(staticVTable());
- }
- ~Data();
- QQmlDelegateModelItem *item;
- };
- V4_OBJECT(QV4::Object)
-
- static void destroy(Managed *that);
+ V4_OBJECT2(QQmlDelegateModelItemObject, QV4::Object)
+ V4_NEEDS_DESTROY
};
+QV4::Heap::QQmlDelegateModelItemObject::QQmlDelegateModelItemObject(QV4::ExecutionEngine *engine, QQmlDelegateModelItem *item)
+ : QV4::Heap::Object(engine)
+ , item(item)
+{
+}
+
class QQmlDelegateModelPrivate;
@@ -221,7 +227,7 @@ public:
void initPackage(int index, QQuickPackage *package);
void destroyingPackage(QQuickPackage *package);
- bool parseIndex(const QV4::ValueRef value, int *index, Compositor::Group *group) const;
+ bool parseIndex(const QV4::Value &value, int *index, Compositor::Group *group) const;
bool parseGroupArgs(
QQmlV4Function *args, Compositor::Group *group, int *index, int *count, int *groups) const;
@@ -284,7 +290,7 @@ public:
void emitChanges();
void emitModelUpdated(const QQmlChangeSet &changeSet, bool reset);
- bool insert(Compositor::insert_iterator &before, const QV4::ValueRef object, int groups);
+ bool insert(Compositor::insert_iterator &before, const QV4::Value &object, int groups);
static void group_append(QQmlListProperty<QQmlDelegateModelGroup> *property, QQmlDelegateModelGroup *group);
static int group_count(QQmlListProperty<QQmlDelegateModelGroup> *property);
diff --git a/src/qml/types/qqmlinstantiator.cpp b/src/qml/types/qqmlinstantiator.cpp
index 1ee6532822..7626ba5a05 100644
--- a/src/qml/types/qqmlinstantiator.cpp
+++ b/src/qml/types/qqmlinstantiator.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Research In Motion.
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -48,6 +48,7 @@ QQmlInstantiatorPrivate::QQmlInstantiatorPrivate()
, active(true)
, async(false)
, ownModel(false)
+ , requestedIndex(-1)
, model(QVariant(1))
, instanceModel(0)
, delegate(0)
@@ -75,6 +76,15 @@ void QQmlInstantiatorPrivate::clear()
q->objectChanged();
}
+QObject *QQmlInstantiatorPrivate::modelObject(int index, bool async)
+{
+ requestedIndex = index;
+ QObject *o = instanceModel->object(index, async);
+ requestedIndex = -1;
+ return o;
+}
+
+
void QQmlInstantiatorPrivate::regenerate()
{
Q_Q(QQmlInstantiator);
@@ -92,7 +102,7 @@ void QQmlInstantiatorPrivate::regenerate()
}
for (int i = 0; i < instanceModel->count(); i++) {
- QObject *object = instanceModel->object(i, async);
+ QObject *object = modelObject(i, async);
// If the item was already created we won't get a createdItem
if (object)
_q_createdItem(i, object);
@@ -106,8 +116,18 @@ void QQmlInstantiatorPrivate::_q_createdItem(int idx, QObject* item)
Q_Q(QQmlInstantiator);
if (objects.contains(item)) //Case when it was created synchronously in regenerate
return;
+ if (requestedIndex != idx) // Asynchronous creation, reference the object
+ (void)instanceModel->object(idx, false);
item->setParent(q);
- objects.insert(idx, item);
+ if (objects.size() < idx + 1) {
+ int modelCount = instanceModel->count();
+ if (objects.capacity() < modelCount)
+ objects.reserve(modelCount);
+ objects.resize(idx + 1);
+ }
+ if (QObject *o = objects.at(idx))
+ instanceModel->release(o);
+ objects.replace(idx, item);
if (objects.count() == 1)
q->objectChanged();
q->objectAdded(idx, item);
@@ -153,11 +173,15 @@ void QQmlInstantiatorPrivate::_q_modelUpdated(const QQmlChangeSet &changeSet, bo
if (insert.isMove()) {
QVector<QPointer<QObject> > movedObjects = moved.value(insert.moveId);
objects = objects.mid(0, index) + movedObjects + objects.mid(index);
- } else for (int i = 0; i < insert.count; ++i) {
- int modelIndex = index + i;
- QObject* obj = instanceModel->object(modelIndex, async);
- if (obj)
- _q_createdItem(modelIndex, obj);
+ } else {
+ if (insert.index <= objects.size())
+ objects.insert(insert.index, insert.count, 0);
+ for (int i = 0; i < insert.count; ++i) {
+ int modelIndex = index + i;
+ QObject* obj = modelObject(modelIndex, async);
+ if (obj)
+ _q_createdItem(modelIndex, obj);
+ }
}
difference += insert.count;
}
diff --git a/src/qml/types/qqmlinstantiator_p.h b/src/qml/types/qqmlinstantiator_p.h
index d2d7650f2b..aa098817cd 100644
--- a/src/qml/types/qqmlinstantiator_p.h
+++ b/src/qml/types/qqmlinstantiator_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Research In Motion.
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/types/qqmlinstantiator_p_p.h b/src/qml/types/qqmlinstantiator_p_p.h
index d1cad4a45a..db8c469039 100644
--- a/src/qml/types/qqmlinstantiator_p_p.h
+++ b/src/qml/types/qqmlinstantiator_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Research In Motion.
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -66,12 +66,14 @@ public:
void makeModel();
void _q_createdItem(int, QObject *);
void _q_modelUpdated(const QQmlChangeSet &, bool);
+ QObject *modelObject(int index, bool async);
bool componentComplete:1;
bool effectiveReset:1;
bool active:1;
bool async:1;
bool ownModel:1;
+ int requestedIndex;
QVariant model;
QQmlInstanceModel *instanceModel;
QQmlComponent *delegate;
diff --git a/src/qml/types/qqmlitemmodels.qdoc b/src/qml/types/qqmlitemmodels.qdoc
new file mode 100644
index 0000000000..4e64aaa338
--- /dev/null
+++ b/src/qml/types/qqmlitemmodels.qdoc
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \chapter QModelIndex & Co. in QML
+
+ Since Qt 5.5, QModelIndex and QPersistentModelIndex are exposed in QML as
+ value-based types. Also exposed in a similar fashion are QModelIndexList,
+ QItemSelectionRange and QItemSelection. All objects from these types can
+ be passed back and forth between QML and C++ as \c var properties or plain
+ JavaScript variables.
+
+ We detail here which API all these classes get exposed in QML. Please refer
+ to the C++ documentation for more information.
+
+ \note Since all these types are exposed as gadgets, there are no property
+ change notification signals emitted. Therefore binding to their properties
+ may not give the expected results. This is especially true for QPersistentModelIndex.
+ It is perfectly possible to bind to properties holding any of those types.
+
+ \section1 \l QModelIndex and \l QPersistentModelIndex
+
+ \list
+ \li \b row : int
+ \li \b column : int
+ \li \b parent : QModelIndex
+ \li \b valid : bool
+ \li \b model : QAbstractItemModel
+ \li \b internalId : quint64
+ \endlist
+
+ All these properties are read-only, as their C++ counterpart.
+
+ \note The usual caveats apply to QModelIndex in QML. If the underlying model changes
+ or gets deleted, it may become dangerous to access its properties. Therefore, you
+ should not store any QModelIndex. You can, however, store QPersistentModelIndexes
+ in a safe way.
+
+ \section1 QModelIndexList
+
+ \l QModelIndexList is exposed in QML as a JavaScript array. Conversions are
+ automatically made from and to C++. In fact, any JavaScript array can be
+ converted back to QModelIndexList, with non-QModelIndex objects replaced by
+ invalid QModelIndexes.
+
+ \note QModelIndex to QPersistentModelIndex conversion happens when accessing
+ the array elements because any QModelIndexList property retains reference
+ semantics when exposed this way.
+
+ \section1 \l QItemSelectionRange
+
+ \list
+ \li \b top : int
+ \li \b left : int
+ \li \b bottom : int
+ \li \b right : int
+ \li \b width : int
+ \li \b height : int
+ \li \b topLeft : QPersistentModelIndex
+ \li \b bottomRight : QPersistentModelIndex
+ \li \b parent : QModelIndex
+ \li \b valid : bool
+ \li \b empty : bool
+ \li \b model : QAbstractItemModel
+ \endlist
+
+ All these properties are read-only, as their C++ counterpart. In addition,
+ we also expose the following functions:
+
+ \list
+ \li bool \b{contains}(QModelIndex index)
+ \li bool \b{contains}(int row, int column, QModelIndex parentIndex)
+ \li bool \b{intersects}(QItemSelectionRange other)
+ \li QItemSelectionRange \b{intersected}(QItemSelectionRange other)
+ \endlist
+
+ \section1 QItemSelection
+
+ Similarly to QModelIndexList, \l QItemSelection is exposed in QML as a JavaScript
+ array of QItemSelectionRanges. Conversions are automatically made from and to C++.
+ In fact, any JavaScript array can be converted back to QItemSelection, with
+ non-QItemSelectionRange objects replaced by empty QItemSelectionRanges.
+
+
+ \sa ItemSelectionModel
+*/
diff --git a/src/qml/types/qqmlitemselectionmodel.qdoc b/src/qml/types/qqmlitemselectionmodel.qdoc
new file mode 100644
index 0000000000..185ffb5fa4
--- /dev/null
+++ b/src/qml/types/qqmlitemselectionmodel.qdoc
@@ -0,0 +1,143 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \qmltype ItemSelectionModel
+ \instantiates QItemSelectionModel
+ \inqmlmodule QtQml.Models
+ \since 5.5
+ \ingroup qtquick-models
+
+ \brief Instantiates a QItemSelectionModel to be used in conjunction
+ with a QAbstractItemModel and any view supporting it.
+
+ This page only enumerates the properties, methods, and signals available in QML.
+ See \l QItemSelectionModel for the actual documentation of this class.
+
+ \sa ItemModels
+*/
+
+
+/*!
+ \qmlproperty QAbstractItemModel ItemSelectionModel::model
+
+ This property's value must match the view's model.
+*/
+
+/*!
+ \qmlproperty bool ItemSelectionModel::hasSelection
+ \readonly
+
+ It will trigger property binding updates every time \l selectionChanged()
+ is emitted, even though its value hasn't changed.
+
+ \sa selection(), selectedIndexes(), select(), selectionChanged()
+*/
+
+/*!
+ \qmlproperty QModelIndex ItemSelectionModel::currentIndex
+ \readonly
+
+ Use \l setCurrentIndex() to set its value.
+
+ \sa setCurrentIndex(), currentChanged()
+*/
+
+/*!
+ \qmlproperty QModelIndexList ItemSelectionModel::selectedIndexes
+ \readonly
+
+ Contains the list of all the indexes in the selection model.
+*/
+
+/*!
+ \qmlmethod bool ItemSelectionModel::isSelected(QModelIndex index)
+*/
+
+/*!
+ \qmlmethod bool ItemSelectionModel::isRowSelected(int row, QModelIndex parent)
+*/
+
+/*!
+ \qmlmethod bool ItemSelectionModel::isColumnSelected(int column, QModelIndex parent)
+*/
+
+/*!
+ \qmlmethod bool ItemSelectionModel::rowIntersectsSelection(int row, QModelIndex parent)
+*/
+
+/*!
+ \qmlmethod bool ItemSelectionModel::columnIntersectsSelection(int column, QModelIndex parent)
+*/
+
+/*!
+ \qmlmethod QModelIndexList ItemSelectionModel::selectedRows(int column)
+*/
+
+/*!
+ \qmlmethod QModelIndexList ItemSelectionModel::selectedColumns(int row)
+*/
+
+/*!
+ \qmlmethod QItemSelection selection()
+*/
+
+/*!
+ \qmlmethod void ItemSelectionModel::setCurrentIndex(QModelIndex index, SelectionFlags command)
+*/
+
+/*!
+ \qmlmethod void ItemSelectionModel::select(QModelIndex index, SelectionFlags command)
+*/
+
+/*!
+ \qmlmethod void ItemSelectionModel::select(QItemSelection selection, SelectionFlags command)
+*/
+
+/*!
+ \qmlmethod void ItemSelectionModel::clear()
+*/
+
+/*!
+ \qmlmethod void ItemSelectionModel::reset()
+*/
+
+/*!
+ \qmlmethod void ItemSelectionModel::clearSelection()
+*/
+
+/*!
+ \qmlmethod void ItemSelectionModel::clearCurrentIndex()
+*/
+
+/*!
+ \qmlsignal ItemSelectionModel::selectionChanged(QItemSelection selected, QItemSelection deselected)
+*/
+
+/*!
+ \qmlsignal ItemSelectionModel::currentChanged(QModelIndex current, QModelIndex previous)
+*/
diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp
index afd887ba53..ed97690adb 100644
--- a/src/qml/types/qqmllistmodel.cpp
+++ b/src/qml/types/qqmllistmodel.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -388,7 +388,7 @@ void ListModel::updateCacheIndices()
}
}
-QVariant ListModel::getProperty(int elementIndex, int roleIndex, const QQmlListModel *owner, QV8Engine *eng)
+QVariant ListModel::getProperty(int elementIndex, int roleIndex, const QQmlListModel *owner, QV4::ExecutionEngine *eng)
{
ListElement *e = elements[elementIndex];
const ListLayout::Role &r = m_layout->getExistingRole(roleIndex);
@@ -401,7 +401,7 @@ ListModel *ListModel::getListProperty(int elementIndex, const ListLayout::Role &
return e->getListProperty(role);
}
-void ListModel::set(int elementIndex, QV4::Object *object, QVector<int> *roles, QV8Engine *eng)
+void ListModel::set(int elementIndex, QV4::Object *object, QVector<int> *roles)
{
ListElement *e = elements[elementIndex];
@@ -410,10 +410,8 @@ void ListModel::set(int elementIndex, QV4::Object *object, QVector<int> *roles,
QV4::ScopedObject o(scope);
QV4::ObjectIterator it(scope, object, QV4::ObjectIterator::WithProtoChain|QV4::ObjectIterator::EnumerableOnly);
- QV4::Scoped<QV4::String> propertyName(scope);
+ QV4::ScopedString propertyName(scope);
QV4::ScopedValue propertyValue(scope);
- QV4::ScopedString s(scope);
- QV4::ScopedArrayObject a(scope);
while (1) {
propertyName = it.nextPropertyNameAsString(propertyValue);
if (!propertyName)
@@ -423,41 +421,41 @@ void ListModel::set(int elementIndex, QV4::Object *object, QVector<int> *roles,
int roleIndex = -1;
// Add the value now
- if ((s = propertyValue)) {
- const ListLayout::Role &r = m_layout->getRoleOrCreate(propertyName.getPointer(), ListLayout::Role::String);
+ if (QV4::String *s = propertyValue->asString()) {
+ const ListLayout::Role &r = m_layout->getRoleOrCreate(propertyName, ListLayout::Role::String);
roleIndex = e->setStringProperty(r, s->toQString());
} else if (propertyValue->isNumber()) {
- const ListLayout::Role &r = m_layout->getRoleOrCreate(propertyName.getPointer(), ListLayout::Role::Number);
+ const ListLayout::Role &r = m_layout->getRoleOrCreate(propertyName, ListLayout::Role::Number);
roleIndex = e->setDoubleProperty(r, propertyValue->asDouble());
- } else if ((a = propertyValue)) {
- const ListLayout::Role &r = m_layout->getRoleOrCreate(propertyName.getPointer(), ListLayout::Role::List);
+ } else if (QV4::ArrayObject *a = propertyValue->asArrayObject()) {
+ const ListLayout::Role &r = m_layout->getRoleOrCreate(propertyName, ListLayout::Role::List);
ListModel *subModel = new ListModel(r.subLayout, 0, -1);
int arrayLength = a->getLength();
for (int j=0 ; j < arrayLength ; ++j) {
o = a->getIndexed(j);
- subModel->append(o, eng);
+ subModel->append(o);
}
roleIndex = e->setListProperty(r, subModel);
} else if (propertyValue->isBoolean()) {
- const ListLayout::Role &r = m_layout->getRoleOrCreate(propertyName.getPointer(), ListLayout::Role::Bool);
+ const ListLayout::Role &r = m_layout->getRoleOrCreate(propertyName, ListLayout::Role::Bool);
roleIndex = e->setBoolProperty(r, propertyValue->booleanValue());
} else if (QV4::DateObject *dd = propertyValue->asDateObject()) {
- const ListLayout::Role &r = m_layout->getRoleOrCreate(propertyName.getPointer(), ListLayout::Role::DateTime);
+ const ListLayout::Role &r = m_layout->getRoleOrCreate(propertyName, ListLayout::Role::DateTime);
QDateTime dt = dd->toQDateTime();
roleIndex = e->setDateTimeProperty(r, dt);
} else if (QV4::Object *o = propertyValue->asObject()) {
if (QV4::QObjectWrapper *wrapper = o->as<QV4::QObjectWrapper>()) {
QObject *o = wrapper->object();
- const ListLayout::Role &role = m_layout->getRoleOrCreate(propertyName.getPointer(), ListLayout::Role::QObject);
+ const ListLayout::Role &role = m_layout->getRoleOrCreate(propertyName, ListLayout::Role::QObject);
if (role.type == ListLayout::Role::QObject)
roleIndex = e->setQObjectProperty(role, o);
} else {
const ListLayout::Role &role = m_layout->getRoleOrCreate(propertyName, ListLayout::Role::VariantMap);
if (role.type == ListLayout::Role::VariantMap) {
QV4::ScopedObject obj(scope, o);
- roleIndex = e->setVariantMapProperty(role, obj, eng);
+ roleIndex = e->setVariantMapProperty(role, obj);
}
}
} else if (propertyValue->isNullOrUndefined()) {
@@ -475,7 +473,7 @@ void ListModel::set(int elementIndex, QV4::Object *object, QVector<int> *roles,
}
}
-void ListModel::set(int elementIndex, QV4::Object *object, QV8Engine *eng)
+void ListModel::set(int elementIndex, QV4::Object *object)
{
if (!object)
return;
@@ -486,11 +484,9 @@ void ListModel::set(int elementIndex, QV4::Object *object, QV8Engine *eng)
QV4::Scope scope(v4);
QV4::ObjectIterator it(scope, object, QV4::ObjectIterator::WithProtoChain|QV4::ObjectIterator::EnumerableOnly);
- QV4::Scoped<QV4::String> propertyName(scope);
+ QV4::ScopedString propertyName(scope);
QV4::ScopedValue propertyValue(scope);
QV4::ScopedObject o(scope);
- QV4::ScopedArrayObject a(scope);
- QV4::Scoped<QV4::DateObject> date(scope);
while (1) {
propertyName = it.nextPropertyNameAsString(propertyValue);
if (!propertyName)
@@ -506,8 +502,7 @@ void ListModel::set(int elementIndex, QV4::Object *object, QV8Engine *eng)
if (r.type == ListLayout::Role::Number) {
e->setDoublePropertyFast(r, propertyValue->asDouble());
}
- } else if (propertyValue->asArrayObject()) {
- a = propertyValue;
+ } else if (QV4::ArrayObject *a = propertyValue->asArrayObject()) {
const ListLayout::Role &r = m_layout->getRoleOrCreate(propertyName, ListLayout::Role::List);
if (r.type == ListLayout::Role::List) {
ListModel *subModel = new ListModel(r.subLayout, 0, -1);
@@ -515,7 +510,7 @@ void ListModel::set(int elementIndex, QV4::Object *object, QV8Engine *eng)
int arrayLength = a->getLength();
for (int j=0 ; j < arrayLength ; ++j) {
o = a->getIndexed(j);
- subModel->append(o, eng);
+ subModel->append(o);
}
e->setListPropertyFast(r, subModel);
@@ -525,15 +520,13 @@ void ListModel::set(int elementIndex, QV4::Object *object, QV8Engine *eng)
if (r.type == ListLayout::Role::Bool) {
e->setBoolPropertyFast(r, propertyValue->booleanValue());
}
- } else if (propertyValue->asDateObject()) {
- date = propertyValue;
+ } else if (QV4::DateObject *date = propertyValue->asDateObject()) {
const ListLayout::Role &r = m_layout->getRoleOrCreate(propertyName, ListLayout::Role::DateTime);
if (r.type == ListLayout::Role::DateTime) {
QDateTime dt = date->toQDateTime();;
e->setDateTimePropertyFast(r, dt);
}
- } else if (propertyValue->isObject()) {
- o = propertyValue;
+ } else if (QV4::Object *o = propertyValue->asObject()) {
if (QV4::QObjectWrapper *wrapper = o->as<QV4::QObjectWrapper>()) {
QObject *o = wrapper->object();
const ListLayout::Role &r = m_layout->getRoleOrCreate(propertyName, ListLayout::Role::QObject);
@@ -542,7 +535,7 @@ void ListModel::set(int elementIndex, QV4::Object *object, QV8Engine *eng)
} else {
const ListLayout::Role &role = m_layout->getRoleOrCreate(propertyName, ListLayout::Role::VariantMap);
if (role.type == ListLayout::Role::VariantMap)
- e->setVariantMapFast(role, o, eng);
+ e->setVariantMapFast(role, o);
}
} else if (propertyValue->isNullOrUndefined()) {
const ListLayout::Role *r = m_layout->getExistingRole(propertyName);
@@ -572,16 +565,16 @@ void ListModel::remove(int index, int count)
updateCacheIndices();
}
-void ListModel::insert(int elementIndex, QV4::Object *object, QV8Engine *eng)
+void ListModel::insert(int elementIndex, QV4::Object *object)
{
insertElement(elementIndex);
- set(elementIndex, object, eng);
+ set(elementIndex, object);
}
-int ListModel::append(QV4::Object *object, QV8Engine *eng)
+int ListModel::append(QV4::Object *object)
{
int elementIndex = appendElement();
- set(elementIndex, object, eng);
+ set(elementIndex, object);
return elementIndex;
}
@@ -607,7 +600,7 @@ int ListModel::setOrCreateProperty(int elementIndex, const QString &key, const Q
return roleIndex;
}
-int ListModel::setExistingProperty(int elementIndex, const QString &key, const QV4::ValueRef data, QV8Engine *eng)
+int ListModel::setExistingProperty(int elementIndex, const QString &key, const QV4::Value &data, QV4::ExecutionEngine *eng)
{
int roleIndex = -1;
@@ -701,7 +694,7 @@ ListModel *ListElement::getListProperty(const ListLayout::Role &role)
return *value;
}
-QVariant ListElement::getProperty(const ListLayout::Role &role, const QQmlListModel *owner, QV8Engine *eng)
+QVariant ListElement::getProperty(const ListLayout::Role &role, const QQmlListModel *owner, QV4::ExecutionEngine *eng)
{
char *mem = getPropertyMemory(role);
@@ -875,7 +868,7 @@ int ListElement::setQObjectProperty(const ListLayout::Role &role, QObject *o)
return roleIndex;
}
-int ListElement::setVariantMapProperty(const ListLayout::Role &role, QV4::Object *o, QV8Engine *eng)
+int ListElement::setVariantMapProperty(const ListLayout::Role &role, QV4::Object *o)
{
int roleIndex = -1;
@@ -885,7 +878,7 @@ int ListElement::setVariantMapProperty(const ListLayout::Role &role, QV4::Object
QVariantMap *map = reinterpret_cast<QVariantMap *>(mem);
map->~QMap();
}
- new (mem) QVariantMap(eng->variantMapFromJS(o));
+ new (mem) QVariantMap(o->engine()->variantMapFromJS(o));
roleIndex = role.index;
}
@@ -962,11 +955,11 @@ void ListElement::setListPropertyFast(const ListLayout::Role &role, ListModel *m
*value = m;
}
-void ListElement::setVariantMapFast(const ListLayout::Role &role, QV4::Object *o, QV8Engine *eng)
+void ListElement::setVariantMapFast(const ListLayout::Role &role, QV4::Object *o)
{
char *mem = getPropertyMemory(role);
QVariantMap *map = new (mem) QVariantMap;
- *map = eng->variantMapFromJS(o);
+ *map = o->engine()->variantMapFromJS(o);
}
void ListElement::setDateTimePropertyFast(const ListLayout::Role &role, const QDateTime &dt)
@@ -997,7 +990,7 @@ void ListElement::clearProperty(const ListLayout::Role &role)
setDateTimeProperty(role, QDateTime());
break;
case ListLayout::Role::VariantMap:
- setVariantMapProperty(role, 0);
+ setVariantMapProperty(role, (QVariantMap *)0);
break;
default:
break;
@@ -1163,51 +1156,51 @@ int ListElement::setVariantProperty(const ListLayout::Role &role, const QVariant
return roleIndex;
}
-int ListElement::setJsProperty(const ListLayout::Role &role, const QV4::ValueRef d, QV8Engine *eng)
+int ListElement::setJsProperty(const ListLayout::Role &role, const QV4::Value &d, QV4::ExecutionEngine *eng)
{
// Check if this key exists yet
int roleIndex = -1;
- QV4::Scope scope(QV8Engine::getV4(eng));
+ QV4::Scope scope(eng);
// Add the value now
- if (d->isString()) {
- QString qstr = d->toQString();
+ if (d.isString()) {
+ QString qstr = d.toQString();
roleIndex = setStringProperty(role, qstr);
- } else if (d->isNumber()) {
- roleIndex = setDoubleProperty(role, d->asDouble());
- } else if (d->asArrayObject()) {
+ } else if (d.isNumber()) {
+ roleIndex = setDoubleProperty(role, d.asDouble());
+ } else if (d.asArrayObject()) {
QV4::ScopedArrayObject a(scope, d);
if (role.type == ListLayout::Role::List) {
QV4::Scope scope(a->engine());
- QV4::Scoped<QV4::Object> o(scope);
+ QV4::ScopedObject o(scope);
ListModel *subModel = new ListModel(role.subLayout, 0, -1);
int arrayLength = a->getLength();
for (int j=0 ; j < arrayLength ; ++j) {
o = a->getIndexed(j);
- subModel->append(o, eng);
+ subModel->append(o);
}
roleIndex = setListProperty(role, subModel);
} else {
qmlInfo(0) << QString::fromLatin1("Can't assign to existing role '%1' of different type [%2 -> %3]").arg(role.name).arg(roleTypeName(role.type)).arg(roleTypeName(ListLayout::Role::List));
}
- } else if (d->isBoolean()) {
- roleIndex = setBoolProperty(role, d->booleanValue());
- } else if (d->asDateObject()) {
+ } else if (d.isBoolean()) {
+ roleIndex = setBoolProperty(role, d.booleanValue());
+ } else if (d.asDateObject()) {
QV4::Scoped<QV4::DateObject> dd(scope, d);
QDateTime dt = dd->toQDateTime();
roleIndex = setDateTimeProperty(role, dt);
- } else if (d->isObject()) {
+ } else if (d.isObject()) {
QV4::ScopedObject o(scope, d);
QV4::QObjectWrapper *wrapper = o->as<QV4::QObjectWrapper>();
if (role.type == ListLayout::Role::QObject && wrapper) {
QObject *o = wrapper->object();
roleIndex = setQObjectProperty(role, o);
} else if (role.type == ListLayout::Role::VariantMap) {
- roleIndex = setVariantMapProperty(role, o, eng);
+ roleIndex = setVariantMapProperty(role, o);
}
- } else if (d->isNullOrUndefined()) {
+ } else if (d.isNullOrUndefined()) {
clearProperty(role);
}
@@ -1258,15 +1251,13 @@ void ModelNodeMetaObject::propertyWritten(int index)
if (!m_enabled)
return;
- QV8Engine *eng = m_obj->m_model->engine();
-
QString propName = QString::fromUtf8(name(index));
QVariant value = operator[](index);
- QV4::Scope scope(QV8Engine::getV4((eng)));
- QV4::ScopedValue v(scope, eng->fromVariant(value));
+ QV4::Scope scope(m_obj->m_model->engine());
+ QV4::ScopedValue v(scope, scope.engine->fromVariant(value));
- int roleIndex = m_obj->m_model->m_listModel->setExistingProperty(m_obj->m_elementIndex, propName, v, eng);
+ int roleIndex = m_obj->m_model->m_listModel->setExistingProperty(m_obj->m_elementIndex, propName, v, scope.engine);
if (roleIndex != -1) {
QVector<int> roles;
roles << roleIndex;
@@ -1542,7 +1533,7 @@ QQmlListModel::QQmlListModel(QObject *parent)
m_engine = 0;
}
-QQmlListModel::QQmlListModel(const QQmlListModel *owner, ListModel *data, QV8Engine *eng, QObject *parent)
+QQmlListModel::QQmlListModel(const QQmlListModel *owner, ListModel *data, QV4::ExecutionEngine *engine, QObject *parent)
: QAbstractListModel(parent)
{
m_mainThread = owner->m_mainThread;
@@ -1554,7 +1545,7 @@ QQmlListModel::QQmlListModel(const QQmlListModel *owner, ListModel *data, QV8Eng
m_layout = 0;
m_listModel = data;
- m_engine = eng;
+ m_engine = engine;
}
QQmlListModel::QQmlListModel(QQmlListModel *orig, QQmlListModelWorkerAgent *agent)
@@ -1614,10 +1605,10 @@ QQmlListModel *QQmlListModel::createWithOwner(QQmlListModel *newOwner)
return model;
}
-QV8Engine *QQmlListModel::engine() const
+QV4::ExecutionEngine *QQmlListModel::engine() const
{
if (m_engine == 0) {
- m_engine = QQmlEnginePrivate::getV8Engine(qmlEngine(this));
+ m_engine = QQmlEnginePrivate::get(qmlEngine(this))->v4engine();
}
return m_engine;
@@ -1985,9 +1976,9 @@ void QQmlListModel::insert(QQmlV4Function *args)
argObject = objectArray->getIndexed(i);
if (m_dynamicRoles) {
- m_modelObjects.insert(index+i, DynamicRoleModelNode::create(args->engine()->variantMapFromJS(argObject), this));
+ m_modelObjects.insert(index+i, DynamicRoleModelNode::create(scope.engine->variantMapFromJS(argObject), this));
} else {
- m_listModel->insert(index+i, argObject, args->engine());
+ m_listModel->insert(index+i, argObject);
}
}
emitItemsInserted(index, objectArrayLength);
@@ -1995,9 +1986,9 @@ void QQmlListModel::insert(QQmlV4Function *args)
emitItemsAboutToBeInserted(index, 1);
if (m_dynamicRoles) {
- m_modelObjects.insert(index, DynamicRoleModelNode::create(args->engine()->variantMapFromJS(argObject), this));
+ m_modelObjects.insert(index, DynamicRoleModelNode::create(scope.engine->variantMapFromJS(argObject), this));
} else {
- m_listModel->insert(index, argObject, args->engine());
+ m_listModel->insert(index, argObject);
}
emitItemsInserted(index, 1);
@@ -2084,7 +2075,7 @@ void QQmlListModel::append(QQmlV4Function *args)
QV4::ScopedArrayObject objectArray(scope, (*args)[0]);
if (objectArray) {
- QV4::Scoped<QV4::Object> argObject(scope);
+ QV4::ScopedObject argObject(scope);
int objectArrayLength = objectArray->getLength();
@@ -2095,9 +2086,9 @@ void QQmlListModel::append(QQmlV4Function *args)
argObject = objectArray->getIndexed(i);
if (m_dynamicRoles) {
- m_modelObjects.append(DynamicRoleModelNode::create(args->engine()->variantMapFromJS(argObject), this));
+ m_modelObjects.append(DynamicRoleModelNode::create(scope.engine->variantMapFromJS(argObject), this));
} else {
- m_listModel->append(argObject, args->engine());
+ m_listModel->append(argObject);
}
}
@@ -2108,11 +2099,11 @@ void QQmlListModel::append(QQmlV4Function *args)
if (m_dynamicRoles) {
index = m_modelObjects.count();
emitItemsAboutToBeInserted(index, 1);
- m_modelObjects.append(DynamicRoleModelNode::create(args->engine()->variantMapFromJS(argObject), this));
+ m_modelObjects.append(DynamicRoleModelNode::create(scope.engine->variantMapFromJS(argObject), this));
} else {
index = m_listModel->elementCount();
emitItemsAboutToBeInserted(index, 1);
- m_listModel->append(argObject, args->engine());
+ m_listModel->append(argObject);
}
emitItemsInserted(index, 1);
@@ -2157,18 +2148,17 @@ void QQmlListModel::append(QQmlV4Function *args)
*/
QQmlV4Handle QQmlListModel::get(int index) const
{
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine());
- QV4::Scope scope(v4);
+ QV4::Scope scope(engine());
QV4::ScopedValue result(scope, QV4::Primitive::undefinedValue());
if (index >= 0 && index < count()) {
if (m_dynamicRoles) {
DynamicRoleModelNode *object = m_modelObjects[index];
- result = QV4::QObjectWrapper::wrap(v4, object);
+ result = QV4::QObjectWrapper::wrap(scope.engine, object);
} else {
ModelObject *object = m_listModel->getOrCreateModelObject(const_cast<QQmlListModel *>(this), index);
- result = QV4::QObjectWrapper::wrap(v4, object);
+ result = QV4::QObjectWrapper::wrap(scope.engine, object);
}
}
@@ -2193,7 +2183,7 @@ QQmlV4Handle QQmlListModel::get(int index) const
*/
void QQmlListModel::set(int index, const QQmlV4Handle &handle)
{
- QV4::Scope scope(QV8Engine::getV4(engine()));
+ QV4::Scope scope(engine());
QV4::ScopedObject object(scope, handle);
if (!object) {
@@ -2210,9 +2200,9 @@ void QQmlListModel::set(int index, const QQmlV4Handle &handle)
emitItemsAboutToBeInserted(index, 1);
if (m_dynamicRoles) {
- m_modelObjects.append(DynamicRoleModelNode::create(engine()->variantMapFromJS(object), this));
+ m_modelObjects.append(DynamicRoleModelNode::create(scope.engine->variantMapFromJS(object), this));
} else {
- m_listModel->insert(index, object, engine());
+ m_listModel->insert(index, object);
}
emitItemsInserted(index, 1);
@@ -2221,9 +2211,9 @@ void QQmlListModel::set(int index, const QQmlV4Handle &handle)
QVector<int> roles;
if (m_dynamicRoles) {
- m_modelObjects[index]->updateValues(engine()->variantMapFromJS(object), roles);
+ m_modelObjects[index]->updateValues(scope.engine->variantMapFromJS(object), roles);
} else {
- m_listModel->set(index, object, &roles, engine());
+ m_listModel->set(index, object, &roles);
}
if (roles.count())
@@ -2414,8 +2404,7 @@ void QQmlListModelParser::applyBindings(QObject *obj, QQmlCompiledData *cdata, c
{
QQmlListModel *rv = static_cast<QQmlListModel *>(obj);
- QV8Engine *engine = QQmlEnginePrivate::getV8Engine(qmlEngine(rv));
- rv->m_engine = engine;
+ rv->m_engine = QV8Engine::getV4(qmlEngine(rv));
const QV4::CompiledData::Unit *qmlUnit = cdata->compilationUnit->data;
diff --git a/src/qml/types/qqmllistmodel_p.h b/src/qml/types/qqmllistmodel_p.h
index debe7ee98d..75373be47c 100644
--- a/src/qml/types/qqmllistmodel_p.h
+++ b/src/qml/types/qqmllistmodel_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -44,7 +44,7 @@
#include <QtCore/QVariant>
#include <QtCore/qabstractitemmodel.h>
-#include <private/qv8engine_p.h>
+#include <private/qv4engine_p.h>
#include <private/qpodvector_p.h>
QT_BEGIN_NAMESPACE
@@ -102,14 +102,14 @@ private:
// Constructs a flat list model for a worker agent
QQmlListModel(QQmlListModel *orig, QQmlListModelWorkerAgent *agent);
- QQmlListModel(const QQmlListModel *owner, ListModel *data, QV8Engine *eng, QObject *parent=0);
+ QQmlListModel(const QQmlListModel *owner, ListModel *data, QV4::ExecutionEngine *engine, QObject *parent=0);
- QV8Engine *engine() const;
+ QV4::ExecutionEngine *engine() const;
inline bool canMove(int from, int to, int n) const { return !(from+n > count() || to+n > count() || from < 0 || to < 0 || n < 0); }
QQmlListModelWorkerAgent *m_agent;
- mutable QV8Engine *m_engine;
+ mutable QV4::ExecutionEngine *m_engine;
bool m_mainThread;
bool m_primary;
diff --git a/src/qml/types/qqmllistmodel_p_p.h b/src/qml/types/qqmllistmodel_p_p.h
index 9e70e6ad54..4e3132b860 100644
--- a/src/qml/types/qqmllistmodel_p_p.h
+++ b/src/qml/types/qqmllistmodel_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -245,14 +245,14 @@ private:
int setVariantProperty(const ListLayout::Role &role, const QVariant &d);
- int setJsProperty(const ListLayout::Role &role, const QV4::ValueRef d, QV8Engine *eng);
+ int setJsProperty(const ListLayout::Role &role, const QV4::Value &d, QV4::ExecutionEngine *eng);
int setStringProperty(const ListLayout::Role &role, const QString &s);
int setDoubleProperty(const ListLayout::Role &role, double n);
int setBoolProperty(const ListLayout::Role &role, bool b);
int setListProperty(const ListLayout::Role &role, ListModel *m);
int setQObjectProperty(const ListLayout::Role &role, QObject *o);
- int setVariantMapProperty(const ListLayout::Role &role, QV4::Object *o, QV8Engine *eng);
+ int setVariantMapProperty(const ListLayout::Role &role, QV4::Object *o);
int setVariantMapProperty(const ListLayout::Role &role, QVariantMap *m);
int setDateTimeProperty(const ListLayout::Role &role, const QDateTime &dt);
@@ -261,12 +261,12 @@ private:
void setBoolPropertyFast(const ListLayout::Role &role, bool b);
void setQObjectPropertyFast(const ListLayout::Role &role, QObject *o);
void setListPropertyFast(const ListLayout::Role &role, ListModel *m);
- void setVariantMapFast(const ListLayout::Role &role, QV4::Object *o, QV8Engine *eng);
+ void setVariantMapFast(const ListLayout::Role &role, QV4::Object *o);
void setDateTimePropertyFast(const ListLayout::Role &role, const QDateTime &dt);
void clearProperty(const ListLayout::Role &role);
- QVariant getProperty(const ListLayout::Role &role, const QQmlListModel *owner, QV8Engine *eng);
+ QVariant getProperty(const ListLayout::Role &role, const QQmlListModel *owner, QV4::ExecutionEngine *eng);
ListModel *getListProperty(const ListLayout::Role &role);
QString *getStringProperty(const ListLayout::Role &role);
QObject *getQObjectProperty(const ListLayout::Role &role);
@@ -300,9 +300,9 @@ public:
void destroy();
int setOrCreateProperty(int elementIndex, const QString &key, const QVariant &data);
- int setExistingProperty(int uid, const QString &key, const QV4::ValueRef data, QV8Engine *eng);
+ int setExistingProperty(int uid, const QString &key, const QV4::Value &data, QV4::ExecutionEngine *eng);
- QVariant getProperty(int elementIndex, int roleIndex, const QQmlListModel *owner, QV8Engine *eng);
+ QVariant getProperty(int elementIndex, int roleIndex, const QQmlListModel *owner, QV4::ExecutionEngine *eng);
ListModel *getListProperty(int elementIndex, const ListLayout::Role &role);
int roleCount() const
@@ -325,11 +325,11 @@ public:
return elements.count();
}
- void set(int elementIndex, QV4::Object *object, QVector<int> *roles, QV8Engine *eng);
- void set(int elementIndex, QV4::Object *object, QV8Engine *eng);
+ void set(int elementIndex, QV4::Object *object, QVector<int> *roles);
+ void set(int elementIndex, QV4::Object *object);
- int append(QV4::Object *object, QV8Engine *eng);
- void insert(int elementIndex, QV4::Object *object, QV8Engine *eng);
+ int append(QV4::Object *object);
+ void insert(int elementIndex, QV4::Object *object);
void clear();
void remove(int index, int count);
diff --git a/src/qml/types/qqmllistmodelworkeragent.cpp b/src/qml/types/qqmllistmodelworkeragent.cpp
index 35369bfe87..76aab248bc 100644
--- a/src/qml/types/qqmllistmodelworkeragent.cpp
+++ b/src/qml/types/qqmllistmodelworkeragent.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -91,7 +91,7 @@ QQmlListModelWorkerAgent::~QQmlListModelWorkerAgent()
mutex.unlock();
}
-void QQmlListModelWorkerAgent::setV8Engine(QV8Engine *eng)
+void QQmlListModelWorkerAgent::setEngine(QV4::ExecutionEngine *eng)
{
m_copy->m_engine = eng;
}
diff --git a/src/qml/types/qqmllistmodelworkeragent_p.h b/src/qml/types/qqmllistmodelworkeragent_p.h
index 7a8f6e6593..be5217eaa4 100644
--- a/src/qml/types/qqmllistmodelworkeragent_p.h
+++ b/src/qml/types/qqmllistmodelworkeragent_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -65,7 +65,7 @@ class QQmlListModelWorkerAgent : public QObject
public:
QQmlListModelWorkerAgent(QQmlListModel *);
~QQmlListModelWorkerAgent();
- void setV8Engine(QV8Engine *eng);
+ void setEngine(QV4::ExecutionEngine *eng);
void addref();
void release();
diff --git a/src/qml/types/qqmlmodelindexvaluetype.cpp b/src/qml/types/qqmlmodelindexvaluetype.cpp
new file mode 100644
index 0000000000..a8900c686b
--- /dev/null
+++ b/src/qml/types/qqmlmodelindexvaluetype.cpp
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qqmlmodelindexvaluetype_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \internal
+*/
+QString QQmlModelIndexValueType::propertiesString(const QModelIndex &idx)
+{
+ if (!idx.isValid())
+ return QLatin1String("()");
+ return QString(QLatin1String("(%1,%2,0x%3,%4(0x%5))"))
+ .arg(idx.row()).arg(idx.column()).arg(idx.internalId(), 0, 16)
+ .arg(QLatin1String(idx.model()->metaObject()->className())).arg(quintptr(idx.model()), 0, 16);
+}
+
+/*!
+ \internal
+*/
+QString QQmlItemSelectionRangeValueType::toString() const
+{
+ return QString(QLatin1String("QItemSelectionRange(%1,%2)"))
+ .arg(reinterpret_cast<const QQmlPersistentModelIndexValueType *>(&v.topLeft())->toString())
+ .arg(reinterpret_cast<const QQmlPersistentModelIndexValueType *>(&v.bottomRight())->toString());
+}
+
+QT_END_NAMESPACE
diff --git a/src/qml/types/qqmlmodelindexvaluetype_p.h b/src/qml/types/qqmlmodelindexvaluetype_p.h
new file mode 100644
index 0000000000..371335c9f3
--- /dev/null
+++ b/src/qml/types/qqmlmodelindexvaluetype_p.h
@@ -0,0 +1,158 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQMLMODELINDEXVALUETYPE_P_H
+#define QQMLMODELINDEXVALUETYPE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qabstractitemmodel.h>
+#include <QtCore/qitemselectionmodel.h>
+
+QT_BEGIN_NAMESPACE
+
+struct QQmlModelIndexValueType
+{
+ QModelIndex v;
+
+ Q_PROPERTY(int row READ row CONSTANT FINAL)
+ Q_PROPERTY(int column READ column CONSTANT FINAL)
+ Q_PROPERTY(QModelIndex parent READ parent FINAL)
+ Q_PROPERTY(bool valid READ isValid CONSTANT FINAL)
+ Q_PROPERTY(QAbstractItemModel *model READ model CONSTANT FINAL)
+ Q_PROPERTY(quint64 internalId READ internalId CONSTANT FINAL)
+ Q_GADGET
+
+public:
+ Q_INVOKABLE QString toString() const
+ { return QLatin1String("QModelIndex") + propertiesString(v); }
+
+ inline int row() const Q_DECL_NOTHROW { return v.row(); }
+ inline int column() const Q_DECL_NOTHROW { return v.column(); }
+ inline QModelIndex parent() const { return v.parent(); }
+ inline bool isValid() const Q_DECL_NOTHROW { return v.isValid(); }
+ inline QAbstractItemModel *model() const Q_DECL_NOTHROW
+ { return const_cast<QAbstractItemModel *>(v.model()); }
+ quint64 internalId() const { return v.internalId(); }
+
+ static QString propertiesString(const QModelIndex &idx);
+
+ static QPersistentModelIndex toPersistentModelIndex(const QModelIndex &index)
+ { return QPersistentModelIndex(index); }
+};
+
+struct QQmlPersistentModelIndexValueType
+{
+ QPersistentModelIndex v;
+
+ Q_PROPERTY(int row READ row FINAL)
+ Q_PROPERTY(int column READ column FINAL)
+ Q_PROPERTY(QModelIndex parent READ parent FINAL)
+ Q_PROPERTY(bool valid READ isValid FINAL)
+ Q_PROPERTY(QAbstractItemModel *model READ model FINAL)
+ Q_PROPERTY(quint64 internalId READ internalId FINAL)
+ Q_GADGET
+
+public:
+ Q_INVOKABLE QString toString() const
+ { return QLatin1String("QPersistentModelIndex") + QQmlModelIndexValueType::propertiesString(v); }
+
+ inline int row() const { return v.row(); }
+ inline int column() const { return v.column(); }
+ inline QModelIndex parent() const { return v.parent(); }
+ inline bool isValid() const { return v.isValid(); }
+ inline QAbstractItemModel *model() const { return const_cast<QAbstractItemModel *>(v.model()); }
+ inline quint64 internalId() const { return v.internalId(); }
+
+ static const QModelIndex &toModelIndex(const QPersistentModelIndex &index)
+ { return index; }
+};
+
+struct QQmlItemSelectionRangeValueType
+{
+ QItemSelectionRange v;
+
+ Q_PROPERTY(int top READ top FINAL)
+ Q_PROPERTY(int left READ left FINAL)
+ Q_PROPERTY(int bottom READ bottom FINAL)
+ Q_PROPERTY(int right READ right FINAL)
+ Q_PROPERTY(int width READ width FINAL)
+ Q_PROPERTY(int height READ height FINAL)
+ Q_PROPERTY(QPersistentModelIndex topLeft READ topLeft FINAL)
+ Q_PROPERTY(QPersistentModelIndex bottomRight READ bottomRight FINAL)
+ Q_PROPERTY(QModelIndex parent READ parent FINAL)
+ Q_PROPERTY(bool valid READ isValid FINAL)
+ Q_PROPERTY(bool empty READ isEmpty FINAL)
+ Q_PROPERTY(QAbstractItemModel *model READ model FINAL)
+ Q_GADGET
+
+public:
+ Q_INVOKABLE QString toString() const;
+ Q_INVOKABLE inline bool contains(const QModelIndex &index) const
+ { return v.contains(index); }
+ Q_INVOKABLE inline bool contains(int row, int column, const QModelIndex &parentIndex) const
+ { return v.contains(row, column, parentIndex); }
+ Q_INVOKABLE inline bool intersects(const QItemSelectionRange &other) const
+ { return v.intersects(other); }
+ Q_INVOKABLE QItemSelectionRange intersected(const QItemSelectionRange &other) const
+ { return v.intersected(other); }
+
+ inline int top() const { return v.top(); }
+ inline int left() const { return v.left(); }
+ inline int bottom() const { return v.bottom(); }
+ inline int right() const { return v.right(); }
+ inline int width() const { return v.width(); }
+ inline int height() const { return v.height(); }
+ inline QPersistentModelIndex &topLeft() const { return const_cast<QPersistentModelIndex &>(v.topLeft()); }
+ inline QPersistentModelIndex &bottomRight() const { return const_cast<QPersistentModelIndex &>(v.bottomRight()); }
+ inline QModelIndex parent() const { return v.parent(); }
+ inline QAbstractItemModel *model() const { return const_cast<QAbstractItemModel *>(v.model()); }
+ inline bool isValid() const { return v.isValid(); }
+ inline bool isEmpty() const { return v.isEmpty(); }
+};
+
+#undef QLISTVALUETYPE_INVOKABLE_API
+
+QT_END_NAMESPACE
+
+#endif // QQMLMODELINDEXVALUETYPE_P_H
+
diff --git a/src/qml/types/qqmlmodelsmodule.cpp b/src/qml/types/qqmlmodelsmodule.cpp
index cdf2211f36..3e53efd8b9 100644
--- a/src/qml/types/qqmlmodelsmodule.cpp
+++ b/src/qml/types/qqmlmodelsmodule.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Research In Motion.
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -32,6 +32,7 @@
****************************************************************************/
#include "qqmlmodelsmodule_p.h"
+#include <QtCore/qitemselectionmodel.h>
#include <private/qqmllistmodel_p.h>
#include <private/qqmldelegatemodel_p.h>
#include <private/qqmlobjectmodel_p.h>
@@ -47,6 +48,8 @@ void QQmlModelsModule::defineModule()
qmlRegisterType<QQmlDelegateModel>(uri, 2, 1, "DelegateModel");
qmlRegisterType<QQmlDelegateModelGroup>(uri, 2, 1, "DelegateModelGroup");
qmlRegisterType<QQmlObjectModel>(uri, 2, 1, "ObjectModel");
+
+ qmlRegisterType<QItemSelectionModel>(uri, 2, 2, "ItemSelectionModel");
}
QT_END_NAMESPACE
diff --git a/src/qml/types/qqmlmodelsmodule_p.h b/src/qml/types/qqmlmodelsmodule_p.h
index a1b8bc1608..7fd02b600a 100644
--- a/src/qml/types/qqmlmodelsmodule_p.h
+++ b/src/qml/types/qqmlmodelsmodule_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Research In Motion.
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/types/qqmlobjectmodel.cpp b/src/qml/types/qqmlobjectmodel.cpp
index 7c1a951a2b..1d892beabf 100644
--- a/src/qml/types/qqmlobjectmodel.cpp
+++ b/src/qml/types/qqmlobjectmodel.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/types/qqmlobjectmodel_p.h b/src/qml/types/qqmlobjectmodel_p.h
index c9ec8efba4..4c37a5ac30 100644
--- a/src/qml/types/qqmlobjectmodel_p.h
+++ b/src/qml/types/qqmlobjectmodel_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/types/qqmltimer.cpp b/src/qml/types/qqmltimer.cpp
index 8cbcf7a349..fb500426f3 100644
--- a/src/qml/types/qqmltimer.cpp
+++ b/src/qml/types/qqmltimer.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/types/qqmltimer_p.h b/src/qml/types/qqmltimer_p.h
index 8347886603..0da81b481f 100644
--- a/src/qml/types/qqmltimer_p.h
+++ b/src/qml/types/qqmltimer_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/types/qquickpackage.cpp b/src/qml/types/qquickpackage.cpp
index ad2618d1c1..69bf058e6f 100644
--- a/src/qml/types/qquickpackage.cpp
+++ b/src/qml/types/qquickpackage.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -45,8 +45,8 @@ QT_BEGIN_NAMESPACE
\ingroup qtquick-views
\brief Specifies a collection of named items
- The Package class is used in conjunction with
- VisualDataModel to enable delegates with a shared context
+ The Package type is used in conjunction with
+ DelegateModel to enable delegates with a shared context
to be provided to multiple views.
Any item within a Package may be assigned a name via the
diff --git a/src/qml/types/qquickpackage_p.h b/src/qml/types/qquickpackage_p.h
index 0baa908cbf..6398e6a4fa 100644
--- a/src/qml/types/qquickpackage_p.h
+++ b/src/qml/types/qquickpackage_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/types/qquickworkerscript.cpp b/src/qml/types/qquickworkerscript.cpp
index f2705aca44..c2c6e5ef5c 100644
--- a/src/qml/types/qquickworkerscript.cpp
+++ b/src/qml/types/qquickworkerscript.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -221,18 +221,19 @@ void QQuickWorkerScriptEnginePrivate::WorkerEngine::init()
"})"
QV4::Scope scope(m_v4Engine);
- onmessage = QV4::Script(m_v4Engine->rootContext, QString::fromUtf8(CALL_ONMESSAGE_SCRIPT)).run(); // do not use QStringLiteral here, MSVC2012 cannot apply this cleanly to the macro
+ QV4::ScopedContext globalContext(scope, scope.engine->rootContext());
+ onmessage.set(scope.engine, QV4::Script(globalContext, QString::fromUtf8(CALL_ONMESSAGE_SCRIPT)).run()); // do not use QStringLiteral here, MSVC2012 cannot apply this cleanly to the macro
Q_ASSERT(!scope.engine->hasException);
- QV4::Script createsendscript(m_v4Engine->rootContext, QString::fromUtf8(SEND_MESSAGE_CREATE_SCRIPT)); // do not use QStringLiteral here, MSVC2012 cannot apply this cleanly to the macro
- QV4::Scoped<QV4::FunctionObject> createsendconstructor(scope, createsendscript.run());
+ QV4::Script createsendscript(globalContext, QString::fromUtf8(SEND_MESSAGE_CREATE_SCRIPT)); // do not use QStringLiteral here, MSVC2012 cannot apply this cleanly to the macro
+ QV4::ScopedFunctionObject createsendconstructor(scope, createsendscript.run());
Q_ASSERT(!scope.engine->hasException);
QV4::ScopedString name(scope, m_v4Engine->newString(QStringLiteral("sendMessage")));
- QV4::ScopedValue function(scope, QV4::BuiltinFunction::create(m_v4Engine->rootContext, name.getPointer(),
+ QV4::ScopedValue function(scope, QV4::BuiltinFunction::create(globalContext, name,
QQuickWorkerScriptEnginePrivate::method_sendMessage));
QV4::ScopedCallData callData(scope, 1);
callData->args[0] = function;
callData->thisObject = global();
- createsend = createsendconstructor->call(callData);
+ createsend.set(scope.engine, createsendconstructor->call(callData));
}
// Requires handle and context scope
@@ -244,7 +245,6 @@ QV4::ReturnedValue QQuickWorkerScriptEnginePrivate::WorkerEngine::sendFunction(i
QV4::Scope scope(v4);
QV4::ScopedFunctionObject f(scope, createsend.value());
- QV4::ExecutionContext *ctx = v4->currentContext();
QV4::ScopedValue v(scope);
QV4::ScopedCallData callData(scope, 1);
@@ -252,8 +252,8 @@ QV4::ReturnedValue QQuickWorkerScriptEnginePrivate::WorkerEngine::sendFunction(i
callData->thisObject = global();
v = f->call(callData);
if (scope.hasException())
- v = ctx->catchException();
- return v.asReturnedValue();
+ v = scope.engine->catchException();
+ return v->asReturnedValue();
}
QNetworkAccessManager *QQuickWorkerScriptEnginePrivate::WorkerEngine::networkAccessManager()
@@ -277,11 +277,11 @@ QV4::ReturnedValue QQuickWorkerScriptEnginePrivate::method_sendMessage(QV4::Call
{
WorkerEngine *engine = (WorkerEngine*)ctx->engine()->v8Engine;
- int id = ctx->d()->callData->argc > 1 ? ctx->d()->callData->args[1].toInt32() : 0;
+ int id = ctx->argc() > 1 ? ctx->args()[1].toInt32() : 0;
QV4::Scope scope(ctx);
- QV4::ScopedValue v(scope, ctx->d()->callData->argument(2));
- QByteArray data = QV4::Serialize::serialize(v, engine);
+ QV4::ScopedValue v(scope, ctx->argument(2));
+ QByteArray data = QV4::Serialize::serialize(v, scope.engine);
QMutexLocker locker(&engine->p->m_lock);
WorkerScript *script = engine->p->workers.value(id);
@@ -300,16 +300,16 @@ QV4::ReturnedValue QQuickWorkerScriptEnginePrivate::getWorker(WorkerScript *scri
QV4::ExecutionEngine *v4 = QV8Engine::getV4(workerEngine);
QV4::Scope scope(v4);
- script->object = QV4::QmlContextWrapper::urlScope(workerEngine, script->source);
+ script->object.set(v4, QV4::QmlContextWrapper::urlScope(v4, script->source));
QV4::Scoped<QV4::QmlContextWrapper> w(scope, script->object.value());
Q_ASSERT(!!w);
w->setReadOnly(false);
- QV4::Scoped<QV4::Object> api(scope, v4->newObject());
- api->put(QV4::ScopedString(scope, v4->newString(QStringLiteral("sendMessage"))).getPointer(), QV4::ScopedValue(scope, workerEngine->sendFunction(script->id)));
+ QV4::ScopedObject api(scope, v4->newObject());
+ api->put(QV4::ScopedString(scope, v4->newString(QStringLiteral("sendMessage"))), QV4::ScopedValue(scope, workerEngine->sendFunction(script->id)));
- w->QV4::Object::put(QV4::ScopedString(scope, v4->newString(QStringLiteral("WorkerScript"))).getPointer(), api);
+ w->QV4::Object::put(QV4::ScopedString(scope, v4->newString(QStringLiteral("WorkerScript"))), api);
w->setReadOnly(true);
}
@@ -352,9 +352,8 @@ void QQuickWorkerScriptEnginePrivate::processMessage(int id, const QByteArray &d
QV4::ExecutionEngine *v4 = QV8Engine::getV4(workerEngine);
QV4::Scope scope(v4);
QV4::ScopedFunctionObject f(scope, workerEngine->onmessage.value());
- QV4::ExecutionContext *ctx = v4->currentContext();
- QV4::ScopedValue value(scope, QV4::Serialize::deserialize(data, workerEngine));
+ QV4::ScopedValue value(scope, QV4::Serialize::deserialize(data, v4));
QV4::ScopedCallData callData(scope, 2);
callData->thisObject = workerEngine->global();
@@ -362,7 +361,7 @@ void QQuickWorkerScriptEnginePrivate::processMessage(int id, const QByteArray &d
callData->args[1] = value;
f->call(callData);
if (scope.hasException()) {
- QQmlError error = QV4::ExecutionEngine::catchExceptionAsQmlError(ctx);
+ QQmlError error = scope.engine->catchExceptionAsQmlError();
reportScriptException(script, error);
}
}
@@ -383,7 +382,7 @@ void QQuickWorkerScriptEnginePrivate::processLoad(int id, const QUrl &url)
return;
script->source = url;
- QV4::Scoped<QV4::Object> activation(scope, getWorker(script));
+ QV4::ScopedObject activation(scope, getWorker(script));
if (!activation)
return;
@@ -409,8 +408,7 @@ void QQuickWorkerScriptEnginePrivate::processLoad(int id, const QUrl &url)
program->run();
if (v4->hasException) {
- QV4::ExecutionContext *ctx = v4->currentContext();
- QQmlError error = QV4::ExecutionEngine::catchExceptionAsQmlError(ctx);
+ QQmlError error = v4->catchExceptionAsQmlError();
reportScriptException(script, error);
}
}
@@ -684,7 +682,7 @@ void QQuickWorkerScript::sendMessage(QQmlV4Function *args)
if (args->length() != 0)
argument = (*args)[0];
- m_engine->sendMessage(m_scriptId, QV4::Serialize::serialize(argument, args->engine()));
+ m_engine->sendMessage(m_scriptId, QV4::Serialize::serialize(argument, scope.engine));
}
void QQuickWorkerScript::classBegin()
@@ -736,7 +734,7 @@ bool QQuickWorkerScript::event(QEvent *event)
WorkerDataEvent *workerEvent = static_cast<WorkerDataEvent *>(event);
QV8Engine *v8engine = QQmlEnginePrivate::get(engine)->v8engine();
QV4::Scope scope(QV8Engine::getV4(v8engine));
- QV4::ScopedValue value(scope, QV4::Serialize::deserialize(workerEvent->data(), v8engine));
+ QV4::ScopedValue value(scope, QV4::Serialize::deserialize(workerEvent->data(), scope.engine));
emit message(QQmlV4Handle(value));
}
return true;
diff --git a/src/qml/types/qquickworkerscript_p.h b/src/qml/types/qquickworkerscript_p.h
index 39cdaf01f4..5a1f1ccdbd 100644
--- a/src/qml/types/qquickworkerscript_p.h
+++ b/src/qml/types/qquickworkerscript_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/types/types.pri b/src/qml/types/types.pri
index 3e6153759d..d2e5020738 100644
--- a/src/qml/types/types.pri
+++ b/src/qml/types/types.pri
@@ -5,6 +5,7 @@ SOURCES += \
$$PWD/qqmllistmodel.cpp \
$$PWD/qqmllistmodelworkeragent.cpp \
$$PWD/qqmlmodelsmodule.cpp \
+ $$PWD/qqmlmodelindexvaluetype.cpp \
$$PWD/qqmlobjectmodel.cpp \
$$PWD/qqmltimer.cpp \
$$PWD/qquickpackage.cpp \
@@ -20,6 +21,7 @@ HEADERS += \
$$PWD/qqmllistmodel_p_p.h \
$$PWD/qqmllistmodelworkeragent_p.h \
$$PWD/qqmlmodelsmodule_p.h \
+ $$PWD/qqmlmodelindexvaluetype_p.h \
$$PWD/qqmlobjectmodel_p.h \
$$PWD/qqmltimer_p.h \
$$PWD/qquickpackage_p.h \
diff --git a/src/qml/util/qqmladaptormodel.cpp b/src/qml/util/qqmladaptormodel.cpp
index b147f56bfa..356970eef0 100644
--- a/src/qml/util/qqmladaptormodel.cpp
+++ b/src/qml/util/qqmladaptormodel.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -46,21 +46,21 @@ QT_BEGIN_NAMESPACE
class QQmlAdaptorModelEngineData : public QV8Engine::Deletable
{
public:
- QQmlAdaptorModelEngineData(QV8Engine *engine);
+ QQmlAdaptorModelEngineData(QV4::ExecutionEngine *v4);
~QQmlAdaptorModelEngineData();
QV4::ExecutionEngine *v4;
QV4::PersistentValue listItemProto;
};
-V8_DEFINE_EXTENSION(QQmlAdaptorModelEngineData, engineData)
+V4_DEFINE_EXTENSION(QQmlAdaptorModelEngineData, engineData)
static QV4::ReturnedValue get_index(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->d()->callData->thisObject.as<QQmlDelegateModelItemObject>());
+ QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->thisObject().as<QQmlDelegateModelItemObject>());
if (!o)
- return ctx->throwTypeError(QStringLiteral("Not a valid VisualData object"));
+ return ctx->engine()->throwTypeError(QStringLiteral("Not a valid VisualData object"));
return QV4::Encode(o->d()->item->index);
}
@@ -190,9 +190,9 @@ public:
static QV4::ReturnedValue get_hasModelChildren(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->d()->callData->thisObject.as<QQmlDelegateModelItemObject>());
+ QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->thisObject().as<QQmlDelegateModelItemObject>());
if (!o)
- return ctx->throwTypeError(QStringLiteral("Not a valid VisualData object"));
+ return ctx->engine()->throwTypeError(QStringLiteral("Not a valid VisualData object"));
const QQmlAdaptorModel *const model = static_cast<QQmlDMCachedModelData *>(o->d()->item)->type->model;
if (o->d()->item->index >= 0 && *model) {
@@ -208,7 +208,7 @@ public:
{
QV4::ExecutionEngine *v4 = data->v4;
QV4::Scope scope(v4);
- QV4::Scoped<QV4::Object> proto(scope, v4->newObject());
+ QV4::ScopedObject proto(scope, v4->newObject());
proto->defineAccessorProperty(QStringLiteral("index"), get_index, 0);
proto->defineAccessorProperty(QStringLiteral("hasModelChildren"), get_hasModelChildren, 0);
QV4::ScopedProperty p(scope);
@@ -219,13 +219,14 @@ public:
const QByteArray &propertyName = it.key();
QV4::ScopedString name(scope, v4->newString(QString::fromUtf8(propertyName)));
- QV4::ScopedFunctionObject g(scope, v4->memoryManager->alloc<QV4::IndexedBuiltinFunction>(v4->rootContext, propertyId, QQmlDMCachedModelData::get_property));
- QV4::ScopedFunctionObject s(scope, v4->memoryManager->alloc<QV4::IndexedBuiltinFunction>(v4->rootContext, propertyId, QQmlDMCachedModelData::set_property));
+ QV4::ScopedContext global(scope, v4->rootContext());
+ QV4::ScopedFunctionObject g(scope, v4->memoryManager->alloc<QV4::IndexedBuiltinFunction>(global, propertyId, QQmlDMCachedModelData::get_property));
+ QV4::ScopedFunctionObject s(scope, v4->memoryManager->alloc<QV4::IndexedBuiltinFunction>(global, propertyId, QQmlDMCachedModelData::set_property));
p->setGetter(g);
p->setSetter(s);
- proto->insertMember(name.getPointer(), p, QV4::Attr_Accessor|QV4::Attr_NotEnumerable|QV4::Attr_NotConfigurable);
+ proto->insertMember(name, p, QV4::Attr_Accessor|QV4::Attr_NotEnumerable|QV4::Attr_NotConfigurable);
}
- prototype = proto;
+ prototype.set(v4, proto);
}
// QAbstractDynamicMetaObject
@@ -337,18 +338,18 @@ bool QQmlDMCachedModelData::resolveIndex(const QQmlAdaptorModel &, int idx)
QV4::ReturnedValue QQmlDMCachedModelData::get_property(QV4::CallContext *ctx, uint propertyId)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->d()->callData->thisObject.as<QQmlDelegateModelItemObject>());
+ QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->thisObject().as<QQmlDelegateModelItemObject>());
if (!o)
- return ctx->throwTypeError(QStringLiteral("Not a valid VisualData object"));
+ return ctx->engine()->throwTypeError(QStringLiteral("Not a valid VisualData object"));
QQmlDMCachedModelData *modelData = static_cast<QQmlDMCachedModelData *>(o->d()->item);
if (o->d()->item->index == -1) {
if (!modelData->cachedData.isEmpty()) {
- return ctx->d()->engine->v8Engine->fromVariant(
+ return scope.engine->fromVariant(
modelData->cachedData.at(modelData->type->hasModelData ? 0 : propertyId));
}
} else if (*modelData->type->model) {
- return ctx->d()->engine->v8Engine->fromVariant(
+ return scope.engine->fromVariant(
modelData->value(modelData->type->propertyRoles.at(propertyId)));
}
return QV4::Encode::undefined();
@@ -357,20 +358,20 @@ QV4::ReturnedValue QQmlDMCachedModelData::get_property(QV4::CallContext *ctx, ui
QV4::ReturnedValue QQmlDMCachedModelData::set_property(QV4::CallContext *ctx, uint propertyId)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->d()->callData->thisObject.as<QQmlDelegateModelItemObject>());
+ QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->thisObject().as<QQmlDelegateModelItemObject>());
if (!o)
- return ctx->throwTypeError(QStringLiteral("Not a valid VisualData object"));
- if (!ctx->d()->callData->argc)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError(QStringLiteral("Not a valid VisualData object"));
+ if (!ctx->argc())
+ return ctx->engine()->throwTypeError();
if (o->d()->item->index == -1) {
QQmlDMCachedModelData *modelData = static_cast<QQmlDMCachedModelData *>(o->d()->item);
if (!modelData->cachedData.isEmpty()) {
if (modelData->cachedData.count() > 1) {
- modelData->cachedData[propertyId] = scope.engine->v8Engine->toVariant(ctx->d()->callData->args[0], QVariant::Invalid);
+ modelData->cachedData[propertyId] = scope.engine->toVariant(ctx->args()[0], QVariant::Invalid);
QMetaObject::activate(o->d()->item, o->d()->item->metaObject(), propertyId, 0);
} else if (modelData->cachedData.count() == 1) {
- modelData->cachedData[0] = scope.engine->v8Engine->toVariant(ctx->d()->callData->args[0], QVariant::Invalid);
+ modelData->cachedData[0] = scope.engine->toVariant(ctx->args()[0], QVariant::Invalid);
QMetaObject::activate(o->d()->item, o->d()->item->metaObject(), 0, 0);
QMetaObject::activate(o->d()->item, o->d()->item->metaObject(), 1, 0);
}
@@ -420,13 +421,13 @@ public:
QV4::ReturnedValue get()
{
if (type->prototype.isUndefined()) {
- QQmlAdaptorModelEngineData * const data = engineData(v4->v8Engine);
+ QQmlAdaptorModelEngineData * const data = engineData(v4);
type->initializeConstructor(data);
}
QV4::Scope scope(v4);
QV4::ScopedObject proto(scope, type->prototype.value());
QV4::ScopedObject o(scope, proto->engine()->memoryManager->alloc<QQmlDelegateModelItemObject>(proto->engine(), this));
- o->setPrototype(proto.getPointer());
+ o->setPrototype(proto);
++scriptRef;
return o.asReturnedValue();
}
@@ -526,7 +527,7 @@ public:
const QByteArray propertyType = QByteArrayLiteral("QVariant");
const QHash<int, QByteArray> names = model.aim()->roleNames();
- for (QHash<int, QByteArray>::const_iterator it = names.begin(); it != names.end(); ++it) {
+ for (QHash<int, QByteArray>::const_iterator it = names.begin(), cend = names.end(); it != cend; ++it) {
const int propertyId = propertyRoles.count();
propertyRoles.append(it.key());
roleNames.insert(it.value(), it.key());
@@ -579,33 +580,33 @@ public:
static QV4::ReturnedValue get_modelData(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->d()->callData->thisObject.as<QQmlDelegateModelItemObject>());
+ QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->thisObject().as<QQmlDelegateModelItemObject>());
if (!o)
- return ctx->throwTypeError(QStringLiteral("Not a valid VisualData object"));
+ return ctx->engine()->throwTypeError(QStringLiteral("Not a valid VisualData object"));
- return scope.engine->v8Engine->fromVariant(static_cast<QQmlDMListAccessorData *>(o->d()->item)->cachedData);
+ return scope.engine->fromVariant(static_cast<QQmlDMListAccessorData *>(o->d()->item)->cachedData);
}
static QV4::ReturnedValue set_modelData(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->d()->callData->thisObject.as<QQmlDelegateModelItemObject>());
+ QV4::Scoped<QQmlDelegateModelItemObject> o(scope, ctx->thisObject().as<QQmlDelegateModelItemObject>());
if (!o)
- return ctx->throwTypeError(QStringLiteral("Not a valid VisualData object"));
- if (!ctx->d()->callData->argc)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError(QStringLiteral("Not a valid VisualData object"));
+ if (!ctx->argc())
+ return ctx->engine()->throwTypeError();
- static_cast<QQmlDMListAccessorData *>(o->d()->item)->setModelData(scope.engine->v8Engine->toVariant(ctx->d()->callData->args[0], QVariant::Invalid));
+ static_cast<QQmlDMListAccessorData *>(o->d()->item)->setModelData(scope.engine->toVariant(ctx->args()[0], QVariant::Invalid));
return QV4::Encode::undefined();
}
QV4::ReturnedValue get()
{
- QQmlAdaptorModelEngineData *data = engineData(v4->v8Engine);
+ QQmlAdaptorModelEngineData *data = engineData(v4);
QV4::Scope scope(v4);
QV4::ScopedObject o(scope, v4->memoryManager->alloc<QQmlDelegateModelItemObject>(v4, this));
QV4::ScopedObject p(scope, data->listItemProto.value());
- o->setPrototype(p.getPointer());
+ o->setPrototype(p);
++scriptRef;
return o.asReturnedValue();
}
@@ -954,15 +955,15 @@ void QQmlAdaptorModel::objectDestroyed(QObject *)
setModel(QVariant(), 0, 0);
}
-QQmlAdaptorModelEngineData::QQmlAdaptorModelEngineData(QV8Engine *e)
- : v4(QV8Engine::getV4(e))
+QQmlAdaptorModelEngineData::QQmlAdaptorModelEngineData(QV4::ExecutionEngine *v4)
+ : v4(v4)
{
QV4::Scope scope(v4);
- QV4::Scoped<QV4::Object> proto(scope, v4->newObject());
+ QV4::ScopedObject proto(scope, v4->newObject());
proto->defineAccessorProperty(QStringLiteral("index"), get_index, 0);
proto->defineAccessorProperty(QStringLiteral("modelData"),
QQmlDMListAccessorData::get_modelData, QQmlDMListAccessorData::set_modelData);
- listItemProto = proto;
+ listItemProto.set(v4, proto);
}
QQmlAdaptorModelEngineData::~QQmlAdaptorModelEngineData()
diff --git a/src/qml/util/qqmladaptormodel_p.h b/src/qml/util/qqmladaptormodel_p.h
index 14e721ddc8..b0f211a0f2 100644
--- a/src/qml/util/qqmladaptormodel_p.h
+++ b/src/qml/util/qqmladaptormodel_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/util/qqmlchangeset.cpp b/src/qml/util/qqmlchangeset.cpp
index 359c134397..58091c61b3 100644
--- a/src/qml/util/qqmlchangeset.cpp
+++ b/src/qml/util/qqmlchangeset.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/util/qqmlchangeset_p.h b/src/qml/util/qqmlchangeset_p.h
index 5a373506ce..28077b4e23 100644
--- a/src/qml/util/qqmlchangeset_p.h
+++ b/src/qml/util/qqmlchangeset_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/util/qqmllistaccessor.cpp b/src/qml/util/qqmllistaccessor.cpp
index 5a199abf44..bebab80d28 100644
--- a/src/qml/util/qqmllistaccessor.cpp
+++ b/src/qml/util/qqmllistaccessor.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -96,7 +96,7 @@ int QQmlListAccessor::count() const
case VariantList:
return qvariant_cast<QVariantList>(d).count();
case ListProperty:
- return ((QQmlListReference *)d.constData())->count();
+ return ((const QQmlListReference *)d.constData())->count();
case Instance:
return 1;
case Integer:
@@ -116,7 +116,7 @@ QVariant QQmlListAccessor::at(int idx) const
case VariantList:
return qvariant_cast<QVariantList>(d).at(idx);
case ListProperty:
- return QVariant::fromValue(((QQmlListReference *)d.constData())->at(idx));
+ return QVariant::fromValue(((const QQmlListReference *)d.constData())->at(idx));
case Instance:
return d;
case Integer:
diff --git a/src/qml/util/qqmllistaccessor_p.h b/src/qml/util/qqmllistaccessor_p.h
index 1760660f49..cf0ec52be4 100644
--- a/src/qml/util/qqmllistaccessor_p.h
+++ b/src/qml/util/qqmllistaccessor_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/util/qqmllistcompositor.cpp b/src/qml/util/qqmllistcompositor.cpp
index 1f161da8bb..1d8a60a583 100644
--- a/src/qml/util/qqmllistcompositor.cpp
+++ b/src/qml/util/qqmllistcompositor.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/util/qqmllistcompositor_p.h b/src/qml/util/qqmllistcompositor_p.h
index 5dcce690c1..8e10cb1546 100644
--- a/src/qml/util/qqmllistcompositor_p.h
+++ b/src/qml/util/qqmllistcompositor_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/util/qqmlpropertymap.cpp b/src/qml/util/qqmlpropertymap.cpp
index 2fd737bd7d..2e95ab7cb5 100644
--- a/src/qml/util/qqmlpropertymap.cpp
+++ b/src/qml/util/qqmlpropertymap.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qml/util/qqmlpropertymap.h b/src/qml/util/qqmlpropertymap.h
index 9313b2c9f8..685f771452 100644
--- a/src/qml/util/qqmlpropertymap.h
+++ b/src/qml/util/qqmlpropertymap.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qmldevtools/qmldevtools.pro b/src/qmldevtools/qmldevtools.pro
index 5af5443df7..df1b750282 100644
--- a/src/qmldevtools/qmldevtools.pro
+++ b/src/qmldevtools/qmldevtools.pro
@@ -1,14 +1,11 @@
option(host_build)
TARGET = QtQmlDevTools
QT = core
-CONFIG += static no_module_headers internal_module qmldevtools_build
+CONFIG += static internal_module qmldevtools_build
-MODULE_INCLUDES = \
- \$\$QT_MODULE_INCLUDE_BASE \
- \$\$QT_MODULE_INCLUDE_BASE/QtQml
-MODULE_PRIVATE_INCLUDES = \
- \$\$QT_MODULE_INCLUDE_BASE/QtQml/$$QT.qml.VERSION \
- \$\$QT_MODULE_INCLUDE_BASE/QtQml/$$QT.qml.VERSION/QtQml
+# Don't use pch because the auto-generated header refers to QtBootstrap,
+# which doesn't exist
+CONFIG -= precompile_header
# 2415: variable "xx" of static storage duration was declared but never referenced
# unused variable 'xx' [-Werror,-Wunused-const-variable]
@@ -22,4 +19,3 @@ include(../3rdparty/masm/masm-defs.pri)
include(../qml/parser/parser.pri)
include(../qml/jsruntime/jsruntime.pri)
include(../qml/compiler/compiler.pri)
-include(../qml/qml/qml.pri)
diff --git a/src/qmldevtools/qtqmldevtoolsglobal_p.h b/src/qmldevtools/qtqmldevtoolsglobal_p.h
new file mode 100644
index 0000000000..fa8731deb6
--- /dev/null
+++ b/src/qmldevtools/qtqmldevtoolsglobal_p.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTQMLGLOBAL_P_H
+#define QTQMLGLOBAL_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+#ifndef QT_STATIC
+# if defined(QT_BUILD_QML_LIB)
+# define Q_QML_EXPORT Q_DECL_EXPORT
+# else
+# define Q_QML_EXPORT Q_DECL_IMPORT
+# endif
+#else
+# define Q_QML_EXPORT
+#endif
+
+#if defined(QT_BUILD_QMLDEVTOOLS_LIB) || defined(QT_QMLDEVTOOLS_LIB)
+# define Q_QML_PRIVATE_EXPORT
+#else
+# define Q_QML_PRIVATE_EXPORT Q_QML_EXPORT
+#endif
+
+QT_END_NAMESPACE
+#endif // QTQMLGLOBAL_P_H
diff --git a/src/qmltest/qmltest.pro b/src/qmltest/qmltest.pro
index 04588f110c..24b87588b8 100644
--- a/src/qmltest/qmltest.pro
+++ b/src/qmltest/qmltest.pro
@@ -5,8 +5,8 @@ QT = core
QT_PRIVATE = testlib-private quick qml-private gui core-private
# Testlib is only a private dependency, which results in our users not
-# inheriting CONFIG+=console transitively. Make it explicit.
-MODULE_CONFIG = console
+# inheriting testlibs's MODULE_CONFIG transitively. Make it explicit.
+MODULE_CONFIG += $${QT.testlib.CONFIG}
qtHaveModule(widgets) {
QT += widgets
diff --git a/src/qmltest/qtestoptions_p.h b/src/qmltest/qtestoptions_p.h
index 76b8ceefb1..af6764f98b 100644
--- a/src/qmltest/qtestoptions_p.h
+++ b/src/qmltest/qtestoptions_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtTest module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp
index 74732ee3c2..5e9712d202 100644
--- a/src/qmltest/quicktest.cpp
+++ b/src/qmltest/quicktest.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -215,9 +215,11 @@ int quick_test_main(int argc, char **argv, const char *name, const char *sourceD
// Look for QML-specific command-line options.
// -import dir Specify an import directory.
+ // -plugins dir Specify a directory where to search for plugins.
// -input dir Specify the input directory for test cases.
// -translation file Specify the translation file.
QStringList imports;
+ QStringList pluginPaths;
QString testPath;
QString translationFile;
int index = 1;
@@ -228,6 +230,9 @@ int quick_test_main(int argc, char **argv, const char *name, const char *sourceD
if (strcmp(argv[index], "-import") == 0 && (index + 1) < argc) {
imports += stripQuotes(QString::fromLocal8Bit(argv[index + 1]));
index += 2;
+ } else if (strcmp(argv[index], "-plugins") == 0 && (index + 1) < argc) {
+ pluginPaths += stripQuotes(QString::fromLocal8Bit(argv[index + 1]));
+ index += 2;
} else if (strcmp(argv[index], "-input") == 0 && (index + 1) < argc) {
testPath = stripQuotes(QString::fromLocal8Bit(argv[index + 1]));
index += 2;
@@ -327,6 +332,8 @@ int quick_test_main(int argc, char **argv, const char *name, const char *sourceD
(QLatin1String("qtest"), QTestRootObject::instance()); // Deprecated. Use QTestRootObject from Qt.test.qtestroot instead
foreach (const QString &path, imports)
view->engine()->addImportPath(path);
+ foreach (const QString &path, pluginPaths)
+ view->engine()->addPluginPath(path);
foreach (const QString &file, files) {
const QFileInfo fi(file);
if (!fi.exists())
diff --git a/src/qmltest/quicktest.h b/src/qmltest/quicktest.h
index aa34e0f19a..49bd7edfaa 100644
--- a/src/qmltest/quicktest.h
+++ b/src/qmltest/quicktest.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qmltest/quicktestevent.cpp b/src/qmltest/quicktestevent.cpp
index 907d2c0673..df8de14c14 100644
--- a/src/qmltest/quicktestevent.cpp
+++ b/src/qmltest/quicktestevent.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -111,7 +111,7 @@ namespace QTest {
namespace QtQuickTest
{
- enum MouseAction { MousePress, MouseRelease, MouseClick, MouseDoubleClick, MouseMove };
+ enum MouseAction { MousePress, MouseRelease, MouseClick, MouseDoubleClick, MouseMove, MouseDoubleClickSequence };
static void mouseEvent(MouseAction action, QWindow *window,
QObject *item, Qt::MouseButton button,
@@ -131,6 +131,15 @@ namespace QtQuickTest
return;
}
+ if (action == MouseDoubleClickSequence) {
+ mouseEvent(MousePress, window, item, button, stateKey, _pos);
+ mouseEvent(MouseRelease, window, item, button, stateKey, _pos);
+ mouseEvent(MousePress, window, item, button, stateKey, _pos);
+ mouseEvent(MouseDoubleClick, window, item, button, stateKey, _pos);
+ mouseEvent(MouseRelease, window, item, button, stateKey, _pos);
+ return;
+ }
+
QPoint pos;
QQuickItem *sgitem = qobject_cast<QQuickItem *>(item);
if (sgitem)
@@ -162,7 +171,7 @@ namespace QtQuickTest
QSpontaneKeyEvent::setSpontaneous(&me);
if (!qApp->notify(window, &me)) {
static const char *mouseActionNames[] =
- { "MousePress", "MouseRelease", "MouseClick", "MouseDoubleClick", "MouseMove" };
+ { "MousePress", "MouseRelease", "MouseClick", "MouseDoubleClick", "MouseMove", "MouseDoubleClickSequence" };
QString warning = QString::fromLatin1("Mouse event \"%1\" not accepted by receiving window");
QWARN(warning.arg(QString::fromLatin1(mouseActionNames[static_cast<int>(action)])).toLatin1().data());
}
@@ -269,6 +278,20 @@ bool QuickTestEvent::mouseDoubleClick
return true;
}
+bool QuickTestEvent::mouseDoubleClickSequence
+ (QObject *item, qreal x, qreal y, int button,
+ int modifiers, int delay)
+{
+ QWindow *view = eventWindow();
+ if (!view)
+ return false;
+ QtQuickTest::mouseEvent(QtQuickTest::MouseDoubleClickSequence, view, item,
+ Qt::MouseButton(button),
+ Qt::KeyboardModifiers(modifiers),
+ QPointF(x, y), delay);
+ return true;
+}
+
bool QuickTestEvent::mouseMove
(QObject *item, qreal x, qreal y, int delay, int buttons)
{
diff --git a/src/qmltest/quicktestevent_p.h b/src/qmltest/quicktestevent_p.h
index 5176019d01..b7f8f3eda2 100644
--- a/src/qmltest/quicktestevent_p.h
+++ b/src/qmltest/quicktestevent_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -63,6 +63,8 @@ public Q_SLOTS:
int modifiers, int delay);
bool mouseDoubleClick(QObject *item, qreal x, qreal y, int button,
int modifiers, int delay);
+ bool mouseDoubleClickSequence(QObject *item, qreal x, qreal y, int button,
+ int modifiers, int delay);
bool mouseMove(QObject *item, qreal x, qreal y, int delay, int buttons);
#ifndef QT_NO_WHEELEVENT
diff --git a/src/qmltest/quicktestglobal.h b/src/qmltest/quicktestglobal.h
index 300280ef58..15da6b93fa 100644
--- a/src/qmltest/quicktestglobal.h
+++ b/src/qmltest/quicktestglobal.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/qmltest/quicktestresult.cpp b/src/qmltest/quicktestresult.cpp
index 868a378318..3f91ce85a8 100644
--- a/src/qmltest/quicktestresult.cpp
+++ b/src/qmltest/quicktestresult.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -475,13 +475,12 @@ void QuickTestResult::stringify(QQmlV4Function *args)
QV4::ScopedValue value(scope, (*args)[0]);
QString result;
- QV8Engine *engine = args->engine();
//Check for Object Type
if (value->isObject()
&& !value->asFunctionObject()
&& !value->asArrayObject()) {
- QVariant v = engine->toVariant(value, QMetaType::UnknownType);
+ QVariant v = scope.engine->toVariant(value, QMetaType::UnknownType);
if (v.isValid()) {
switch (v.type()) {
case QVariant::Vector3D:
@@ -497,7 +496,9 @@ void QuickTestResult::stringify(QQmlV4Function *args)
} else {
result = QLatin1String("Object");
}
- } else {
+ }
+
+ if (result.isEmpty()) {
QString tmp = value->toQStringNoThrow();
if (value->asArrayObject())
result.append(QString::fromLatin1("[%1]").arg(tmp));
@@ -505,7 +506,7 @@ void QuickTestResult::stringify(QQmlV4Function *args)
result.append(tmp);
}
- args->setReturnValue(args->engine()->toString(result));
+ args->setReturnValue(QV4::Encode(args->v4engine()->newString(result)));
}
bool QuickTestResult::compare
diff --git a/src/qmltest/quicktestresult_p.h b/src/qmltest/quicktestresult_p.h
index 0da29e8bd4..80f84bfa55 100644
--- a/src/qmltest/quicktestresult_p.h
+++ b/src/qmltest/quicktestresult_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/accessible/accessible.pri b/src/quick/accessible/accessible.pri
index 88ff747488..bff1325bd9 100644
--- a/src/quick/accessible/accessible.pri
+++ b/src/quick/accessible/accessible.pri
@@ -4,13 +4,11 @@ QT += core-private gui-private qml-private
#DEFINES+=Q_ACCESSIBLE_QUICK_ITEM_ENABLE_DEBUG_DESCRIPTION
SOURCES += \
- $$PWD/qqmlaccessible.cpp \
$$PWD/qaccessiblequickview.cpp \
$$PWD/qaccessiblequickitem.cpp \
$$PWD/qquickaccessiblefactory.cpp \
HEADERS += \
- $$PWD/qqmlaccessible_p.h \
$$PWD/qaccessiblequickview_p.h \
$$PWD/qaccessiblequickitem_p.h \
$$PWD/qquickaccessiblefactory_p.h \
diff --git a/src/quick/accessible/qaccessiblequickitem.cpp b/src/quick/accessible/qaccessiblequickitem.cpp
index e13224f6fb..4ccfdb9142 100644
--- a/src/quick/accessible/qaccessiblequickitem.cpp
+++ b/src/quick/accessible/qaccessiblequickitem.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_ACCESSIBILITY
QAccessibleQuickItem::QAccessibleQuickItem(QQuickItem *item)
- : QQmlAccessible(item), m_doc(textDocument())
+ : QAccessibleObject(item), m_doc(textDocument())
{
}
@@ -178,16 +178,22 @@ QAccessible::State QAccessibleQuickItem::state() const
if (!attached)
return QAccessible::State();
- QAccessible::State st = attached->state();
+ QAccessible::State state = attached->state();
- if (!item()->window() || !item()->window()->isVisible() ||!item()->isVisible() || qFuzzyIsNull(item()->opacity()))
- st.invisible = true;
+ QRect viewRect_ = viewRect();
+ QRect itemRect = rect();
- if (item()->activeFocusOnTab())
- st.focusable = true;
+ if (viewRect_.isNull() || itemRect.isNull() || !item()->window() || !item()->window()->isVisible() ||!item()->isVisible() || qFuzzyIsNull(item()->opacity()))
+ state.invisible = true;
+ if (!viewRect_.intersects(itemRect))
+ state.offscreen = true;
+ if ((role() == QAccessible::CheckBox || role() == QAccessible::RadioButton) && object()->property("checked").toBool())
+ state.checked = true;
+ if (item()->activeFocusOnTab() || role() == QAccessible::EditableText)
+ state.focusable = true;
if (item()->hasActiveFocus())
- st.focused = true;
- return st;
+ state.focused = true;
+ return state;
}
QAccessible::Role QAccessibleQuickItem::role() const
@@ -213,11 +219,29 @@ bool QAccessibleQuickItem::isAccessible() const
QStringList QAccessibleQuickItem::actionNames() const
{
- QStringList actions = QQmlAccessible::actionNames();
+ QStringList actions;
+ switch (role()) {
+ case QAccessible::PushButton:
+ actions << QAccessibleActionInterface::pressAction();
+ break;
+ case QAccessible::RadioButton:
+ case QAccessible::CheckBox:
+ actions << QAccessibleActionInterface::toggleAction()
+ << QAccessibleActionInterface::pressAction();
+ break;
+ case QAccessible::Slider:
+ case QAccessible::SpinBox:
+ case QAccessible::ScrollBar:
+ actions << QAccessibleActionInterface::increaseAction()
+ << QAccessibleActionInterface::decreaseAction();
+ break;
+ default:
+ break;
+ }
if (state().focusable)
actions.append(QAccessibleActionInterface::setFocusAction());
- // ### The following can lead to duplicate action names. We'll fix that when we kill QQmlAccessible
+ // ### The following can lead to duplicate action names.
if (QQuickAccessibleAttached *attached = QQuickAccessibleAttached::attachedProperties(item()))
attached->availableActions(&actions);
return actions;
@@ -232,13 +256,80 @@ void QAccessibleQuickItem::doAction(const QString &actionName)
}
if (QQuickAccessibleAttached *attached = QQuickAccessibleAttached::attachedProperties(item()))
accepted = attached->doAction(actionName);
- if (!accepted)
- QQmlAccessible::doAction(actionName);
+
+ if (accepted)
+ return;
+ // Look for and call the accessible[actionName]Action() function on the item.
+ // This allows for overriding the default action handling.
+ const QByteArray functionName = QByteArrayLiteral("accessible") + actionName.toLatin1() + QByteArrayLiteral("Action");
+ if (object()->metaObject()->indexOfMethod(QByteArray(functionName + QByteArrayLiteral("()"))) != -1) {
+ QMetaObject::invokeMethod(object(), functionName);
+ return;
+ }
+
+ // Role-specific default action handling follows. Items are expected to provide
+ // properties according to role conventions. These will then be read and/or updated
+ // by the accessibility system.
+ // Checkable roles : checked
+ // Value-based roles : (via the value interface: value, minimumValue, maximumValue), stepSize
+ switch (role()) {
+ case QAccessible::RadioButton:
+ case QAccessible::CheckBox: {
+ QVariant checked = object()->property("checked");
+ if (checked.isValid()) {
+ if (actionName == QAccessibleActionInterface::toggleAction() ||
+ actionName == QAccessibleActionInterface::pressAction()) {
+
+ object()->setProperty("checked", QVariant(!checked.toBool()));
+ }
+ }
+ break;
+ }
+ case QAccessible::Slider:
+ case QAccessible::SpinBox:
+ case QAccessible::Dial:
+ case QAccessible::ScrollBar: {
+ if (actionName != QAccessibleActionInterface::increaseAction() &&
+ actionName != QAccessibleActionInterface::decreaseAction())
+ break;
+
+ // Update the value using QAccessibleValueInterface, respecting
+ // the minimum and maximum value (if set). Also check for and
+ // use the "stepSize" property on the item
+ if (QAccessibleValueInterface *valueIface = valueInterface()) {
+ QVariant valueV = valueIface->currentValue();
+ qreal newValue = valueV.toReal();
+
+ QVariant stepSizeV = object()->property("stepSize");
+ qreal stepSize = stepSizeV.isValid() ? stepSizeV.toReal() : qreal(1.0);
+ if (actionName == QAccessibleActionInterface::increaseAction()) {
+ newValue += stepSize;
+ } else {
+ newValue -= stepSize;
+ }
+
+ QVariant minimumValueV = valueIface->minimumValue();
+ if (minimumValueV.isValid()) {
+ newValue = qMax(newValue, minimumValueV.toReal());
+ }
+ QVariant maximumValueV = valueIface->maximumValue();
+ if (maximumValueV.isValid()) {
+ newValue = qMin(newValue, maximumValueV.toReal());
+ }
+
+ valueIface->setCurrentValue(QVariant(newValue));
+ }
+ break;
+ }
+ default:
+ break;
+ }
}
QStringList QAccessibleQuickItem::keyBindingsForAction(const QString &actionName) const
{
- return QQmlAccessible::keyBindingsForAction(actionName);
+ Q_UNUSED(actionName)
+ return QStringList();
}
QString QAccessibleQuickItem::text(QAccessible::Text textType) const
@@ -287,6 +378,8 @@ QString QAccessibleQuickItem::text(QAccessible::Text textType) const
void *QAccessibleQuickItem::interface_cast(QAccessible::InterfaceType t)
{
QAccessible::Role r = role();
+ if (t == QAccessible::ActionInterface)
+ return static_cast<QAccessibleActionInterface*>(this);
if (t == QAccessible::ValueInterface &&
(r == QAccessible::Slider ||
r == QAccessible::SpinBox ||
@@ -298,7 +391,7 @@ void *QAccessibleQuickItem::interface_cast(QAccessible::InterfaceType t)
(r == QAccessible::EditableText))
return static_cast<QAccessibleTextInterface*>(this);
- return QQmlAccessible::interface_cast(t);
+ return QAccessibleObject::interface_cast(t);
}
QVariant QAccessibleQuickItem::currentValue() const
diff --git a/src/quick/accessible/qaccessiblequickitem_p.h b/src/quick/accessible/qaccessiblequickitem_p.h
index e8486721f3..deefb10e60 100644
--- a/src/quick/accessible/qaccessiblequickitem_p.h
+++ b/src/quick/accessible/qaccessiblequickitem_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -36,7 +36,7 @@
#include <QtQuick/QQuickItem>
#include <QtQuick/QQuickView>
-#include <QtQuick/private/qqmlaccessible_p.h>
+#include <QtGui/qaccessibleobject.h>
QT_BEGIN_NAMESPACE
@@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE
class QTextDocument;
-class QAccessibleQuickItem : public QQmlAccessible, public QAccessibleValueInterface, public QAccessibleTextInterface
+class QAccessibleQuickItem : public QAccessibleObject, public QAccessibleActionInterface, public QAccessibleValueInterface, public QAccessibleTextInterface
{
public:
QAccessibleQuickItem(QQuickItem *item);
diff --git a/src/quick/accessible/qaccessiblequickview.cpp b/src/quick/accessible/qaccessiblequickview.cpp
index e3ee1d2722..db37173cb0 100644
--- a/src/quick/accessible/qaccessiblequickview.cpp
+++ b/src/quick/accessible/qaccessiblequickview.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -39,7 +39,6 @@
#include <QtQuick/private/qquickitem_p.h>
#include "qaccessiblequickitem_p.h"
-#include "qqmlaccessible_p.h"
#ifndef QT_NO_ACCESSIBILITY
diff --git a/src/quick/accessible/qaccessiblequickview_p.h b/src/quick/accessible/qaccessiblequickview_p.h
index f6da6ba25d..f08b78528d 100644
--- a/src/quick/accessible/qaccessiblequickview_p.h
+++ b/src/quick/accessible/qaccessiblequickview_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/accessible/qqmlaccessible.cpp b/src/quick/accessible/qqmlaccessible.cpp
deleted file mode 100644
index 53eb6a7a0d..0000000000
--- a/src/quick/accessible/qqmlaccessible.cpp
+++ /dev/null
@@ -1,195 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qnamespace.h>
-#include "qqmlaccessible_p.h"
-
-#ifndef QT_NO_ACCESSIBILITY
-
-QT_BEGIN_NAMESPACE
-
-QQmlAccessible::QQmlAccessible(QObject *object)
- :QAccessibleObject(object)
-{
-}
-
-void *QQmlAccessible::interface_cast(QAccessible::InterfaceType t)
-{
- if (t == QAccessible::ActionInterface)
- return static_cast<QAccessibleActionInterface*>(this);
- return QAccessibleObject::interface_cast(t);
-}
-
-QQmlAccessible::~QQmlAccessible()
-{
-}
-
-QAccessible::State QQmlAccessible::state() const
-{
- QAccessible::State state;
-
- //QRect viewRect(QPoint(0, 0), m_implementation->size());
- //QRect itemRect(m_item->scenePos().toPoint(), m_item->boundingRect().size().toSize());
-
- QRect viewRect_ = viewRect();
- QRect itemRect = rect();
-
- // qDebug() << "viewRect" << viewRect << "itemRect" << itemRect;
- // error case:
- if (viewRect_.isNull() || itemRect.isNull()) {
- state.invisible = true;
- }
-
- if (!viewRect_.intersects(itemRect)) {
- state.offscreen = true;
- // state.invisible = true; // no set at this point to ease development
- }
-
- if (!object()->property("visible").toBool() || qFuzzyIsNull(object()->property("opacity").toDouble())) {
- state.invisible = true;
- }
-
- if ((role() == QAccessible::CheckBox || role() == QAccessible::RadioButton) && object()->property("checked").toBool()) {
- state.checked = true;
- }
-
- if (role() == QAccessible::EditableText)
- state.focusable = true;
-
- //qDebug() << "state?" << m_item->property("state").toString() << m_item->property("status").toString() << m_item->property("visible").toString();
-
- return state;
-}
-
-QStringList QQmlAccessible::actionNames() const
-{
- QStringList actions;
- switch (role()) {
- case QAccessible::PushButton:
- actions << QAccessibleActionInterface::pressAction();
- break;
- case QAccessible::RadioButton:
- case QAccessible::CheckBox:
- actions << QAccessibleActionInterface::toggleAction()
- << QAccessibleActionInterface::pressAction();
- break;
- case QAccessible::Slider:
- case QAccessible::SpinBox:
- case QAccessible::ScrollBar:
- actions << QAccessibleActionInterface::increaseAction()
- << QAccessibleActionInterface::decreaseAction();
- break;
- default:
- break;
- }
- return actions;
-}
-
-void QQmlAccessible::doAction(const QString &actionName)
-{
- // Look for and call the accessible[actionName]Action() function on the item.
- // This allows for overriding the default action handling.
- const QByteArray functionName = QByteArrayLiteral("accessible") + actionName.toLatin1() + QByteArrayLiteral("Action");
- if (object()->metaObject()->indexOfMethod(QByteArray(functionName + QByteArrayLiteral("()"))) != -1) {
- QMetaObject::invokeMethod(object(), functionName);
- return;
- }
-
- // Role-specific default action handling follows. Items are expected to provide
- // properties according to role conventions. These will then be read and/or updated
- // by the accessibility system.
- // Checkable roles : checked
- // Value-based roles : (via the value interface: value, minimumValue, maximumValue), stepSize
- switch (role()) {
- case QAccessible::RadioButton:
- case QAccessible::CheckBox: {
- QVariant checked = object()->property("checked");
- if (checked.isValid()) {
- if (actionName == QAccessibleActionInterface::toggleAction() ||
- actionName == QAccessibleActionInterface::pressAction()) {
-
- object()->setProperty("checked", QVariant(!checked.toBool()));
- }
- }
- break;
- }
- case QAccessible::Slider:
- case QAccessible::SpinBox:
- case QAccessible::Dial:
- case QAccessible::ScrollBar: {
- if (actionName != QAccessibleActionInterface::increaseAction() &&
- actionName != QAccessibleActionInterface::decreaseAction())
- break;
-
- // Update the value using QAccessibleValueInterface, respecting
- // the minimum and maximum value (if set). Also check for and
- // use the "stepSize" property on the item
- if (QAccessibleValueInterface *valueIface = valueInterface()) {
- QVariant valueV = valueIface->currentValue();
- qreal newValue = valueV.toReal();
-
- QVariant stepSizeV = object()->property("stepSize");
- qreal stepSize = stepSizeV.isValid() ? stepSizeV.toReal() : qreal(1.0);
- if (actionName == QAccessibleActionInterface::increaseAction()) {
- newValue += stepSize;
- } else {
- newValue -= stepSize;
- }
-
- QVariant minimumValueV = valueIface->minimumValue();
- if (minimumValueV.isValid()) {
- newValue = qMax(newValue, minimumValueV.toReal());
- }
- QVariant maximumValueV = valueIface->maximumValue();
- if (maximumValueV.isValid()) {
- newValue = qMin(newValue, maximumValueV.toReal());
- }
-
- valueIface->setCurrentValue(QVariant(newValue));
- }
- break;
- }
- default:
- break;
- }
-}
-
-QStringList QQmlAccessible::keyBindingsForAction(const QString &actionName) const
-{
- Q_UNUSED(actionName)
- return QStringList();
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_ACCESSIBILITY
diff --git a/src/quick/accessible/qqmlaccessible_p.h b/src/quick/accessible/qqmlaccessible_p.h
deleted file mode 100644
index 5948f06cb5..0000000000
--- a/src/quick/accessible/qqmlaccessible_p.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQMLACCESSIBLE_H
-#define QQMLACCESSIBLE_H
-
-#include <QtGui/qaccessibleobject.h>
-#include <QtQml/qqmlproperty.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_ACCESSIBILITY
-
-/*
- -- Declarative Accessibility Overview. --
-
- * Item interface classes:
- QAccessibleDeclarativeItem for Qt Quick 1
- QAccessibleQuickItem for for Qt Quick 2
- Common base class: QQmlAccessible
-
- * View interface classes.
-
- These are the root of the QML accessible tree and connects it to the widget hierarchy.
-
- QAccessbileDeclarativeView is the root for the QGraphicsView implementation
- QAccessbileQuickView is the root for the SceneGraph implementation
-
-*/
-class QQmlAccessible: public QAccessibleObject, public QAccessibleActionInterface
-{
-public:
- ~QQmlAccessible();
- void *interface_cast(QAccessible::InterfaceType t);
-
- virtual QRect viewRect() const = 0;
- QAccessible::State state() const;
-
- QStringList actionNames() const;
- void doAction(const QString &actionName);
- QStringList keyBindingsForAction(const QString &actionName) const;
-
-protected:
- // For subclasses, use instantiateObject factory method outside the class.
- QQmlAccessible(QObject *object);
-};
-
-#endif // QT_NO_ACCESSIBILITY
-
-QT_END_NAMESPACE
-
-#endif // QQMLACCESSIBLE_H
diff --git a/src/quick/accessible/qquickaccessiblefactory.cpp b/src/quick/accessible/qquickaccessiblefactory.cpp
index 85b9a6d3c0..1dd1e1c706 100644
--- a/src/quick/accessible/qquickaccessiblefactory.cpp
+++ b/src/quick/accessible/qquickaccessiblefactory.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/accessible/qquickaccessiblefactory_p.h b/src/quick/accessible/qquickaccessiblefactory_p.h
index 892dbc2c4f..f7936b140e 100644
--- a/src/quick/accessible/qquickaccessiblefactory_p.h
+++ b/src/quick/accessible/qquickaccessiblefactory_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/designer/designersupport.cpp b/src/quick/designer/designersupport.cpp
index c31fd2daeb..56d2badb62 100644
--- a/src/quick/designer/designersupport.cpp
+++ b/src/quick/designer/designersupport.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -57,9 +57,9 @@ DesignerSupport::DesignerSupport()
DesignerSupport::~DesignerSupport()
{
- QHash<QQuickItem*, QSGLayer*>::iterator iterator;
+ typedef QHash<QQuickItem*, QSGLayer*>::iterator ItemTextureHashIt;
- for (iterator = m_itemTextureHash.begin(); iterator != m_itemTextureHash.end(); ++iterator) {
+ for (ItemTextureHashIt iterator = m_itemTextureHash.begin(), end = m_itemTextureHash.end(); iterator != end; ++iterator) {
QSGLayer *texture = iterator.value();
QQuickItem *item = iterator.key();
QQuickItemPrivate::get(item)->derefFromEffectItem(true);
diff --git a/src/quick/designer/designersupport.h b/src/quick/designer/designersupport.h
index 59f0cf288e..51fcef4512 100644
--- a/src/quick/designer/designersupport.h
+++ b/src/quick/designer/designersupport.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/designer/designerwindowmanager.cpp b/src/quick/designer/designerwindowmanager.cpp
index 340728be4c..f37d6a2180 100644
--- a/src/quick/designer/designerwindowmanager.cpp
+++ b/src/quick/designer/designerwindowmanager.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/designer/designerwindowmanager_p.h b/src/quick/designer/designerwindowmanager_p.h
index d8870d4194..e7a7314c20 100644
--- a/src/quick/designer/designerwindowmanager_p.h
+++ b/src/quick/designer/designerwindowmanager_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/doc/snippets/qml/anchoranimation.qml b/src/quick/doc/snippets/qml/anchoranimation.qml
index ce3935f8fa..1879ef5b0c 100644
--- a/src/quick/doc/snippets/qml/anchoranimation.qml
+++ b/src/quick/doc/snippets/qml/anchoranimation.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/anchorchanges.qml b/src/quick/doc/snippets/qml/anchorchanges.qml
index 44c05ea9b4..429ebf813f 100644
--- a/src/quick/doc/snippets/qml/anchorchanges.qml
+++ b/src/quick/doc/snippets/qml/anchorchanges.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/animatedimage.qml b/src/quick/doc/snippets/qml/animatedimage.qml
index f6e8d027ea..beb0ca7773 100644
--- a/src/quick/doc/snippets/qml/animatedimage.qml
+++ b/src/quick/doc/snippets/qml/animatedimage.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/animation.qml b/src/quick/doc/snippets/qml/animation.qml
index 9d27ee0033..7d958abefb 100644
--- a/src/quick/doc/snippets/qml/animation.qml
+++ b/src/quick/doc/snippets/qml/animation.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/animators.qml b/src/quick/doc/snippets/qml/animators.qml
index 4b9e4f4250..a2885ae141 100644
--- a/src/quick/doc/snippets/qml/animators.qml
+++ b/src/quick/doc/snippets/qml/animators.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/behavior.qml b/src/quick/doc/snippets/qml/behavior.qml
index 13222d5065..fef83e2701 100644
--- a/src/quick/doc/snippets/qml/behavior.qml
+++ b/src/quick/doc/snippets/qml/behavior.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/borderimage/borderimage-scaled.qml b/src/quick/doc/snippets/qml/borderimage/borderimage-scaled.qml
index 1b01a965fd..b9359b401c 100644
--- a/src/quick/doc/snippets/qml/borderimage/borderimage-scaled.qml
+++ b/src/quick/doc/snippets/qml/borderimage/borderimage-scaled.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/borderimage/borderimage-tiled.qml b/src/quick/doc/snippets/qml/borderimage/borderimage-tiled.qml
index 53a7cc0c7d..d806ed79b4 100644
--- a/src/quick/doc/snippets/qml/borderimage/borderimage-tiled.qml
+++ b/src/quick/doc/snippets/qml/borderimage/borderimage-tiled.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/borderimage/normal-image.qml b/src/quick/doc/snippets/qml/borderimage/normal-image.qml
index 1b2aef9f12..90cff36142 100644
--- a/src/quick/doc/snippets/qml/borderimage/normal-image.qml
+++ b/src/quick/doc/snippets/qml/borderimage/normal-image.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/coloranimation.qml b/src/quick/doc/snippets/qml/coloranimation.qml
index 7075e73d2a..268f2d1427 100644
--- a/src/quick/doc/snippets/qml/coloranimation.qml
+++ b/src/quick/doc/snippets/qml/coloranimation.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/colors.qml b/src/quick/doc/snippets/qml/colors.qml
index 473df711bd..dc1080477d 100644
--- a/src/quick/doc/snippets/qml/colors.qml
+++ b/src/quick/doc/snippets/qml/colors.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/column/column-transitions.qml b/src/quick/doc/snippets/qml/column/column-transitions.qml
index f222ab6002..b20a22696e 100644
--- a/src/quick/doc/snippets/qml/column/column-transitions.qml
+++ b/src/quick/doc/snippets/qml/column/column-transitions.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/column/column.qml b/src/quick/doc/snippets/qml/column/column.qml
index a69b13c32a..e47fdeaa1f 100644
--- a/src/quick/doc/snippets/qml/column/column.qml
+++ b/src/quick/doc/snippets/qml/column/column.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/column/vertical-positioner.qml b/src/quick/doc/snippets/qml/column/vertical-positioner.qml
index c957baeb9c..13a2f86eab 100644
--- a/src/quick/doc/snippets/qml/column/vertical-positioner.qml
+++ b/src/quick/doc/snippets/qml/column/vertical-positioner.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/drag.qml b/src/quick/doc/snippets/qml/drag.qml
index 1a4b3d8a0e..03b71b3b4d 100644
--- a/src/quick/doc/snippets/qml/drag.qml
+++ b/src/quick/doc/snippets/qml/drag.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/flickable.qml b/src/quick/doc/snippets/qml/flickable.qml
index 68d92924d6..2740d0569c 100644
--- a/src/quick/doc/snippets/qml/flickable.qml
+++ b/src/quick/doc/snippets/qml/flickable.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/flickableScrollbar.qml b/src/quick/doc/snippets/qml/flickableScrollbar.qml
index f1d08dec27..6538cc0660 100644
--- a/src/quick/doc/snippets/qml/flickableScrollbar.qml
+++ b/src/quick/doc/snippets/qml/flickableScrollbar.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/flipable/flipable.qml b/src/quick/doc/snippets/qml/flipable/flipable.qml
index be536537e2..a1a9ab0a87 100644
--- a/src/quick/doc/snippets/qml/flipable/flipable.qml
+++ b/src/quick/doc/snippets/qml/flipable/flipable.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/flow.qml b/src/quick/doc/snippets/qml/flow.qml
index d6246ad0c3..c15c860af3 100644
--- a/src/quick/doc/snippets/qml/flow.qml
+++ b/src/quick/doc/snippets/qml/flow.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/focus/MyClickableWidget.qml b/src/quick/doc/snippets/qml/focus/MyClickableWidget.qml
index 1f4c0d4674..5c53f73147 100644
--- a/src/quick/doc/snippets/qml/focus/MyClickableWidget.qml
+++ b/src/quick/doc/snippets/qml/focus/MyClickableWidget.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/focus/MyWidget.qml b/src/quick/doc/snippets/qml/focus/MyWidget.qml
index c91203c3e2..8cf3aed80b 100644
--- a/src/quick/doc/snippets/qml/focus/MyWidget.qml
+++ b/src/quick/doc/snippets/qml/focus/MyWidget.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/focus/advancedFocus.qml b/src/quick/doc/snippets/qml/focus/advancedFocus.qml
index 79258455c0..d7c6146c34 100644
--- a/src/quick/doc/snippets/qml/focus/advancedFocus.qml
+++ b/src/quick/doc/snippets/qml/focus/advancedFocus.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/focus/basicwidget.qml b/src/quick/doc/snippets/qml/focus/basicwidget.qml
index 6ab6c6a5a3..2c35e5bf48 100644
--- a/src/quick/doc/snippets/qml/focus/basicwidget.qml
+++ b/src/quick/doc/snippets/qml/focus/basicwidget.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/focus/clickablewidget.qml b/src/quick/doc/snippets/qml/focus/clickablewidget.qml
index c9137e5ae7..6831d0aaf0 100644
--- a/src/quick/doc/snippets/qml/focus/clickablewidget.qml
+++ b/src/quick/doc/snippets/qml/focus/clickablewidget.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the FOO module of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/focus/myfocusscopewidget.qml b/src/quick/doc/snippets/qml/focus/myfocusscopewidget.qml
index 61b77cd229..e6fe23f7b1 100644
--- a/src/quick/doc/snippets/qml/focus/myfocusscopewidget.qml
+++ b/src/quick/doc/snippets/qml/focus/myfocusscopewidget.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/focus/rectangle.qml b/src/quick/doc/snippets/qml/focus/rectangle.qml
index 2a510d1558..aad7e72306 100644
--- a/src/quick/doc/snippets/qml/focus/rectangle.qml
+++ b/src/quick/doc/snippets/qml/focus/rectangle.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the FOO module of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/focus/widget.qml b/src/quick/doc/snippets/qml/focus/widget.qml
index e9d247bdb0..79d507c751 100644
--- a/src/quick/doc/snippets/qml/focus/widget.qml
+++ b/src/quick/doc/snippets/qml/focus/widget.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/gradient.qml b/src/quick/doc/snippets/qml/gradient.qml
index e01e5de43e..bf71d48551 100644
--- a/src/quick/doc/snippets/qml/gradient.qml
+++ b/src/quick/doc/snippets/qml/gradient.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/grid-spacing.qml b/src/quick/doc/snippets/qml/grid-spacing.qml
index 30a265f4a4..a771cf9b86 100644
--- a/src/quick/doc/snippets/qml/grid-spacing.qml
+++ b/src/quick/doc/snippets/qml/grid-spacing.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/grid/grid.qml b/src/quick/doc/snippets/qml/grid/grid.qml
index 33ff4cf884..eedb554052 100644
--- a/src/quick/doc/snippets/qml/grid/grid.qml
+++ b/src/quick/doc/snippets/qml/grid/grid.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/gridview/ContactModel.qml b/src/quick/doc/snippets/qml/gridview/ContactModel.qml
index 13c78f632e..aeff0bf3dc 100644
--- a/src/quick/doc/snippets/qml/gridview/ContactModel.qml
+++ b/src/quick/doc/snippets/qml/gridview/ContactModel.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/gridview/gridview.qml b/src/quick/doc/snippets/qml/gridview/gridview.qml
index 80d461d470..6faac7f8bc 100644
--- a/src/quick/doc/snippets/qml/gridview/gridview.qml
+++ b/src/quick/doc/snippets/qml/gridview/gridview.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/image.qml b/src/quick/doc/snippets/qml/image.qml
index fb04a406ab..7aa2951480 100644
--- a/src/quick/doc/snippets/qml/image.qml
+++ b/src/quick/doc/snippets/qml/image.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/itemGrab.qml b/src/quick/doc/snippets/qml/itemGrab.qml
index c8ffd30edc..5811147215 100644
--- a/src/quick/doc/snippets/qml/itemGrab.qml
+++ b/src/quick/doc/snippets/qml/itemGrab.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/keynavigation.qml b/src/quick/doc/snippets/qml/keynavigation.qml
index 1b7b98ef32..3e3dcb05f4 100644
--- a/src/quick/doc/snippets/qml/keynavigation.qml
+++ b/src/quick/doc/snippets/qml/keynavigation.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/keys/keys-handler.qml b/src/quick/doc/snippets/qml/keys/keys-handler.qml
index a91d4f90d8..0326471f1f 100644
--- a/src/quick/doc/snippets/qml/keys/keys-handler.qml
+++ b/src/quick/doc/snippets/qml/keys/keys-handler.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/keys/keys-pressed.qml b/src/quick/doc/snippets/qml/keys/keys-pressed.qml
index 903be5ee84..0abc9f0559 100644
--- a/src/quick/doc/snippets/qml/keys/keys-pressed.qml
+++ b/src/quick/doc/snippets/qml/keys/keys-pressed.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/layerblending.qml b/src/quick/doc/snippets/qml/layerblending.qml
index 0ef23465a5..a922f7896c 100644
--- a/src/quick/doc/snippets/qml/layerblending.qml
+++ b/src/quick/doc/snippets/qml/layerblending.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Gunnar Sletta <gunnar@sletta.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/layerwitheffect.qml b/src/quick/doc/snippets/qml/layerwitheffect.qml
index 8cfac0bb19..2ac3e488cc 100644
--- a/src/quick/doc/snippets/qml/layerwitheffect.qml
+++ b/src/quick/doc/snippets/qml/layerwitheffect.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Gunnar Sletta <gunnar@sletta.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/layoutmirroring.qml b/src/quick/doc/snippets/qml/layoutmirroring.qml
index 5ad64aefad..348c2b5213 100644
--- a/src/quick/doc/snippets/qml/layoutmirroring.qml
+++ b/src/quick/doc/snippets/qml/layoutmirroring.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/listview-decorations.qml b/src/quick/doc/snippets/qml/listview-decorations.qml
index 213f81bb59..82f75dc3a4 100644
--- a/src/quick/doc/snippets/qml/listview-decorations.qml
+++ b/src/quick/doc/snippets/qml/listview-decorations.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/listview-sections.qml b/src/quick/doc/snippets/qml/listview-sections.qml
index 39bc2fa5f4..a307531b5a 100644
--- a/src/quick/doc/snippets/qml/listview-sections.qml
+++ b/src/quick/doc/snippets/qml/listview-sections.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/listview.qml b/src/quick/doc/snippets/qml/listview.qml
index 19c806832e..9b155fc1a4 100644
--- a/src/quick/doc/snippets/qml/listview.qml
+++ b/src/quick/doc/snippets/qml/listview.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/listview/ContactModel.qml b/src/quick/doc/snippets/qml/listview/ContactModel.qml
index 9a8789d210..30e4757894 100644
--- a/src/quick/doc/snippets/qml/listview/ContactModel.qml
+++ b/src/quick/doc/snippets/qml/listview/ContactModel.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/listview/listview.qml b/src/quick/doc/snippets/qml/listview/listview.qml
index 868ba4dfc1..31896626a4 100644
--- a/src/quick/doc/snippets/qml/listview/listview.qml
+++ b/src/quick/doc/snippets/qml/listview/listview.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/loader/KeyReader.qml b/src/quick/doc/snippets/qml/loader/KeyReader.qml
index 5eb342f35a..eebd72b96d 100644
--- a/src/quick/doc/snippets/qml/loader/KeyReader.qml
+++ b/src/quick/doc/snippets/qml/loader/KeyReader.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -37,7 +37,8 @@ Item {
Item {
focus: true
Keys.onPressed: {
- console.log("Loaded item captured:", event.text);
+ console.log("Loaded item captured:",
+ event.text);
event.accepted = true;
}
}
diff --git a/src/quick/doc/snippets/qml/loader/MyComponent.qml b/src/quick/doc/snippets/qml/loader/MyComponent.qml
index 629f1ec272..d6cb9618df 100644
--- a/src/quick/doc/snippets/qml/loader/MyComponent.qml
+++ b/src/quick/doc/snippets/qml/loader/MyComponent.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/doc/snippets/qml/loader/MyItem.qml b/src/quick/doc/snippets/qml/loader/MyItem.qml
index 05f873a5cb..144b1b1ac1 100644
--- a/src/quick/doc/snippets/qml/loader/MyItem.qml
+++ b/src/quick/doc/snippets/qml/loader/MyItem.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/doc/snippets/qml/loader/connections.qml b/src/quick/doc/snippets/qml/loader/connections.qml
index cd926cf704..fc1969ba22 100644
--- a/src/quick/doc/snippets/qml/loader/connections.qml
+++ b/src/quick/doc/snippets/qml/loader/connections.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/doc/snippets/qml/loader/creationContext1.qml b/src/quick/doc/snippets/qml/loader/creationContext1.qml
index 9cc2ad2a67..d34fc6152d 100644
--- a/src/quick/doc/snippets/qml/loader/creationContext1.qml
+++ b/src/quick/doc/snippets/qml/loader/creationContext1.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/doc/snippets/qml/loader/creationContext2.qml b/src/quick/doc/snippets/qml/loader/creationContext2.qml
index f908800385..1930ca85ec 100644
--- a/src/quick/doc/snippets/qml/loader/creationContext2.qml
+++ b/src/quick/doc/snippets/qml/loader/creationContext2.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/doc/snippets/qml/loader/creationContext3.qml b/src/quick/doc/snippets/qml/loader/creationContext3.qml
index 57127d11b3..a127a44097 100644
--- a/src/quick/doc/snippets/qml/loader/creationContext3.qml
+++ b/src/quick/doc/snippets/qml/loader/creationContext3.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/doc/snippets/qml/loader/creationContext4.qml b/src/quick/doc/snippets/qml/loader/creationContext4.qml
index 19af0d53e6..06f16b8a95 100644
--- a/src/quick/doc/snippets/qml/loader/creationContext4.qml
+++ b/src/quick/doc/snippets/qml/loader/creationContext4.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/doc/snippets/qml/loader/focus.qml b/src/quick/doc/snippets/qml/loader/focus.qml
index 20c2318f5e..18eef79c46 100644
--- a/src/quick/doc/snippets/qml/loader/focus.qml
+++ b/src/quick/doc/snippets/qml/loader/focus.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/doc/snippets/qml/loader/simple.qml b/src/quick/doc/snippets/qml/loader/simple.qml
index 81e4c8baf6..f1c340e9c5 100644
--- a/src/quick/doc/snippets/qml/loader/simple.qml
+++ b/src/quick/doc/snippets/qml/loader/simple.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/doc/snippets/qml/loader/sizeitem.qml b/src/quick/doc/snippets/qml/loader/sizeitem.qml
index 467e000db0..750ea9f58a 100644
--- a/src/quick/doc/snippets/qml/loader/sizeitem.qml
+++ b/src/quick/doc/snippets/qml/loader/sizeitem.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -34,21 +34,22 @@
import QtQuick 2.0
Item {
- width: 200; height: 200
+ width: 200; height: 200
- Loader {
- // position the Loader in the center of the parent
- anchors.centerIn: parent
- sourceComponent: rect
- }
+ Loader {
+ // position the Loader in the center
+ // of the parent
+ anchors.centerIn: parent
+ sourceComponent: rect
+ }
- Component {
- id: rect
- Rectangle {
- width: 50
- height: 50
- color: "red"
- }
- }
+ Component {
+ id: rect
+ Rectangle {
+ width: 50
+ height: 50
+ color: "red"
+ }
+ }
}
//![0]
diff --git a/src/quick/doc/snippets/qml/loader/sizeloader.qml b/src/quick/doc/snippets/qml/loader/sizeloader.qml
index 6db3c2b408..9643768774 100644
--- a/src/quick/doc/snippets/qml/loader/sizeloader.qml
+++ b/src/quick/doc/snippets/qml/loader/sizeloader.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -34,21 +34,22 @@
import QtQuick 2.0
Item {
- width: 200; height: 200
+ width: 200; height: 200
- Loader {
- // Explicitly set the size of the Loader to the parent item's size
- anchors.fill: parent
- sourceComponent: rect
- }
+ Loader {
+ // Explicitly set the size of the
+ // Loader to the parent item's size
+ anchors.fill: parent
+ sourceComponent: rect
+ }
- Component {
- id: rect
- Rectangle {
- width: 50
- height: 50
- color: "red"
- }
- }
+ Component {
+ id: rect
+ Rectangle {
+ width: 50
+ height: 50
+ color: "red"
+ }
+ }
}
//![0]
diff --git a/src/quick/doc/snippets/qml/models/views-models-delegates.qml b/src/quick/doc/snippets/qml/models/views-models-delegates.qml
index 1393b11f5d..6b637b633d 100644
--- a/src/quick/doc/snippets/qml/models/views-models-delegates.qml
+++ b/src/quick/doc/snippets/qml/models/views-models-delegates.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/models/visual-model-and-view.qml b/src/quick/doc/snippets/qml/models/visual-model-and-view.qml
index f984fbf702..367934856c 100644
--- a/src/quick/doc/snippets/qml/models/visual-model-and-view.qml
+++ b/src/quick/doc/snippets/qml/models/visual-model-and-view.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/mousearea/mousearea-snippet.qml b/src/quick/doc/snippets/qml/mousearea/mousearea-snippet.qml
index dbfab44e45..c23f873482 100644
--- a/src/quick/doc/snippets/qml/mousearea/mousearea-snippet.qml
+++ b/src/quick/doc/snippets/qml/mousearea/mousearea-snippet.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/mousearea/mousearea.qml b/src/quick/doc/snippets/qml/mousearea/mousearea.qml
index 3a916c5d2f..351a1e8701 100644
--- a/src/quick/doc/snippets/qml/mousearea/mousearea.qml
+++ b/src/quick/doc/snippets/qml/mousearea/mousearea.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/mousearea/mouseareadragfilter.qml b/src/quick/doc/snippets/qml/mousearea/mouseareadragfilter.qml
index 49ffad816d..e5d1626f66 100644
--- a/src/quick/doc/snippets/qml/mousearea/mouseareadragfilter.qml
+++ b/src/quick/doc/snippets/qml/mousearea/mouseareadragfilter.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/multipointtoucharea/multipointtoucharea.qml b/src/quick/doc/snippets/qml/multipointtoucharea/multipointtoucharea.qml
index 7d79da5d88..5431b31560 100644
--- a/src/quick/doc/snippets/qml/multipointtoucharea/multipointtoucharea.qml
+++ b/src/quick/doc/snippets/qml/multipointtoucharea/multipointtoucharea.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/numberanimation.qml b/src/quick/doc/snippets/qml/numberanimation.qml
index 7fcc22a8d7..a89d0e16fe 100644
--- a/src/quick/doc/snippets/qml/numberanimation.qml
+++ b/src/quick/doc/snippets/qml/numberanimation.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/opacitymask.qml b/src/quick/doc/snippets/qml/opacitymask.qml
index e458f810ea..beffb633d6 100644
--- a/src/quick/doc/snippets/qml/opacitymask.qml
+++ b/src/quick/doc/snippets/qml/opacitymask.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Gunnar Sletta <gunnar@sletta.org>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/parallelanimation.qml b/src/quick/doc/snippets/qml/parallelanimation.qml
index 0bc215a0d0..8be0c9ef2a 100644
--- a/src/quick/doc/snippets/qml/parallelanimation.qml
+++ b/src/quick/doc/snippets/qml/parallelanimation.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/parentanimation.qml b/src/quick/doc/snippets/qml/parentanimation.qml
index 6652030e15..9be1d42f6c 100644
--- a/src/quick/doc/snippets/qml/parentanimation.qml
+++ b/src/quick/doc/snippets/qml/parentanimation.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/parentchange.qml b/src/quick/doc/snippets/qml/parentchange.qml
index 4f1fb2a286..7e6e3a7e6d 100644
--- a/src/quick/doc/snippets/qml/parentchange.qml
+++ b/src/quick/doc/snippets/qml/parentchange.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/path/arcdirection.qml b/src/quick/doc/snippets/qml/path/arcdirection.qml
index 8a8676e4da..a40e53a0ff 100644
--- a/src/quick/doc/snippets/qml/path/arcdirection.qml
+++ b/src/quick/doc/snippets/qml/path/arcdirection.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/path/arcradius.qml b/src/quick/doc/snippets/qml/path/arcradius.qml
index 97cba2432d..5032b63043 100644
--- a/src/quick/doc/snippets/qml/path/arcradius.qml
+++ b/src/quick/doc/snippets/qml/path/arcradius.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/path/basicarc.qml b/src/quick/doc/snippets/qml/path/basicarc.qml
index 64d195d39d..96338c6705 100644
--- a/src/quick/doc/snippets/qml/path/basicarc.qml
+++ b/src/quick/doc/snippets/qml/path/basicarc.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/path/basiccurve.qml b/src/quick/doc/snippets/qml/path/basiccurve.qml
index ca554c56a0..b6402b0ded 100644
--- a/src/quick/doc/snippets/qml/path/basiccurve.qml
+++ b/src/quick/doc/snippets/qml/path/basiccurve.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/path/largearc.qml b/src/quick/doc/snippets/qml/path/largearc.qml
index 99068507fe..6b62a20708 100644
--- a/src/quick/doc/snippets/qml/path/largearc.qml
+++ b/src/quick/doc/snippets/qml/path/largearc.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/pathinterpolator.qml b/src/quick/doc/snippets/qml/pathinterpolator.qml
index f38cd19f4b..0589f0de20 100644
--- a/src/quick/doc/snippets/qml/pathinterpolator.qml
+++ b/src/quick/doc/snippets/qml/pathinterpolator.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/pathview/ContactModel.qml b/src/quick/doc/snippets/qml/pathview/ContactModel.qml
index 63e0e223f3..dfcc18c829 100644
--- a/src/quick/doc/snippets/qml/pathview/ContactModel.qml
+++ b/src/quick/doc/snippets/qml/pathview/ContactModel.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/pathview/pathattributes.qml b/src/quick/doc/snippets/qml/pathview/pathattributes.qml
index 25a6bee84e..3b55113cdc 100644
--- a/src/quick/doc/snippets/qml/pathview/pathattributes.qml
+++ b/src/quick/doc/snippets/qml/pathview/pathattributes.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/pathview/pathview.qml b/src/quick/doc/snippets/qml/pathview/pathview.qml
index ba1c25f09d..bac756b453 100644
--- a/src/quick/doc/snippets/qml/pathview/pathview.qml
+++ b/src/quick/doc/snippets/qml/pathview/pathview.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/propertyaction-sequential.qml b/src/quick/doc/snippets/qml/propertyaction-sequential.qml
index fadbe3ade3..0941388441 100644
--- a/src/quick/doc/snippets/qml/propertyaction-sequential.qml
+++ b/src/quick/doc/snippets/qml/propertyaction-sequential.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/propertyaction.qml b/src/quick/doc/snippets/qml/propertyaction.qml
index 51ae753ab8..23a5d74429 100644
--- a/src/quick/doc/snippets/qml/propertyaction.qml
+++ b/src/quick/doc/snippets/qml/propertyaction.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/propertyanimation.qml b/src/quick/doc/snippets/qml/propertyanimation.qml
index db589bbc21..1cbb84e1db 100644
--- a/src/quick/doc/snippets/qml/propertyanimation.qml
+++ b/src/quick/doc/snippets/qml/propertyanimation.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
@@ -92,7 +92,11 @@ Rectangle {
color: "red"
// this is a standalone animation, it's not running by default
- PropertyAnimation { id: animation; target: theRect; property: "width"; to: 30; duration: 500 }
+ PropertyAnimation { id: animation;
+ target: theRect;
+ property: "width";
+ to: 30;
+ duration: 500 }
MouseArea { anchors.fill: parent; onClicked: animation.running = true }
}
diff --git a/src/quick/doc/snippets/qml/propertychanges.qml b/src/quick/doc/snippets/qml/propertychanges.qml
index f9f1b807e0..1ad9d69ada 100644
--- a/src/quick/doc/snippets/qml/propertychanges.qml
+++ b/src/quick/doc/snippets/qml/propertychanges.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/qml-data-models/dynamic-listmodel.qml b/src/quick/doc/snippets/qml/qml-data-models/dynamic-listmodel.qml
index c3e25ebfc0..55448d20f3 100644
--- a/src/quick/doc/snippets/qml/qml-data-models/dynamic-listmodel.qml
+++ b/src/quick/doc/snippets/qml/qml-data-models/dynamic-listmodel.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/qml-data-models/listelements.qml b/src/quick/doc/snippets/qml/qml-data-models/listelements.qml
index a553476e46..38e1d1a3c0 100644
--- a/src/quick/doc/snippets/qml/qml-data-models/listelements.qml
+++ b/src/quick/doc/snippets/qml/qml-data-models/listelements.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/qml-data-models/listmodel-listview.qml b/src/quick/doc/snippets/qml/qml-data-models/listmodel-listview.qml
index 37c0f589e8..aa6a9a62d5 100644
--- a/src/quick/doc/snippets/qml/qml-data-models/listmodel-listview.qml
+++ b/src/quick/doc/snippets/qml/qml-data-models/listmodel-listview.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/qml-extending-types/components/Button.qml b/src/quick/doc/snippets/qml/qml-extending-types/components/Button.qml
index 898d08aad0..8ba458a8bf 100644
--- a/src/quick/doc/snippets/qml/qml-extending-types/components/Button.qml
+++ b/src/quick/doc/snippets/qml/qml-extending-types/components/Button.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/qml-extending-types/components/application.qml b/src/quick/doc/snippets/qml/qml-extending-types/components/application.qml
index 96e2cc8d2d..8d7f8dee7d 100644
--- a/src/quick/doc/snippets/qml/qml-extending-types/components/application.qml
+++ b/src/quick/doc/snippets/qml/qml-extending-types/components/application.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/qml-extending-types/methods/app.qml b/src/quick/doc/snippets/qml/qml-extending-types/methods/app.qml
index 1093344276..a0086180f1 100644
--- a/src/quick/doc/snippets/qml/qml-extending-types/methods/app.qml
+++ b/src/quick/doc/snippets/qml/qml-extending-types/methods/app.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/qml-extending-types/properties/ImageViewer.qml b/src/quick/doc/snippets/qml/qml-extending-types/properties/ImageViewer.qml
index b90f0c1eb7..8f0d61b77d 100644
--- a/src/quick/doc/snippets/qml/qml-extending-types/properties/ImageViewer.qml
+++ b/src/quick/doc/snippets/qml/qml-extending-types/properties/ImageViewer.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/qml-extending-types/properties/alias-override.qml b/src/quick/doc/snippets/qml/qml-extending-types/properties/alias-override.qml
index 5050b869cc..992febff83 100644
--- a/src/quick/doc/snippets/qml/qml-extending-types/properties/alias-override.qml
+++ b/src/quick/doc/snippets/qml/qml-extending-types/properties/alias-override.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/qml-extending-types/properties/alias.qml b/src/quick/doc/snippets/qml/qml-extending-types/properties/alias.qml
index 0ac8c01012..d625454266 100644
--- a/src/quick/doc/snippets/qml/qml-extending-types/properties/alias.qml
+++ b/src/quick/doc/snippets/qml/qml-extending-types/properties/alias.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/qml-extending-types/properties/alias/ImageViewer.qml b/src/quick/doc/snippets/qml/qml-extending-types/properties/alias/ImageViewer.qml
index be64f8ebc4..72e877dba3 100644
--- a/src/quick/doc/snippets/qml/qml-extending-types/properties/alias/ImageViewer.qml
+++ b/src/quick/doc/snippets/qml/qml-extending-types/properties/alias/ImageViewer.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/qml-extending-types/properties/alias/application.qml b/src/quick/doc/snippets/qml/qml-extending-types/properties/alias/application.qml
index b41221ac0d..6b422a1f0e 100644
--- a/src/quick/doc/snippets/qml/qml-extending-types/properties/alias/application.qml
+++ b/src/quick/doc/snippets/qml/qml-extending-types/properties/alias/application.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/qml-extending-types/properties/application.qml b/src/quick/doc/snippets/qml/qml-extending-types/properties/application.qml
index e736d82847..e9f95303f8 100644
--- a/src/quick/doc/snippets/qml/qml-extending-types/properties/application.qml
+++ b/src/quick/doc/snippets/qml/qml-extending-types/properties/application.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/qml-extending-types/properties/property-signals.qml b/src/quick/doc/snippets/qml/qml-extending-types/properties/property-signals.qml
index de103a6686..d9dcef7c14 100644
--- a/src/quick/doc/snippets/qml/qml-extending-types/properties/property-signals.qml
+++ b/src/quick/doc/snippets/qml/qml-extending-types/properties/property-signals.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/qml-extending-types/signals/Button.qml b/src/quick/doc/snippets/qml/qml-extending-types/signals/Button.qml
index 1a65cccf41..851341e26f 100644
--- a/src/quick/doc/snippets/qml/qml-extending-types/signals/Button.qml
+++ b/src/quick/doc/snippets/qml/qml-extending-types/signals/Button.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/qml-extending-types/signals/basic.qml b/src/quick/doc/snippets/qml/qml-extending-types/signals/basic.qml
index 7f96030a86..1f207be34d 100644
--- a/src/quick/doc/snippets/qml/qml-extending-types/signals/basic.qml
+++ b/src/quick/doc/snippets/qml/qml-extending-types/signals/basic.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/qml-extending-types/signals/connectdynamic.qml b/src/quick/doc/snippets/qml/qml-extending-types/signals/connectdynamic.qml
index 0f6901c64a..5ecc19453f 100644
--- a/src/quick/doc/snippets/qml/qml-extending-types/signals/connectdynamic.qml
+++ b/src/quick/doc/snippets/qml/qml-extending-types/signals/connectdynamic.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/qml-extending-types/signals/connectslots.qml b/src/quick/doc/snippets/qml/qml-extending-types/signals/connectslots.qml
index 1f58310d5c..d3bcfe1d30 100644
--- a/src/quick/doc/snippets/qml/qml-extending-types/signals/connectslots.qml
+++ b/src/quick/doc/snippets/qml/qml-extending-types/signals/connectslots.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/qml-extending-types/signals/no-parameters.qml b/src/quick/doc/snippets/qml/qml-extending-types/signals/no-parameters.qml
index 2d3b02c635..2b906aec49 100644
--- a/src/quick/doc/snippets/qml/qml-extending-types/signals/no-parameters.qml
+++ b/src/quick/doc/snippets/qml/qml-extending-types/signals/no-parameters.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/qml-extending-types/signals/parameters.qml b/src/quick/doc/snippets/qml/qml-extending-types/signals/parameters.qml
index 8bd87e58f4..3a29f594e3 100644
--- a/src/quick/doc/snippets/qml/qml-extending-types/signals/parameters.qml
+++ b/src/quick/doc/snippets/qml/qml-extending-types/signals/parameters.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/rectangle/rectangle-colors.qml b/src/quick/doc/snippets/qml/rectangle/rectangle-colors.qml
index 8704da2fa6..57fee02caa 100644
--- a/src/quick/doc/snippets/qml/rectangle/rectangle-colors.qml
+++ b/src/quick/doc/snippets/qml/rectangle/rectangle-colors.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/rectangle/rectangle-gradient.qml b/src/quick/doc/snippets/qml/rectangle/rectangle-gradient.qml
index 47cfb19fe0..a4b542ee78 100644
--- a/src/quick/doc/snippets/qml/rectangle/rectangle-gradient.qml
+++ b/src/quick/doc/snippets/qml/rectangle/rectangle-gradient.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/rectangle/rectangle.qml b/src/quick/doc/snippets/qml/rectangle/rectangle.qml
index 8a44e05188..b50b664ea5 100644
--- a/src/quick/doc/snippets/qml/rectangle/rectangle.qml
+++ b/src/quick/doc/snippets/qml/rectangle/rectangle.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/repeaters/repeater-grid-index.qml b/src/quick/doc/snippets/qml/repeaters/repeater-grid-index.qml
index ac0e4057cf..444356e31c 100644
--- a/src/quick/doc/snippets/qml/repeaters/repeater-grid-index.qml
+++ b/src/quick/doc/snippets/qml/repeaters/repeater-grid-index.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/repeaters/repeater.qml b/src/quick/doc/snippets/qml/repeaters/repeater.qml
index 3afc8c67c2..c859aa97d5 100644
--- a/src/quick/doc/snippets/qml/repeaters/repeater.qml
+++ b/src/quick/doc/snippets/qml/repeaters/repeater.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/righttoleft.qml b/src/quick/doc/snippets/qml/righttoleft.qml
index 1754fa8272..0eee55f707 100644
--- a/src/quick/doc/snippets/qml/righttoleft.qml
+++ b/src/quick/doc/snippets/qml/righttoleft.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/righttoleft/Child.qml b/src/quick/doc/snippets/qml/righttoleft/Child.qml
index 35f02da04f..6be9fbfb14 100644
--- a/src/quick/doc/snippets/qml/righttoleft/Child.qml
+++ b/src/quick/doc/snippets/qml/righttoleft/Child.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/rotation.qml b/src/quick/doc/snippets/qml/rotation.qml
index 89068e75ef..db31db5724 100644
--- a/src/quick/doc/snippets/qml/rotation.qml
+++ b/src/quick/doc/snippets/qml/rotation.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/rotationanimation.qml b/src/quick/doc/snippets/qml/rotationanimation.qml
index 677c798ce9..08489b5e16 100644
--- a/src/quick/doc/snippets/qml/rotationanimation.qml
+++ b/src/quick/doc/snippets/qml/rotationanimation.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/row.qml b/src/quick/doc/snippets/qml/row.qml
index 88f24c9140..16f63ec76b 100644
--- a/src/quick/doc/snippets/qml/row.qml
+++ b/src/quick/doc/snippets/qml/row.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/row/row.qml b/src/quick/doc/snippets/qml/row/row.qml
index 90b7b040c3..9d5d4de37d 100644
--- a/src/quick/doc/snippets/qml/row/row.qml
+++ b/src/quick/doc/snippets/qml/row/row.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/sequentialanimation.qml b/src/quick/doc/snippets/qml/sequentialanimation.qml
index 8e27ce503e..5364340153 100644
--- a/src/quick/doc/snippets/qml/sequentialanimation.qml
+++ b/src/quick/doc/snippets/qml/sequentialanimation.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/smoothedanimation.qml b/src/quick/doc/snippets/qml/smoothedanimation.qml
index c01ba46ce3..8f263333e6 100644
--- a/src/quick/doc/snippets/qml/smoothedanimation.qml
+++ b/src/quick/doc/snippets/qml/smoothedanimation.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/springanimation.qml b/src/quick/doc/snippets/qml/springanimation.qml
index 57025aad28..af3ffe1de1 100644
--- a/src/quick/doc/snippets/qml/springanimation.qml
+++ b/src/quick/doc/snippets/qml/springanimation.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/state-when.qml b/src/quick/doc/snippets/qml/state-when.qml
index 9cbe9f61e7..c90adf739b 100644
--- a/src/quick/doc/snippets/qml/state-when.qml
+++ b/src/quick/doc/snippets/qml/state-when.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/state.qml b/src/quick/doc/snippets/qml/state.qml
index 09afde4b6f..2a6bd8621a 100644
--- a/src/quick/doc/snippets/qml/state.qml
+++ b/src/quick/doc/snippets/qml/state.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/states.qml b/src/quick/doc/snippets/qml/states.qml
index 458f7d4bef..2fbc23b737 100644
--- a/src/quick/doc/snippets/qml/states.qml
+++ b/src/quick/doc/snippets/qml/states.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/states/statechangescript.qml b/src/quick/doc/snippets/qml/states/statechangescript.qml
index d6e6683544..ecefc063d9 100644
--- a/src/quick/doc/snippets/qml/states/statechangescript.qml
+++ b/src/quick/doc/snippets/qml/states/statechangescript.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/systempalette.qml b/src/quick/doc/snippets/qml/systempalette.qml
index f5ae1368e1..2187eec6c1 100644
--- a/src/quick/doc/snippets/qml/systempalette.qml
+++ b/src/quick/doc/snippets/qml/systempalette.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/text/onLinkActivated.qml b/src/quick/doc/snippets/qml/text/onLinkActivated.qml
index aa09f91dea..da48262151 100644
--- a/src/quick/doc/snippets/qml/text/onLinkActivated.qml
+++ b/src/quick/doc/snippets/qml/text/onLinkActivated.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/texteditor.qml b/src/quick/doc/snippets/qml/texteditor.qml
index c22b68be18..7da9086e10 100644
--- a/src/quick/doc/snippets/qml/texteditor.qml
+++ b/src/quick/doc/snippets/qml/texteditor.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/texthandling.qml b/src/quick/doc/snippets/qml/texthandling.qml
index 84d974689c..e8ff132b0c 100644
--- a/src/quick/doc/snippets/qml/texthandling.qml
+++ b/src/quick/doc/snippets/qml/texthandling.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/transition-from-to-modified.qml b/src/quick/doc/snippets/qml/transition-from-to-modified.qml
index 0dcac653e1..5ed9a8a035 100644
--- a/src/quick/doc/snippets/qml/transition-from-to-modified.qml
+++ b/src/quick/doc/snippets/qml/transition-from-to-modified.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/transition-from-to.qml b/src/quick/doc/snippets/qml/transition-from-to.qml
index 7afc097eef..da6741aedb 100644
--- a/src/quick/doc/snippets/qml/transition-from-to.qml
+++ b/src/quick/doc/snippets/qml/transition-from-to.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/transition-reversible.qml b/src/quick/doc/snippets/qml/transition-reversible.qml
index 1bb5a0bc5b..648da3545a 100644
--- a/src/quick/doc/snippets/qml/transition-reversible.qml
+++ b/src/quick/doc/snippets/qml/transition-reversible.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/transition.qml b/src/quick/doc/snippets/qml/transition.qml
index 421149764c..34c9cb38a4 100644
--- a/src/quick/doc/snippets/qml/transition.qml
+++ b/src/quick/doc/snippets/qml/transition.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/transitions-list.qml b/src/quick/doc/snippets/qml/transitions-list.qml
index 863604549a..ac884856a2 100644
--- a/src/quick/doc/snippets/qml/transitions-list.qml
+++ b/src/quick/doc/snippets/qml/transitions-list.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/viewtransitions/viewtransitions-basic.qml b/src/quick/doc/snippets/qml/viewtransitions/viewtransitions-basic.qml
index c800f1415c..95a8e9bb10 100644
--- a/src/quick/doc/snippets/qml/viewtransitions/viewtransitions-basic.qml
+++ b/src/quick/doc/snippets/qml/viewtransitions/viewtransitions-basic.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/viewtransitions/viewtransitions-delayedbyindex.qml b/src/quick/doc/snippets/qml/viewtransitions/viewtransitions-delayedbyindex.qml
index c66e8aeb3d..1a8fab037e 100644
--- a/src/quick/doc/snippets/qml/viewtransitions/viewtransitions-delayedbyindex.qml
+++ b/src/quick/doc/snippets/qml/viewtransitions/viewtransitions-delayedbyindex.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/viewtransitions/viewtransitions-intermediatemove.qml b/src/quick/doc/snippets/qml/viewtransitions/viewtransitions-intermediatemove.qml
index a66b82b4bb..b984eb895c 100644
--- a/src/quick/doc/snippets/qml/viewtransitions/viewtransitions-intermediatemove.qml
+++ b/src/quick/doc/snippets/qml/viewtransitions/viewtransitions-intermediatemove.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/viewtransitions/viewtransitions-interruptedgood.qml b/src/quick/doc/snippets/qml/viewtransitions/viewtransitions-interruptedgood.qml
index 54b09c4676..5cde4622b6 100644
--- a/src/quick/doc/snippets/qml/viewtransitions/viewtransitions-interruptedgood.qml
+++ b/src/quick/doc/snippets/qml/viewtransitions/viewtransitions-interruptedgood.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/viewtransitions/viewtransitions-pathanim.qml b/src/quick/doc/snippets/qml/viewtransitions/viewtransitions-pathanim.qml
index 3b96b864c7..d7be9f6a26 100644
--- a/src/quick/doc/snippets/qml/viewtransitions/viewtransitions-pathanim.qml
+++ b/src/quick/doc/snippets/qml/viewtransitions/viewtransitions-pathanim.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/viewtransitions/viewtransitions-scriptactionbad.qml b/src/quick/doc/snippets/qml/viewtransitions/viewtransitions-scriptactionbad.qml
index e62a35d2cb..a6c079cbb9 100644
--- a/src/quick/doc/snippets/qml/viewtransitions/viewtransitions-scriptactionbad.qml
+++ b/src/quick/doc/snippets/qml/viewtransitions/viewtransitions-scriptactionbad.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/viewtransitions/viewtransitions-scriptactiongood.qml b/src/quick/doc/snippets/qml/viewtransitions/viewtransitions-scriptactiongood.qml
index dc74501e33..3c583445ed 100644
--- a/src/quick/doc/snippets/qml/viewtransitions/viewtransitions-scriptactiongood.qml
+++ b/src/quick/doc/snippets/qml/viewtransitions/viewtransitions-scriptactiongood.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/visualparent.qml b/src/quick/doc/snippets/qml/visualparent.qml
index 5a95bc006a..30a1391883 100644
--- a/src/quick/doc/snippets/qml/visualparent.qml
+++ b/src/quick/doc/snippets/qml/visualparent.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/visualparent2.qml b/src/quick/doc/snippets/qml/visualparent2.qml
index 2cd21290da..d19aee17b6 100644
--- a/src/quick/doc/snippets/qml/visualparent2.qml
+++ b/src/quick/doc/snippets/qml/visualparent2.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/snippets/qml/xmlrole.qml b/src/quick/doc/snippets/qml/xmlrole.qml
index 257594179a..bb6bcac83b 100644
--- a/src/quick/doc/snippets/qml/xmlrole.qml
+++ b/src/quick/doc/snippets/qml/xmlrole.qml
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -17,8 +17,8 @@
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
+** * 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.
**
**
diff --git a/src/quick/doc/src/advtutorial.qdoc b/src/quick/doc/src/advtutorial.qdoc
index aa44ef8a85..6aeabbd7b5 100644
--- a/src/quick/doc/src/advtutorial.qdoc
+++ b/src/quick/doc/src/advtutorial.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/quick/doc/src/concepts/convenience/topic.qdoc b/src/quick/doc/src/concepts/convenience/topic.qdoc
index b87cfd84c1..0f81fa2526 100644
--- a/src/quick/doc/src/concepts/convenience/topic.qdoc
+++ b/src/quick/doc/src/concepts/convenience/topic.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/quick/doc/src/concepts/effects/particles.qdoc b/src/quick/doc/src/concepts/effects/particles.qdoc
index c3262b7082..d0c54decfd 100644
--- a/src/quick/doc/src/concepts/effects/particles.qdoc
+++ b/src/quick/doc/src/concepts/effects/particles.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/quick/doc/src/concepts/effects/sprites.qdoc b/src/quick/doc/src/concepts/effects/sprites.qdoc
index 31a5502128..edad89b1e5 100644
--- a/src/quick/doc/src/concepts/effects/sprites.qdoc
+++ b/src/quick/doc/src/concepts/effects/sprites.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/quick/doc/src/concepts/effects/topic.qdoc b/src/quick/doc/src/concepts/effects/topic.qdoc
index bf713c2259..3b93a0d0f9 100644
--- a/src/quick/doc/src/concepts/effects/topic.qdoc
+++ b/src/quick/doc/src/concepts/effects/topic.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/quick/doc/src/concepts/effects/transformations.qdoc b/src/quick/doc/src/concepts/effects/transformations.qdoc
index 606260cdd4..a5c7b9c208 100644
--- a/src/quick/doc/src/concepts/effects/transformations.qdoc
+++ b/src/quick/doc/src/concepts/effects/transformations.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/quick/doc/src/concepts/input/focus.qdoc b/src/quick/doc/src/concepts/input/focus.qdoc
index 6a7d41dbab..db84961d20 100644
--- a/src/quick/doc/src/concepts/input/focus.qdoc
+++ b/src/quick/doc/src/concepts/input/focus.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/quick/doc/src/concepts/input/mouse.qdoc b/src/quick/doc/src/concepts/input/mouse.qdoc
index a32100f830..33229969b7 100644
--- a/src/quick/doc/src/concepts/input/mouse.qdoc
+++ b/src/quick/doc/src/concepts/input/mouse.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/quick/doc/src/concepts/input/textinput.qdoc b/src/quick/doc/src/concepts/input/textinput.qdoc
index 3c65b7e842..3965c246da 100644
--- a/src/quick/doc/src/concepts/input/textinput.qdoc
+++ b/src/quick/doc/src/concepts/input/textinput.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/quick/doc/src/concepts/input/topic.qdoc b/src/quick/doc/src/concepts/input/topic.qdoc
index e3349f350c..c5f19f2d4f 100644
--- a/src/quick/doc/src/concepts/input/topic.qdoc
+++ b/src/quick/doc/src/concepts/input/topic.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc b/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc
index dcc7a592e6..dffcabbd5b 100644
--- a/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc
+++ b/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
@@ -169,6 +169,7 @@ created directly as types within QML:
\table
\row
+\li C++
\li
\code
class MyModelPlugin : public QQmlExtensionPlugin
@@ -183,7 +184,8 @@ public:
}
}
\endcode
-
+\row
+\li QML
\li
\qml
MyModel {
diff --git a/src/quick/doc/src/concepts/modelviewsdata/modelview.qdoc b/src/quick/doc/src/concepts/modelviewsdata/modelview.qdoc
index 85d34e5376..4e894e5a33 100644
--- a/src/quick/doc/src/concepts/modelviewsdata/modelview.qdoc
+++ b/src/quick/doc/src/concepts/modelviewsdata/modelview.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/quick/doc/src/concepts/modelviewsdata/topic.qdoc b/src/quick/doc/src/concepts/modelviewsdata/topic.qdoc
index 21c81f47e5..e17e606ae1 100644
--- a/src/quick/doc/src/concepts/modelviewsdata/topic.qdoc
+++ b/src/quick/doc/src/concepts/modelviewsdata/topic.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/quick/doc/src/concepts/positioning/anchors.qdoc b/src/quick/doc/src/concepts/positioning/anchors.qdoc
index d0a14f7392..71af38b587 100644
--- a/src/quick/doc/src/concepts/positioning/anchors.qdoc
+++ b/src/quick/doc/src/concepts/positioning/anchors.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/quick/doc/src/concepts/positioning/layouts.qdoc b/src/quick/doc/src/concepts/positioning/layouts.qdoc
index fef55582dc..de47af6db8 100644
--- a/src/quick/doc/src/concepts/positioning/layouts.qdoc
+++ b/src/quick/doc/src/concepts/positioning/layouts.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/quick/doc/src/concepts/positioning/righttoleft.qdoc b/src/quick/doc/src/concepts/positioning/righttoleft.qdoc
index d6b1753ee3..3e6bc64726 100644
--- a/src/quick/doc/src/concepts/positioning/righttoleft.qdoc
+++ b/src/quick/doc/src/concepts/positioning/righttoleft.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/quick/doc/src/concepts/positioning/topic.qdoc b/src/quick/doc/src/concepts/positioning/topic.qdoc
index 51cb07c51d..92113ece54 100644
--- a/src/quick/doc/src/concepts/positioning/topic.qdoc
+++ b/src/quick/doc/src/concepts/positioning/topic.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/quick/doc/src/concepts/statesanimations/animations.qdoc b/src/quick/doc/src/concepts/statesanimations/animations.qdoc
index 080b786f9b..4e336afa36 100644
--- a/src/quick/doc/src/concepts/statesanimations/animations.qdoc
+++ b/src/quick/doc/src/concepts/statesanimations/animations.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/quick/doc/src/concepts/statesanimations/behaviors.qdoc b/src/quick/doc/src/concepts/statesanimations/behaviors.qdoc
index 9c213fdf9f..3ffe07b0f5 100644
--- a/src/quick/doc/src/concepts/statesanimations/behaviors.qdoc
+++ b/src/quick/doc/src/concepts/statesanimations/behaviors.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/quick/doc/src/concepts/statesanimations/states.qdoc b/src/quick/doc/src/concepts/statesanimations/states.qdoc
index b0d7765c66..d107369e44 100644
--- a/src/quick/doc/src/concepts/statesanimations/states.qdoc
+++ b/src/quick/doc/src/concepts/statesanimations/states.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/quick/doc/src/concepts/statesanimations/topic.qdoc b/src/quick/doc/src/concepts/statesanimations/topic.qdoc
index e294b5325e..ab91268d5e 100644
--- a/src/quick/doc/src/concepts/statesanimations/topic.qdoc
+++ b/src/quick/doc/src/concepts/statesanimations/topic.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/quick/doc/src/concepts/visualcanvas/coordinates.qdoc b/src/quick/doc/src/concepts/visualcanvas/coordinates.qdoc
index fead7d7777..6c2e4fc61e 100644
--- a/src/quick/doc/src/concepts/visualcanvas/coordinates.qdoc
+++ b/src/quick/doc/src/concepts/visualcanvas/coordinates.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc b/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc
index 046c23f8f0..8ef77dac4c 100644
--- a/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc
+++ b/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
@@ -173,8 +173,26 @@ defined by the render loop.
For detailed description of how the scene graph renderer works, see
\l {Qt Quick Scene Graph Renderer}.
-
-\section2 Threaded Render Loop
+There are three render loop variants available: \c basic, \c windows,
+and \c threaded. Out of these, \c basic and \c windows are
+single-threaded, while \c threaded performs scene graph rendering on a
+dedicated thread. Qt attempts to choose a suitable loop based on the
+platform and possibly the graphics drivers in use. When this is not
+satisfactory, or for testing purposes, the environment variable
+\c QSG_RENDER_LOOP can be used to force the usage of a given loop. To
+verify which render loop is in use, launch the application with
+\c QSG_INFO set to \c 1.
+
+\note The \c threaded and \c windows render loops rely on the OpenGL
+implementation for throttling by requesting a swap interval of 1. Some
+graphics drivers allow users to override this setting and turn it off,
+ignoring Qt's request. Without blocking in the swap buffers operation
+(or elsewhere), the render loop will run animations too fast and spin
+the CPU at 100%. If a system is known to be unable to provide
+vsync-based throttling, use the \c basic render loop instead by
+setting \c {QSG_RENDER_LOOP=basic} in the environment.
+
+\section2 Threaded Render Loop ("threaded")
On many configurations, the scene graph rendering will happen on a
dedicated render thread. This is done to increase parallelism of
@@ -244,18 +262,25 @@ animations, process events, etc.
\endlist
-The threaded renderer is currently used by default on Linux with
-non-Mesa based drivers, OS X and EGLFS based QPA platforms, but this
-is subject to change. It is possible to force use of the threaded
-renderer by setting \c {QSG_RENDER_LOOP=threaded} in the
-environment.
+The threaded renderer is currently used by default on Windows with
+opengl32.dll, Linux with non-Mesa based drivers, OS X, mobile
+platforms, and Embedded Linux with EGLFS but this is subject to
+change. It is possible to force use of the threaded renderer by
+setting \c {QSG_RENDER_LOOP=threaded} in the environment.
-\section2 Non-threaded Render Loop
+\section2 Non-threaded Render Loops ("basic" and "windows")
The non-threaded render loop is currently used by default on Windows
-and non-EGLFS based embedded platforms. This is mostly a precautionary
-measure, as not all combinations of OpenGL drivers and windowing
-systems have been tested.
+with ANGLE or a non-default opengl32 implementation and Linux with
+Mesa drivers. For the latter this is mostly a precautionary measure,
+as not all combinations of OpenGL drivers and windowing systems have
+been tested. At the same time implementations like ANGLE or Mesa
+llvmpipe are not able to function properly with threaded rendering at
+all so not using threaded rendering is essential for these.
+
+By default \c windows is used for non-threaded rendering on Windows
+with ANGLE, while \c basic is used for all other platforms when
+non-threaded rendering is needed.
Even when using the non-threaded render loop, you should write your
code as if you are using the threaded renderer, as failing to do so
diff --git a/src/quick/doc/src/concepts/visualcanvas/topic.qdoc b/src/quick/doc/src/concepts/visualcanvas/topic.qdoc
index c70c86ff3f..30fba97474 100644
--- a/src/quick/doc/src/concepts/visualcanvas/topic.qdoc
+++ b/src/quick/doc/src/concepts/visualcanvas/topic.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/quick/doc/src/concepts/visualcanvas/visualparent.qdoc b/src/quick/doc/src/concepts/visualcanvas/visualparent.qdoc
index 37b0b6084f..fd5bf51307 100644
--- a/src/quick/doc/src/concepts/visualcanvas/visualparent.qdoc
+++ b/src/quick/doc/src/concepts/visualcanvas/visualparent.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
@@ -63,7 +63,9 @@ import QtQuick 2.0
Item {
width: 100; height: 100
- Rectangle { width: 50; height: 50; color: "red" }
+ Rectangle { width: 50;
+ height: 50;
+ color: "red" }
}
\endcode
@@ -75,7 +77,9 @@ Item {
width: 100; height: 100
data: [
- Rectangle { width: 50; height: 50; color: "red" }
+ Rectangle { width: 50;
+ height: 50;
+ color: "red" }
]
}
\endcode
diff --git a/src/quick/doc/src/concepts/visualtypes/topic.qdoc b/src/quick/doc/src/concepts/visualtypes/topic.qdoc
index d30c7767c0..01ffed6b16 100644
--- a/src/quick/doc/src/concepts/visualtypes/topic.qdoc
+++ b/src/quick/doc/src/concepts/visualtypes/topic.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/quick/doc/src/cppextensionpoints.qdoc b/src/quick/doc/src/cppextensionpoints.qdoc
index db003b2427..b4eaf1cc14 100644
--- a/src/quick/doc/src/cppextensionpoints.qdoc
+++ b/src/quick/doc/src/cppextensionpoints.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/quick/doc/src/dynamicview-tutorial.qdoc b/src/quick/doc/src/dynamicview-tutorial.qdoc
index dd5e1ce344..f87f94f264 100644
--- a/src/quick/doc/src/dynamicview-tutorial.qdoc
+++ b/src/quick/doc/src/dynamicview-tutorial.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/quick/doc/src/examples.qdoc b/src/quick/doc/src/examples.qdoc
index 0ec4507450..dd21270673 100644
--- a/src/quick/doc/src/examples.qdoc
+++ b/src/quick/doc/src/examples.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/quick/doc/src/qmltypereference.qdoc b/src/quick/doc/src/qmltypereference.qdoc
index 430c0ed11a..630e0f58bc 100644
--- a/src/quick/doc/src/qmltypereference.qdoc
+++ b/src/quick/doc/src/qmltypereference.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
@@ -26,7 +26,7 @@
****************************************************************************/
/*!
-\qmlmodule QtQuick 2.4
+\qmlmodule QtQuick 2.5
\title Qt Quick QML Types
\ingroup qmlmodules
\brief Provides graphical QML types.
@@ -34,11 +34,11 @@
The \l{Qt Quick} module provides graphical primitive types. These types are only
available in a QML document if that document imports the \c QtQuick namespace.
-The current version of the \c QtQuick module is version 2.4, and thus it may be
+The current version of the \c QtQuick module is version 2.5, and thus it may be
imported via the following statement:
\qml
-import QtQuick 2.4
+import QtQuick 2.5
\endqml
Visit the \l {Qt Quick} module documentation for more
@@ -185,18 +185,30 @@ available when you import \c QtQuick.
\table
\row
+ \li \c Font.Thin
+ \li 0
+ \row
+ \li \c Font.ExtraLight
+ \li 12
+ \row
\li \c Font.Light
\li 25
\row
\li \c Font.Normal
\li 50
\row
+ \li \c Font.Medium
+ \li 57
+ \row
\li \c Font.DemiBold
\li 63
\row
\li \c Font.Bold
\li 75
\row
+ \li \c Font.ExtraBold
+ \li 81
+ \row
\li \c Font.Black
\li 87
\endtable
@@ -240,7 +252,7 @@ available when you import \c QtQuick.
The vector2d type has the following idempotent functions which can be
invoked in QML:
- \table
+ \table 60%
\header
\li Function Signature
\li Description
@@ -418,9 +430,11 @@ console.log(c); // 32
the 4x4 \c matrix with the matrix applied post-vector
\li \code
var a = Qt.vector3d(1,2,3);
-var b = Qt.matrix4x4(4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19);
+var b = Qt.matrix4x4(4,5,6,7,8,9,10,11,
+ 12,13,14,15,16,17,18,19);
var c = a.times(b);
-console.log(c.toString()); // QVector3D(0.774194, 0.849462, 0.924731)
+console.log(c.toString());
+// QVector3D(0.774194, 0.849462, 0.924731)
\endcode
\row
@@ -469,7 +483,8 @@ console.log(c.toString()); // QVector3D(-3, -3, -3)
\li \code
var a = Qt.vector3d(1,2,3);
var b = a.normalized();
-console.log(b.toString()); // QVector3D(0.267261, 0.534522, 0.801784)
+console.log(b.toString());
+// QVector3D(0.267261, 0.534522, 0.801784)
\endcode
\row
@@ -503,7 +518,8 @@ console.log(b.toString()); // QVector4D(1, 2, 3, 0)
\li bool fuzzyEquals(vector3d other, real epsilon)
\li Returns true if \c this vector3d is approximately equal to the \c other vector3d.
The approximation will be true if each attribute of \c this is within \c epsilon
- of \c other. Note that \c epsilon is an optional argument, the default \c epsilon
+ of \c other.
+ Note that \c epsilon is an optional argument, the default \c epsilon
is 0.00001.
\li \code
var a = Qt.vector3d(1,2,3);
@@ -579,7 +595,8 @@ console.log(c.toString()); // QVector4D(5, 12, 21, 32)
var a = Qt.vector4d(1,2,3,4);
var b = 4.48;
var c = a.times(b);
-console.log(c.toString()); // QVector3D(4.48, 8.96, 13.44, 17.92)
+console.log(c.toString()); // QVector3D(4.48, 8.96,
+ 13.44, 17.92)
\endcode
\row
@@ -608,7 +625,8 @@ console.log(c.toString()); // QVector4D(-4, -4, -4, -4)
\li \code
var a = Qt.vector4d(1,2,3,4);
var b = a.normalized();
-console.log(b.toString()); // QVector4D(0.182574, 0.365148, 0.547723, 0.730297)
+console.log(b.toString());
+// QVector4D(0.182574, 0.365148, 0.547723, 0.730297)
\endcode
\row
@@ -689,7 +707,7 @@ console.log(c + " " + d); // false true
The matrix4x4 type has the following idempotent functions which can be
invoked in QML:
- \table
+ \table 70 %
\header
\li Function Signature
\li Description
@@ -703,7 +721,9 @@ console.log(c + " " + d); // false true
var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
var b = Qt.matrix4x4(4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19);
var c = a.times(b);
-console.log(c.toString()); // QMatrix4x4(120, 130, 140, 150, 280, 306, 332, 358, 440, 482, 524, 566, 600, 658, 716, 774)
+console.log(c.toString());
+// QMatrix4x4(120, 130, 140, 150, 280, 306, 332, 358, 440, 482,
+//524, 566, 600, 658, 716, 774)
\endcode
\row
@@ -737,7 +757,9 @@ console.log(c.toString()); // QVector3D(0.155556, 0.437037, 0.718518)
var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
var b = 4.48;
var c = a.times(b);
-console.log(c.toString()); // QMatrix4x4(4.48, 8.96, 13.44, 17.92, 22.4, 26.88, 31.36, 35.84, 40.32, 44.8, 49.28, 53.76, 58.24, 62.72, 67.2, 71.68)
+console.log(c.toString());
+// QMatrix4x4(4.48, 8.96, 13.44, 17.92, 22.4, 26.88, 31.36, 35.84,
+// 40.32, 44.8, 49.28, 53.76, 58.24, 62.72, 67.2, 71.68)
\endcode
\row
@@ -747,7 +769,9 @@ console.log(c.toString()); // QMatrix4x4(4.48, 8.96, 13.44, 17.92, 22.4, 26.88,
var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
var b = Qt.matrix4x4(5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
var c = a.plus(b);
-console.log(c.toString()); // QMatrix4x4(6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36)
+console.log(c.toString());
+// QMatrix4x4(6, 8, 10, 12, 14, 16, 18, 20, 22,
+// 24, 26, 28, 30, 32, 34, 36)
\endcode
\row
@@ -757,7 +781,9 @@ console.log(c.toString()); // QMatrix4x4(6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 2
var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
var b = Qt.matrix4x4(5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
var c = a.minus(b);
-console.log(c.toString()); // QMatrix4x4(-4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4)
+console.log(c.toString());
+// QMatrix4x4(-4, -4, -4, -4, -4, -4, -4, -4, -4,
+// -4, -4, -4, -4, -4, -4, -4)
\endcode
\row
@@ -768,7 +794,8 @@ console.log(c.toString()); // QMatrix4x4(-4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
var b = Qt.vector4d(a.m21, a.m22, a.m23, a.m24);
var c = a.row(2); // zero based access! so not equal to b
-console.log(b.toString() + " " + c.toString()); // QVector4D(5, 6, 7, 8) QVector4D(9, 10, 11, 12)
+console.log(b.toString() + " " + c.toString());
+// QVector4D(5, 6, 7, 8) QVector4D(9, 10, 11, 12)
\endcode
\row
@@ -779,7 +806,8 @@ console.log(b.toString() + " " + c.toString()); // QVector4D(5, 6, 7, 8) QVector
var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
var b = Qt.vector4d(a.m12, a.m22, a.m32, a.m42);
var c = a.column(2); // zero based access! so not equal to b
-console.log(b.toString() + " " + c.toString()); // QVector4D(2, 6, 10, 14) QVector4D(3, 7, 11, 15)
+console.log(b.toString() + " " + c.toString());
+// QVector4D(2, 6, 10, 14) QVector4D(3, 7, 11, 15)
\endcode
\row
@@ -797,7 +825,9 @@ console.log(b); // 6
\li \code
var a = Qt.matrix4x4(1,0,0,0,0,2,0,0,0,0,3,0,100,200,300,1);
var b = a.inverted();
-console.log(b.toString()); // QMatrix4x4(1, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0.333333, 0, -100, -100, -100, 1)
+console.log(b.toString());
+// QMatrix4x4(1, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0.333333, 0, -100,
+// -100, -100, 1)
\endcode
\row
@@ -806,7 +836,8 @@ console.log(b.toString()); // QMatrix4x4(1, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0.33333
\li \code
var a = Qt.matrix4x4(1,0,0,0,0,2,0,0,0,0,3,0,100,200,300,1);
var b = a.transposed();
-console.log(b.toString()); // QMatrix4x4(1, 0, 0, 100, 0, 2, 0, 200, 0, 0, 3, 300, 0, 0, 0, 1)
+console.log(b.toString());
+// QMatrix4x4(1, 0, 0, 100, 0, 2, 0, 200, 0, 0, 3, 300, 0, 0, 0, 1)
\endcode
\row
@@ -817,7 +848,10 @@ console.log(b.toString()); // QMatrix4x4(1, 0, 0, 100, 0, 2, 0, 200, 0, 0, 3, 30
argument, the default \c epsilon is 0.00001.
\li \code
var a = Qt.matrix4x4(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
-var b = Qt.matrix4x4(1.0001,2.0001,3.0002,4.0003,5.0001,6.0002,7.0002,8.0004,9.0001,10.0003,11.0003,12.0004,13.0001,14.0002,15.0003,16.0004);
+var b = Qt.matrix4x4(1.0001,2.0001,3.0002,4.0003,5.0001,6.0002,
+ 7.0002,8.0004, 9.0001,10.0003,
+ 11.0003,12.0004,13.0001,
+ 14.0002,15.0003,16.0004);
var c = a.fuzzyEquals(b); // default epsilon
var d = a.fuzzyEquals(b, 0.005); // supplied epsilon
console.log(c + " " + d); // false true
diff --git a/src/quick/doc/src/qtquick-cpp.qdoc b/src/quick/doc/src/qtquick-cpp.qdoc
index 6ff52bfd4d..fbea76a8d7 100644
--- a/src/quick/doc/src/qtquick-cpp.qdoc
+++ b/src/quick/doc/src/qtquick-cpp.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/quick/doc/src/qtquick.qdoc b/src/quick/doc/src/qtquick.qdoc
index 95c59b5c1a..98a77a48d8 100644
--- a/src/quick/doc/src/qtquick.qdoc
+++ b/src/quick/doc/src/qtquick.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
@@ -42,9 +42,8 @@ The Qt Quick module provides both a \l{Qt Quick QML Types}{QML API} which suppli
QML types for creating user interfaces with the QML language, and a
\l{Qt Quick C++ Classes}{C++ API} for extending QML applications with C++ code.
-\note From Qt 5.1, a set of Qt Quick based UI controls is available to
-create user interfaces. Please see \l{Qt Quick Controls}
-for more information.
+\note A set of Qt Quick-based UI controls is also available to create user
+interfaces. See \l{Qt Quick Controls} for more information.
For those new to QML and Qt Quick, please see
\l{QML Applications}
@@ -108,7 +107,6 @@ Additional Qt Quick information:
interacting with system dialogs
\li \l{Qt Quick Test QML Types}{Tests} - contains types for writing unit test for a QML application
\endlist
-\li \l{Qt Quick Release Notes} - list of changes and additions in the Qt Quick
\li \l{Qt Quick Examples and Tutorials}
\endlist
diff --git a/src/quick/doc/src/tutorial.qdoc b/src/quick/doc/src/tutorial.qdoc
index 91032f1d92..e44129de83 100644
--- a/src/quick/doc/src/tutorial.qdoc
+++ b/src/quick/doc/src/tutorial.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -10,15 +10,15 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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
+** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
diff --git a/src/quick/doc/src/whatsnew.qdoc b/src/quick/doc/src/whatsnew.qdoc
deleted file mode 100644
index c41ea562f0..0000000000
--- a/src/quick/doc/src/whatsnew.qdoc
+++ /dev/null
@@ -1,452 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\title Qt Quick Release Notes
-\page qtquick-releasenotes.html
-
-\section1 Qt Quick in Qt 5.1
-
-\l{Qt Quick} 2.1 is new in Qt 5.1. This is a summary of improvements and new
-features introduced by the new import and new classes in Qt 5.1:
-\list
-\li New threaded render loop for Mac, Linux, and Embedded.
-\li New render loop for windows for smoother animations.
-\li New \l Window properties: activeFocusItem, minimumWidth, minimumHeight,
- maximumWidth, maximumHeight, visibility, contentOrientation, and opacity.
-\li New \l Screen attached properties: name, desktopAvailableWidth,
- desktopAvailableHeight, logicalPixelDensity
-\li New \l Grid properties: horizontalAlignment, verticalAlignment, and
- effectiveHorizontalAlignment.
-\li New \l TextEdit properties: selectByKeyboard and textDocument
-\li A \l Window declared inside another Window or \l Item will automatically be
- transient for (centered upon) the outer window.
-\li These types are now part of \l{Qt QML}:
- \list
- \li \l {VisualItemModel}
- \li \l {VisualDataModel} - Encapsulates a model and a delegate
- \li \l {VisualDataGroup}
- \endlist
- These types are kept due to compatibility reasons and are replaced by the
- \l{Qt QML Models QML Types}{Qt QML Models} types.
-\endlist
-
-\section2 New Submodules
-
-In Qt 5.1, there are several new modules which extend Qt Quick functionalities.
-\list
-\li \l{Qt Quick Dialogs} - contains types for creating and interacting with system dialogs
-\li \l{Qt Quick Controls} - provides a set of reusable UI components
-\li \l{Qt Quick Layouts} - contains types that are used to arrange items in the user interface
-\endlist
-
-The \l{What's New in Qt 5.1} has more information about the Qt 5.1 release.
-
-\section1 Qt Quick in Qt 5.0
-
-The \l {Qt Quick} module is new in Qt 5. It provides the visual canvas and scenegraph back-end
-as well as the \c QtQuick QML module for QML application development.
-
-As of Qt 5, the \l {Qt Quick} module is based on an OpenGL scenegraph. Many of the classes in
-the \l {Qt Quick} module have been ported from the \l {Qt Quick 1}{QtDeclarative} module from Qt 4.8 to use
-the scenegraph architecture; these classes have been renamed to use a \c QQuick* prefix.
-(See the \l {Porting QML Applications to Qt 5} for porting information.)
-
-The following classes provide the basic functionality for interacting with the QML visual
-canvas from C++:
-
-\list
-\li QQuickItem - the base visual QML type (replaces \c QDeclarativeItem)
-\li QQuickView - a convenience window for rendering a QML scene from a QML file (replaces \c QDeclarativeView)
-\li QQuickWindow - a base window for displaying a QML scene
-\li QQuickPaintedItem - convenience for using the QPainter API with the scenegraph
-\li QQuickImageProvider - fetches custom images for use in QML applications (replaces \c
- QDeclarativeImageProvider)
-\li QQuickTextureFactory - use with QQuickImageProvider::requestTexture()
-\endlist
-
-Custom rendering can be performed on the scenegraph using the following new classes:
-
-\list
-\li QSGNode
-\li QSGMaterial
-\li QSGBasicGeometryNode
-\li QSGGeometryNode
-\li QSGClipNode
-\li QSGTransformNode
-\li QSGOpacityNode
-\li QSGFlatColorMaterial
-\li QSGSimpleRectNode
-\li QSGSimpleTextureNode
-\li QSGTexture
-\li QSGDynamicTexture
-\li QSGOpaqueTextureMaterial
-\li QSGTextureMaterial
-\li QSGTextureProvider
-\li QSGVertexColorMaterial
-\endlist
-
-
-\section1 Qt 5.0 - QtQuick QML Module
-
-The \c {QtQuick 2.0} QML module is a major update.
-
-Below are the additions in \c {QtQuick 2.0}. For a list of behavioral changes which may affect
-applications ported from \c {QtQuick 1.x}, see the \l {Porting QML Applications to Qt 5}.
-
-\section2 Visual types, Graphical Effects and Sprites
-
-\list
-\li New \l Canvas type for drawing. This provides an API similar to that of the HTML5 Canvas API,
- along with some additional features.
- \list
- \li Supports two render targets: \c Canvas.Image and \c Canvas.FramebufferObject.
- \li Supports background thread rendering.
- \li Supports tiled canvas rendering.
- \li Supports most of the HTML5 context2d APIs.
- \endlist
-\li \l Item:
- \list
- \li New \l{Item::}{layer.enabled} property enables an item to be rendered into an offscreen
- cache for optimization.
- \li New \l{Item::}{contains()} method returns whether an item contains a specified point.
- \li New \l{Item::}{anchors.alignWhenCentered} property can force centered anchors to align on a
- whole pixel.
- \li New \l{Item::}{enabled} property is available, which stops input event delivery and removes active focus.
- \endlist
-\li \l Image:
- \list
- \li New \l{Image::}{horizontalAlignment} and \l{Image::}{verticalAlignment} properties to set
- the image alignment.
- \li New \c Image.Pad enumeration value for \l{Image::}{fillMode} that does not transform the image,
- unlike other \l{Image::}{fillMode} enumeration values.
- \endlist
-\li New ShaderEffect and ShaderEffectSource types enable GLSL shader programs to be integrated
- directly into QML code and applied to QML items and images. (This obsoletes the experimental
- Qt.labs.shaders module.)
-\li New SpriteSequence type renders animated sprites and can transition between animations. Each
- animation in a sequence is represented by the new \l Sprite type.
-\li New AnimatedSprite type for drawing single sprite animations.
-\endlist
-
-
-\section2 Animations and Transitions
-\list
-\li New AnimationController type enables an animation to be manually driven by a
- \l{AnimationController::}{progress} value.
-\li New PathAnimation type animates an item along a \l Path.
-\li New PathInterpolator type provides updated attribute values for an item animating along a path.
- It can be used as an low-level alternative to PathAnimation.
-\li \l Transition:
- \list
- \li New \l{Transition::}{running} property holds whether a transition is currently running.
- \li New \l{Transition::}{enabled} property controls whether a transition is enabled.
- \endlist
-\endlist
-
-
-\section2 Paths
-\list
-\li New PathArc type creates an arc-type path.
-\li New PathCurve type creates a catmull-rom curve path.
-\li New PathSvg type creates a path from a SVG string.
-\li Changes common to PathLine, PathQuad and PathCubic:
- \list
- \li New \c relativeX and \c relativeY properties define the start and end points of a path
-relative to its start.
- \endlist
-\li PathCubic only:
- \list
- \li New \l{PathCubic::}{relativeControl1X}, \l{PathCubic::}{relativeControl1Y},
- \l{PathCubic::}{relativeControl2X} and \l{PathCubic::}{relativeControl2Y} properties define the
- positions of the control points relative to the start of the curve.
- \endlist
-\li PathQuad only:
- \list
- \li New \l{PathQuad::}{relativeControlX} and \l{PathQuad::}{relativeControlY}
- define the positions of the control points relative to the start of the curve.
- \endlist
-\endlist
-
-
-\section2 Text Rendering and Input
-
-\list
-\li Changes common to \l Text, TextEdit and TextInput:
- \list
- \li New \c contentWidth and \c contentHeight properties provide the dimensions of the textual
- content.
- \li New \c effectiveHorizontalAlignment property provides the read-only actual horizontal
- alignment.
- \endlist
-\li Changes common to both TextEdit and TextInput:
- \list
- \li New \c canUndo and \c canRedo properties specify whether undo and redo operations are
- available.
- \li New \c getText() method returns the text located between specified start and end indexes.
- Additionally TextEdit has a \l{TextEdit::}{getFormattedText()} method that returns the formatted
- text.
- \endlist
-\li \l Text only:
- \list
- \li \c Text.RightElide is now supported where text spans multiple lines.
- \li New \l{Text::}{linkColor} property controls the color of linked text.
- \li New \l{Text::}{lineLaidOut} signal is emitted for every line during the layout process to
- give the option of positioning and/or resizing lines as they are laid out.
- \li New \l{Text::}{doLayout()} method will trigger the text layout from Javascript.
- \li New \l{Text::}{fontSizeMode} property allows text to be fitted to the item size.
- \li New \l{Text::}{minimumPixelSize} and \l {Text::}{minimumPointSize} properties can be used to
- specify a lower bound when auto-fitting.
- \endlist
-\li TextEdit only:
- \list
- \li New \l{TextEdit::}{baseUrl} property specified the base URL used to resolve relative URLs
- within the text.
- \endlist
-\li TextInput only:
- \list
- \li New \l{TextInput::}{wrapMode} property sets the text wrapping mode.
- \li New \l{TextInput::}{horizontalAlignment} and \l{TextInput::}{verticalAlignment} properties.
- \li New \l{TextInput::}{length} property provides the total number of text characters.
- \li New \l{TextInput::}{persistentSelection} property enables the text selection to persist when
-the window loses focus.
- \li \l{TextInput::}{positionAt()} method now takes a y parameter.
- \endlist
-\endlist
-
-\section2 User Input
-
-\list
-\li New MultiPointTouchArea type processes multi-point touches and provides information on touch
- points including position, pressure and velocity. Touch point data is provided by the new \l
- TouchPoint type.
-\li New DropArea type provides more advanced drag and drop functionality.
-\li MouseArea:
- \list
- \li Wheel events are now supported; events are provided through the new WheelEvent type.
- \li New \l{MouseArea::}{propagateComposedEvents} property sets whether composed events are
- propagated to other mouse areas. If this property is true and the handlers of the
- \l{MouseArea::}{clicked}, \l{MouseArea::}{doubleClicked} or \l{MouseArea::}{pressAndHold}
- signals reject a mouse event, the event will be propagated to overlapping MouseArea items
- in the same area that are lower in the stacking order.
- \li New \l{MouseArea::}{cursorShape} property controls the cursor shape.
- \endlist
-\endlist
-
-\section2 Specialized Containers
-
-\list
-\li Flickable:
- \list
- \li New \l{Flickable::}{rebound} property specifies the transition to be applied when a
- flickable snaps back to its bounds.
- \li New \l{Flickable::}{topMargin}, \l{Flickable::}{bottomMargin}, \l{Flickable::}{leftMargin},
- \l{Flickable::}{rightMargin} allow extra margin space to be specified for a flickable. This can be
- used, for example, to implement pull-to-refresh functionality for a list.
- \li New \l{Flickable::}{originX} and \l{Flickable::}{originY} properties provide the top left
- position of the content item.
- \li New \l{Flickable::}{dragging}, \l{Flickable::}{draggingHorizontally} and
- \l{Flickable::}{draggingVertically} properties provide information on whether a flickable is
- currently being dragged.
- \li New \l{Flickable::}{flick()} method flicks the view with a specific velocity.
- \li New \l{Flickable::}{cancelFlick()} method stops any current flicking movement.
- \endlist
-\endlist
-
-\section2 Positioners (Row, Column, Grid, Flow types):
-
-\list
-\li Changes common to \l Row, \l Column, \l Grid and \l Flow:
- \list
- \li The \c add and \c move transitions can access a new ViewTransition attached property (see
- the ViewTransition documentation for examples) and can now animate arbitrary item properties
- (instead of being restricted to animating an item's position).
- \li New \c effectiveLayoutDirection property provides the read-only actual layout direction of a
- positioner.
- \li New \l Positioner type provides \c index, \c isFirstItem and \c isLastItem attached
- properties for items within positioners.
- \li All \c spacing properties on positioners now use real numbers instead of integers.
- \endlist
-\li Grid only:
- \list
- \li New \l{Grid::}{rowSpacing} and \l{Grid::}{columnSpacing} properties.
- \endlist
-\endlist
-
-\section2 Models and Views
-
-\list
-\li Any delegate of a view that uses a QAbstractItemModel-derived model type can use the syntax
- \c {model.<role> = <newDataValue>} to modify the data for a particular role. (Previously,
- the \c {model.<role>} syntax was only available for reading, not writing to, a role value.)
-\li ListModel:
- \list
- \li By default, roles can no longer change type during a model's lifetime. The new
- \l{ListModel::}{dynamicRoles} property can be set to restore the original (less performant)
- behavior.
- \endlist
-\li VisualDataModel:
- \list
- \li Now has features to filter the items to be displayed in a view. This is supported by the new
- \l {DelegateModel::}{groups}, \l {DelegateModel::}{filterOnGroup}, \l {DelegateModel::}{items}
- and \l {DelegateModel::}{persistedItems} properties.
- \endlist
-\li Changes common to both ListView and GridView:
- \list
- \li New transition support for animating the adding, removing and moving of items in a ListView
- or GridView. See the ViewTransition documentation for details.
- \li New \c verticalLayoutDirection property enables items to be laid out from bottom-to-top
- using the new \c BottomToTop enumeration value.
- \li New \c headerItem and \c footerItem properties provide access to the instantiated header and
- footer items.
- \li The \c cacheBuffer property now has a non-zero default.
- \li Delegates in the cache buffer are now created asynchronously.
- \li Setting a \c RightToLeft layout now also reverses the \c preferredHighlightBegin and \c
- preferredHighlightEnd.
- \li If the model is changed after the component is completed, currentIndex is reset to 0.
- \endlist
-\li ListView only:
- \list
- \li New \l{ListView::}{section.labelPositioning} property can fix the current section label to
- the start of the view, and the next section label to the end of the view, to prevent labels from
- scrolling while section items are still in view.
- \li \c highlightMoveSpeed and \c highlightResizeSpeed have been renamed to
- \l{ListView::}{highlightMoveVelocity} and \l{ListView::}{highlightResizeVelocity}.
- \endlist
-\li GridView only:
- \list
- \li \l{GridView::}{cellWidth} and \l{GridView::}{cellHeight} now use real numbers instead of
- integers.
- \endlist
-\li PathView:
- \list
- \li New \l{PathView::}{currentItem} property holds the current item in the view.
- \li New \l{PathView::}{maximumFlickVelocity} property controls the maximum flick velocity of the
- view.
- \li New \l{PathView::}{snapMode} property controls the snap model when flicking between items
- \li If the model is changed after the component is completed, the offset and currentIndex are
- reset to 0.
- \li New \l{PathView::}{positionViewAtIndex()} function allows the view to be moved to display
- the specified index.
- \li New \l{PathView::}{indexAt()} and \l{PathView::}{itemAt()} functions return the index or
- item at a specified point in the view.
- \endlist
-\endlist
-
-\section2 Utility types
-
-\list
-\li New \l Accessible attached property for implementing accessibility features in QML applications.
-\li \l Loader:
- \list
- \li New \l{Loader::}{asynchronous} property allows components to be instantiated with lower
- chance of blocking. If source is used with \e {asynchronous: true} the component will be compiled in
- a background thread.
- \li New \l{Loader::}{active} property can delay instantiation of a \l Loader object's
- \l{Loader::}{item}.
- \li New \l{Loader::}{setSource()} method loads an object with specific initial property values,
- similar to \l Component::createObject().
- \endlist
-\li \l Binding:
- \list
- \li This type can now be used as a value source, and will also restore any previously set
- binding when its \l{Binding::}{when} clause becomes false.
- \endlist
-\endlist
-
-\section2 Property types
-
-Support for various math and geometry-related value types, including QVector2D, QVector3D, QVector4D,
-QMatrix4x4 and QQuaternion, as well as QColor and QFont, are now provided by \l {Qt Quick}. Properties of
-these types can be declared in QML documents via the property syntax where the type name is \c vector2d,
-\c vector3d, \c vector4d, \c matrix4x4, \c quaternion, \c color and \c font respectively.
-
-\l {Qt Quick} also provides implementation for the various value type factory or utility functions of the
-\c Qt object which return or operate on values of the above types. The functions are:
-\table
- \header
- \li Value type
- \li Functions
-
- \row
- \li color
- \li Qt.rgba(), Qt.hsla(), Qt.tint(), Qt.lighter(), Qt.darker(), Qt.colorEqual()
-
- \row
- \li font
- \li Qt.font(), Qt.fontFamilies()
-
- \row
- \li vector2d
- \li Qt.vector2d()
-
- \row
- \li vector3d
- \li Qt.vector3d()
-
- \row
- \li vector4d
- \li Qt.vector4d()
-
- \row
- \li matrix4x4
- \li Qt.matrix4x4()
-
- \row
- \li quaternion
- \li Qt.quaternion()
-\endtable
-
-The \c Qt.rgba(), \c Qt.hsla(), \c Qt.tint(), \c Qt.lighter(), \c Qt.darker()
-and \c Qt.fontFamilies() functions already existed in \l {Qt Quick 1}{QtDeclarative} prior
-to \l {Qt Quick}{Qt Quick 2}; the other functions are all new in \l {Qt Quick}{Qt Quick 2}.
-
-\section1 Qt 5.0 - Additional QML Modules
-
-\section2 QtQuick.Particles
-
-This new module provides particle system support for creating a variety of 2D particle systems. See
-the \l QtQuick.Particles documentation for comprehensive details.
-
-This obsoletes the experimental \c Qt.labs.particles module.
-
-\section2 QtQuick.Window
-
-This new module contains the \l Window type for creating a basic window and the \l Screen type for
-accessing a screen's resolution and other details. See the \l QtQuick.Window
-documentation for comprehensive details.
-
-\section2 QtQuick.XmlListModel
-
-This new module contains XmlListModel and associated types, which were previously in the \c QtQuick
-module. See the \l QtQuick.XmlListModel documentation for details.
-
-\section2 QtQuick.LocalStorage
-
-This new module provides access to the SQL Local Storage API that was previously accessible from the
-\l {QML Global Object}. See the \l QtQuick.LocalStorage documentation for details.
-*/
diff --git a/src/quick/items/checksync.pl b/src/quick/items/checksync.pl
index 4e05492671..ca51ddd622 100755
--- a/src/quick/items/checksync.pl
+++ b/src/quick/items/checksync.pl
@@ -1,8 +1,8 @@
#!/usr/bin/perl
#############################################################################
##
-## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-## Contact: http://www.qt-project.org/legal
+## Copyright (C) 2015 The Qt Company Ltd.
+## Contact: http://www.qt.io/licensing/
##
## This file is part of the Declarative module of the Qt Toolkit.
##
@@ -11,9 +11,9 @@
## Licensees holding valid commercial Qt licenses may use this file in
## accordance with the commercial license agreement provided with the
## Software or, alternatively, in accordance with the terms contained in
-## a written agreement between you and Digia. For licensing terms and
-## conditions see http://qt.digia.com/licensing. For further information
-## use the contact form at http://qt.digia.com/contact-us.
+## a written agreement between you and The Qt Company. For licensing terms
+## and conditions see http://www.qt.io/terms-conditions. For further
+## information use the contact form at http://www.qt.io/contact-us.
##
## GNU Lesser General Public License Usage
## Alternatively, this file may be used under the terms of the GNU Lesser
@@ -24,8 +24,8 @@
## requirements will be met: https://www.gnu.org/licenses/lgpl.html and
## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
##
-## In addition, as a special exception, Digia gives you certain additional
-## rights. These rights are described in the Digia Qt LGPL Exception
+## As a special exception, The Qt Company gives you certain additional
+## rights. These rights are described in The Qt Company LGPL Exception
## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
##
## $QT_END_LICENSE$
diff --git a/src/quick/items/context2d/qquickcanvascontext.cpp b/src/quick/items/context2d/qquickcanvascontext.cpp
index af2c988f10..8cf3c8ec05 100644
--- a/src/quick/items/context2d/qquickcanvascontext.cpp
+++ b/src/quick/items/context2d/qquickcanvascontext.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/context2d/qquickcanvascontext_p.h b/src/quick/items/context2d/qquickcanvascontext_p.h
index e036e0b18d..b7a7f6db71 100644
--- a/src/quick/items/context2d/qquickcanvascontext_p.h
+++ b/src/quick/items/context2d/qquickcanvascontext_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -60,7 +60,7 @@ public:
virtual void prepare(const QSize& canvasSize, const QSize& tileSize, const QRect& canvasWindow, const QRect& dirtyRect, bool smooth, bool antialiasing);
virtual void flush();
- virtual void setV8Engine(QV8Engine *engine) = 0;
+ virtual void setV4Engine(QV4::ExecutionEngine *engine) = 0;
virtual QV4::ReturnedValue v4value() const = 0;
virtual QImage toImage(const QRectF& bounds) = 0;
diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp
index b39c4e49f8..cb694c499a 100644
--- a/src/quick/items/context2d/qquickcanvasitem.cpp
+++ b/src/quick/items/context2d/qquickcanvasitem.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -277,7 +277,7 @@ QQuickCanvasItemPrivate::~QQuickCanvasItemPrivate()
\section1 Tips for Porting Existing HTML5 Canvas Applications
- Although the Canvas item is provides a HTML5 like API, HTML5 canvas
+ Although the Canvas item provides an HTML5-like API, HTML5 canvas
applications need to be modified to run in the Canvas item:
\list
\li Replace all DOM API calls with QML property bindings or Canvas item methods.
@@ -866,7 +866,7 @@ void QQuickCanvasItem::requestAnimationFrame(QQmlV4Function *args)
static int id = 0;
- d->animationCallbacks.insert(++id, QV4::PersistentValue(f));
+ d->animationCallbacks.insert(++id, QV4::PersistentValue(scope.engine, f->asReturnedValue()));
if (isVisible())
polish();
@@ -1147,7 +1147,7 @@ void QQuickCanvasItem::initializeContext(QQuickCanvasContext *context, const QVa
d->context = context;
d->context->init(this, args);
- d->context->setV8Engine(QQmlEnginePrivate::getV8Engine(qmlEngine(this)));
+ d->context->setV4Engine(QQmlEnginePrivate::get(qmlEngine(this))->v4engine());
connect(d->context, SIGNAL(textureChanged()), SLOT(update()));
connect(d->context, SIGNAL(textureChanged()), SIGNAL(painted()));
emit contextChanged();
diff --git a/src/quick/items/context2d/qquickcanvasitem_p.h b/src/quick/items/context2d/qquickcanvasitem_p.h
index b3509a5e58..bcd7072903 100644
--- a/src/quick/items/context2d/qquickcanvasitem_p.h
+++ b/src/quick/items/context2d/qquickcanvasitem_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -162,12 +162,12 @@ private Q_SLOTS:
void invalidateSceneGraph();
protected:
- void componentComplete();
- void itemChange(QQuickItem::ItemChange, const QQuickItem::ItemChangeData &);
- void updatePolish();
- QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
- void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
- void releaseResources();
+ void componentComplete() Q_DECL_OVERRIDE;
+ void itemChange(QQuickItem::ItemChange, const QQuickItem::ItemChangeData &) Q_DECL_OVERRIDE;
+ void updatePolish() Q_DECL_OVERRIDE;
+ QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+ void releaseResources() Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QQuickCanvasItem)
Q_INVOKABLE void delayedCreate();
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp
index 2d1bb4d933..4aa3b1c8d0 100644
--- a/src/quick/items/context2d/qquickcontext2d.cpp
+++ b/src/quick/items/context2d/qquickcontext2d.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -37,7 +37,6 @@
#include <private/qquickcontext2dtexture_p.h>
#include <private/qquickitem_p.h>
#include <QtQuick/private/qquickshadereffectsource_p.h>
-#include <QtGui/qopenglframebufferobject.h>
#include <QtQuick/private/qsgcontext_p.h>
#include <private/qquicksvgparser_p.h>
@@ -45,16 +44,13 @@
#include <private/qquickimage_p_p.h>
-#include <QtGui/qguiapplication.h>
#include <qqmlinfo.h>
-#include <QtCore/qmath.h>
#include <private/qv8engine_p.h>
#include <qqmlengine.h>
#include <private/qv4domerrors_p.h>
#include <private/qv4engine_p.h>
#include <private/qv4object_p.h>
-#include <QtCore/qnumeric.h>
#include <private/qquickwindow_p.h>
#include <private/qv4value_inl_p.h>
@@ -62,11 +58,15 @@
#include <private/qv4objectproto_p.h>
#include <private/qv4scopedvalue_p.h>
+#include <QtCore/qmath.h>
+#include <QtCore/qnumeric.h>
+#include <QtCore/QRunnable>
+#include <QtGui/qguiapplication.h>
+#include <QtGui/qopenglframebufferobject.h>
#include <private/qguiapplication_p.h>
#include <qpa/qplatformintegration.h>
-#include <QtCore/QRunnable>
-
+#include <cmath>
#if defined(Q_OS_QNX) || defined(Q_OS_ANDROID)
#include <ctype.h>
#endif
@@ -113,9 +113,7 @@ QT_BEGIN_NAMESPACE
Q_CORE_EXPORT double qstrtod(const char *s00, char const **se, bool *ok);
-static const double Q_PI = 3.14159265358979323846; // pi
-
-#define DEGREES(t) ((t) * 180.0 / Q_PI)
+#define DEGREES(t) ((t) * 180.0 / M_PI)
#define CHECK_CONTEXT(r) if (!r || !r->d()->context || !r->d()->context->bufferValid()) \
V4THROW_ERROR("Not a Context2D object");
@@ -124,9 +122,9 @@ static const double Q_PI = 3.14159265358979323846; // pi
V4THROW_ERROR("Not a Context2D object");
#define qClamp(val, min, max) qMin(qMax(val, min), max)
#define CHECK_RGBA(c) (c == '-' || c == '.' || (c >=0 && c <= 9))
-QColor qt_color_from_string(const QV4::ValueRef name)
+QColor qt_color_from_string(const QV4::Value &name)
{
- QByteArray str = name->toQString().toUtf8();
+ QByteArray str = name.toQString().toUtf8();
char *p = str.data();
int len = str.length();
@@ -463,7 +461,7 @@ static QFont qt_font_from_string(const QString& fontString, const QFont &current
class QQuickContext2DEngineData : public QV8Engine::Deletable
{
public:
- QQuickContext2DEngineData(QV8Engine *engine);
+ QQuickContext2DEngineData(QV4::ExecutionEngine *engine);
~QQuickContext2DEngineData();
QV4::PersistentValue contextPrototype;
@@ -471,20 +469,47 @@ public:
QV4::PersistentValue pixelArrayProto;
};
-V8_DEFINE_EXTENSION(QQuickContext2DEngineData, engineData)
+V4_DEFINE_EXTENSION(QQuickContext2DEngineData, engineData)
+
+namespace QV4 {
+namespace Heap {
+
+struct QQuickJSContext2D : Object {
+ QQuickJSContext2D(QV4::ExecutionEngine *engine);
+ QQuickContext2D* context;
+};
+
+struct QQuickJSContext2DPrototype : Object {
+ QQuickJSContext2DPrototype(ExecutionEngine *e)
+ : Object(e) {}
+};
+
+struct QQuickContext2DStyle : Object {
+ QQuickContext2DStyle(QV4::ExecutionEngine *e);
+
+ QBrush brush;
+ bool patternRepeatX:1;
+ bool patternRepeatY:1;
+};
+
+struct QQuickJSContext2DPixelData : Object {
+ QQuickJSContext2DPixelData(QV4::ExecutionEngine *engine);
+
+ QImage image;
+};
+
+struct QQuickJSContext2DImageData : Object {
+ QQuickJSContext2DImageData(QV4::ExecutionEngine *engine);
+ QV4::Value pixelData;
+};
+
+}
+}
struct QQuickJSContext2D : public QV4::Object
{
- struct Data : Object::Data {
- Data(QV4::ExecutionEngine *engine)
- : Object::Data(engine)
- {
- setVTable(staticVTable());
- }
- QQuickContext2D* context;
- };
- V4_OBJECT(QV4::Object)
+ V4_OBJECT2(QQuickJSContext2D, QV4::Object)
static QV4::ReturnedValue method_get_globalAlpha(QV4::CallContext *ctx);
static QV4::ReturnedValue method_set_globalAlpha(QV4::CallContext *ctx);
@@ -527,17 +552,22 @@ struct QQuickJSContext2D : public QV4::Object
static QV4::ReturnedValue method_set_textBaseline(QV4::CallContext *ctx);
};
+QV4::Heap::QQuickJSContext2D::QQuickJSContext2D(QV4::ExecutionEngine *engine)
+ : QV4::Heap::Object(engine)
+{
+}
+
DEFINE_OBJECT_VTABLE(QQuickJSContext2D);
struct QQuickJSContext2DPrototype : public QV4::Object
{
- V4_OBJECT(QV4::Object)
+ V4_OBJECT2(QQuickJSContext2DPrototype, QV4::Object)
public:
- static QQuickJSContext2DPrototype *create(QV4::ExecutionEngine *engine)
+ static QV4::Heap::QQuickJSContext2DPrototype *create(QV4::ExecutionEngine *engine)
{
QV4::Scope scope(engine);
- QV4::ScopedObject o(scope, engine->memoryManager->alloc<QQuickJSContext2DPrototype>(engine));
+ QV4::Scoped<QQuickJSContext2DPrototype> o(scope, engine->memoryManager->alloc<QQuickJSContext2DPrototype>(engine));
o->defineDefaultProperty(QStringLiteral("quadraticCurveTo"), method_quadraticCurveTo, 0);
o->defineDefaultProperty(QStringLiteral("restore"), method_restore, 0);
@@ -584,7 +614,7 @@ public:
o->defineDefaultProperty(QStringLiteral("closePath"), method_closePath, 0);
o->defineAccessorProperty(QStringLiteral("canvas"), QQuickJSContext2DPrototype::method_get_canvas, 0);
- return static_cast<QQuickJSContext2DPrototype*>(o.getPointer());
+ return o->d();
}
static QV4::ReturnedValue method_get_canvas(QV4::CallContext *ctx);
@@ -639,28 +669,19 @@ DEFINE_OBJECT_VTABLE(QQuickJSContext2DPrototype);
struct QQuickContext2DStyle : public QV4::Object
{
- struct Data : Object::Data {
- Data(QV4::ExecutionEngine *e)
- : Object::Data(e)
- {
- patternRepeatX = false;
- patternRepeatY = false;
- setVTable(staticVTable());
- }
- QBrush brush;
- bool patternRepeatX:1;
- bool patternRepeatY:1;
- };
- V4_OBJECT(QV4::Object)
+ V4_OBJECT2(QQuickContext2DStyle, QV4::Object)
+ V4_NEEDS_DESTROY
static QV4::ReturnedValue gradient_proto_addColorStop(QV4::CallContext *ctx);
-protected:
- static void destroy(Managed *that)
- {
- static_cast<QQuickContext2DStyle *>(that)->d()->~Data();
- }
};
+QV4::Heap::QQuickContext2DStyle::QQuickContext2DStyle(QV4::ExecutionEngine *e)
+ : QV4::Heap::Object(e)
+{
+ patternRepeatX = false;
+ patternRepeatY = false;
+}
+
DEFINE_OBJECT_VTABLE(QQuickContext2DStyle);
QImage qt_image_convolute_filter(const QImage& src, const QVector<qreal>& weights, int radius = 0)
@@ -860,70 +881,61 @@ static QString qt_composite_mode_to_string(QPainter::CompositionMode op)
struct QQuickJSContext2DPixelData : public QV4::Object
{
- struct Data : Object::Data {
- Data(QV4::ExecutionEngine *engine)
- : Object::Data(engine)
- {
- setVTable(staticVTable());
- QV4::Scope scope(engine);
- QV4::ScopedObject o(scope, this);
- o->setArrayType(QV4::ArrayData::Custom);
- }
- QImage image;
- };
- V4_OBJECT(QV4::Object)
+ V4_OBJECT2(QQuickJSContext2DPixelData, QV4::Object)
+ V4_NEEDS_DESTROY
- static void destroy(QV4::Managed *that) {
- static_cast<QQuickJSContext2DPixelData *>(that)->d()->~Data();
- }
static QV4::ReturnedValue getIndexed(QV4::Managed *m, uint index, bool *hasProperty);
- static void putIndexed(QV4::Managed *m, uint index, const QV4::ValueRef value);
+ static void putIndexed(QV4::Managed *m, uint index, const QV4::Value &value);
static QV4::ReturnedValue proto_get_length(QV4::CallContext *ctx);
};
+QV4::Heap::QQuickJSContext2DPixelData::QQuickJSContext2DPixelData(QV4::ExecutionEngine *engine)
+ : QV4::Heap::Object(engine)
+{
+ QV4::Scope scope(engine);
+ QV4::ScopedObject o(scope, this);
+ o->setArrayType(QV4::Heap::ArrayData::Custom);
+}
+
DEFINE_OBJECT_VTABLE(QQuickJSContext2DPixelData);
struct QQuickJSContext2DImageData : public QV4::Object
{
- struct Data : Object::Data {
- Data(QV4::ExecutionEngine *engine)
- : Object::Data(engine)
- {
- setVTable(staticVTable());
- pixelData = QV4::Primitive::undefinedValue();
-
- QV4::Scope scope(engine);
- QV4::ScopedObject o(scope, this);
-
- o->defineAccessorProperty(QStringLiteral("width"), method_get_width, 0);
- o->defineAccessorProperty(QStringLiteral("height"), method_get_height, 0);
- o->defineAccessorProperty(QStringLiteral("data"), method_get_data, 0);
- }
- QV4::Value pixelData;
- };
- V4_OBJECT(QV4::Object)
+ V4_OBJECT2(QQuickJSContext2DImageData, QV4::Object)
static QV4::ReturnedValue method_get_width(QV4::CallContext *ctx);
static QV4::ReturnedValue method_get_height(QV4::CallContext *ctx);
static QV4::ReturnedValue method_get_data(QV4::CallContext *ctx);
- static void markObjects(Managed *that, QV4::ExecutionEngine *engine) {
- static_cast<QQuickJSContext2DImageData *>(that)->d()->pixelData.mark(engine);
+ static void markObjects(QV4::Heap::Base *that, QV4::ExecutionEngine *engine) {
+ static_cast<QQuickJSContext2DImageData::Data *>(that)->pixelData.mark(engine);
QV4::Object::markObjects(that, engine);
}
};
+QV4::Heap::QQuickJSContext2DImageData::QQuickJSContext2DImageData(QV4::ExecutionEngine *engine)
+ : QV4::Heap::Object(engine)
+{
+ pixelData = QV4::Primitive::undefinedValue();
+
+ QV4::Scope scope(engine);
+ QV4::ScopedObject o(scope, this);
+
+ o->defineAccessorProperty(QStringLiteral("width"), ::QQuickJSContext2DImageData::method_get_width, 0);
+ o->defineAccessorProperty(QStringLiteral("height"), ::QQuickJSContext2DImageData::method_get_height, 0);
+ o->defineAccessorProperty(QStringLiteral("data"), ::QQuickJSContext2DImageData::method_get_data, 0);
+}
+
DEFINE_OBJECT_VTABLE(QQuickJSContext2DImageData);
-static QV4::ReturnedValue qt_create_image_data(qreal w, qreal h, QV8Engine* engine, const QImage& image)
+static QV4::ReturnedValue qt_create_image_data(qreal w, qreal h, QV4::ExecutionEngine *v4, const QImage& image)
{
- QQuickContext2DEngineData *ed = engineData(engine);
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine);
QV4::Scope scope(v4);
+ QQuickContext2DEngineData *ed = engineData(scope.engine);
QV4::Scoped<QQuickJSContext2DPixelData> pixelData(scope, scope.engine->memoryManager->alloc<QQuickJSContext2DPixelData>(v4));
QV4::ScopedObject p(scope, ed->pixelArrayProto.value());
- pixelData->setPrototype(p.getPointer());
+ pixelData->setPrototype(p);
if (image.isNull()) {
pixelData->d()->image = QImage(w, h, QImage::Format_ARGB32);
@@ -949,7 +961,7 @@ static QV4::ReturnedValue qt_create_image_data(qreal w, qreal h, QV8Engine* engi
QV4::ReturnedValue QQuickJSContext2DPrototype::method_get_canvas(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
return QV4::QObjectWrapper::wrap(scope.engine, r->d()->context->canvas());
@@ -964,11 +976,11 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_get_canvas(QV4::CallContex
QV4::ReturnedValue QQuickJSContext2DPrototype::method_restore(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
r->d()->context->popState();
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -978,12 +990,12 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_restore(QV4::CallContext *
QV4::ReturnedValue QQuickJSContext2DPrototype::method_reset(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
r->d()->context->reset();
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -1019,12 +1031,12 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_reset(QV4::CallContext *ct
QV4::ReturnedValue QQuickJSContext2DPrototype::method_save(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
r->d()->context->pushState();
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
// transformations
@@ -1048,12 +1060,12 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_save(QV4::CallContext *ctx
QV4::ReturnedValue QQuickJSContext2DPrototype::method_rotate(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 1)
- r->d()->context->rotate(ctx->d()->callData->args[0].toNumber());
- return ctx->d()->callData->thisObject.asReturnedValue();
+ if (ctx->argc() >= 1)
+ r->d()->context->rotate(ctx->args()[0].toNumber());
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -1076,13 +1088,13 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_rotate(QV4::CallContext *c
QV4::ReturnedValue QQuickJSContext2DPrototype::method_scale(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 2)
- r->d()->context->scale(ctx->d()->callData->args[0].toNumber(), ctx->d()->callData->args[1].toNumber());
- return ctx->d()->callData->thisObject.asReturnedValue();
+ if (ctx->argc() >= 2)
+ r->d()->context->scale(ctx->args()[0].toNumber(), ctx->args()[1].toNumber());
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -1122,19 +1134,19 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_scale(QV4::CallContext *ct
QV4::ReturnedValue QQuickJSContext2DPrototype::method_setTransform(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 6)
- r->d()->context->setTransform( ctx->d()->callData->args[0].toNumber()
- , ctx->d()->callData->args[1].toNumber()
- , ctx->d()->callData->args[2].toNumber()
- , ctx->d()->callData->args[3].toNumber()
- , ctx->d()->callData->args[4].toNumber()
- , ctx->d()->callData->args[5].toNumber());
+ if (ctx->argc() >= 6)
+ r->d()->context->setTransform( ctx->args()[0].toNumber()
+ , ctx->args()[1].toNumber()
+ , ctx->args()[2].toNumber()
+ , ctx->args()[3].toNumber()
+ , ctx->args()[4].toNumber()
+ , ctx->args()[5].toNumber());
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -1151,18 +1163,18 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_setTransform(QV4::CallCont
QV4::ReturnedValue QQuickJSContext2DPrototype::method_transform(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 6)
- r->d()->context->transform( ctx->d()->callData->args[0].toNumber()
- , ctx->d()->callData->args[1].toNumber()
- , ctx->d()->callData->args[2].toNumber()
- , ctx->d()->callData->args[3].toNumber()
- , ctx->d()->callData->args[4].toNumber()
- , ctx->d()->callData->args[5].toNumber());
+ if (ctx->argc() >= 6)
+ r->d()->context->transform( ctx->args()[0].toNumber()
+ , ctx->args()[1].toNumber()
+ , ctx->args()[2].toNumber()
+ , ctx->args()[3].toNumber()
+ , ctx->args()[4].toNumber()
+ , ctx->args()[5].toNumber());
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -1177,12 +1189,12 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_transform(QV4::CallContext
QV4::ReturnedValue QQuickJSContext2DPrototype::method_translate(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 2)
- r->d()->context->translate(ctx->d()->callData->args[0].toNumber(), ctx->d()->callData->args[1].toNumber());
- return ctx->d()->callData->thisObject.asReturnedValue();
+ if (ctx->argc() >= 2)
+ r->d()->context->translate(ctx->args()[0].toNumber(), ctx->args()[1].toNumber());
+ return ctx->thisObject().asReturnedValue();
}
@@ -1197,12 +1209,12 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_translate(QV4::CallContext
QV4::ReturnedValue QQuickJSContext2DPrototype::method_resetTransform(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
r->d()->context->setTransform(1, 0, 0, 1, 0, 0);
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
@@ -1215,13 +1227,13 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_resetTransform(QV4::CallCo
QV4::ReturnedValue QQuickJSContext2DPrototype::method_shear(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 2)
- r->d()->context->shear(ctx->d()->callData->args[0].toNumber(), ctx->d()->callData->args[1].toNumber());
+ if (ctx->argc() >= 2)
+ r->d()->context->shear(ctx->args()[0].toNumber(), ctx->args()[1].toNumber());
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
// compositing
@@ -1235,7 +1247,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_shear(QV4::CallContext *ct
QV4::ReturnedValue QQuickJSContext2D::method_get_globalAlpha(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
return QV4::Encode(r->d()->context->state.globalAlpha);
@@ -1244,10 +1256,10 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_globalAlpha(QV4::CallContext *c
QV4::ReturnedValue QQuickJSContext2D::method_set_globalAlpha(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT_SETTER(r)
- double globalAlpha = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
+ double globalAlpha = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
if (!qIsFinite(globalAlpha))
return QV4::Encode::undefined();
@@ -1288,7 +1300,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_globalAlpha(QV4::CallContext *c
QV4::ReturnedValue QQuickJSContext2D::method_get_globalCompositeOperation(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
return QV4::Encode(scope.engine->newString(qt_composite_mode_to_string(r->d()->context->state.globalCompositeOperation)));
@@ -1297,13 +1309,13 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_globalCompositeOperation(QV4::C
QV4::ReturnedValue QQuickJSContext2D::method_set_globalCompositeOperation(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT_SETTER(r)
- if (!ctx->d()->callData->argc)
- return ctx->throwTypeError();
+ if (!ctx->argc())
+ return ctx->engine()->throwTypeError();
- QString mode = ctx->d()->callData->args[0].toQString();
+ QString mode = ctx->args()[0].toQString();
QPainter::CompositionMode cm = qt_composite_mode_from_string(mode);
if (cm == QPainter::CompositionMode_SourceOver && mode != QStringLiteral("source-over"))
return QV4::Encode::undefined();
@@ -1341,7 +1353,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_globalCompositeOperation(QV4::C
QV4::ReturnedValue QQuickJSContext2D::method_get_fillStyle(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
QColor color = r->d()->context->state.fillStyle.color();
@@ -1362,24 +1374,23 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_fillStyle(QV4::CallContext *ctx
QV4::ReturnedValue QQuickJSContext2D::method_set_fillStyle(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT_SETTER(r)
QV4::ScopedValue value(scope, ctx->argument(0));
- QV8Engine *engine = scope.engine->v8Engine;
if (value->asObject()) {
- QColor color = engine->toVariant(value, qMetaTypeId<QColor>()).value<QColor>();
+ QColor color = scope.engine->toVariant(value, qMetaTypeId<QColor>()).value<QColor>();
if (color.isValid()) {
r->d()->context->state.fillStyle = color;
r->d()->context->buffer()->setFillStyle(color);
- r->d()->context->m_fillStyle = value;
+ r->d()->context->m_fillStyle.set(scope.engine, value);
} else {
QV4::Scoped<QQuickContext2DStyle> style(scope, value->as<QQuickContext2DStyle>());
if (style && style->d()->brush != r->d()->context->state.fillStyle) {
r->d()->context->state.fillStyle = style->d()->brush;
r->d()->context->buffer()->setFillStyle(style->d()->brush, style->d()->patternRepeatX, style->d()->patternRepeatY);
- r->d()->context->m_fillStyle = value;
+ r->d()->context->m_fillStyle.set(scope.engine, value);
r->d()->context->state.fillPatternRepeatX = style->d()->patternRepeatX;
r->d()->context->state.fillPatternRepeatY = style->d()->patternRepeatY;
}
@@ -1389,7 +1400,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_fillStyle(QV4::CallContext *ctx
if (color.isValid() && r->d()->context->state.fillStyle != QBrush(color)) {
r->d()->context->state.fillStyle = QBrush(color);
r->d()->context->buffer()->setFillStyle(r->d()->context->state.fillStyle);
- r->d()->context->m_fillStyle = value;
+ r->d()->context->m_fillStyle.set(scope.engine, value);
}
}
return QV4::Encode::undefined();
@@ -1409,17 +1420,16 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_fillStyle(QV4::CallContext *ctx
QV4::ReturnedValue QQuickJSContext2D::method_get_fillRule(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- QV8Engine *engine = scope.engine->v8Engine;
- return engine->fromVariant(r->d()->context->state.fillRule);
+ return scope.engine->fromVariant(r->d()->context->state.fillRule);
}
QV4::ReturnedValue QQuickJSContext2D::method_set_fillRule(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT_SETTER(r)
QV4::ScopedValue value(scope, ctx->argument(0));
@@ -1452,7 +1462,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_fillRule(QV4::CallContext *ctx)
QV4::ReturnedValue QQuickJSContext2D::method_get_strokeStyle(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
QColor color = r->d()->context->state.strokeStyle.color();
@@ -1473,24 +1483,23 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_strokeStyle(QV4::CallContext *c
QV4::ReturnedValue QQuickJSContext2D::method_set_strokeStyle(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT_SETTER(r)
- QV8Engine *engine = scope.engine->v8Engine;
QV4::ScopedValue value(scope, ctx->argument(0));
if (value->asObject()) {
- QColor color = engine->toVariant(value, qMetaTypeId<QColor>()).value<QColor>();
+ QColor color = scope.engine->toVariant(value, qMetaTypeId<QColor>()).value<QColor>();
if (color.isValid()) {
r->d()->context->state.fillStyle = color;
r->d()->context->buffer()->setStrokeStyle(color);
- r->d()->context->m_strokeStyle = value;
+ r->d()->context->m_strokeStyle.set(scope.engine, value);
} else {
QV4::Scoped<QQuickContext2DStyle> style(scope, value->as<QQuickContext2DStyle>());
if (style && style->d()->brush != r->d()->context->state.strokeStyle) {
r->d()->context->state.strokeStyle = style->d()->brush;
r->d()->context->buffer()->setStrokeStyle(style->d()->brush, style->d()->patternRepeatX, style->d()->patternRepeatY);
- r->d()->context->m_strokeStyle = value;
+ r->d()->context->m_strokeStyle.set(scope.engine, value);
r->d()->context->state.strokePatternRepeatX = style->d()->patternRepeatX;
r->d()->context->state.strokePatternRepeatY = style->d()->patternRepeatY;
@@ -1501,7 +1510,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_strokeStyle(QV4::CallContext *c
if (color.isValid() && r->d()->context->state.strokeStyle != QBrush(color)) {
r->d()->context->state.strokeStyle = QBrush(color);
r->d()->context->buffer()->setStrokeStyle(r->d()->context->state.strokeStyle);
- r->d()->context->m_strokeStyle = value;
+ r->d()->context->m_strokeStyle.set(scope.engine, value);
}
}
return QV4::Encode::undefined();
@@ -1527,17 +1536,14 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_strokeStyle(QV4::CallContext *c
QV4::ReturnedValue QQuickJSContext2DPrototype::method_createLinearGradient(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
-
- QV8Engine *engine = scope.engine->v8Engine;
-
- if (ctx->d()->callData->argc >= 4) {
- qreal x0 = ctx->d()->callData->args[0].toNumber();
- qreal y0 = ctx->d()->callData->args[1].toNumber();
- qreal x1 = ctx->d()->callData->args[2].toNumber();
- qreal y1 = ctx->d()->callData->args[3].toNumber();
+ if (ctx->argc() >= 4) {
+ qreal x0 = ctx->args()[0].toNumber();
+ qreal y0 = ctx->args()[1].toNumber();
+ qreal x1 = ctx->args()[2].toNumber();
+ qreal y1 = ctx->args()[3].toNumber();
if (!qIsFinite(x0)
|| !qIsFinite(y0)
@@ -1545,16 +1551,16 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createLinearGradient(QV4::
|| !qIsFinite(y1)) {
V4THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "createLinearGradient(): Incorrect arguments")
}
- QQuickContext2DEngineData *ed = engineData(engine);
+ QQuickContext2DEngineData *ed = engineData(scope.engine);
QV4::Scoped<QQuickContext2DStyle> gradient(scope, scope.engine->memoryManager->alloc<QQuickContext2DStyle>(scope.engine));
QV4::ScopedObject p(scope, ed->gradientProto.value());
- gradient->setPrototype(p.getPointer());
+ gradient->setPrototype(p);
gradient->d()->brush = QLinearGradient(x0, y0, x1, y1);
return gradient.asReturnedValue();
}
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -1573,19 +1579,16 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createLinearGradient(QV4::
QV4::ReturnedValue QQuickJSContext2DPrototype::method_createRadialGradient(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
-
- QV8Engine *engine = scope.engine->v8Engine;
-
- if (ctx->d()->callData->argc >= 6) {
- qreal x0 = ctx->d()->callData->args[0].toNumber();
- qreal y0 = ctx->d()->callData->args[1].toNumber();
- qreal r0 = ctx->d()->callData->args[2].toNumber();
- qreal x1 = ctx->d()->callData->args[3].toNumber();
- qreal y1 = ctx->d()->callData->args[4].toNumber();
- qreal r1 = ctx->d()->callData->args[5].toNumber();
+ if (ctx->argc() >= 6) {
+ qreal x0 = ctx->args()[0].toNumber();
+ qreal y0 = ctx->args()[1].toNumber();
+ qreal r0 = ctx->args()[2].toNumber();
+ qreal x1 = ctx->args()[3].toNumber();
+ qreal y1 = ctx->args()[4].toNumber();
+ qreal r1 = ctx->args()[5].toNumber();
if (!qIsFinite(x0)
|| !qIsFinite(y0)
@@ -1599,16 +1602,16 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createRadialGradient(QV4::
if (r0 < 0 || r1 < 0)
V4THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "createRadialGradient(): Incorrect arguments")
- QQuickContext2DEngineData *ed = engineData(engine);
+ QQuickContext2DEngineData *ed = engineData(scope.engine);
QV4::Scoped<QQuickContext2DStyle> gradient(scope, scope.engine->memoryManager->alloc<QQuickContext2DStyle>(scope.engine));
QV4::ScopedObject p(scope, ed->gradientProto.value());
- gradient->setPrototype(p.getPointer());
+ gradient->setPrototype(p);
gradient->d()->brush = QRadialGradient(QPointF(x1, y1), r0+r1, QPointF(x0, y0));
return gradient.asReturnedValue();
}
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -1627,16 +1630,13 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createRadialGradient(QV4::
QV4::ReturnedValue QQuickJSContext2DPrototype::method_createConicalGradient(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
-
- QV8Engine *engine = scope.engine->v8Engine;
-
- if (ctx->d()->callData->argc >= 3) {
- qreal x = ctx->d()->callData->args[0].toNumber();
- qreal y = ctx->d()->callData->args[1].toNumber();
- qreal angle = DEGREES(ctx->d()->callData->args[2].toNumber());
+ if (ctx->argc() >= 3) {
+ qreal x = ctx->args()[0].toNumber();
+ qreal y = ctx->args()[1].toNumber();
+ qreal angle = DEGREES(ctx->args()[2].toNumber());
if (!qIsFinite(x) || !qIsFinite(y)) {
V4THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "createConicalGradient(): Incorrect arguments");
}
@@ -1645,16 +1645,16 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createConicalGradient(QV4:
V4THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "createConicalGradient(): Incorrect arguments");
}
- QQuickContext2DEngineData *ed = engineData(engine);
+ QQuickContext2DEngineData *ed = engineData(scope.engine);
QV4::Scoped<QQuickContext2DStyle> gradient(scope, scope.engine->memoryManager->alloc<QQuickContext2DStyle>(scope.engine));
QV4::ScopedObject p(scope, ed->gradientProto.value());
- gradient->setPrototype(p.getPointer());
+ gradient->setPrototype(p);
gradient->d()->brush = QConicalGradient(x, y, angle);
return gradient.asReturnedValue();
}
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
\qmlmethod variant QtQuick::Context2D::createPattern(color color, enumeration patternMode)
@@ -1702,17 +1702,15 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createConicalGradient(QV4:
QV4::ReturnedValue QQuickJSContext2DPrototype::method_createPattern(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- QV8Engine *engine = scope.engine->v8Engine;
-
- if (ctx->d()->callData->argc >= 2) {
+ if (ctx->argc() >= 2) {
QV4::Scoped<QQuickContext2DStyle> pattern(scope, scope.engine->memoryManager->alloc<QQuickContext2DStyle>(scope.engine));
- QColor color = engine->toVariant(ctx->d()->callData->args[0], qMetaTypeId<QColor>()).value<QColor>();
+ QColor color = scope.engine->toVariant(ctx->args()[0], qMetaTypeId<QColor>()).value<QColor>();
if (color.isValid()) {
- int patternMode = ctx->d()->callData->args[1].toInt32();
+ int patternMode = ctx->args()[1].toInt32();
Qt::BrushStyle style = Qt::SolidPattern;
if (patternMode >= 0 && patternMode < Qt::LinearGradientPattern) {
style = static_cast<Qt::BrushStyle>(patternMode);
@@ -1721,20 +1719,20 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createPattern(QV4::CallCon
} else {
QImage patternTexture;
- if (QV4::Object *o = ctx->d()->callData->args[0].asObject()) {
+ if (QV4::Object *o = ctx->args()[0].asObject()) {
QV4::ScopedString s(scope, scope.engine->newString(QStringLiteral("data")));
- QV4::Scoped<QQuickJSContext2DPixelData> pixelData(scope, o->get(s.getPointer()));
+ QV4::Scoped<QQuickJSContext2DPixelData> pixelData(scope, o->get(s));
if (!!pixelData) {
patternTexture = pixelData->d()->image;
}
} else {
- patternTexture = r->d()->context->createPixmap(QUrl(ctx->d()->callData->args[0].toQStringNoThrow()))->image();
+ patternTexture = r->d()->context->createPixmap(QUrl(ctx->args()[0].toQStringNoThrow()))->image();
}
if (!patternTexture.isNull()) {
pattern->d()->brush.setTextureImage(patternTexture);
- QString repetition = ctx->d()->callData->args[1].toQStringNoThrow();
+ QString repetition = ctx->args()[1].toQStringNoThrow();
if (repetition == QStringLiteral("repeat") || repetition.isEmpty()) {
pattern->d()->patternRepeatX = true;
pattern->d()->patternRepeatY = true;
@@ -1775,7 +1773,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createPattern(QV4::CallCon
QV4::ReturnedValue QQuickJSContext2D::method_get_lineCap(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
switch (r->d()->context->state.lineCap) {
@@ -1793,10 +1791,10 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_lineCap(QV4::CallContext *ctx)
QV4::ReturnedValue QQuickJSContext2D::method_set_lineCap(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT_SETTER(r)
- QString lineCap = ctx->d()->callData->args[0].toQString();
+ QString lineCap = ctx->args()[0].toQString();
Qt::PenCapStyle cap;
if (lineCap == QStringLiteral("round"))
cap = Qt::RoundCap;
@@ -1831,7 +1829,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_lineCap(QV4::CallContext *ctx)
QV4::ReturnedValue QQuickJSContext2D::method_get_lineJoin(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
switch (r->d()->context->state.lineJoin) {
@@ -1849,13 +1847,13 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_lineJoin(QV4::CallContext *ctx)
QV4::ReturnedValue QQuickJSContext2D::method_set_lineJoin(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT_SETTER(r)
- if (!ctx->d()->callData->argc)
- return ctx->throwTypeError();
+ if (!ctx->argc())
+ return ctx->engine()->throwTypeError();
- QString lineJoin = ctx->d()->callData->args[0].toQString();
+ QString lineJoin = ctx->args()[0].toQString();
Qt::PenJoinStyle join;
if (lineJoin == QStringLiteral("round"))
join = Qt::RoundJoin;
@@ -1880,7 +1878,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_lineJoin(QV4::CallContext *ctx)
QV4::ReturnedValue QQuickJSContext2D::method_get_lineWidth(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
return QV4::Encode(r->d()->context->state.lineWidth);
@@ -1889,10 +1887,10 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_lineWidth(QV4::CallContext *ctx
QV4::ReturnedValue QQuickJSContext2D::method_set_lineWidth(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT_SETTER(r)
- qreal w = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : -1;
+ qreal w = ctx->argc() ? ctx->args()[0].toNumber() : -1;
if (w > 0 && qIsFinite(w) && w != r->d()->context->state.lineWidth) {
r->d()->context->state.lineWidth = w;
@@ -1909,7 +1907,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_lineWidth(QV4::CallContext *ctx
QV4::ReturnedValue QQuickJSContext2D::method_get_miterLimit(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
return QV4::Encode(r->d()->context->state.miterLimit);
@@ -1918,10 +1916,10 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_miterLimit(QV4::CallContext *ct
QV4::ReturnedValue QQuickJSContext2D::method_set_miterLimit(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT_SETTER(r)
- qreal ml = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : -1;
+ qreal ml = ctx->argc() ? ctx->args()[0].toNumber() : -1;
if (ml > 0 && qIsFinite(ml) && ml != r->d()->context->state.miterLimit) {
r->d()->context->state.miterLimit = ml;
@@ -1938,7 +1936,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_miterLimit(QV4::CallContext *ct
QV4::ReturnedValue QQuickJSContext2D::method_get_shadowBlur(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
return QV4::Encode(r->d()->context->state.shadowBlur);
@@ -1947,10 +1945,10 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_shadowBlur(QV4::CallContext *ct
QV4::ReturnedValue QQuickJSContext2D::method_set_shadowBlur(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT_SETTER(r)
- qreal blur = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : -1;
+ qreal blur = ctx->argc() ? ctx->args()[0].toNumber() : -1;
if (blur > 0 && qIsFinite(blur) && blur != r->d()->context->state.shadowBlur) {
r->d()->context->state.shadowBlur = blur;
@@ -1966,7 +1964,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_shadowBlur(QV4::CallContext *ct
QV4::ReturnedValue QQuickJSContext2D::method_get_shadowColor(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
return QV4::Encode(scope.engine->newString(r->d()->context->state.shadowColor.name()));
@@ -1975,12 +1973,12 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_shadowColor(QV4::CallContext *c
QV4::ReturnedValue QQuickJSContext2D::method_set_shadowColor(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT_SETTER(r)
QColor color;
- if (ctx->d()->callData->argc)
- color = qt_color_from_string(ctx->d()->callData->args[0]);
+ if (ctx->argc())
+ color = qt_color_from_string(ctx->args()[0]);
if (color.isValid() && color != r->d()->context->state.shadowColor) {
r->d()->context->state.shadowColor = color;
@@ -1999,7 +1997,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_shadowColor(QV4::CallContext *c
QV4::ReturnedValue QQuickJSContext2D::method_get_shadowOffsetX(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
return QV4::Encode(r->d()->context->state.shadowOffsetX);
@@ -2008,10 +2006,10 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_shadowOffsetX(QV4::CallContext
QV4::ReturnedValue QQuickJSContext2D::method_set_shadowOffsetX(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT_SETTER(r)
- qreal offsetX = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
+ qreal offsetX = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
if (qIsFinite(offsetX) && offsetX != r->d()->context->state.shadowOffsetX) {
r->d()->context->state.shadowOffsetX = offsetX;
r->d()->context->buffer()->setShadowOffsetX(offsetX);
@@ -2027,7 +2025,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_shadowOffsetX(QV4::CallContext
QV4::ReturnedValue QQuickJSContext2D::method_get_shadowOffsetY(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
return QV4::Encode(r->d()->context->state.shadowOffsetY);
@@ -2036,10 +2034,10 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_shadowOffsetY(QV4::CallContext
QV4::ReturnedValue QQuickJSContext2D::method_set_shadowOffsetY(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT_SETTER(r)
- qreal offsetY = ctx->d()->callData->argc ? ctx->d()->callData->args[0].toNumber() : qSNaN();
+ qreal offsetY = ctx->argc() ? ctx->args()[0].toNumber() : qSNaN();
if (qIsFinite(offsetY) && offsetY != r->d()->context->state.shadowOffsetY) {
r->d()->context->state.shadowOffsetY = offsetY;
r->d()->context->buffer()->setShadowOffsetY(offsetY);
@@ -2050,7 +2048,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_shadowOffsetY(QV4::CallContext
QV4::ReturnedValue QQuickJSContext2D::method_get_path(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
return r->d()->context->m_v4path.value();
@@ -2059,7 +2057,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_path(QV4::CallContext *ctx)
QV4::ReturnedValue QQuickJSContext2D::method_set_path(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT_SETTER(r)
QV4::ScopedValue value(scope, ctx->argument(0));
@@ -2072,7 +2070,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_path(QV4::CallContext *ctx)
QString path =value->toQStringNoThrow();
QQuickSvgParser::parsePathDataFast(path, r->d()->context->m_path);
}
- r->d()->context->m_v4path = value;
+ r->d()->context->m_v4path.set(scope.engine, value);
return QV4::Encode::undefined();
}
@@ -2084,17 +2082,17 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_path(QV4::CallContext *ctx)
QV4::ReturnedValue QQuickJSContext2DPrototype::method_clearRect(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 4)
- r->d()->context->clearRect(ctx->d()->callData->args[0].toNumber(),
- ctx->d()->callData->args[1].toNumber(),
- ctx->d()->callData->args[2].toNumber(),
- ctx->d()->callData->args[3].toNumber());
+ if (ctx->argc() >= 4)
+ r->d()->context->clearRect(ctx->args()[0].toNumber(),
+ ctx->args()[1].toNumber(),
+ ctx->args()[2].toNumber(),
+ ctx->args()[3].toNumber());
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
\qmlmethod object QtQuick::Context2D::fillRect(real x, real y, real w, real h)
@@ -2105,12 +2103,12 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_clearRect(QV4::CallContext
QV4::ReturnedValue QQuickJSContext2DPrototype::method_fillRect(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 4)
- r->d()->context->fillRect(ctx->d()->callData->args[0].toNumber(), ctx->d()->callData->args[1].toNumber(), ctx->d()->callData->args[2].toNumber(), ctx->d()->callData->args[3].toNumber());
- return ctx->d()->callData->thisObject.asReturnedValue();
+ if (ctx->argc() >= 4)
+ r->d()->context->fillRect(ctx->args()[0].toNumber(), ctx->args()[1].toNumber(), ctx->args()[2].toNumber(), ctx->args()[3].toNumber());
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2126,13 +2124,13 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_fillRect(QV4::CallContext
QV4::ReturnedValue QQuickJSContext2DPrototype::method_strokeRect(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 4)
- r->d()->context->strokeRect(ctx->d()->callData->args[0].toNumber(), ctx->d()->callData->args[1].toNumber(), ctx->d()->callData->args[2].toNumber(), ctx->d()->callData->args[3].toNumber());
+ if (ctx->argc() >= 4)
+ r->d()->context->strokeRect(ctx->args()[0].toNumber(), ctx->args()[1].toNumber(), ctx->args()[2].toNumber(), ctx->args()[3].toNumber());
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
// Complex shapes (paths) API
@@ -2159,29 +2157,29 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_strokeRect(QV4::CallContex
QV4::ReturnedValue QQuickJSContext2DPrototype::method_arc(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 5) {
+ if (ctx->argc() >= 5) {
bool antiClockwise = false;
- if (ctx->d()->callData->argc == 6)
- antiClockwise = ctx->d()->callData->args[5].toBoolean();
+ if (ctx->argc() == 6)
+ antiClockwise = ctx->args()[5].toBoolean();
- qreal radius = ctx->d()->callData->args[2].toNumber();
+ qreal radius = ctx->args()[2].toNumber();
if (qIsFinite(radius) && radius < 0)
V4THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "Incorrect argument radius");
- r->d()->context->arc(ctx->d()->callData->args[0].toNumber(),
- ctx->d()->callData->args[1].toNumber(),
+ r->d()->context->arc(ctx->args()[0].toNumber(),
+ ctx->args()[1].toNumber(),
radius,
- ctx->d()->callData->args[3].toNumber(),
- ctx->d()->callData->args[4].toNumber(),
+ ctx->args()[3].toNumber(),
+ ctx->args()[4].toNumber(),
antiClockwise);
}
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2210,23 +2208,23 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_arc(QV4::CallContext *ctx)
QV4::ReturnedValue QQuickJSContext2DPrototype::method_arcTo(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 5) {
- qreal radius = ctx->d()->callData->args[4].toNumber();
+ if (ctx->argc() >= 5) {
+ qreal radius = ctx->args()[4].toNumber();
if (qIsFinite(radius) && radius < 0)
V4THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "Incorrect argument radius");
- r->d()->context->arcTo(ctx->d()->callData->args[0].toNumber(),
- ctx->d()->callData->args[1].toNumber(),
- ctx->d()->callData->args[2].toNumber(),
- ctx->d()->callData->args[3].toNumber(),
+ r->d()->context->arcTo(ctx->args()[0].toNumber(),
+ ctx->args()[1].toNumber(),
+ ctx->args()[2].toNumber(),
+ ctx->args()[3].toNumber(),
radius);
}
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2237,12 +2235,12 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_arcTo(QV4::CallContext *ct
QV4::ReturnedValue QQuickJSContext2DPrototype::method_beginPath(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
r->d()->context->beginPath();
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2267,25 +2265,25 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_beginPath(QV4::CallContext
QV4::ReturnedValue QQuickJSContext2DPrototype::method_bezierCurveTo(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 6) {
- qreal cp1x = ctx->d()->callData->args[0].toNumber();
- qreal cp1y = ctx->d()->callData->args[1].toNumber();
- qreal cp2x = ctx->d()->callData->args[2].toNumber();
- qreal cp2y = ctx->d()->callData->args[3].toNumber();
- qreal x = ctx->d()->callData->args[4].toNumber();
- qreal y = ctx->d()->callData->args[5].toNumber();
+ if (ctx->argc() >= 6) {
+ qreal cp1x = ctx->args()[0].toNumber();
+ qreal cp1y = ctx->args()[1].toNumber();
+ qreal cp2x = ctx->args()[2].toNumber();
+ qreal cp2y = ctx->args()[3].toNumber();
+ qreal x = ctx->args()[4].toNumber();
+ qreal y = ctx->args()[5].toNumber();
if (!qIsFinite(cp1x) || !qIsFinite(cp1y) || !qIsFinite(cp2x) || !qIsFinite(cp2y) || !qIsFinite(x) || !qIsFinite(y))
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
r->d()->context->bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
}
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2315,11 +2313,11 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_bezierCurveTo(QV4::CallCon
QV4::ReturnedValue QQuickJSContext2DPrototype::method_clip(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
r->d()->context->clip();
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2332,13 +2330,13 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_clip(QV4::CallContext *ctx
QV4::ReturnedValue QQuickJSContext2DPrototype::method_closePath(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
r->d()->context->closePath();
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2353,10 +2351,10 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_closePath(QV4::CallContext
QV4::ReturnedValue QQuickJSContext2DPrototype::method_fill(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r);
r->d()->context->fill();
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2367,21 +2365,21 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_fill(QV4::CallContext *ctx
QV4::ReturnedValue QQuickJSContext2DPrototype::method_lineTo(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 2) {
- qreal x = ctx->d()->callData->args[0].toNumber();
- qreal y = ctx->d()->callData->args[1].toNumber();
+ if (ctx->argc() >= 2) {
+ qreal x = ctx->args()[0].toNumber();
+ qreal y = ctx->args()[1].toNumber();
if (!qIsFinite(x) || !qIsFinite(y))
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
r->d()->context->lineTo(x, y);
}
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2392,18 +2390,18 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_lineTo(QV4::CallContext *c
QV4::ReturnedValue QQuickJSContext2DPrototype::method_moveTo(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 2) {
- qreal x = ctx->d()->callData->args[0].toNumber();
- qreal y = ctx->d()->callData->args[1].toNumber();
+ if (ctx->argc() >= 2) {
+ qreal x = ctx->args()[0].toNumber();
+ qreal y = ctx->args()[1].toNumber();
if (!qIsFinite(x) || !qIsFinite(y))
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
r->d()->context->moveTo(x, y);
}
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2416,22 +2414,22 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_moveTo(QV4::CallContext *c
QV4::ReturnedValue QQuickJSContext2DPrototype::method_quadraticCurveTo(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 4) {
- qreal cpx = ctx->d()->callData->args[0].toNumber();
- qreal cpy = ctx->d()->callData->args[1].toNumber();
- qreal x = ctx->d()->callData->args[2].toNumber();
- qreal y = ctx->d()->callData->args[3].toNumber();
+ if (ctx->argc() >= 4) {
+ qreal cpx = ctx->args()[0].toNumber();
+ qreal cpy = ctx->args()[1].toNumber();
+ qreal x = ctx->args()[2].toNumber();
+ qreal y = ctx->args()[3].toNumber();
if (!qIsFinite(cpx) || !qIsFinite(cpy) || !qIsFinite(x) || !qIsFinite(y))
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
r->d()->context->quadraticCurveTo(cpx, cpy, x, y);
}
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2442,12 +2440,12 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_quadraticCurveTo(QV4::Call
QV4::ReturnedValue QQuickJSContext2DPrototype::method_rect(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 4)
- r->d()->context->rect(ctx->d()->callData->args[0].toNumber(), ctx->d()->callData->args[1].toNumber(), ctx->d()->callData->args[2].toNumber(), ctx->d()->callData->args[3].toNumber());
- return ctx->d()->callData->thisObject.asReturnedValue();
+ if (ctx->argc() >= 4)
+ r->d()->context->rect(ctx->args()[0].toNumber(), ctx->args()[1].toNumber(), ctx->args()[2].toNumber(), ctx->args()[3].toNumber());
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2459,17 +2457,17 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_rect(QV4::CallContext *ctx
QV4::ReturnedValue QQuickJSContext2DPrototype::method_roundedRect(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 6)
- r->d()->context->roundedRect(ctx->d()->callData->args[0].toNumber()
- , ctx->d()->callData->args[1].toNumber()
- , ctx->d()->callData->args[2].toNumber()
- , ctx->d()->callData->args[3].toNumber()
- , ctx->d()->callData->args[4].toNumber()
- , ctx->d()->callData->args[5].toNumber());
- return ctx->d()->callData->thisObject.asReturnedValue();
+ if (ctx->argc() >= 6)
+ r->d()->context->roundedRect(ctx->args()[0].toNumber()
+ , ctx->args()[1].toNumber()
+ , ctx->args()[2].toNumber()
+ , ctx->args()[3].toNumber()
+ , ctx->args()[4].toNumber()
+ , ctx->args()[5].toNumber());
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2483,14 +2481,14 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_roundedRect(QV4::CallConte
QV4::ReturnedValue QQuickJSContext2DPrototype::method_ellipse(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 4)
- r->d()->context->ellipse(ctx->d()->callData->args[0].toNumber(), ctx->d()->callData->args[1].toNumber(), ctx->d()->callData->args[2].toNumber(), ctx->d()->callData->args[3].toNumber());
+ if (ctx->argc() >= 4)
+ r->d()->context->ellipse(ctx->args()[0].toNumber(), ctx->args()[1].toNumber(), ctx->args()[2].toNumber(), ctx->args()[3].toNumber());
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2502,18 +2500,18 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_ellipse(QV4::CallContext *
QV4::ReturnedValue QQuickJSContext2DPrototype::method_text(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 3) {
- qreal x = ctx->d()->callData->args[1].toNumber();
- qreal y = ctx->d()->callData->args[2].toNumber();
+ if (ctx->argc() >= 3) {
+ qreal x = ctx->args()[1].toNumber();
+ qreal y = ctx->args()[2].toNumber();
if (!qIsFinite(x) || !qIsFinite(y))
- return ctx->d()->callData->thisObject.asReturnedValue();
- r->d()->context->text(ctx->d()->callData->args[0].toQStringNoThrow(), x, y);
+ return ctx->thisObject().asReturnedValue();
+ r->d()->context->text(ctx->args()[0].toQStringNoThrow(), x, y);
}
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2528,11 +2526,11 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_text(QV4::CallContext *ctx
QV4::ReturnedValue QQuickJSContext2DPrototype::method_stroke(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
r->d()->context->stroke();
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2545,12 +2543,12 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_stroke(QV4::CallContext *c
QV4::ReturnedValue QQuickJSContext2DPrototype::method_isPointInPath(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
bool pointInPath = false;
- if (ctx->d()->callData->argc >= 2)
- pointInPath = r->d()->context->isPointInPath(ctx->d()->callData->args[0].toNumber(), ctx->d()->callData->args[1].toNumber());
+ if (ctx->argc() >= 2)
+ pointInPath = r->d()->context->isPointInPath(ctx->args()[0].toNumber(), ctx->args()[1].toNumber());
return QV4::Primitive::fromBoolean(pointInPath).asReturnedValue();
}
@@ -2601,7 +2599,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_caretBlinkRate(QV4::CallCo
QV4::ReturnedValue QQuickJSContext2D::method_get_font(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
return QV4::Encode(scope.engine->newString(r->d()->context->state.font.toString()));
@@ -2610,10 +2608,10 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_font(QV4::CallContext *ctx)
QV4::ReturnedValue QQuickJSContext2D::method_set_font(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT_SETTER(r)
- QV4::Scoped<QV4::String> s(scope, ctx->argument(0), QV4::Scoped<QV4::String>::Convert);
+ QV4::ScopedString s(scope, ctx->argument(0), QV4::ScopedString::Convert);
if (scope.engine->hasException)
return QV4::Encode::undefined();
QFont font = qt_font_from_string(s->toQString(), r->d()->context->state.font);
@@ -2640,7 +2638,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_font(QV4::CallContext *ctx)
QV4::ReturnedValue QQuickJSContext2D::method_get_textAlign(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
switch (r->d()->context->state.textAlign) {
@@ -2662,10 +2660,10 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_textAlign(QV4::CallContext *ctx
QV4::ReturnedValue QQuickJSContext2D::method_set_textAlign(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT_SETTER(r)
- QV4::Scoped<QV4::String> s(scope, ctx->argument(0), QV4::Scoped<QV4::String>::Convert);
+ QV4::ScopedString s(scope, ctx->argument(0), QV4::ScopedString::Convert);
if (scope.engine->hasException)
return QV4::Encode::undefined();
QString textAlign = s->toQString();
@@ -2708,7 +2706,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_textAlign(QV4::CallContext *ctx
QV4::ReturnedValue QQuickJSContext2D::method_get_textBaseline(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
switch (r->d()->context->state.textBaseline) {
@@ -2730,9 +2728,9 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_textBaseline(QV4::CallContext *
QV4::ReturnedValue QQuickJSContext2D::method_set_textBaseline(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT_SETTER(r)
- QV4::Scoped<QV4::String> s(scope, ctx->argument(0), QV4::Scoped<QV4::String>::Convert);
+ QV4::ScopedString s(scope, ctx->argument(0), QV4::ScopedString::Convert);
if (scope.engine->hasException)
return QV4::Encode::undefined();
QString textBaseline = s->toQString();
@@ -2768,18 +2766,18 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_textBaseline(QV4::CallContext *
QV4::ReturnedValue QQuickJSContext2DPrototype::method_fillText(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 3) {
- qreal x = ctx->d()->callData->args[1].toNumber();
- qreal y = ctx->d()->callData->args[2].toNumber();
+ if (ctx->argc() >= 3) {
+ qreal x = ctx->args()[1].toNumber();
+ qreal y = ctx->args()[2].toNumber();
if (!qIsFinite(x) || !qIsFinite(y))
- return ctx->d()->callData->thisObject.asReturnedValue();
- QPainterPath textPath = r->d()->context->createTextGlyphs(x, y, ctx->d()->callData->args[0].toQStringNoThrow());
+ return ctx->thisObject().asReturnedValue();
+ QPainterPath textPath = r->d()->context->createTextGlyphs(x, y, ctx->args()[0].toQStringNoThrow());
r->d()->context->buffer()->fill(textPath);
}
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
\qmlmethod object QtQuick::Context2D::strokeText(text, x, y)
@@ -2792,12 +2790,12 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_fillText(QV4::CallContext
QV4::ReturnedValue QQuickJSContext2DPrototype::method_strokeText(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 3)
- r->d()->context->drawText(ctx->d()->callData->args[0].toQStringNoThrow(), ctx->d()->callData->args[1].toNumber(), ctx->d()->callData->args[2].toNumber(), false);
- return ctx->d()->callData->thisObject.asReturnedValue();
+ if (ctx->argc() >= 3)
+ r->d()->context->drawText(ctx->args()[0].toQStringNoThrow(), ctx->args()[1].toNumber(), ctx->args()[2].toNumber(), false);
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -2809,13 +2807,13 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_strokeText(QV4::CallContex
QV4::ReturnedValue QQuickJSContext2DPrototype::method_measureText(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc >= 1) {
+ if (ctx->argc() >= 1) {
QFontMetrics fm(r->d()->context->state.font);
- uint width = fm.width(ctx->d()->callData->args[0].toQStringNoThrow());
- QV4::Scoped<QV4::Object> tm(scope, scope.engine->newObject());
+ uint width = fm.width(ctx->args()[0].toQStringNoThrow());
+ QV4::ScopedObject tm(scope, scope.engine->newObject());
tm->put(QV4::ScopedString(scope, scope.engine->newIdentifier(QStringLiteral("width"))).getPointer(),
QV4::ScopedValue(scope, QV4::Primitive::fromDouble(width)));
return tm.asReturnedValue();
@@ -2885,21 +2883,21 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_measureText(QV4::CallConte
QV4::ReturnedValue QQuickJSContext2DPrototype::method_drawImage(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT(r)
qreal sx, sy, sw, sh, dx, dy, dw, dh;
- if (!ctx->d()->callData->argc)
- return ctx->d()->callData->thisObject.asReturnedValue();
+ if (!ctx->argc())
+ return ctx->thisObject().asReturnedValue();
//FIXME:This function should be moved to QQuickContext2D::drawImage(...)
if (!r->d()->context->state.invertibleCTM)
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
QQmlRefPointer<QQuickCanvasPixmap> pixmap;
- QV4::ScopedValue arg(scope, ctx->d()->callData->args[0]);
+ QV4::ScopedValue arg(scope, ctx->args()[0]);
if (arg->isString()) {
QUrl url(arg->toQString());
if (!url.isValid())
@@ -2940,29 +2938,29 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_drawImage(QV4::CallContext
}
if (pixmap.isNull() || !pixmap->isValid())
- return ctx->d()->callData->thisObject.asReturnedValue();
-
- if (ctx->d()->callData->argc >= 9) {
- sx = ctx->d()->callData->args[1].toNumber();
- sy = ctx->d()->callData->args[2].toNumber();
- sw = ctx->d()->callData->args[3].toNumber();
- sh = ctx->d()->callData->args[4].toNumber();
- dx = ctx->d()->callData->args[5].toNumber();
- dy = ctx->d()->callData->args[6].toNumber();
- dw = ctx->d()->callData->args[7].toNumber();
- dh = ctx->d()->callData->args[8].toNumber();
- } else if (ctx->d()->callData->argc >= 5) {
+ return ctx->thisObject().asReturnedValue();
+
+ if (ctx->argc() >= 9) {
+ sx = ctx->args()[1].toNumber();
+ sy = ctx->args()[2].toNumber();
+ sw = ctx->args()[3].toNumber();
+ sh = ctx->args()[4].toNumber();
+ dx = ctx->args()[5].toNumber();
+ dy = ctx->args()[6].toNumber();
+ dw = ctx->args()[7].toNumber();
+ dh = ctx->args()[8].toNumber();
+ } else if (ctx->argc() >= 5) {
sx = 0;
sy = 0;
sw = pixmap->width();
sh = pixmap->height();
- dx = ctx->d()->callData->args[1].toNumber();
- dy = ctx->d()->callData->args[2].toNumber();
- dw = ctx->d()->callData->args[3].toNumber();
- dh = ctx->d()->callData->args[4].toNumber();
- } else if (ctx->d()->callData->argc >= 3) {
- dx = ctx->d()->callData->args[1].toNumber();
- dy = ctx->d()->callData->args[2].toNumber();
+ dx = ctx->args()[1].toNumber();
+ dy = ctx->args()[2].toNumber();
+ dw = ctx->args()[3].toNumber();
+ dh = ctx->args()[4].toNumber();
+ } else if (ctx->argc() >= 3) {
+ dx = ctx->args()[1].toNumber();
+ dy = ctx->args()[2].toNumber();
sx = 0;
sy = 0;
sw = pixmap->width();
@@ -2970,7 +2968,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_drawImage(QV4::CallContext
dw = sw;
dh = sh;
} else {
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
if (!qIsFinite(sx)
@@ -2981,7 +2979,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_drawImage(QV4::CallContext
|| !qIsFinite(dy)
|| !qIsFinite(dw)
|| !qIsFinite(dh))
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
if (sx < 0
|| sy < 0
@@ -2995,7 +2993,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_drawImage(QV4::CallContext
r->d()->context->buffer()->drawPixmap(pixmap, QRectF(sx, sy, sw, sh), QRectF(dx, dy, dw, dh));
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
// pixel manipulation
@@ -3025,9 +3023,9 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_drawImage(QV4::CallContext
QV4::ReturnedValue QQuickJSContext2DImageData::method_get_width(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2DImageData> imageData(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2DImageData> imageData(scope, ctx->thisObject());
if (!imageData)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
QV4::Scoped<QQuickJSContext2DPixelData> r(scope, imageData->d()->pixelData.as<QQuickJSContext2DPixelData>());
if (!r)
return QV4::Encode(0);
@@ -3041,9 +3039,9 @@ QV4::ReturnedValue QQuickJSContext2DImageData::method_get_width(QV4::CallContext
QV4::ReturnedValue QQuickJSContext2DImageData::method_get_height(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2DImageData> imageData(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2DImageData> imageData(scope, ctx->thisObject());
if (!imageData)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
QV4::Scoped<QQuickJSContext2DPixelData> r(scope, imageData->d()->pixelData.as<QQuickJSContext2DPixelData>());
if (!r)
return QV4::Encode(0);
@@ -3057,9 +3055,9 @@ QV4::ReturnedValue QQuickJSContext2DImageData::method_get_height(QV4::CallContex
QV4::ReturnedValue QQuickJSContext2DImageData::method_get_data(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2DImageData> imageData(scope, ctx->d()->callData->thisObject);
+ QV4::Scoped<QQuickJSContext2DImageData> imageData(scope, ctx->thisObject());
if (!imageData)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
return imageData->d()->pixelData.asReturnedValue();
}
@@ -3084,7 +3082,7 @@ QV4::ReturnedValue QQuickJSContext2DImageData::method_get_data(QV4::CallContext
QV4::ReturnedValue QQuickJSContext2DPixelData::proto_get_length(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2DPixelData> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2DPixelData>());
+ QV4::Scoped<QQuickJSContext2DPixelData> r(scope, ctx->thisObject().as<QQuickJSContext2DPixelData>());
if (!r || r->d()->image.isNull())
return QV4::Encode::undefined();
@@ -3094,7 +3092,7 @@ QV4::ReturnedValue QQuickJSContext2DPixelData::proto_get_length(QV4::CallContext
QV4::ReturnedValue QQuickJSContext2DPixelData::getIndexed(QV4::Managed *m, uint index, bool *hasProperty)
{
Q_ASSERT(m->as<QQuickJSContext2DPixelData>());
- QV4::ExecutionEngine *v4 = m->engine();
+ QV4::ExecutionEngine *v4 = static_cast<QQuickJSContext2DPixelData *>(m)->engine();
QV4::Scope scope(v4);
QV4::Scoped<QQuickJSContext2DPixelData> r(scope, static_cast<QQuickJSContext2DPixelData *>(m));
@@ -3122,17 +3120,17 @@ QV4::ReturnedValue QQuickJSContext2DPixelData::getIndexed(QV4::Managed *m, uint
return QV4::Encode::undefined();
}
-void QQuickJSContext2DPixelData::putIndexed(QV4::Managed *m, uint index, const QV4::ValueRef value)
+void QQuickJSContext2DPixelData::putIndexed(QV4::Managed *m, uint index, const QV4::Value &value)
{
Q_ASSERT(m->as<QQuickJSContext2DPixelData>());
- QV4::ExecutionEngine *v4 = m->engine();
+ QV4::ExecutionEngine *v4 = static_cast<QQuickJSContext2DPixelData *>(m)->engine();
QV4::Scope scope(v4);
if (scope.hasException())
return;
QV4::Scoped<QQuickJSContext2DPixelData> r(scope, static_cast<QQuickJSContext2DPixelData *>(m));
- const int v = value->toInt32();
+ const int v = value.toInt32();
if (r && index < static_cast<quint32>(r->d()->image.width() * r->d()->image.height() * 4) && v >= 0 && v <= 255) {
const quint32 w = r->d()->image.width();
const quint32 row = (index / 4) / w;
@@ -3180,34 +3178,32 @@ void QQuickJSContext2DPixelData::putIndexed(QV4::Managed *m, uint index, const Q
QV4::ReturnedValue QQuickJSContext2DPrototype::method_createImageData(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- QV8Engine *engine = scope.engine->v8Engine;
-
- if (ctx->d()->callData->argc == 1) {
- QV4::ScopedValue arg0(scope, ctx->d()->callData->args[0]);
+ if (ctx->argc() == 1) {
+ QV4::ScopedValue arg0(scope, ctx->args()[0]);
QV4::Scoped<QQuickJSContext2DImageData> imgData(scope, arg0);
if (!!imgData) {
QV4::Scoped<QQuickJSContext2DPixelData> pa(scope, imgData->d()->pixelData.as<QQuickJSContext2DPixelData>());
if (pa) {
qreal w = pa->d()->image.width();
qreal h = pa->d()->image.height();
- return qt_create_image_data(w, h, engine, QImage());
+ return qt_create_image_data(w, h, scope.engine, QImage());
}
} else if (arg0->isString()) {
QImage image = r->d()->context->createPixmap(QUrl(arg0->toQStringNoThrow()))->image();
- return qt_create_image_data(image.width(), image.height(), engine, image);
+ return qt_create_image_data(image.width(), image.height(), scope.engine, image);
}
- } else if (ctx->d()->callData->argc == 2) {
- qreal w = ctx->d()->callData->args[0].toNumber();
- qreal h = ctx->d()->callData->args[1].toNumber();
+ } else if (ctx->argc() == 2) {
+ qreal w = ctx->args()[0].toNumber();
+ qreal h = ctx->args()[1].toNumber();
if (!qIsFinite(w) || !qIsFinite(h))
V4THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "createImageData(): invalid arguments");
if (w > 0 && h > 0)
- return qt_create_image_data(w, h, engine, QImage());
+ return qt_create_image_data(w, h, scope.engine, QImage());
else
V4THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "createImageData(): invalid arguments");
}
@@ -3221,15 +3217,14 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createImageData(QV4::CallC
QV4::ReturnedValue QQuickJSContext2DPrototype::method_getImageData(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- QV8Engine *engine = scope.engine->v8Engine;
- if (ctx->d()->callData->argc >= 4) {
- qreal x = ctx->d()->callData->args[0].toNumber();
- qreal y = ctx->d()->callData->args[1].toNumber();
- qreal w = ctx->d()->callData->args[2].toNumber();
- qreal h = ctx->d()->callData->args[3].toNumber();
+ if (ctx->argc() >= 4) {
+ qreal x = ctx->args()[0].toNumber();
+ qreal y = ctx->args()[1].toNumber();
+ qreal w = ctx->args()[2].toNumber();
+ qreal h = ctx->args()[3].toNumber();
if (!qIsFinite(x) || !qIsFinite(y) || !qIsFinite(w) || !qIsFinite(h))
V4THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "getImageData(): Invalid arguments");
@@ -3237,7 +3232,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_getImageData(QV4::CallCont
V4THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "getImageData(): Invalid arguments");
QImage image = r->d()->context->canvas()->toImage(QRectF(x, y, w, h));
- return qt_create_image_data(w, h, engine, image);
+ return qt_create_image_data(w, h, scope.engine, image);
}
return QV4::Encode::null();
}
@@ -3249,17 +3244,17 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_getImageData(QV4::CallCont
QV4::ReturnedValue QQuickJSContext2DPrototype::method_putImageData(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject.as<QQuickJSContext2D>());
+ QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- if (ctx->d()->callData->argc < 7)
+ if (ctx->argc() < 7)
return QV4::Encode::undefined();
- QV4::ScopedValue arg0(scope, ctx->d()->callData->args[0]);
+ QV4::ScopedValue arg0(scope, ctx->args()[0]);
if (!arg0->isObject())
V4THROW_DOM(DOMEXCEPTION_TYPE_MISMATCH_ERR, "Context2D::putImageData, the image data type mismatch");
- qreal dx = ctx->d()->callData->args[1].toNumber();
- qreal dy = ctx->d()->callData->args[2].toNumber();
+ qreal dx = ctx->args()[1].toNumber();
+ qreal dy = ctx->args()[2].toNumber();
qreal w, h, dirtyX, dirtyY, dirtyWidth, dirtyHeight;
if (!qIsFinite(dx) || !qIsFinite(dy))
@@ -3267,18 +3262,18 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_putImageData(QV4::CallCont
QV4::Scoped<QQuickJSContext2DImageData> imageData(scope, arg0);
if (!imageData)
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
QV4::Scoped<QQuickJSContext2DPixelData> pixelArray(scope, imageData->d()->pixelData.as<QQuickJSContext2DPixelData>());
if (pixelArray) {
w = pixelArray->d()->image.width();
h = pixelArray->d()->image.height();
- if (ctx->d()->callData->argc == 7) {
- dirtyX = ctx->d()->callData->args[3].toNumber();
- dirtyY = ctx->d()->callData->args[4].toNumber();
- dirtyWidth = ctx->d()->callData->args[5].toNumber();
- dirtyHeight = ctx->d()->callData->args[6].toNumber();
+ if (ctx->argc() == 7) {
+ dirtyX = ctx->args()[3].toNumber();
+ dirtyY = ctx->args()[4].toNumber();
+ dirtyWidth = ctx->args()[5].toNumber();
+ dirtyHeight = ctx->args()[6].toNumber();
if (!qIsFinite(dirtyX) || !qIsFinite(dirtyY) || !qIsFinite(dirtyWidth) || !qIsFinite(dirtyHeight))
V4THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "putImageData() : Invalid arguments");
@@ -3313,7 +3308,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_putImageData(QV4::CallCont
}
if (dirtyWidth <=0 || dirtyHeight <= 0)
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
} else {
dirtyX = 0;
dirtyY = 0;
@@ -3324,7 +3319,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_putImageData(QV4::CallCont
QImage image = pixelArray->d()->image.copy(dirtyX, dirtyY, dirtyWidth, dirtyHeight);
r->d()->context->buffer()->drawImage(image, QRectF(dirtyX, dirtyY, dirtyWidth, dirtyHeight), QRectF(dx, dy, dirtyWidth, dirtyHeight));
}
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
/*!
@@ -3350,24 +3345,22 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_putImageData(QV4::CallCont
QV4::ReturnedValue QQuickContext2DStyle::gradient_proto_addColorStop(QV4::CallContext *ctx)
{
QV4::Scope scope(ctx);
- QV4::Scoped<QQuickContext2DStyle> style(scope, ctx->d()->callData->thisObject.as<QQuickContext2DStyle>());
+ QV4::Scoped<QQuickContext2DStyle> style(scope, ctx->thisObject().as<QQuickContext2DStyle>());
if (!style)
V4THROW_ERROR("Not a CanvasGradient object");
- QV8Engine *engine = scope.engine->v8Engine;
-
- if (ctx->d()->callData->argc == 2) {
+ if (ctx->argc() == 2) {
if (!style->d()->brush.gradient())
V4THROW_ERROR("Not a valid CanvasGradient object, can't get the gradient information");
QGradient gradient = *(style->d()->brush.gradient());
- qreal pos = ctx->d()->callData->args[0].toNumber();
+ qreal pos = ctx->args()[0].toNumber();
QColor color;
- if (ctx->d()->callData->args[1].asObject()) {
- color = engine->toVariant(ctx->d()->callData->args[1], qMetaTypeId<QColor>()).value<QColor>();
+ if (ctx->args()[1].asObject()) {
+ color = scope.engine->toVariant(ctx->args()[1], qMetaTypeId<QColor>()).value<QColor>();
} else {
- color = qt_color_from_string(ctx->d()->callData->args[1]);
+ color = qt_color_from_string(ctx->args()[1]);
}
if (pos < 0.0 || pos > 1.0 || !qIsFinite(pos)) {
V4THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "CanvasGradient: parameter offset out of range");
@@ -3381,7 +3374,7 @@ QV4::ReturnedValue QQuickContext2DStyle::gradient_proto_addColorStop(QV4::CallCo
style->d()->brush = gradient;
}
- return ctx->d()->callData->thisObject.asReturnedValue();
+ return ctx->thisObject().asReturnedValue();
}
void QQuickContext2D::scale(qreal x, qreal y)
@@ -3667,25 +3660,25 @@ void QQuickContext2D::addArcTo(const QPointF& p1, const QPointF& p2, float radiu
QPointF p1p0((p0.x() - p1.x()), (p0.y() - p1.y()));
QPointF p1p2((p2.x() - p1.x()), (p2.y() - p1.y()));
- float p1p0_length = qSqrt(p1p0.x() * p1p0.x() + p1p0.y() * p1p0.y());
- float p1p2_length = qSqrt(p1p2.x() * p1p2.x() + p1p2.y() * p1p2.y());
+ float p1p0_length = std::sqrt(p1p0.x() * p1p0.x() + p1p0.y() * p1p0.y());
+ float p1p2_length = std::sqrt(p1p2.x() * p1p2.x() + p1p2.y() * p1p2.y());
double cos_phi = (p1p0.x() * p1p2.x() + p1p0.y() * p1p2.y()) / (p1p0_length * p1p2_length);
// The points p0, p1, and p2 are on the same straight line (HTML5, 4.8.11.1.8)
// We could have used areCollinear() here, but since we're reusing
// the variables computed above later on we keep this logic.
- if (qFuzzyCompare(qAbs(cos_phi), 1.0)) {
+ if (qFuzzyCompare(std::abs(cos_phi), 1.0)) {
m_path.lineTo(p1);
return;
}
- float tangent = radius / tan(acos(cos_phi) / 2);
+ float tangent = radius / std::tan(std::acos(cos_phi) / 2);
float factor_p1p0 = tangent / p1p0_length;
QPointF t_p1p0((p1.x() + factor_p1p0 * p1p0.x()), (p1.y() + factor_p1p0 * p1p0.y()));
QPointF orth_p1p0(p1p0.y(), -p1p0.x());
- float orth_p1p0_length = sqrt(orth_p1p0.x() * orth_p1p0.x() + orth_p1p0.y() * orth_p1p0.y());
+ float orth_p1p0_length = std::sqrt(orth_p1p0.x() * orth_p1p0.x() + orth_p1p0.y() * orth_p1p0.y());
float factor_ra = radius / orth_p1p0_length;
// angle between orth_p1p0 and p1p2 to get the right vector orthographic to p1p0
@@ -3697,9 +3690,9 @@ void QQuickContext2D::addArcTo(const QPointF& p1, const QPointF& p2, float radiu
// calculate angles for addArc
orth_p1p0 = QPointF(-orth_p1p0.x(), -orth_p1p0.y());
- float sa = acos(orth_p1p0.x() / orth_p1p0_length);
+ float sa = std::acos(orth_p1p0.x() / orth_p1p0_length);
if (orth_p1p0.y() < 0.f)
- sa = 2 * Q_PI - sa;
+ sa = 2 * M_PI - sa;
// anticlockwise logic
bool anticlockwise = false;
@@ -3707,13 +3700,13 @@ void QQuickContext2D::addArcTo(const QPointF& p1, const QPointF& p2, float radiu
float factor_p1p2 = tangent / p1p2_length;
QPointF t_p1p2((p1.x() + factor_p1p2 * p1p2.x()), (p1.y() + factor_p1p2 * p1p2.y()));
QPointF orth_p1p2((t_p1p2.x() - p.x()), (t_p1p2.y() - p.y()));
- float orth_p1p2_length = sqrtf(orth_p1p2.x() * orth_p1p2.x() + orth_p1p2.y() * orth_p1p2.y());
- float ea = acos(orth_p1p2.x() / orth_p1p2_length);
+ float orth_p1p2_length = std::sqrt(orth_p1p2.x() * orth_p1p2.x() + orth_p1p2.y() * orth_p1p2.y());
+ float ea = std::acos(orth_p1p2.x() / orth_p1p2_length);
if (orth_p1p2.y() < 0)
- ea = 2 * Q_PI - ea;
- if ((sa > ea) && ((sa - ea) < Q_PI))
+ ea = 2 * M_PI - ea;
+ if ((sa > ea) && ((sa - ea) < M_PI))
anticlockwise = true;
- if ((sa < ea) && ((ea - sa) > Q_PI))
+ if ((sa < ea) && ((ea - sa) > M_PI))
anticlockwise = true;
arc(p.x(), p.y(), radius, sa, ea, anticlockwise);
@@ -4011,7 +4004,7 @@ QMutex QQuickContext2D::mutex;
QQuickContext2D::QQuickContext2D(QObject *parent)
: QQuickCanvasContext(parent)
, m_buffer(new QQuickContext2DCommandBuffer)
- , m_v8engine(0)
+ , m_v4engine(0)
, m_surface(0)
, m_glContext(0)
, m_thread(0)
@@ -4213,12 +4206,11 @@ QImage QQuickContext2D::toImage(const QRectF& bounds)
}
-QQuickContext2DEngineData::QQuickContext2DEngineData(QV8Engine *engine)
+QQuickContext2DEngineData::QQuickContext2DEngineData(QV4::ExecutionEngine *v4)
{
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine);
QV4::Scope scope(v4);
- QV4::Scoped<QV4::Object> proto(scope, QQuickJSContext2DPrototype::create(v4));
+ QV4::ScopedObject proto(scope, QQuickJSContext2DPrototype::create(v4));
proto->defineAccessorProperty(QStringLiteral("strokeStyle"), QQuickJSContext2D::method_get_strokeStyle, QQuickJSContext2D::method_set_strokeStyle);
proto->defineAccessorProperty(QStringLiteral("font"), QQuickJSContext2D::method_get_font, QQuickJSContext2D::method_set_font);
proto->defineAccessorProperty(QStringLiteral("fillRule"), QQuickJSContext2D::method_get_fillRule, QQuickJSContext2D::method_set_fillRule);
@@ -4322,20 +4314,19 @@ void QQuickContext2D::reset()
m_buffer->clearRect(QRectF(0, 0, m_canvas->width(), m_canvas->height()));
}
-void QQuickContext2D::setV8Engine(QV8Engine *engine)
+void QQuickContext2D::setV4Engine(QV4::ExecutionEngine *engine)
{
- if (m_v8engine != engine) {
- m_v8engine = engine;
+ if (m_v4engine != engine) {
+ m_v4engine = engine;
- if (m_v8engine == 0)
+ if (m_v4engine == 0)
return;
QQuickContext2DEngineData *ed = engineData(engine);
- QV4::ExecutionEngine *v4Engine = QV8Engine::getV4(engine);
- QV4::Scope scope(v4Engine);
- QV4::Scoped<QQuickJSContext2D> wrapper(scope, v4Engine->memoryManager->alloc<QQuickJSContext2D>(v4Engine));
+ QV4::Scope scope(engine);
+ QV4::Scoped<QQuickJSContext2D> wrapper(scope, engine->memoryManager->alloc<QQuickJSContext2D>(engine));
QV4::ScopedObject p(scope, ed->contextPrototype.value());
- wrapper->setPrototype(p.getPointer());
+ wrapper->setPrototype(p);
wrapper->d()->context = this;
m_v4value = wrapper;
}
diff --git a/src/quick/items/context2d/qquickcontext2d_p.h b/src/quick/items/context2d/qquickcontext2d_p.h
index dcfe6cfe50..67d3a2e4fb 100644
--- a/src/quick/items/context2d/qquickcontext2d_p.h
+++ b/src/quick/items/context2d/qquickcontext2d_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -173,7 +173,7 @@ public:
QImage toImage(const QRectF& bounds);
QV4::ReturnedValue v4value() const;
- void setV8Engine(QV8Engine *eng);
+ void setV4Engine(QV4::ExecutionEngine *eng);
QQuickCanvasItem* canvas() const { return m_canvas; }
QQuickContext2DCommandBuffer* buffer() const { return m_buffer; }
@@ -234,7 +234,7 @@ public:
QV4::PersistentValue m_fillStyle;
QV4::PersistentValue m_strokeStyle;
QV4::PersistentValue m_v4path;
- QV8Engine *m_v8engine;
+ QV4::ExecutionEngine *m_v4engine;
QScopedPointer<QOffscreenSurface> m_surface;
QOpenGLContext *m_glContext;
QV4::PersistentValue m_v4value;
diff --git a/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp b/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp
index a52f1c8cd2..782d03f9f9 100644
--- a/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp
+++ b/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -93,7 +93,7 @@ namespace {
}
void paint(QPainter *p) const { p->fillRect(m_rect, m_brush); }
- QRectF boundingRect() const { return m_rect; }
+ QRectF boundingRect() const Q_DECL_OVERRIDE { return m_rect; }
private:
QRectF m_rect;
@@ -110,7 +110,7 @@ namespace {
}
void paint(QPainter *p) const { p->fillPath(m_path, m_brush); }
- QRectF boundingRect() const { return m_path.boundingRect(); }
+ QRectF boundingRect() const Q_DECL_OVERRIDE { return m_path.boundingRect(); }
private:
QPainterPath m_path;
@@ -128,7 +128,7 @@ namespace {
void paint(QPainter *p) const { p->strokePath(m_path, m_pen); }
- QRectF boundingRect() const
+ QRectF boundingRect() const Q_DECL_OVERRIDE
{
qreal d = qMax(qreal(1), m_pen.widthF());
return m_path.boundingRect().adjusted(-d, -d, d, d);
@@ -150,7 +150,7 @@ namespace {
void paint(QPainter *p) const { p->drawImage(m_offset, m_image); }
- QRectF boundingRect() const { return QRectF(m_image.rect()).translated(m_offset); }
+ QRectF boundingRect() const Q_DECL_OVERRIDE { return QRectF(m_image.rect()).translated(m_offset); }
private:
QImage m_image;
diff --git a/src/quick/items/context2d/qquickcontext2dcommandbuffer_p.h b/src/quick/items/context2d/qquickcontext2dcommandbuffer_p.h
index 4e6232ac7f..54bf209c79 100644
--- a/src/quick/items/context2d/qquickcontext2dcommandbuffer_p.h
+++ b/src/quick/items/context2d/qquickcontext2dcommandbuffer_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/context2d/qquickcontext2dtexture.cpp b/src/quick/items/context2d/qquickcontext2dtexture.cpp
index 1dd8e50387..73b0b55a29 100644
--- a/src/quick/items/context2d/qquickcontext2dtexture.cpp
+++ b/src/quick/items/context2d/qquickcontext2dtexture.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/context2d/qquickcontext2dtexture_p.h b/src/quick/items/context2d/qquickcontext2dtexture_p.h
index 3ff0cb12c1..88d7b6858f 100644
--- a/src/quick/items/context2d/qquickcontext2dtexture_p.h
+++ b/src/quick/items/context2d/qquickcontext2dtexture_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -165,21 +165,21 @@ class QQuickContext2DFBOTexture : public QQuickContext2DTexture
public:
QQuickContext2DFBOTexture();
~QQuickContext2DFBOTexture();
- virtual QQuickContext2DTile* createTile() const;
- virtual QPaintDevice* beginPainting();
- virtual void endPainting();
+ QQuickContext2DTile* createTile() const Q_DECL_OVERRIDE;
+ QPaintDevice* beginPainting() Q_DECL_OVERRIDE;
+ void endPainting() Q_DECL_OVERRIDE;
QRectF normalizedTextureSubRect() const;
- virtual QQuickCanvasItem::RenderTarget renderTarget() const;
- virtual void compositeTile(QQuickContext2DTile* tile);
- QSize adjustedTileSize(const QSize &ts);
+ QQuickCanvasItem::RenderTarget renderTarget() const Q_DECL_OVERRIDE;
+ void compositeTile(QQuickContext2DTile* tile) Q_DECL_OVERRIDE;
+ QSize adjustedTileSize(const QSize &ts) Q_DECL_OVERRIDE;
- QSGTexture *textureForNextFrame(QSGTexture *, QQuickWindow *window);
+ QSGTexture *textureForNextFrame(QSGTexture *, QQuickWindow *window) Q_DECL_OVERRIDE;
protected:
QVector2D scaleFactor() const Q_DECL_OVERRIDE;
public Q_SLOTS:
- virtual void grabImage(const QRectF& region = QRectF());
+ void grabImage(const QRectF& region = QRectF()) Q_DECL_OVERRIDE;
private:
bool doMultisampling() const;
diff --git a/src/quick/items/context2d/qquickcontext2dtile.cpp b/src/quick/items/context2d/qquickcontext2dtile.cpp
index 6beb8f2442..cd1a3ff91e 100644
--- a/src/quick/items/context2d/qquickcontext2dtile.cpp
+++ b/src/quick/items/context2d/qquickcontext2dtile.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/context2d/qquickcontext2dtile_p.h b/src/quick/items/context2d/qquickcontext2dtile_p.h
index 270094d04d..d923313a28 100644
--- a/src/quick/items/context2d/qquickcontext2dtile_p.h
+++ b/src/quick/items/context2d/qquickcontext2dtile_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickaccessibleattached.cpp b/src/quick/items/qquickaccessibleattached.cpp
index 57b814964b..99b9311ee0 100644
--- a/src/quick/items/qquickaccessibleattached.cpp
+++ b/src/quick/items/qquickaccessibleattached.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -291,11 +291,59 @@ QT_BEGIN_NAMESPACE
The corresponding handler is \c onDecreaseAction.
*/
+/*!
+ \qmlsignal QtQuick::Accessible::scrollUpAction()
+
+ This signal is emitted when a scroll up action is received from an assistive tool such as a screen-reader.
+
+ The corresponding handler is \c onScrollUpAction.
+*/
+/*!
+ \qmlsignal QtQuick::Accessible::scrollDownAction()
+
+ This signal is emitted when a scroll down action is received from an assistive tool such as a screen-reader.
+
+ The corresponding handler is \c onScrollDownAction.
+*/
+/*!
+ \qmlsignal QtQuick::Accessible::scrollLeftAction()
+
+ This signal is emitted when a scroll left action is received from an assistive tool such as a screen-reader.
+
+ The corresponding handler is \c onScrollLeftAction.
+*/
+/*!
+ \qmlsignal QtQuick::Accessible::scrollRightAction()
+
+ This signal is emitted when a scroll right action is received from an assistive tool such as a screen-reader.
+
+ The corresponding handler is \c onScrollRightAction.
+*/
+/*!
+ \qmlsignal QtQuick::Accessible::previousPageAction()
+
+ This signal is emitted when a previous page action is received from an assistive tool such as a screen-reader.
+
+ The corresponding handler is \c onPreviousPageAction.
+*/
+/*!
+ \qmlsignal QtQuick::Accessible::nextPageAction()
+
+ This signal is emitted when a next page action is received from an assistive tool such as a screen-reader.
+
+ The corresponding handler is \c onNextPageAction.
+*/
QMetaMethod QQuickAccessibleAttached::sigPress;
QMetaMethod QQuickAccessibleAttached::sigToggle;
QMetaMethod QQuickAccessibleAttached::sigIncrease;
QMetaMethod QQuickAccessibleAttached::sigDecrease;
+QMetaMethod QQuickAccessibleAttached::sigScrollUp;
+QMetaMethod QQuickAccessibleAttached::sigScrollDown;
+QMetaMethod QQuickAccessibleAttached::sigScrollLeft;
+QMetaMethod QQuickAccessibleAttached::sigScrollRight;
+QMetaMethod QQuickAccessibleAttached::sigPreviousPage;
+QMetaMethod QQuickAccessibleAttached::sigNextPage;
QQuickAccessibleAttached::QQuickAccessibleAttached(QObject *parent)
: QObject(parent), m_role(QAccessible::NoRole)
@@ -323,6 +371,12 @@ QQuickAccessibleAttached::QQuickAccessibleAttached(QObject *parent)
sigToggle = QMetaMethod::fromSignal(&QQuickAccessibleAttached::toggleAction);
sigIncrease = QMetaMethod::fromSignal(&QQuickAccessibleAttached::increaseAction);
sigDecrease = QMetaMethod::fromSignal(&QQuickAccessibleAttached::decreaseAction);
+ sigScrollUp = QMetaMethod::fromSignal(&QQuickAccessibleAttached::scrollUpAction);
+ sigScrollDown = QMetaMethod::fromSignal(&QQuickAccessibleAttached::scrollDownAction);
+ sigScrollLeft = QMetaMethod::fromSignal(&QQuickAccessibleAttached::scrollLeftAction);
+ sigScrollRight = QMetaMethod::fromSignal(&QQuickAccessibleAttached::scrollRightAction);
+ sigPreviousPage = QMetaMethod::fromSignal(&QQuickAccessibleAttached::previousPageAction);
+ sigNextPage= QMetaMethod::fromSignal(&QQuickAccessibleAttached::nextPageAction);
}
}
@@ -359,7 +413,18 @@ bool QQuickAccessibleAttached::doAction(const QString &actionName)
sig = &sigIncrease;
else if (actionName == QAccessibleActionInterface::decreaseAction())
sig = &sigDecrease;
-
+ else if (actionName == QAccessibleActionInterface::scrollUpAction())
+ sig = &sigScrollUp;
+ else if (actionName == QAccessibleActionInterface::scrollDownAction())
+ sig = &sigScrollDown;
+ else if (actionName == QAccessibleActionInterface::scrollLeftAction())
+ sig = &sigScrollLeft;
+ else if (actionName == QAccessibleActionInterface::scrollRightAction())
+ sig = &sigScrollRight;
+ else if (actionName == QAccessibleActionInterface::previousPageAction())
+ sig = &sigPreviousPage;
+ else if (actionName == QAccessibleActionInterface::nextPageAction())
+ sig = &sigNextPage;
if (sig && isSignalConnected(*sig))
return sig->invoke(this);
return false;
@@ -375,6 +440,18 @@ void QQuickAccessibleAttached::availableActions(QStringList *actions) const
actions->append(QAccessibleActionInterface::increaseAction());
if (isSignalConnected(sigDecrease))
actions->append(QAccessibleActionInterface::decreaseAction());
+ if (isSignalConnected(sigScrollUp))
+ actions->append(QAccessibleActionInterface::scrollUpAction());
+ if (isSignalConnected(sigScrollDown))
+ actions->append(QAccessibleActionInterface::scrollDownAction());
+ if (isSignalConnected(sigScrollLeft))
+ actions->append(QAccessibleActionInterface::scrollLeftAction());
+ if (isSignalConnected(sigScrollRight))
+ actions->append(QAccessibleActionInterface::scrollRightAction());
+ if (isSignalConnected(sigPreviousPage))
+ actions->append(QAccessibleActionInterface::previousPageAction());
+ if (isSignalConnected(sigNextPage))
+ actions->append(QAccessibleActionInterface::nextPageAction());
}
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickaccessibleattached_p.h b/src/quick/items/qquickaccessibleattached_p.h
index ad6165f936..be78e74b19 100644
--- a/src/quick/items/qquickaccessibleattached_p.h
+++ b/src/quick/items/qquickaccessibleattached_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -212,6 +212,12 @@ Q_SIGNALS:
void toggleAction();
void increaseAction();
void decreaseAction();
+ void scrollUpAction();
+ void scrollDownAction();
+ void scrollLeftAction();
+ void scrollRightAction();
+ void previousPageAction();
+ void nextPageAction();
private:
QQuickItem *item() const { return static_cast<QQuickItem*>(parent()); }
@@ -225,6 +231,12 @@ private:
static QMetaMethod sigToggle;
static QMetaMethod sigIncrease;
static QMetaMethod sigDecrease;
+ static QMetaMethod sigScrollUp;
+ static QMetaMethod sigScrollDown;
+ static QMetaMethod sigScrollLeft;
+ static QMetaMethod sigScrollRight;
+ static QMetaMethod sigPreviousPage;
+ static QMetaMethod sigNextPage;
public:
using QObject::property;
diff --git a/src/quick/items/qquickanchors.cpp b/src/quick/items/qquickanchors.cpp
index 706271f6b2..f559f166bf 100644
--- a/src/quick/items/qquickanchors.cpp
+++ b/src/quick/items/qquickanchors.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickanchors_p.h b/src/quick/items/qquickanchors_p.h
index e02ef9f212..a2328162e5 100644
--- a/src/quick/items/qquickanchors_p.h
+++ b/src/quick/items/qquickanchors_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickanchors_p_p.h b/src/quick/items/qquickanchors_p_p.h
index d07b4369f5..407baad58e 100644
--- a/src/quick/items/qquickanchors_p_p.h
+++ b/src/quick/items/qquickanchors_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -126,8 +126,8 @@ public:
void updateMe();
// QQuickItemGeometryListener interface
- void itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &);
- QQuickAnchorsPrivate *anchorPrivate() { return this; }
+ void itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &) Q_DECL_OVERRIDE;
+ QQuickAnchorsPrivate *anchorPrivate() Q_DECL_OVERRIDE { return this; }
bool checkHValid() const;
bool checkVValid() const;
diff --git a/src/quick/items/qquickanimatedimage.cpp b/src/quick/items/qquickanimatedimage.cpp
index 2fc00ad1d7..49fef12467 100644
--- a/src/quick/items/qquickanimatedimage.cpp
+++ b/src/quick/items/qquickanimatedimage.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -104,7 +104,13 @@ QQuickPixmap* QQuickAnimatedImagePrivate::infoForCurrentFrame(QQmlEngine *engine
about its state, such as the current frame and total number of frames.
The result is an animated image with a simple progress indicator underneath it.
- \b Note: Unlike images, animated images are not cached or shared internally.
+ \b Note: When animated images are cached, every frame of the animation will be cached.
+
+ Set cache to false if you are playing a long or large animation and you
+ want to conserve memory.
+
+ If the image data comes from a sequential device (e.g. a socket),
+ AnimatedImage can only loop if cache is set to true.
\clearfloat
\snippet qml/animatedimage.qml document
@@ -126,6 +132,7 @@ QQuickPixmap* QQuickAnimatedImagePrivate::infoForCurrentFrame(QQmlEngine *engine
QQuickAnimatedImage::QQuickAnimatedImage(QQuickItem *parent)
: QQuickImage(*(new QQuickAnimatedImagePrivate), parent)
{
+ QObject::connect(this, &QQuickImageBase::cacheChanged, this, &QQuickAnimatedImage::onCacheChanged);
}
QQuickAnimatedImage::~QQuickAnimatedImage()
@@ -372,7 +379,8 @@ void QQuickAnimatedImage::movieRequestFinished()
this, SLOT(playingStatusChanged()));
connect(d->_movie, SIGNAL(frameChanged(int)),
this, SLOT(movieUpdate()));
- d->_movie->setCacheMode(QMovie::CacheAll);
+ if (d->cache)
+ d->_movie->setCacheMode(QMovie::CacheAll);
d->status = Ready;
emit statusChanged(d->status);
@@ -406,6 +414,11 @@ void QQuickAnimatedImage::movieUpdate()
{
Q_D(QQuickAnimatedImage);
+ if (!d->cache) {
+ qDeleteAll(d->frameMap);
+ d->frameMap.clear();
+ }
+
if (d->_movie) {
d->setPixmap(*d->infoForCurrentFrame(qmlEngine(this)));
emit frameChanged();
@@ -426,6 +439,22 @@ void QQuickAnimatedImage::playingStatusChanged()
}
}
+void QQuickAnimatedImage::onCacheChanged()
+{
+ Q_D(QQuickAnimatedImage);
+ if (!cache()) {
+ qDeleteAll(d->frameMap);
+ d->frameMap.clear();
+ if (d->_movie) {
+ d->_movie->setCacheMode(QMovie::CacheNone);
+ }
+ } else {
+ if (d->_movie) {
+ d->_movie->setCacheMode(QMovie::CacheAll);
+ }
+ }
+}
+
QSize QQuickAnimatedImage::sourceSize()
{
Q_D(QQuickAnimatedImage);
diff --git a/src/quick/items/qquickanimatedimage_p.h b/src/quick/items/qquickanimatedimage_p.h
index 789f56e6f7..409933817f 100644
--- a/src/quick/items/qquickanimatedimage_p.h
+++ b/src/quick/items/qquickanimatedimage_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -71,7 +71,7 @@ public:
int frameCount() const;
// Extends QQuickImage's src property
- virtual void setSource(const QUrl&);
+ void setSource(const QUrl&) Q_DECL_OVERRIDE;
virtual QSize sourceSize();
Q_SIGNALS:
@@ -84,10 +84,11 @@ private Q_SLOTS:
void movieUpdate();
void movieRequestFinished();
void playingStatusChanged();
+ void onCacheChanged();
protected:
- virtual void load();
- void componentComplete();
+ void load() Q_DECL_OVERRIDE;
+ void componentComplete() Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QQuickAnimatedImage)
diff --git a/src/quick/items/qquickanimatedimage_p_p.h b/src/quick/items/qquickanimatedimage_p_p.h
index 3b8d3c6c1b..bb921fda4a 100644
--- a/src/quick/items/qquickanimatedimage_p_p.h
+++ b/src/quick/items/qquickanimatedimage_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickanimatedsprite.cpp b/src/quick/items/qquickanimatedsprite.cpp
index 5ca17aecec..5e653e426c 100644
--- a/src/quick/items/qquickanimatedsprite.cpp
+++ b/src/quick/items/qquickanimatedsprite.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -54,9 +54,9 @@ class QQuickAnimatedSpriteMaterial : public QSGMaterial
public:
QQuickAnimatedSpriteMaterial();
~QQuickAnimatedSpriteMaterial();
- virtual QSGMaterialType *type() const { static QSGMaterialType type; return &type; }
- virtual QSGMaterialShader *createShader() const;
- virtual int compare(const QSGMaterial *other) const
+ QSGMaterialType *type() const Q_DECL_OVERRIDE { static QSGMaterialType type; return &type; }
+ QSGMaterialShader *createShader() const Q_DECL_OVERRIDE;
+ int compare(const QSGMaterial *other) const Q_DECL_OVERRIDE
{
return this - static_cast<const QQuickAnimatedSpriteMaterial *>(other);
}
@@ -100,7 +100,7 @@ public:
setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/items/shaders/sprite.frag"));
}
- virtual void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *)
+ void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *) Q_DECL_OVERRIDE
{
QQuickAnimatedSpriteMaterial *m = static_cast<QQuickAnimatedSpriteMaterial *>(newEffect);
m->texture->bind();
@@ -113,14 +113,14 @@ public:
program()->setUniformValue(m_matrix_id, state.combinedMatrix());
}
- virtual void initialize() {
+ void initialize() Q_DECL_OVERRIDE {
m_matrix_id = program()->uniformLocation("qt_Matrix");
m_opacity_id = program()->uniformLocation("qt_Opacity");
m_animData_id = program()->uniformLocation("animData");
m_animPos_id = program()->uniformLocation("animPos");
}
- virtual char const *const *attributeNames() const {
+ char const *const *attributeNames() const Q_DECL_OVERRIDE {
static const char *attr[] = {
"vPos",
"vTex",
@@ -388,8 +388,8 @@ void QQuickAnimatedSprite::advance(int frames)
//TODO-C: May not work when running - only when paused
m_curFrame += frames;
while (m_curFrame < 0)
- m_curFrame += m_sprite->frames();
- m_curFrame = m_curFrame % m_sprite->frames();
+ m_curFrame += m_spriteEngine->maxFrames();
+ m_curFrame = m_curFrame % m_spriteEngine->maxFrames();
emit currentFrameChanged(m_curFrame);
}
@@ -529,7 +529,6 @@ QSGGeometryNode* QQuickAnimatedSprite::buildNode()
indices[5] = 2;
- m_timestamp.start();
m_node = new QSGGeometryNode();
m_node->setGeometry(g);
m_node->setMaterial(m_material);
@@ -574,43 +573,47 @@ void QQuickAnimatedSprite::prepareNextFrame()
int timeInt = m_timestamp.elapsed() + m_pauseOffset;
qreal time = timeInt / 1000.;
- double frameAt; //double just for modf
+ int frameAt;
qreal progress = 0.0;
int lastFrame = m_curFrame;
- if (!m_paused) {
+ if (m_running && !m_paused) {
+ const int nColumns = int(m_sheetSize.width()) / m_spriteEngine->spriteWidth();
//Advance State (keeps time for psuedostates)
m_spriteEngine->updateSprites(timeInt);
//Advance AnimatedSprite
qreal animT = m_spriteEngine->spriteStart()/1000.0;
- qreal frameCount = m_spriteEngine->spriteFrames();
- qreal frameDuration = m_spriteEngine->spriteDuration()/frameCount;
+ const int frameCountInRow = m_spriteEngine->spriteFrames();
+ const qreal frameDuration = m_spriteEngine->spriteDuration()/frameCountInRow;
if (frameDuration > 0) {
qreal frame = (time - animT)/(frameDuration / 1000.0);
bool lastLoop = m_loops > 0 && m_curLoop == m_loops-1;
//don't visually interpolate for the last frame of the last loop
- qreal max = lastLoop ? frameCount - qreal(1.0) : frameCount;
- frame = qBound(qreal(0.0), frame, max);
- progress = modf(frame,&frameAt);
- if (m_curFrame > frameAt) //went around
+ const int max = lastLoop ? frameCountInRow - 1 : frameCountInRow;
+ frame = qBound(qreal(0.0), frame, qreal(max));
+ double intpart;
+ progress = std::modf(frame,&intpart);
+ frameAt = (int)intpart;
+ const int rowIndex = m_spriteEngine->spriteY()/frameHeight();
+ const int newFrame = rowIndex * nColumns + frameAt;
+ if (m_curFrame > newFrame) //went around
m_curLoop++;
- m_curFrame = frameAt;
+ m_curFrame = newFrame;
} else {
m_curFrame++;
- if (m_curFrame >= frameCount){
+ if (m_curFrame >= m_spriteEngine->maxFrames()) { // maxFrames: total number of frames including all rows
m_curFrame = 0;
m_curLoop++;
- m_spriteEngine->advance();
}
- frameAt = m_curFrame;
+ frameAt = m_curFrame % nColumns;
+ if (frameAt == 0)
+ m_spriteEngine->advance();
progress = 0;
}
if (m_loops > 0 && m_curLoop >= m_loops) {
frameAt = 0;
- if (m_running) {
- m_running = false;
- emit runningChanged(false);
- }
+ m_running = false;
+ emit runningChanged(false);
}
} else {
frameAt = m_curFrame;
diff --git a/src/quick/items/qquickanimatedsprite_p.h b/src/quick/items/qquickanimatedsprite_p.h
index 0bc2c65b7c..4778afc88b 100644
--- a/src/quick/items/qquickanimatedsprite_p.h
+++ b/src/quick/items/qquickanimatedsprite_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -343,8 +343,8 @@ private Q_SLOTS:
protected:
void reset();
- void componentComplete();
- QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
+ void componentComplete() Q_DECL_OVERRIDE;
+ QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
private:
bool isCurrentFrameChangedConnected();
void prepareNextFrame();
diff --git a/src/quick/items/qquickborderimage.cpp b/src/quick/items/qquickborderimage.cpp
index 38bbc66896..f345a77e15 100644
--- a/src/quick/items/qquickborderimage.cpp
+++ b/src/quick/items/qquickborderimage.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -40,6 +40,7 @@
#include <QtNetwork/qnetworkreply.h>
#include <QtCore/qfile.h>
#include <QtCore/qmath.h>
+#include <QtGui/qguiapplication.h>
#include <private/qqmlglobal_p.h>
@@ -321,7 +322,13 @@ void QQuickBorderImage::load()
if (d->cache)
options |= QQuickPixmap::Cache;
d->pix.clear(this);
- d->pix.load(qmlEngine(this), d->url, options);
+
+ const qreal targetDevicePixelRatio = (window() ? window()->effectiveDevicePixelRatio() : qGuiApp->devicePixelRatio());
+ d->devicePixelRatio = 1.0;
+
+ QUrl loadUrl = d->url;
+ resolve2xLocalFile(d->url, targetDevicePixelRatio, &loadUrl, &d->devicePixelRatio);
+ d->pix.load(qmlEngine(this), loadUrl, d->sourcesize * d->devicePixelRatio, options);
if (d->pix.isLoading()) {
if (d->progress != 0.0) {
@@ -329,8 +336,19 @@ void QQuickBorderImage::load()
emit progressChanged(d->progress);
}
d->status = Loading;
- d->pix.connectFinished(this, SLOT(requestFinished()));
- d->pix.connectDownloadProgress(this, SLOT(requestProgress(qint64,qint64)));
+
+ static int thisRequestProgress = -1;
+ static int thisRequestFinished = -1;
+ if (thisRequestProgress == -1) {
+ thisRequestProgress =
+ QQuickImageBase::staticMetaObject.indexOfSlot("requestProgress(qint64,qint64)");
+ thisRequestFinished =
+ QQuickImageBase::staticMetaObject.indexOfSlot("requestFinished()");
+ }
+ d->pix.connectFinished(this, thisRequestFinished);
+ d->pix.connectDownloadProgress(this, thisRequestProgress);
+
+ update(); //pixmap may have invalidated texture, updatePaintNode needs to be called before the next repaint
} else {
requestFinished();
return;
@@ -495,7 +513,7 @@ void QQuickBorderImage::requestFinished()
}
}
- setImplicitSize(impsize.width(), impsize.height());
+ setImplicitSize(impsize.width() / d->devicePixelRatio, impsize.height() / d->devicePixelRatio);
emit statusChanged(d->status);
if (sourceSize() != d->oldSourceSize) {
d->oldSourceSize = sourceSize();
@@ -569,40 +587,29 @@ QSGNode *QQuickBorderImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDat
QRectF innerTargetRect = targetRect;
if (d->border) {
const QQuickScaleGrid *border = d->getScaleGrid();
- innerSourceRect = QRectF(border->left() / qreal(d->pix.width()),
- border->top() / qreal(d->pix.height()),
- qMax<qreal>(0, d->pix.width() - border->right() - border->left()) / d->pix.width(),
- qMax<qreal>(0, d->pix.height() - border->bottom() - border->top()) / d->pix.height());
+ innerSourceRect = QRectF(border->left() * d->devicePixelRatio / qreal(d->pix.width()),
+ border->top() * d->devicePixelRatio / qreal(d->pix.height()),
+ qMax<qreal>(0, d->pix.width() - (border->right() + border->left()) * d->devicePixelRatio) / d->pix.width(),
+ qMax<qreal>(0, d->pix.height() - (border->bottom() + border->top()) * d->devicePixelRatio) / d->pix.height());
innerTargetRect = QRectF(border->left(),
border->top(),
- qMax<qreal>(0, width() - border->right() - border->left()),
- qMax<qreal>(0, height() - border->bottom() - border->top()));
+ qMax<qreal>(0, width() - (border->right() + border->left())),
+ qMax<qreal>(0, height() - (border->bottom() + border->top())));
}
qreal hTiles = 1;
qreal vTiles = 1;
- if (innerSourceRect.width() != 0) {
- switch (d->horizontalTileMode) {
- case QQuickBorderImage::Repeat:
- hTiles = innerTargetRect.width() / qreal(innerSourceRect.width() * d->pix.width());
- break;
- case QQuickBorderImage::Round:
- hTiles = qCeil(innerTargetRect.width() / qreal(innerSourceRect.width() * d->pix.width()));
- break;
- default:
- break;
- }
+ const QSizeF innerTargetSize = innerTargetRect.size() * d->devicePixelRatio;
+ if (innerSourceRect.width() != 0
+ && d->horizontalTileMode != QQuickBorderImage::Stretch) {
+ hTiles = innerTargetSize.width() / qreal(innerSourceRect.width() * d->pix.width());
+ if (d->horizontalTileMode == QQuickBorderImage::Round)
+ hTiles = qCeil(hTiles);
}
- if (innerSourceRect.height() != 0) {
- switch (d->verticalTileMode) {
- case QQuickBorderImage::Repeat:
- vTiles = innerTargetRect.height() / qreal(innerSourceRect.height() * d->pix.height());
- break;
- case QQuickBorderImage::Round:
- vTiles = qCeil(innerTargetRect.height() / qreal(innerSourceRect.height() * d->pix.height()));
- break;
- default:
- break;
- }
+ if (innerSourceRect.height() != 0
+ && d->verticalTileMode != QQuickBorderImage::Stretch) {
+ vTiles = innerTargetSize.height() / qreal(innerSourceRect.height() * d->pix.height());
+ if (d->verticalTileMode == QQuickBorderImage::Round)
+ vTiles = qCeil(vTiles);
}
node->setTargetRect(targetRect);
diff --git a/src/quick/items/qquickborderimage_p.h b/src/quick/items/qquickborderimage_p.h
index 6a2469adc2..f2a172fad3 100644
--- a/src/quick/items/qquickborderimage_p.h
+++ b/src/quick/items/qquickborderimage_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -66,7 +66,7 @@ public:
TileMode verticalTileMode() const;
void setVerticalTileMode(TileMode);
- void setSource(const QUrl &url);
+ void setSource(const QUrl &url) Q_DECL_OVERRIDE;
Q_SIGNALS:
void horizontalTileModeChanged();
@@ -74,16 +74,16 @@ Q_SIGNALS:
void sourceSizeChanged();
protected:
- virtual void load();
- virtual void pixmapChange();
- virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
+ void load() Q_DECL_OVERRIDE;
+ void pixmapChange() Q_DECL_OVERRIDE;
+ QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
private:
void setGridScaledImage(const QQuickGridScaledImage& sci);
private Q_SLOTS:
void doUpdate();
- void requestFinished();
+ void requestFinished() Q_DECL_OVERRIDE;
void sciRequestFinished();
private:
diff --git a/src/quick/items/qquickborderimage_p_p.h b/src/quick/items/qquickborderimage_p_p.h
index d5b959fd9f..9a8dadf214 100644
--- a/src/quick/items/qquickborderimage_p_p.h
+++ b/src/quick/items/qquickborderimage_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickclipnode.cpp b/src/quick/items/qquickclipnode.cpp
index 0d322c6aa7..a46f758c3b 100644
--- a/src/quick/items/qquickclipnode.cpp
+++ b/src/quick/items/qquickclipnode.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickclipnode_p.h b/src/quick/items/qquickclipnode_p.h
index 8427263f2b..2e7fa1f495 100644
--- a/src/quick/items/qquickclipnode_p.h
+++ b/src/quick/items/qquickclipnode_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp
index cff2f26092..4d46485718 100644
--- a/src/quick/items/qquickdrag.cpp
+++ b/src/quick/items/qquickdrag.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -33,6 +33,9 @@
#include "qquickdrag_p.h"
+#include <private/qguiapplication_p.h>
+#include <qpa/qplatformintegration.h>
+#include <qpa/qplatformdrag.h>
#include <private/qquickitem_p.h>
#include <QtQuick/private/qquickevents_p_p.h>
#include <private/qquickitemchangelistener_p.h>
@@ -71,7 +74,7 @@ public:
{
}
- void itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &);
+ void itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &) Q_DECL_OVERRIDE;
void itemParentChanged(QQuickItem *, QQuickItem *parent);
void updatePosition();
void restartDrag();
@@ -724,7 +727,8 @@ Qt::DropAction QQuickDragAttachedPrivate::startDrag(Qt::DropActions supportedAct
Qt::DropAction dropAction = drag->exec(supportedActions);
- delete drag;
+ if (!QGuiApplicationPrivate::platformIntegration()->drag()->ownsDragObject())
+ drag->deleteLater();
deliverLeaveEvent();
@@ -784,7 +788,7 @@ void QQuickDragAttached::startDrag(QQmlV4Function *args)
QQuickDrag::QQuickDrag(QObject *parent)
: QObject(parent), _target(0), _axis(XAndYAxis), _xmin(-FLT_MAX),
_xmax(FLT_MAX), _ymin(-FLT_MAX), _ymax(FLT_MAX), _active(false), _filterChildren(false),
- _smoothed(true), _threshold(qApp->styleHints()->startDragDistance())
+ _smoothed(true), _threshold(QGuiApplication::styleHints()->startDragDistance())
{
}
@@ -906,7 +910,7 @@ void QQuickDrag::setThreshold(qreal value)
void QQuickDrag::resetThreshold()
{
- setThreshold(qApp->styleHints()->startDragDistance());
+ setThreshold(QGuiApplication::styleHints()->startDragDistance());
}
bool QQuickDrag::active() const
diff --git a/src/quick/items/qquickdrag_p.h b/src/quick/items/qquickdrag_p.h
index 942c9e732c..4bd4cfc6fd 100644
--- a/src/quick/items/qquickdrag_p.h
+++ b/src/quick/items/qquickdrag_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickdroparea.cpp b/src/quick/items/qquickdroparea.cpp
index da00cd3028..e46d546a16 100644
--- a/src/quick/items/qquickdroparea.cpp
+++ b/src/quick/items/qquickdroparea.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -36,6 +36,7 @@
#include "qquickitem_p.h"
#include "qquickwindow.h"
+#include <private/qv4arraybuffer_p.h>
#include <private/qqmlengine_p.h>
#ifndef QT_NO_DRAGANDDROP
@@ -496,6 +497,14 @@ void QQuickDropArea::dropEvent(QDropEvent *event)
Returns the data for the given \a format converted to a string. \a format should be one contained in the \l formats property.
*/
+/*!
+ \qmlmethod string QtQuick::DragEvent::getDataAsArrayBuffer(string format)
+ \since 5.5
+
+ Returns the data for the given \a format into an ArrayBuffer, which can
+ easily be translated into a QByteArray. \a format should be one contained in the \l formats property.
+*/
+
QObject *QQuickDropEvent::source()
{
if (const QQuickDragMimeData *dragMime = qobject_cast<const QQuickDragMimeData *>(event->mimeData()))
@@ -566,6 +575,17 @@ void QQuickDropEvent::getDataAsString(QQmlV4Function *args)
}
}
+void QQuickDropEvent::getDataAsArrayBuffer(QQmlV4Function *args)
+{
+ if (args->length() != 0) {
+ QV4::ExecutionEngine *v4 = args->v4engine();
+ QV4::Scope scope(v4);
+ QV4::ScopedValue v(scope, (*args)[0]);
+ const QString format = v->toQString();
+ args->setReturnValue(v4->newArrayBuffer(event->mimeData()->data(format))->asReturnedValue());
+ }
+}
+
void QQuickDropEvent::acceptProposedAction(QQmlV4Function *)
{
event->acceptProposedAction();
diff --git a/src/quick/items/qquickdroparea_p.h b/src/quick/items/qquickdroparea_p.h
index a0c985ddf7..3223f4203b 100644
--- a/src/quick/items/qquickdroparea_p.h
+++ b/src/quick/items/qquickdroparea_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -96,6 +96,7 @@ public:
QStringList formats() const;
Q_INVOKABLE void getDataAsString(QQmlV4Function *);
+ Q_INVOKABLE void getDataAsArrayBuffer(QQmlV4Function *);
Q_INVOKABLE void acceptProposedAction(QQmlV4Function *);
Q_INVOKABLE void accept(QQmlV4Function *);
@@ -160,10 +161,10 @@ Q_SIGNALS:
void dropped(QQuickDropEvent *drop);
protected:
- void dragMoveEvent(QDragMoveEvent *event);
- void dragEnterEvent(QDragEnterEvent *event);
- void dragLeaveEvent(QDragLeaveEvent *event);
- void dropEvent(QDropEvent *event);
+ void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
+ void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
+ void dragLeaveEvent(QDragLeaveEvent *event) Q_DECL_OVERRIDE;
+ void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QQuickDropArea)
diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp
index e34df86a77..1380452718 100644
--- a/src/quick/items/qquickevents.cpp
+++ b/src/quick/items/qquickevents.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -323,7 +323,7 @@ Item {
\qmlproperty point QtQuick::WheelEvent::pixelDelta
This property holds the delta in screen pixels and is available in plataforms that
- have high-resolution trackpads, such as Mac OS X.
+ have high-resolution trackpads, such as OS X.
The x and y cordinate of this property holds the delta in horizontal and
vertical orientation. The value should be used directly to scroll content on screen.
diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h
index a0a3863f8d..8e7da66543 100644
--- a/src/quick/items/qquickevents_p_p.h
+++ b/src/quick/items/qquickevents_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp
index 9f1de39186..19fb66c19c 100644
--- a/src/quick/items/qquickflickable.cpp
+++ b/src/quick/items/qquickflickable.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -59,6 +59,10 @@ static const int FlickThreshold = 15;
// will ensure the Flickable retains the grab on consecutive flicks.
static const int RetainGrabVelocity = 100;
+static qreal EaseOvershoot(qreal t) {
+ return qAtan(t);
+}
+
QQuickFlickableVisibleArea::QQuickFlickableVisibleArea(QQuickFlickable *parent)
: QObject(parent), flickable(parent), m_xPosition(0.), m_widthRatio(0.)
, m_yPosition(0.), m_heightRatio(0.)
@@ -180,7 +184,7 @@ public:
}
protected:
- virtual void finished() {
+ void finished() Q_DECL_OVERRIDE {
if (!flickable)
return;
axisData->move.setValue(axisData->transitionTo);
@@ -212,7 +216,8 @@ QQuickFlickablePrivate::QQuickFlickablePrivate()
, hData(this, &QQuickFlickablePrivate::setViewportX)
, vData(this, &QQuickFlickablePrivate::setViewportY)
, hMoved(false), vMoved(false)
- , stealMouse(false), pressed(false), interactive(true), calcVelocity(false)
+ , stealMouse(false), pressed(false)
+ , scrollingPhase(false), interactive(true), calcVelocity(false)
, pixelAligned(false), replayingPressEvent(false)
, lastPosTime(-1)
, lastPressTime(0)
@@ -319,7 +324,7 @@ bool QQuickFlickablePrivate::flick(AxisData &data, qreal minExtent, qreal maxExt
maxDistance = qAbs(maxExtent - data.move.value());
data.flickTarget = maxExtent;
}
- if (maxDistance > 0 || boundsBehavior == QQuickFlickable::DragAndOvershootBounds) {
+ if (maxDistance > 0 || boundsBehavior & QQuickFlickable::OvershootBounds) {
qreal v = velocity;
if (maxVelocity != -1 && maxVelocity < qAbs(v)) {
if (v < 0)
@@ -339,7 +344,7 @@ bool QQuickFlickablePrivate::flick(AxisData &data, qreal minExtent, qreal maxExt
accel = v2 / (2.0f * qAbs(dist));
resetTimeline(data);
- if (boundsBehavior == QQuickFlickable::DragAndOvershootBounds)
+ if (boundsBehavior & QQuickFlickable::OvershootBounds)
timeline.accel(data.move, v, accel);
else
timeline.accel(data.move, v, accel, maxDistance);
@@ -915,9 +920,16 @@ qint64 QQuickFlickablePrivate::computeCurrentTime(QInputEvent *event)
{
if (0 != event->timestamp())
return event->timestamp();
+ if (!timer.isValid())
+ return 0LL;
return timer.elapsed();
}
+qreal QQuickFlickablePrivate::devicePixelRatio()
+{
+ return (window ? window->effectiveDevicePixelRatio() : qApp->devicePixelRatio());
+}
+
void QQuickFlickablePrivate::handleMousePressEvent(QMouseEvent *event)
{
Q_Q(QQuickFlickable);
@@ -945,6 +957,13 @@ void QQuickFlickablePrivate::handleMousePressEvent(QMouseEvent *event)
flickBoost = 1.0;
}
q->setKeepMouseGrab(stealMouse);
+
+ maybeBeginDrag(computeCurrentTime(event), event->localPos());
+}
+
+void QQuickFlickablePrivate::maybeBeginDrag(qint64 currentTimestamp, const QPointF &pressPosn)
+{
+ Q_Q(QQuickFlickable);
clearDelayedPress();
pressed = true;
@@ -965,7 +984,7 @@ void QQuickFlickablePrivate::handleMousePressEvent(QMouseEvent *event)
vData.dragMaxBound = q->maxYExtent() + vData.endMargin;
fixupMode = Normal;
lastPos = QPointF();
- pressPos = event->localPos();
+ pressPos = pressPosn;
hData.pressPos = hData.move.value();
vData.pressPos = vData.move.value();
bool wasFlicking = hData.flicking || vData.flicking;
@@ -979,29 +998,37 @@ void QQuickFlickablePrivate::handleMousePressEvent(QMouseEvent *event)
}
if (wasFlicking)
emit q->flickingChanged();
- lastPosTime = lastPressTime = computeCurrentTime(event);
+ lastPosTime = lastPressTime = currentTimestamp;
vData.velocityTime.start();
hData.velocityTime.start();
}
-void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event)
+void QQuickFlickablePrivate::drag(qint64 currentTimestamp, QEvent::Type eventType, const QPointF &localPos,
+ const QVector2D &deltas, bool overThreshold, bool momentum,
+ bool velocitySensitiveOverBounds, const QVector2D &velocity)
{
Q_Q(QQuickFlickable);
- if (!interactive || lastPosTime == -1)
- return;
bool rejectY = false;
bool rejectX = false;
- bool stealY = stealMouse;
- bool stealX = stealMouse;
+ bool keepY = q->yflick();
+ bool keepX = q->xflick();
+
+ bool stealY = false;
+ bool stealX = false;
+ if (eventType == QEvent::MouseMove) {
+ stealX = stealY = stealMouse;
+ } else if (eventType == QEvent::Wheel) {
+ stealX = stealY = scrollingPhase;
+ }
bool prevHMoved = hMoved;
bool prevVMoved = vMoved;
- qint64 elapsedSincePress = computeCurrentTime(event) - lastPressTime;
+ qint64 elapsedSincePress = currentTimestamp - lastPressTime;
+
if (q->yflick()) {
- qreal dy = event->localPos().y() - pressPos.y();
- bool overThreshold = QQuickWindowPrivate::dragOverThreshold(dy, Qt::YAxis, event);
+ qreal dy = deltas.y();
if (overThreshold || elapsedSincePress > 200) {
if (!vMoved)
vData.dragStartOffset = dy;
@@ -1011,57 +1038,130 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event)
// the estimate to be altered
const qreal minY = vData.dragMinBound + vData.startMargin;
const qreal maxY = vData.dragMaxBound - vData.endMargin;
- if (boundsBehavior == QQuickFlickable::StopAtBounds) {
+ if (!(boundsBehavior & QQuickFlickable::DragOverBounds)) {
if (fuzzyLessThanOrEqualTo(newY, maxY)) {
newY = maxY;
rejectY = vData.pressPos == maxY && vData.move.value() == maxY && dy < 0;
}
if (fuzzyLessThanOrEqualTo(minY, newY)) {
newY = minY;
- rejectY = vData.pressPos == minY && vData.move.value() == minY && dy > 0;
+ rejectY |= vData.pressPos == minY && vData.move.value() == minY && dy > 0;
}
} else {
- if (newY > minY)
- newY = minY + (newY - minY) / 2;
- if (newY < maxY && maxY - minY <= 0)
- newY = maxY + (newY - maxY) / 2;
+ qreal vel = velocity.y() / QML_FLICK_OVERSHOOTFRICTION;
+ if (vel > 0. && vel > vData.velocity)
+ vData.velocity = qMin(velocity.y() / QML_FLICK_OVERSHOOTFRICTION, float(QML_FLICK_DEFAULTMAXVELOCITY));
+ else if (vel < 0. && vel < vData.velocity)
+ vData.velocity = qMax(velocity.y() / QML_FLICK_OVERSHOOTFRICTION, -float(QML_FLICK_DEFAULTMAXVELOCITY));
+ if (newY > minY) {
+ // Overshoot beyond the top. But don't wait for momentum phase to end before returning to bounds.
+ if (momentum && vData.atBeginning) {
+ if (!vData.inRebound) {
+ vData.inRebound = true;
+ q->returnToBounds();
+ }
+ return;
+ }
+ if (velocitySensitiveOverBounds) {
+ qreal overshoot = (newY - minY) * vData.velocity / QML_FLICK_DEFAULTMAXVELOCITY / QML_FLICK_OVERSHOOTFRICTION;
+ overshoot = QML_FLICK_OVERSHOOT * devicePixelRatio() * EaseOvershoot(overshoot / QML_FLICK_OVERSHOOT / devicePixelRatio());
+ newY = minY + overshoot;
+ } else {
+ newY = minY + (newY - minY) / 2;
+ }
+ } else if (newY < maxY && maxY - minY <= 0) {
+ // Overshoot beyond the bottom. But don't wait for momentum phase to end before returning to bounds.
+ if (momentum && vData.atEnd) {
+ if (!vData.inRebound) {
+ vData.inRebound = true;
+ q->returnToBounds();
+ }
+ return;
+ }
+ if (velocitySensitiveOverBounds) {
+ qreal overshoot = (newY - maxY) * vData.velocity / QML_FLICK_DEFAULTMAXVELOCITY / QML_FLICK_OVERSHOOTFRICTION;
+ overshoot = QML_FLICK_OVERSHOOT * devicePixelRatio() * EaseOvershoot(overshoot / QML_FLICK_OVERSHOOT / devicePixelRatio());
+ newY = maxY - overshoot;
+ } else {
+ newY = maxY + (newY - maxY) / 2;
+ }
+ }
}
- if (!rejectY && stealMouse && dy != 0.0) {
+ if (!rejectY && stealMouse && dy != 0.0 && dy != vData.previousDragDelta) {
clearTimeline();
vData.move.setValue(newY);
vMoved = true;
}
if (!rejectY && overThreshold)
stealY = true;
+
+ if ((newY >= minY && vData.pressPos == minY && vData.move.value() == minY && dy > 0)
+ || (newY <= maxY && vData.pressPos == maxY && vData.move.value() == maxY && dy < 0)) {
+ keepY = false;
+ }
}
+ vData.previousDragDelta = dy;
}
if (q->xflick()) {
- qreal dx = event->localPos().x() - pressPos.x();
- bool overThreshold = QQuickWindowPrivate::dragOverThreshold(dx, Qt::XAxis, event);
+ qreal dx = deltas.x();
if (overThreshold || elapsedSincePress > 200) {
if (!hMoved)
hData.dragStartOffset = dx;
qreal newX = dx + hData.pressPos - hData.dragStartOffset;
const qreal minX = hData.dragMinBound + hData.startMargin;
const qreal maxX = hData.dragMaxBound - hData.endMargin;
- if (boundsBehavior == QQuickFlickable::StopAtBounds) {
+ if (!(boundsBehavior & QQuickFlickable::DragOverBounds)) {
if (fuzzyLessThanOrEqualTo(newX, maxX)) {
newX = maxX;
rejectX = hData.pressPos == maxX && hData.move.value() == maxX && dx < 0;
}
if (fuzzyLessThanOrEqualTo(minX, newX)) {
newX = minX;
- rejectX = hData.pressPos == minX && hData.move.value() == minX && dx > 0;
+ rejectX |= hData.pressPos == minX && hData.move.value() == minX && dx > 0;
}
} else {
- if (newX > minX)
- newX = minX + (newX - minX) / 2;
- if (newX < maxX && maxX - minX <= 0)
- newX = maxX + (newX - maxX) / 2;
+ qreal vel = velocity.x() / QML_FLICK_OVERSHOOTFRICTION;
+ if (vel > 0. && vel > hData.velocity)
+ hData.velocity = qMin(velocity.x() / QML_FLICK_OVERSHOOTFRICTION, float(QML_FLICK_DEFAULTMAXVELOCITY));
+ else if (vel < 0. && vel < hData.velocity)
+ hData.velocity = qMax(velocity.x() / QML_FLICK_OVERSHOOTFRICTION, -float(QML_FLICK_DEFAULTMAXVELOCITY));
+ if (newX > minX) {
+ // Overshoot beyond the left. But don't wait for momentum phase to end before returning to bounds.
+ if (momentum && hData.atBeginning) {
+ if (!hData.inRebound) {
+ hData.inRebound = true;
+ q->returnToBounds();
+ }
+ return;
+ }
+ if (velocitySensitiveOverBounds) {
+ qreal overshoot = (newX - minX) * hData.velocity / QML_FLICK_DEFAULTMAXVELOCITY / QML_FLICK_OVERSHOOTFRICTION;
+ overshoot = QML_FLICK_OVERSHOOT * devicePixelRatio() * EaseOvershoot(overshoot / QML_FLICK_OVERSHOOT / devicePixelRatio());
+ newX = minX + overshoot;
+ } else {
+ newX = minX + (newX - minX) / 2;
+ }
+ } else if (newX < maxX && maxX - minX <= 0) {
+ // Overshoot beyond the right. But don't wait for momentum phase to end before returning to bounds.
+ if (momentum && hData.atEnd) {
+ if (!hData.inRebound) {
+ hData.inRebound = true;
+ q->returnToBounds();
+ }
+ return;
+ }
+ if (velocitySensitiveOverBounds) {
+ qreal overshoot = (newX - maxX) * hData.velocity / QML_FLICK_DEFAULTMAXVELOCITY / QML_FLICK_OVERSHOOTFRICTION;
+ overshoot = QML_FLICK_OVERSHOOT * devicePixelRatio() * EaseOvershoot(overshoot / QML_FLICK_OVERSHOOT / devicePixelRatio());
+ newX = maxX - overshoot;
+ } else {
+ newX = maxX + (newX - maxX) / 2;
+ }
+ }
}
- if (!rejectX && stealMouse && dx != 0.0) {
+ if (!rejectX && stealMouse && dx != 0.0 && dx != hData.previousDragDelta) {
clearTimeline();
hData.move.setValue(newX);
hMoved = true;
@@ -1069,12 +1169,19 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event)
if (!rejectX && overThreshold)
stealX = true;
+
+ if ((newX >= minX && vData.pressPos == minX && vData.move.value() == minX && dx > 0)
+ || (newX <= maxX && vData.pressPos == maxX && vData.move.value() == maxX && dx < 0)) {
+ keepX = false;
+ }
}
+ hData.previousDragDelta = dx;
}
stealMouse = stealX || stealY;
if (stealMouse) {
- q->setKeepMouseGrab(true);
+ if ((stealX && keepX) || (stealY && keepY))
+ q->setKeepMouseGrab(true);
clearDelayedPress();
}
@@ -1092,29 +1199,35 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event)
if ((hMoved && !prevHMoved) || (vMoved && !prevVMoved))
q->movementStarting();
+ lastPosTime = currentTimestamp;
+ if (q->yflick() && !rejectY)
+ vData.addVelocitySample(velocity.y(), maxVelocity);
+ if (q->xflick() && !rejectX)
+ hData.addVelocitySample(velocity.x(), maxVelocity);
+ lastPos = localPos;
+}
+
+void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event)
+{
+ Q_Q(QQuickFlickable);
+ if (!interactive || lastPosTime == -1)
+ return;
+
qint64 currentTimestamp = computeCurrentTime(event);
qreal elapsed = qreal(currentTimestamp - (lastPos.isNull() ? lastPressTime : lastPosTime)) / 1000.;
- if (elapsed <= 0)
- return;
- lastPosTime = currentTimestamp;
- if (q->yflick() && !rejectY) {
- if (QGuiApplicationPrivate::mouseEventCaps(event) & QTouchDevice::Velocity) {
- vData.addVelocitySample(QGuiApplicationPrivate::mouseEventVelocity(event).y(), maxVelocity);
- } else {
- qreal dy = event->localPos().y() - (lastPos.isNull() ? pressPos.y() : lastPos.y());
- vData.addVelocitySample(dy/elapsed, maxVelocity);
- }
- }
- if (q->xflick() && !rejectX) {
- if (QGuiApplicationPrivate::mouseEventCaps(event) & QTouchDevice::Velocity) {
- hData.addVelocitySample(QGuiApplicationPrivate::mouseEventVelocity(event).x(), maxVelocity);
- } else {
- qreal dx = event->localPos().x() - (lastPos.isNull() ? pressPos.x() : lastPos.x());
- hData.addVelocitySample(dx/elapsed, maxVelocity);
- }
- }
+ QVector2D deltas = QVector2D(event->localPos() - pressPos);
+ bool overThreshold = false;
+ QVector2D velocity = QGuiApplicationPrivate::mouseEventVelocity(event);
+ // TODO guarantee that events always have velocity so that it never needs to be computed here
+ if (!(QGuiApplicationPrivate::mouseEventCaps(event) & QTouchDevice::Velocity))
+ velocity = QVector2D(event->localPos() - (lastPos.isNull() ? pressPos : lastPos)) / elapsed;
+
+ if (q->yflick())
+ overThreshold |= QQuickWindowPrivate::dragOverThreshold(deltas.y(), Qt::YAxis, event);
+ if (q->xflick())
+ overThreshold |= QQuickWindowPrivate::dragOverThreshold(deltas.x(), Qt::XAxis, event);
- lastPos = event->localPos();
+ drag(currentTimestamp, event->type(), event->localPos(), deltas, overThreshold, false, false, velocity);
}
void QQuickFlickablePrivate::handleMouseReleaseEvent(QMouseEvent *event)
@@ -1258,50 +1371,86 @@ void QQuickFlickable::wheelEvent(QWheelEvent *event)
QQuickItem::wheelEvent(event);
return;
}
-
event->setAccepted(false);
+ qint64 currentTimestamp = d->computeCurrentTime(event);
+ switch (event->phase()) {
+ case Qt::ScrollBegin:
+ d->scrollingPhase = true;
+ d->accumulatedWheelPixelDelta = QVector2D();
+ d->vData.velocity = 0;
+ d->hData.velocity = 0;
+ d->timer.start();
+ d->maybeBeginDrag(currentTimestamp, event->posF());
+ break;
+ case Qt::ScrollUpdate:
+ break;
+ case Qt::ScrollEnd:
+ d->scrollingPhase = false;
+ d->draggingEnding();
+ event->accept();
+ returnToBounds();
+ d->lastPosTime = -1;
+ return;
+ }
- int yDelta = event->angleDelta().y();
- int xDelta = event->angleDelta().x();
- if (yflick() && yDelta != 0) {
- bool valid = false;
- if (yDelta > 0 && contentY() > -minYExtent()) {
- d->vData.velocity = qMax(yDelta*2 - d->vData.smoothVelocity.value(), qreal(d->maxVelocity/4));
- valid = true;
- } else if (yDelta < 0 && contentY() < -maxYExtent()) {
- d->vData.velocity = qMin(yDelta*2 - d->vData.smoothVelocity.value(), qreal(-d->maxVelocity/4));
- valid = true;
- }
- if (valid) {
- d->vData.flicking = false;
- d->flickY(d->vData.velocity);
- d->flickingStarted(false, true);
- if (d->vData.flicking) {
- d->vMoved = true;
- movementStarting();
+ if (event->source() == Qt::MouseEventNotSynthesized || event->pixelDelta().isNull()) {
+ // physical mouse wheel, so use angleDelta
+ int xDelta = event->angleDelta().x();
+ int yDelta = event->angleDelta().y();
+ if (yflick() && yDelta != 0) {
+ bool valid = false;
+ if (yDelta > 0 && contentY() > -minYExtent()) {
+ d->vData.velocity = qMax(yDelta*2 - d->vData.smoothVelocity.value(), qreal(d->maxVelocity/4));
+ valid = true;
+ } else if (yDelta < 0 && contentY() < -maxYExtent()) {
+ d->vData.velocity = qMin(yDelta*2 - d->vData.smoothVelocity.value(), qreal(-d->maxVelocity/4));
+ valid = true;
+ }
+ if (valid) {
+ d->vData.flicking = false;
+ d->flickY(d->vData.velocity);
+ d->flickingStarted(false, true);
+ if (d->vData.flicking) {
+ d->vMoved = true;
+ movementStarting();
+ }
+ event->accept();
}
- event->accept();
- }
- }
- if (xflick() && xDelta != 0) {
- bool valid = false;
- if (xDelta > 0 && contentX() > -minXExtent()) {
- d->hData.velocity = qMax(xDelta*2 - d->hData.smoothVelocity.value(), qreal(d->maxVelocity/4));
- valid = true;
- } else if (xDelta < 0 && contentX() < -maxXExtent()) {
- d->hData.velocity = qMin(xDelta*2 - d->hData.smoothVelocity.value(), qreal(-d->maxVelocity/4));
- valid = true;
}
- if (valid) {
- d->hData.flicking = false;
- d->flickX(d->hData.velocity);
- d->flickingStarted(true, false);
- if (d->hData.flicking) {
- d->hMoved = true;
- movementStarting();
+ if (xflick() && xDelta != 0) {
+ bool valid = false;
+ if (xDelta > 0 && contentX() > -minXExtent()) {
+ d->hData.velocity = qMax(xDelta*2 - d->hData.smoothVelocity.value(), qreal(d->maxVelocity/4));
+ valid = true;
+ } else if (xDelta < 0 && contentX() < -maxXExtent()) {
+ d->hData.velocity = qMin(xDelta*2 - d->hData.smoothVelocity.value(), qreal(-d->maxVelocity/4));
+ valid = true;
+ }
+ if (valid) {
+ d->hData.flicking = false;
+ d->flickX(d->hData.velocity);
+ d->flickingStarted(true, false);
+ if (d->hData.flicking) {
+ d->hMoved = true;
+ movementStarting();
+ }
+ event->accept();
}
- event->accept();
}
+ } else {
+ // use pixelDelta (probably from a trackpad)
+ int xDelta = event->pixelDelta().x();
+ int yDelta = event->pixelDelta().y();
+
+ qreal elapsed = qreal(currentTimestamp - d->lastPosTime) / 1000.;
+ if (elapsed <= 0) {
+ d->lastPosTime = currentTimestamp;
+ return;
+ }
+ QVector2D velocity(xDelta / elapsed, yDelta / elapsed);
+ d->lastPosTime = currentTimestamp;
+ d->accumulatedWheelPixelDelta += QVector2D(event->pixelDelta());
+ d->drag(currentTimestamp, event->type(), event->posF(), d->accumulatedWheelPixelDelta, true, !d->scrollingPhase, true, velocity);
}
if (!event->isAccepted())
@@ -1409,13 +1558,13 @@ qreal QQuickFlickable::minXExtent() const
qreal QQuickFlickable::maxXExtent() const
{
Q_D(const QQuickFlickable);
- return width() - vWidth() - d->hData.endMargin;
+ return qMin<qreal>(0, width() - vWidth() - d->hData.endMargin);
}
/* returns -ve */
qreal QQuickFlickable::maxYExtent() const
{
Q_D(const QQuickFlickable);
- return height() - vHeight() - d->vData.endMargin;
+ return qMin<qreal>(0, height() - vHeight() - d->vData.endMargin);
}
void QQuickFlickable::componentComplete()
@@ -1627,6 +1776,8 @@ QQmlListProperty<QQuickItem> QQuickFlickable::flickableChildren()
of the flickable, and flicks will not overshoot.
\li Flickable.DragOverBounds - the contents can be dragged beyond the boundary
of the Flickable, but flicks will not overshoot.
+ \li Flickable.OvershootBounds - the contents can overshoot the boundary when flicked,
+ but the content cannot be dragged beyond the boundary of the flickable. (since \c{QtQuick 2.5})
\li Flickable.DragAndOvershootBounds (default) - the contents can be dragged
beyond the boundary of the Flickable, and can overshoot the
boundary when flicked.
@@ -1985,7 +2136,7 @@ bool QQuickFlickable::xflick() const
{
Q_D(const QQuickFlickable);
if (d->flickableDirection == QQuickFlickable::AutoFlickDirection)
- return floor(qAbs(vWidth() - width()));
+ return std::floor(qAbs(vWidth() - width()));
return d->flickableDirection & QQuickFlickable::HorizontalFlick;
}
@@ -1993,7 +2144,7 @@ bool QQuickFlickable::yflick() const
{
Q_D(const QQuickFlickable);
if (d->flickableDirection == QQuickFlickable::AutoFlickDirection)
- return floor(qAbs(vHeight() - height()));
+ return std::floor(qAbs(vHeight() - height()));
return d->flickableDirection & QQuickFlickable::VerticalFlick;
}
@@ -2238,6 +2389,8 @@ void QQuickFlickablePrivate::draggingEnding()
emit q->draggingChanged();
emit q->dragEnded();
}
+ hData.inRebound = false;
+ vData.inRebound = false;
}
bool QQuickFlickablePrivate::isViewMoving() const
@@ -2387,10 +2540,12 @@ void QQuickFlickable::movementEnding(bool hMovementEnding, bool vMovementEnding)
if (hMovementEnding) {
d->hData.fixingUp = false;
d->hData.smoothVelocity.setValue(0);
+ d->hData.previousDragDelta = 0.0;
}
if (vMovementEnding) {
d->vData.fixingUp = false;
d->vData.smoothVelocity.setValue(0);
+ d->vData.previousDragDelta = 0.0;
}
}
diff --git a/src/quick/items/qquickflickable_p.h b/src/quick/items/qquickflickable_p.h
index c8a1ba6984..3c3cd362dd 100644
--- a/src/quick/items/qquickflickable_p.h
+++ b/src/quick/items/qquickflickable_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -94,7 +94,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickFlickable : public QQuickItem
Q_CLASSINFO("DefaultProperty", "flickableData")
Q_ENUMS(FlickableDirection)
- Q_ENUMS(BoundsBehavior)
+ Q_FLAGS(BoundsBehavior)
public:
QQuickFlickable(QQuickItem *parent=0);
@@ -103,7 +103,14 @@ public:
QQmlListProperty<QObject> flickableData();
QQmlListProperty<QQuickItem> flickableChildren();
- enum BoundsBehavior { StopAtBounds, DragOverBounds, DragAndOvershootBounds };
+ enum BoundsBehaviorFlag {
+ StopAtBounds = 0x0,
+ DragOverBounds = 0x1,
+ OvershootBounds = 0x2,
+ DragAndOvershootBounds = DragOverBounds | OvershootBounds
+ };
+ Q_DECLARE_FLAGS(BoundsBehavior, BoundsBehaviorFlag)
+
BoundsBehavior boundsBehavior() const;
void setBoundsBehavior(BoundsBehavior);
@@ -220,14 +227,14 @@ Q_SIGNALS:
void pixelAlignedChanged();
protected:
- virtual bool childMouseEventFilter(QQuickItem *, QEvent *);
- virtual void mousePressEvent(QMouseEvent *event);
- virtual void mouseMoveEvent(QMouseEvent *event);
- virtual void mouseReleaseEvent(QMouseEvent *event);
+ bool childMouseEventFilter(QQuickItem *, QEvent *) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
#ifndef QT_NO_WHEELEVENT
- virtual void wheelEvent(QWheelEvent *event);
+ void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
#endif
- virtual void timerEvent(QTimerEvent *event);
+ void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
QQuickFlickableVisibleArea *visibleArea();
@@ -244,11 +251,11 @@ protected:
virtual qreal maxYExtent() const;
qreal vWidth() const;
qreal vHeight() const;
- virtual void componentComplete();
+ void componentComplete() Q_DECL_OVERRIDE;
virtual void viewportMoved(Qt::Orientations orient);
- virtual void geometryChanged(const QRectF &newGeometry,
- const QRectF &oldGeometry);
- void mouseUngrabEvent();
+ void geometryChanged(const QRectF &newGeometry,
+ const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+ void mouseUngrabEvent() Q_DECL_OVERRIDE;
bool sendMouseEvent(QQuickItem *item, QMouseEvent *event);
bool xflick() const;
diff --git a/src/quick/items/qquickflickable_p_p.h b/src/quick/items/qquickflickable_p_p.h
index bd8c8de168..65bb3e802d 100644
--- a/src/quick/items/qquickflickable_p_p.h
+++ b/src/quick/items/qquickflickable_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -80,7 +80,7 @@ public:
{
Velocity(QQuickFlickablePrivate *p)
: parent(p) {}
- virtual void setValue(qreal v) {
+ void setValue(qreal v) Q_DECL_OVERRIDE {
if (v != value()) {
QQuickTimeLineValue::setValue(v);
parent->updateVelocity();
@@ -93,7 +93,7 @@ public:
AxisData(QQuickFlickablePrivate *fp, void (QQuickFlickablePrivate::*func)(qreal))
: move(fp, func)
, transitionToBounds(0)
- , viewSize(-1), lastPos(0), velocity(0), startMargin(0), endMargin(0)
+ , viewSize(-1), lastPos(0), previousDragDelta(0), velocity(0), startMargin(0), endMargin(0)
, origin(0)
, transitionTo(0)
, continuousFlickVelocity(0), velocityTime(), vTime(0)
@@ -135,6 +135,7 @@ public:
qreal dragStartOffset;
qreal dragMinBound;
qreal dragMaxBound;
+ qreal previousDragDelta;
qreal velocity;
qreal flickTarget;
qreal startMargin;
@@ -151,6 +152,7 @@ public:
bool transitionToSet : 1;
bool fixingUp : 1;
bool inOvershoot : 1;
+ bool inRebound : 1;
bool moving : 1;
bool flicking : 1;
bool dragging : 1;
@@ -185,7 +187,7 @@ public:
qreal overShootDistance(qreal size);
- void itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &);
+ void itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &) Q_DECL_OVERRIDE;
void draggingStarting();
void draggingEnding();
@@ -205,6 +207,7 @@ public:
bool vMoved : 1;
bool stealMouse : 1;
bool pressed : 1;
+ bool scrollingPhase : 1;
bool interactive : 1;
bool calcVelocity : 1;
bool pixelAligned : 1;
@@ -214,6 +217,7 @@ public:
qint64 lastPressTime;
QPointF lastPos;
QPointF pressPos;
+ QVector2D accumulatedWheelPixelDelta;
qreal deceleration;
qreal maxVelocity;
qreal reportedVelocitySmoothing;
@@ -244,7 +248,13 @@ public:
void handleMouseMoveEvent(QMouseEvent *);
void handleMouseReleaseEvent(QMouseEvent *);
+ void maybeBeginDrag(qint64 currentTimestamp, const QPointF &pressPosn);
+ void drag(qint64 currentTimestamp, QEvent::Type eventType, const QPointF &localPos,
+ const QVector2D &deltas, bool overThreshold, bool momentum,
+ bool velocitySensitiveOverBounds, const QVector2D &velocity);
+
qint64 computeCurrentTime(QInputEvent *event);
+ qreal devicePixelRatio();
// flickableData property
static void data_append(QQmlListProperty<QObject> *, QObject *);
diff --git a/src/quick/items/qquickflickablebehavior_p.h b/src/quick/items/qquickflickablebehavior_p.h
index 01c9d65ece..a79297894c 100644
--- a/src/quick/items/qquickflickablebehavior_p.h
+++ b/src/quick/items/qquickflickablebehavior_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Research In Motion.
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickflipable.cpp b/src/quick/items/qquickflipable.cpp
index 1d439eef05..4fd146f0e4 100644
--- a/src/quick/items/qquickflipable.cpp
+++ b/src/quick/items/qquickflipable.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -51,7 +51,7 @@ public:
transform = t;
update();
}
- virtual void applyTo(QMatrix4x4 *matrix) const {
+ void applyTo(QMatrix4x4 *matrix) const Q_DECL_OVERRIDE {
*matrix *= transform;
}
private:
@@ -64,7 +64,7 @@ class QQuickFlipablePrivate : public QQuickItemPrivate
public:
QQuickFlipablePrivate() : current(QQuickFlipable::Front), front(0), back(0), sideDirty(false) {}
- virtual void transformChanged();
+ void transformChanged() Q_DECL_OVERRIDE;
void updateSide();
void setBackTransform();
diff --git a/src/quick/items/qquickflipable_p.h b/src/quick/items/qquickflipable_p.h
index 0196e35315..bd2efe0676 100644
--- a/src/quick/items/qquickflipable_p.h
+++ b/src/quick/items/qquickflipable_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -72,7 +72,7 @@ Q_SIGNALS:
void sideChanged();
protected:
- virtual void updatePolish();
+ void updatePolish() Q_DECL_OVERRIDE;
private Q_SLOTS:
void retransformBack();
diff --git a/src/quick/items/qquickfocusscope.cpp b/src/quick/items/qquickfocusscope.cpp
index d887952162..bb46576f71 100644
--- a/src/quick/items/qquickfocusscope.cpp
+++ b/src/quick/items/qquickfocusscope.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickfocusscope_p.h b/src/quick/items/qquickfocusscope_p.h
index fa4bdaf05d..b0e92cb312 100644
--- a/src/quick/items/qquickfocusscope_p.h
+++ b/src/quick/items/qquickfocusscope_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickframebufferobject.cpp b/src/quick/items/qquickframebufferobject.cpp
index 09a25f4efa..c3e5b97baf 100644
--- a/src/quick/items/qquickframebufferobject.cpp
+++ b/src/quick/items/qquickframebufferobject.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -386,6 +386,17 @@ QOpenGLFramebufferObject *QQuickFramebufferObject::Renderer::framebufferObject()
* the FBO size.
*
* The FBO will be automatically unbound after the function returns.
+ *
+ * \note Do not assume that the OpenGL state is all set to the defaults when
+ * this function is invoked, or that it is maintained between calls. Both the Qt
+ * Quick renderer and the custom rendering code uses the same OpenGL
+ * context. This means that the state might have been modified by Quick before
+ * invoking this function.
+ *
+ * \note It is recommended to call QQuickWindow::resetOpenGLState() before
+ * returning. This resets OpenGL state used by the Qt Quick renderer and thus
+ * avoids interference from the state changes made by the rendering code in this
+ * function.
*/
/*!
diff --git a/src/quick/items/qquickframebufferobject.h b/src/quick/items/qquickframebufferobject.h
index f6431dc38e..4a0248c082 100644
--- a/src/quick/items/qquickframebufferobject.h
+++ b/src/quick/items/qquickframebufferobject.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -80,7 +80,7 @@ public:
void releaseResources() Q_DECL_OVERRIDE;
protected:
- void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
protected:
QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp
index 72edce4339..3cc0a28b87 100644
--- a/src/quick/items/qquickgridview.cpp
+++ b/src/quick/items/qquickgridview.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -41,9 +41,10 @@
#include <QtGui/qevent.h>
#include <QtCore/qmath.h>
#include <QtCore/qcoreapplication.h>
-#include <math.h>
#include "qplatformdefs.h"
+#include <cmath>
+
QT_BEGIN_NAMESPACE
#ifndef QML_FLICK_SNAPONETHRESHOLD
@@ -115,7 +116,7 @@ public:
void setPosition(qreal col, qreal row, bool immediate = false) {
moveTo(pointForPosition(col, row), immediate);
}
- bool contains(qreal x, qreal y) const {
+ bool contains(qreal x, qreal y) const Q_DECL_OVERRIDE {
return (x >= itemX() && x < itemX() + view->cellWidth() &&
y >= itemY() && y < itemY() + view->cellHeight());
}
@@ -152,13 +153,13 @@ class QQuickGridViewPrivate : public QQuickItemViewPrivate
Q_DECLARE_PUBLIC(QQuickGridView)
public:
- virtual Qt::Orientation layoutOrientation() const;
- virtual bool isContentFlowReversed() const;
+ Qt::Orientation layoutOrientation() const Q_DECL_OVERRIDE;
+ bool isContentFlowReversed() const Q_DECL_OVERRIDE;
- virtual qreal positionAt(int index) const;
- virtual qreal endPositionAt(int index) const;
- virtual qreal originPosition() const;
- virtual qreal lastPosition() const;
+ qreal positionAt(int index) const Q_DECL_OVERRIDE;
+ qreal endPositionAt(int index) const Q_DECL_OVERRIDE;
+ qreal originPosition() const Q_DECL_OVERRIDE;
+ qreal lastPosition() const Q_DECL_OVERRIDE;
qreal rowSize() const;
qreal colSize() const;
@@ -172,41 +173,41 @@ public:
void resetColumns();
- virtual bool addVisibleItems(qreal fillFrom, qreal fillTo, qreal bufferFrom, qreal bufferTo, bool doBuffer);
- virtual bool removeNonVisibleItems(qreal bufferFrom, qreal bufferTo);
-
- virtual FxViewItem *newViewItem(int index, QQuickItem *item);
- virtual void initializeViewItem(FxViewItem *item);
- virtual void repositionItemAt(FxViewItem *item, int index, qreal sizeBuffer);
- virtual void repositionPackageItemAt(QQuickItem *item, int index);
- virtual void resetFirstItemPosition(qreal pos = 0.0);
- virtual void adjustFirstItem(qreal forwards, qreal backwards, int changeBeforeVisible);
-
- virtual void createHighlight();
- virtual void updateHighlight();
- virtual void resetHighlightPosition();
-
- virtual void setPosition(qreal pos);
- virtual void layoutVisibleItems(int fromModelIndex = 0);
- virtual bool applyInsertionChange(const QQmlChangeSet::Change &insert, ChangeResult *changeResult, QList<FxViewItem *> *addedItems, QList<MovedItem> *movingIntoView);
- virtual void translateAndTransitionItemsAfter(int afterModelIndex, const ChangeResult &insertionResult, const ChangeResult &removalResult);
- virtual bool needsRefillForAddedOrRemovedIndex(int index) const;
-
- virtual qreal headerSize() const;
- virtual qreal footerSize() const;
- virtual bool showHeaderForIndex(int index) const;
- virtual bool showFooterForIndex(int index) const;
- virtual void updateHeader();
- virtual void updateFooter();
-
- virtual void changedVisibleIndex(int newIndex);
- virtual void initializeCurrentItem();
-
- virtual void updateViewport();
- virtual void fixupPosition();
- virtual void fixup(AxisData &data, qreal minExtent, qreal maxExtent);
- virtual bool flick(QQuickItemViewPrivate::AxisData &data, qreal minExtent, qreal maxExtent, qreal vSize,
- QQuickTimeLineCallback::Callback fixupCallback, qreal velocity);
+ bool addVisibleItems(qreal fillFrom, qreal fillTo, qreal bufferFrom, qreal bufferTo, bool doBuffer) Q_DECL_OVERRIDE;
+ bool removeNonVisibleItems(qreal bufferFrom, qreal bufferTo) Q_DECL_OVERRIDE;
+
+ FxViewItem *newViewItem(int index, QQuickItem *item) Q_DECL_OVERRIDE;
+ void initializeViewItem(FxViewItem *item) Q_DECL_OVERRIDE;
+ void repositionItemAt(FxViewItem *item, int index, qreal sizeBuffer) Q_DECL_OVERRIDE;
+ void repositionPackageItemAt(QQuickItem *item, int index) Q_DECL_OVERRIDE;
+ void resetFirstItemPosition(qreal pos = 0.0) Q_DECL_OVERRIDE;
+ void adjustFirstItem(qreal forwards, qreal backwards, int changeBeforeVisible) Q_DECL_OVERRIDE;
+
+ void createHighlight() Q_DECL_OVERRIDE;
+ void updateHighlight() Q_DECL_OVERRIDE;
+ void resetHighlightPosition() Q_DECL_OVERRIDE;
+
+ void setPosition(qreal pos) Q_DECL_OVERRIDE;
+ void layoutVisibleItems(int fromModelIndex = 0) Q_DECL_OVERRIDE;
+ bool applyInsertionChange(const QQmlChangeSet::Change &insert, ChangeResult *changeResult, QList<FxViewItem *> *addedItems, QList<MovedItem> *movingIntoView) Q_DECL_OVERRIDE;
+ void translateAndTransitionItemsAfter(int afterModelIndex, const ChangeResult &insertionResult, const ChangeResult &removalResult) Q_DECL_OVERRIDE;
+ bool needsRefillForAddedOrRemovedIndex(int index) const Q_DECL_OVERRIDE;
+
+ qreal headerSize() const Q_DECL_OVERRIDE;
+ qreal footerSize() const Q_DECL_OVERRIDE;
+ bool showHeaderForIndex(int index) const Q_DECL_OVERRIDE;
+ bool showFooterForIndex(int index) const Q_DECL_OVERRIDE;
+ void updateHeader() Q_DECL_OVERRIDE;
+ void updateFooter() Q_DECL_OVERRIDE;
+
+ void changedVisibleIndex(int newIndex) Q_DECL_OVERRIDE;
+ void initializeCurrentItem() Q_DECL_OVERRIDE;
+
+ void updateViewport() Q_DECL_OVERRIDE;
+ void fixupPosition() Q_DECL_OVERRIDE;
+ void fixup(AxisData &data, qreal minExtent, qreal maxExtent) Q_DECL_OVERRIDE;
+ bool flick(QQuickItemViewPrivate::AxisData &data, qreal minExtent, qreal maxExtent, qreal vSize,
+ QQuickTimeLineCallback::Callback fixupCallback, qreal velocity) Q_DECL_OVERRIDE;
QQuickGridView::Flow flow;
qreal cellWidth;
@@ -349,7 +350,7 @@ qreal QQuickGridViewPrivate::snapPosAt(qreal pos) const
pos += highlightStart;
pos += rowSize()/2;
snapPos = static_cast<FxGridItemSG*>(visibleItems.first())->rowPos() - visibleIndex / columns * rowSize();
- snapPos = pos - fmodf(pos - snapPos, qreal(rowSize()));
+ snapPos = pos - std::fmod(pos - snapPos, qreal(rowSize()));
snapPos -= highlightStart;
qreal maxExtent;
qreal minExtent;
@@ -1036,7 +1037,7 @@ bool QQuickGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal maxExte
if (snapMode == QQuickGridView::NoSnap && highlightRange != QQuickGridView::StrictlyEnforceRange)
data.flickTarget = maxExtent;
}
- bool overShoot = boundsBehavior == QQuickFlickable::DragAndOvershootBounds;
+ bool overShoot = boundsBehavior & QQuickFlickable::OvershootBounds;
if (maxDistance > 0 || overShoot) {
// This mode requires the grid to stop exactly on a row boundary.
qreal v = velocity;
diff --git a/src/quick/items/qquickgridview_p.h b/src/quick/items/qquickgridview_p.h
index 7468a49ac1..7e1ace01dd 100644
--- a/src/quick/items/qquickgridview_p.h
+++ b/src/quick/items/qquickgridview_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -65,8 +65,8 @@ public:
QQuickGridView(QQuickItem *parent=0);
~QQuickGridView();
- virtual void setHighlightFollowsCurrentItem(bool);
- virtual void setHighlightMoveDuration(int);
+ void setHighlightFollowsCurrentItem(bool) Q_DECL_OVERRIDE;
+ void setHighlightMoveDuration(int) Q_DECL_OVERRIDE;
Flow flow() const;
void setFlow(Flow);
@@ -97,10 +97,10 @@ Q_SIGNALS:
void snapModeChanged();
protected:
- virtual void viewportMoved(Qt::Orientations);
- virtual void keyPressEvent(QKeyEvent *);
- virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
- virtual void initItem(int index, QObject *item);
+ void viewportMoved(Qt::Orientations) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+ void initItem(int index, QObject *item) Q_DECL_OVERRIDE;
};
class QQuickGridViewAttached : public QQuickItemViewAttached
diff --git a/src/quick/items/qquickimage.cpp b/src/quick/items/qquickimage.cpp
index 1e389cfe38..3ba09f9cea 100644
--- a/src/quick/items/qquickimage.cpp
+++ b/src/quick/items/qquickimage.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -39,8 +39,8 @@
#include <QtQuick/private/qsgcontext_p.h>
#include <private/qsgadaptationlayer_p.h>
+#include <QtCore/qmath.h>
#include <QtGui/qpainter.h>
-#include <qmath.h>
#include <QtCore/QRunnable>
QT_BEGIN_NAMESPACE
@@ -820,4 +820,14 @@ void QQuickImage::setMipmap(bool use)
update();
}
+/*!
+ \qmlproperty bool QtQuick::Image::autoTransform
+ \since 5.5
+
+ This property holds whether the image should automatically apply
+ image transformation metadata such as EXIF orientation.
+
+ By default, this property is set to false.
+ */
+
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickimage_p.h b/src/quick/items/qquickimage_p.h
index b359ff779d..8edf153ca3 100644
--- a/src/quick/items/qquickimage_p.h
+++ b/src/quick/items/qquickimage_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -53,6 +53,7 @@ class Q_AUTOTEST_EXPORT QQuickImage : public QQuickImageBase
Q_PROPERTY(HAlignment horizontalAlignment READ horizontalAlignment WRITE setHorizontalAlignment NOTIFY horizontalAlignmentChanged)
Q_PROPERTY(VAlignment verticalAlignment READ verticalAlignment WRITE setVerticalAlignment NOTIFY verticalAlignmentChanged)
Q_PROPERTY(bool mipmap READ mipmap WRITE setMipmap NOTIFY mipmapChanged REVISION 1)
+ Q_PROPERTY(bool autoTransform READ autoTransform WRITE setAutoTransform NOTIFY autoTransformChanged REVISION 2)
public:
QQuickImage(QQuickItem *parent=0);
@@ -73,7 +74,7 @@ public:
qreal paintedWidth() const;
qreal paintedHeight() const;
- QRectF boundingRect() const;
+ QRectF boundingRect() const Q_DECL_OVERRIDE;
HAlignment horizontalAlignment() const;
void setHorizontalAlignment(HAlignment align);
@@ -81,30 +82,33 @@ public:
VAlignment verticalAlignment() const;
void setVerticalAlignment(VAlignment align);
- bool isTextureProvider() const { return true; }
- QSGTextureProvider *textureProvider() const;
+ bool isTextureProvider() const Q_DECL_OVERRIDE { return true; }
+ QSGTextureProvider *textureProvider() const Q_DECL_OVERRIDE;
bool mipmap() const;
void setMipmap(bool use);
+ virtual void emitAutoTransformBaseChanged() { emit autoTransformChanged(); }
+
Q_SIGNALS:
void fillModeChanged();
void paintedGeometryChanged();
void horizontalAlignmentChanged(HAlignment alignment);
void verticalAlignmentChanged(VAlignment alignment);
Q_REVISION(1) void mipmapChanged(bool);
+ Q_REVISION(2) void autoTransformChanged();
private Q_SLOTS:
void invalidateSceneGraph();
protected:
QQuickImage(QQuickImagePrivate &dd, QQuickItem *parent);
- void pixmapChange();
+ void pixmapChange() Q_DECL_OVERRIDE;
void updatePaintedGeometry();
void releaseResources() Q_DECL_OVERRIDE;
- virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
- virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+ QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QQuickImage)
diff --git a/src/quick/items/qquickimage_p_p.h b/src/quick/items/qquickimage_p_p.h
index afed78340f..d1a74245ce 100644
--- a/src/quick/items/qquickimage_p_p.h
+++ b/src/quick/items/qquickimage_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickimagebase.cpp b/src/quick/items/qquickimagebase.cpp
index bdd0ef0ce4..223cb8f46f 100644
--- a/src/quick/items/qquickimagebase.cpp
+++ b/src/quick/items/qquickimagebase.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -195,6 +195,10 @@ void QQuickImageBase::load()
d->oldSourceSize = sourceSize();
emit sourceSizeChanged();
}
+ if (autoTransform() != d->oldAutoTransform) {
+ d->oldAutoTransform = autoTransform();
+ emitAutoTransformBaseChanged();
+ }
update();
} else {
@@ -209,8 +213,21 @@ void QQuickImageBase::load()
d->devicePixelRatio = 1.0;
QUrl loadUrl = d->url;
- resolve2xLocalFile(d->url, targetDevicePixelRatio, &loadUrl, &d->devicePixelRatio);
- d->pix.load(qmlEngine(this), loadUrl, d->sourcesize * d->devicePixelRatio, options);
+ if (d->url.scheme() == QStringLiteral("image")
+ || d->url.toString().endsWith(QLatin1String(".svg"))
+ || d->url.toString().endsWith(QLatin1String(".svgz"))) {
+ // QQuickImageProvider and SVG can generate a high resolution image when
+ // sourceSize is set. If sourceSize is not set then the provider default size
+ // will be used, as usual.
+ if (!d->sourcesize.isEmpty())
+ d->devicePixelRatio = targetDevicePixelRatio;
+ } else {
+ // (possible) local file: loadUrl and d->devicePixelRatio will be modified if
+ // an "@2x" file is found.
+ resolve2xLocalFile(d->url, targetDevicePixelRatio, &loadUrl, &d->devicePixelRatio);
+ }
+
+ d->pix.load(qmlEngine(this), loadUrl, d->sourcesize * d->devicePixelRatio, options, d->autoTransform);
if (d->pix.isLoading()) {
if (d->progress != 0.0) {
@@ -265,6 +282,10 @@ void QQuickImageBase::requestFinished()
d->oldSourceSize = sourceSize();
emit sourceSizeChanged();
}
+ if (autoTransform() != d->oldAutoTransform) {
+ d->oldAutoTransform = autoTransform();
+ emitAutoTransformBaseChanged();
+ }
update();
}
@@ -355,4 +376,21 @@ void QQuickImageBase::resolve2xLocalFile(const QUrl &url, qreal targetDevicePixe
*sourceDevicePixelRatio = qreal(2.0);
}
+bool QQuickImageBase::autoTransform() const
+{
+ Q_D(const QQuickImageBase);
+ if (d->autoTransform == UsePluginDefault)
+ return d->pix.autoTransform() == ApplyTransform;
+ return d->autoTransform == ApplyTransform;
+}
+
+void QQuickImageBase::setAutoTransform(bool transform)
+{
+ Q_D(QQuickImageBase);
+ if (d->autoTransform != UsePluginDefault && transform == (d->autoTransform == ApplyTransform))
+ return;
+ d->autoTransform = transform ? ApplyTransform : DoNotApplyTransform;
+ emitAutoTransformBaseChanged();
+}
+
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickimagebase_p.h b/src/quick/items/qquickimagebase_p.h
index 2750db8873..4fcfaecd7d 100644
--- a/src/quick/items/qquickimagebase_p.h
+++ b/src/quick/items/qquickimagebase_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -78,8 +78,15 @@ public:
virtual void setMirror(bool mirror);
bool mirror() const;
+ virtual void setAutoTransform(bool transform);
+ bool autoTransform() const;
+
void resolve2xLocalFile(const QUrl &url, qreal targetDevicePixelRatio, QUrl *sourceUrl, qreal *sourceDevicePixelRatio);
+ // Use a virtual rather than a signal->signal to avoid the huge
+ // connect/conneciton overhead for this rare case.
+ virtual void emitAutoTransformBaseChanged() { }
+
Q_SIGNALS:
void sourceChanged(const QUrl &);
void sourceSizeChanged();
@@ -91,7 +98,7 @@ Q_SIGNALS:
protected:
virtual void load();
- virtual void componentComplete();
+ void componentComplete() Q_DECL_OVERRIDE;
virtual void pixmapChange();
void itemChange(ItemChange change, const ItemChangeData &value) Q_DECL_OVERRIDE;
QQuickImageBase(QQuickImageBasePrivate &dd, QQuickItem *parent);
diff --git a/src/quick/items/qquickimagebase_p_p.h b/src/quick/items/qquickimagebase_p_p.h
index f30eacb4ac..cffe709116 100644
--- a/src/quick/items/qquickimagebase_p_p.h
+++ b/src/quick/items/qquickimagebase_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -62,9 +62,11 @@ public:
: status(QQuickImageBase::Null),
progress(0.0),
devicePixelRatio(1.0),
+ autoTransform(UsePluginDefault),
async(false),
cache(true),
- mirror(false)
+ mirror(false),
+ oldAutoTransform(false)
{
}
@@ -75,9 +77,11 @@ public:
QSize sourcesize;
QSize oldSourceSize;
qreal devicePixelRatio;
+ AutoTransform autoTransform;
bool async : 1;
bool cache : 1;
bool mirror: 1;
+ bool oldAutoTransform : 1;
};
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickimplicitsizeitem.cpp b/src/quick/items/qquickimplicitsizeitem.cpp
index 410829e0dd..12afae676e 100644
--- a/src/quick/items/qquickimplicitsizeitem.cpp
+++ b/src/quick/items/qquickimplicitsizeitem.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickimplicitsizeitem_p.h b/src/quick/items/qquickimplicitsizeitem_p.h
index 65e991946d..3499cf22c5 100644
--- a/src/quick/items/qquickimplicitsizeitem_p.h
+++ b/src/quick/items/qquickimplicitsizeitem_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickimplicitsizeitem_p_p.h b/src/quick/items/qquickimplicitsizeitem_p_p.h
index cdf768cbd9..f2e502af15 100644
--- a/src/quick/items/qquickimplicitsizeitem_p_p.h
+++ b/src/quick/items/qquickimplicitsizeitem_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -60,8 +60,8 @@ public:
{
}
- virtual void implicitWidthChanged();
- virtual void implicitHeightChanged();
+ void implicitWidthChanged() Q_DECL_OVERRIDE;
+ void implicitHeightChanged() Q_DECL_OVERRIDE;
};
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index a37cc34427..3d0f550d14 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -46,9 +46,9 @@
#include <QtQml/qqmlinfo.h>
#include <QtGui/qpen.h>
#include <QtGui/qguiapplication.h>
+#include <QtGui/qstylehints.h>
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/qinputmethod.h>
-#include <QtCore/qdebug.h>
#include <QtCore/qcoreevent.h>
#include <QtCore/qnumeric.h>
#include <QtGui/qpa/qplatformtheme.h>
@@ -65,6 +65,7 @@
#include <private/qv4engine_p.h>
#include <private/qv4object_p.h>
+#include <private/qdebug_p.h>
#ifndef QT_NO_CURSOR
# include <QtGui/qcursor.h>
@@ -2290,16 +2291,6 @@ QQuickItem::~QQuickItem()
/*!
\internal
*/
-bool QQuickItemPrivate::qt_tab_all_widgets()
-{
- if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
- return theme->themeHint(QPlatformTheme::TabAllWidgets).toBool();
- return true;
-}
-
-/*!
- \internal
-*/
bool QQuickItemPrivate::canAcceptTabFocus(QQuickItem *item)
{
if (!item->window())
@@ -2362,7 +2353,7 @@ QQuickItem* QQuickItemPrivate::nextPrevItemInTabFocusChain(QQuickItem *item, boo
if (!contentItem)
return item;
- bool all = QQuickItemPrivate::qt_tab_all_widgets();
+ bool all = QGuiApplication::styleHints()->tabFocusBehavior() == Qt::TabFocusAllControls;
QQuickItem *from = 0;
if (forward) {
@@ -2721,8 +2712,11 @@ void QQuickItemPrivate::addChild(QQuickItem *child)
#ifndef QT_NO_CURSOR
QQuickItemPrivate *childPrivate = QQuickItemPrivate::get(child);
- if (childPrivate->extra.isAllocated())
- incrementCursorCount(childPrivate->extra.value().numItemsWithCursor);
+
+ // if the added child has a cursor and we do not currently have any children
+ // with cursors, bubble the notification up
+ if (childPrivate->hasCursorInChild && !hasCursorInChild)
+ setHasCursorInChild(true);
#endif
markSortedChildrenDirty(child);
@@ -2744,8 +2738,10 @@ void QQuickItemPrivate::removeChild(QQuickItem *child)
#ifndef QT_NO_CURSOR
QQuickItemPrivate *childPrivate = QQuickItemPrivate::get(child);
- if (childPrivate->extra.isAllocated())
- incrementCursorCount(-childPrivate->extra.value().numItemsWithCursor);
+
+ // turn it off, if nothing else is using it
+ if (childPrivate->hasCursorInChild && hasCursorInChild)
+ setHasCursorInChild(false);
#endif
markSortedChildrenDirty(child);
@@ -2840,10 +2836,8 @@ void QQuickItemPrivate::derefWindow()
extra->opacityNode = 0;
extra->clipNode = 0;
extra->rootNode = 0;
- extra->beforePaintNode = 0;
}
- groupNode = 0;
paintNode = 0;
for (int ii = 0; ii < childItems.count(); ++ii) {
@@ -2949,6 +2943,7 @@ QQuickItemPrivate::QQuickItemPrivate()
, isAccessible(false)
, culled(false)
, hasCursor(false)
+ , hasCursorInChild(false)
, activeFocusOnTab(false)
, implicitAntialiasing(false)
, antialiasingValid(false)
@@ -2968,7 +2963,6 @@ QQuickItemPrivate::QQuickItemPrivate()
, implicitHeight(0)
, baselineOffset(0)
, itemNodeInstance(0)
- , groupNode(0)
, paintNode(0)
{
}
@@ -4119,8 +4113,8 @@ void QQuickItem::polish()
\qmlmethod object QtQuick::Item::mapFromItem(Item item, real x, real y, real width, real height)
Maps the point (\a x, \a y) or rect (\a x, \a y, \a width, \a height), which is in \a
- item's coordinate system, to this item's coordinate system, and returns an object with \c x and
- \c y (and optionally \c width and \c height) properties matching the mapped coordinate.
+ item's coordinate system, to this item's coordinate system, and returns a \l point or \rect
+ matching the mapped coordinate.
If \a item is a \c null value, this maps the point or rect from the coordinate system of
the root QML view.
@@ -4130,50 +4124,43 @@ void QQuickItem::polish()
*/
void QQuickItem::mapFromItem(QQmlV4Function *args) const
{
- if (args->length() != 0) {
- QV4::ExecutionEngine *v4 = args->v4engine();
- QV4::Scope scope(v4);
- QV4::ScopedValue item(scope, (*args)[0]);
-
- QQuickItem *itemObj = 0;
- if (!item->isNull()) {
- QV4::Scoped<QV4::QObjectWrapper> qobjectWrapper(scope, item->as<QV4::QObjectWrapper>());
- if (qobjectWrapper)
- itemObj = qobject_cast<QQuickItem*>(qobjectWrapper->object());
- }
-
- if (!itemObj && !item->isNull()) {
- qmlInfo(this) << "mapFromItem() given argument \"" << item->toQStringNoThrow()
- << "\" which is neither null nor an Item";
- return;
- }
+ if (args->length() == 0)
+ return;
- QV4::Scoped<QV4::Object> rv(scope, v4->newObject());
- args->setReturnValue(rv.asReturnedValue());
+ QV4::ExecutionEngine *v4 = args->v4engine();
+ QV4::Scope scope(v4);
+ QV4::ScopedValue item(scope, (*args)[0]);
- QV4::ScopedString s(scope);
- QV4::ScopedValue v(scope);
+ QQuickItem *itemObj = 0;
+ if (!item->isNull()) {
+ QV4::Scoped<QV4::QObjectWrapper> qobjectWrapper(scope, item->as<QV4::QObjectWrapper>());
+ if (qobjectWrapper)
+ itemObj = qobject_cast<QQuickItem*>(qobjectWrapper->object());
+ }
- qreal x = (args->length() > 1) ? (v = (*args)[1])->asDouble() : 0;
- qreal y = (args->length() > 2) ? (v = (*args)[2])->asDouble() : 0;
+ if (!itemObj && !item->isNull()) {
+ qmlInfo(this) << "mapFromItem() given argument \"" << item->toQStringNoThrow()
+ << "\" which is neither null nor an Item";
+ return;
+ }
- if (args->length() > 3) {
- qreal w = (v = (*args)[3])->asDouble();
- qreal h = (args->length() > 4) ? (v = (*args)[4])->asDouble() : 0;
+ QV4::ScopedValue v(scope);
- QRectF r = mapRectFromItem(itemObj, QRectF(x, y, w, h));
+ qreal x = (args->length() > 1) ? (v = (*args)[1])->asDouble() : 0;
+ qreal y = (args->length() > 2) ? (v = (*args)[2])->asDouble() : 0;
- rv->put((s = v4->newString(QStringLiteral("x"))).getPointer(), (v = QV4::Primitive::fromDouble(r.x())));
- rv->put((s = v4->newString(QStringLiteral("y"))).getPointer(), (v = QV4::Primitive::fromDouble(r.y())));
- rv->put((s = v4->newString(QStringLiteral("width"))).getPointer(), (v = QV4::Primitive::fromDouble(r.width())));
- rv->put((s = v4->newString(QStringLiteral("height"))).getPointer(), (v = QV4::Primitive::fromDouble(r.height())));
- } else {
- QPointF p = mapFromItem(itemObj, QPointF(x, y));
+ QVariant result;
- rv->put((s = v4->newString(QStringLiteral("x"))).getPointer(), (v = QV4::Primitive::fromDouble(p.x())));
- rv->put((s = v4->newString(QStringLiteral("y"))).getPointer(), (v = QV4::Primitive::fromDouble(p.y())));
- }
+ if (args->length() > 3) {
+ qreal w = (v = (*args)[3])->asDouble();
+ qreal h = (args->length() > 4) ? (v = (*args)[4])->asDouble() : 0;
+ result = mapRectFromItem(itemObj, QRectF(x, y, w, h));
+ } else {
+ result = mapFromItem(itemObj, QPointF(x, y));
}
+
+ QV4::ScopedObject rv(scope, v4->fromVariant(result));
+ args->setReturnValue(rv.asReturnedValue());
}
/*!
@@ -4198,8 +4185,8 @@ QTransform QQuickItem::itemTransform(QQuickItem *other, bool *ok) const
\qmlmethod object QtQuick::Item::mapToItem(Item item, real x, real y, real width, real height)
Maps the point (\a x, \a y) or rect (\a x, \a y, \a width, \a height), which is in this
- item's coordinate system, to \a item's coordinate system, and returns an object with \c x and
- \c y (and optionally \c width and \c height) properties matching the mapped coordinate.
+ item's coordinate system, to \a item's coordinate system, and returns a \l point or \l rect
+ matching the mapped coordinate.
If \a item is a \c null value, this maps the point or rect to the coordinate system of the
root QML view.
@@ -4209,51 +4196,43 @@ QTransform QQuickItem::itemTransform(QQuickItem *other, bool *ok) const
*/
void QQuickItem::mapToItem(QQmlV4Function *args) const
{
- if (args->length() != 0) {
- QV4::ExecutionEngine *v4 = args->v4engine();
- QV4::Scope scope(v4);
- QV4::ScopedValue item(scope, (*args)[0]);
-
- QQuickItem *itemObj = 0;
- if (!item->isNull()) {
- QV4::Scoped<QV4::QObjectWrapper> qobjectWrapper(scope, item->as<QV4::QObjectWrapper>());
- if (qobjectWrapper)
- itemObj = qobject_cast<QQuickItem*>(qobjectWrapper->object());
- }
-
- if (!itemObj && !item->isNull()) {
- qmlInfo(this) << "mapToItem() given argument \"" << item->toQStringNoThrow()
- << "\" which is neither null nor an Item";
- return;
- }
-
- QV4::Scoped<QV4::Object> rv(scope, v4->newObject());
- args->setReturnValue(rv.asReturnedValue());
+ if (args->length() == 0)
+ return;
- QV4::ScopedValue v(scope);
+ QV4::ExecutionEngine *v4 = args->v4engine();
+ QV4::Scope scope(v4);
+ QV4::ScopedValue item(scope, (*args)[0]);
- qreal x = (args->length() > 1) ? (v = (*args)[1])->asDouble() : 0;
- qreal y = (args->length() > 2) ? (v = (*args)[2])->asDouble() : 0;
+ QQuickItem *itemObj = 0;
+ if (!item->isNull()) {
+ QV4::Scoped<QV4::QObjectWrapper> qobjectWrapper(scope, item->as<QV4::QObjectWrapper>());
+ if (qobjectWrapper)
+ itemObj = qobject_cast<QQuickItem*>(qobjectWrapper->object());
+ }
- QV4::ScopedString s(scope);
+ if (!itemObj && !item->isNull()) {
+ qmlInfo(this) << "mapToItem() given argument \"" << item->toQStringNoThrow()
+ << "\" which is neither null nor an Item";
+ return;
+ }
- if (args->length() > 3) {
- qreal w = (v = (*args)[3])->asDouble();
- qreal h = (args->length() > 4) ? (v = (*args)[4])->asDouble() : 0;
+ QV4::ScopedValue v(scope);
+ QVariant result;
- QRectF r = mapRectToItem(itemObj, QRectF(x, y, w, h));
+ qreal x = (args->length() > 1) ? (v = (*args)[1])->asDouble() : 0;
+ qreal y = (args->length() > 2) ? (v = (*args)[2])->asDouble() : 0;
- rv->put((s = v4->newString(QStringLiteral("x"))).getPointer(), (v = QV4::Primitive::fromDouble(r.x())));
- rv->put((s = v4->newString(QStringLiteral("y"))).getPointer(), (v = QV4::Primitive::fromDouble(r.y())));
- rv->put((s = v4->newString(QStringLiteral("width"))).getPointer(), (v = QV4::Primitive::fromDouble(r.width())));
- rv->put((s = v4->newString(QStringLiteral("height"))).getPointer(), (v = QV4::Primitive::fromDouble(r.height())));
- } else {
- QPointF p = mapToItem(itemObj, QPointF(x, y));
+ if (args->length() > 3) {
+ qreal w = (v = (*args)[3])->asDouble();
+ qreal h = (args->length() > 4) ? (v = (*args)[4])->asDouble() : 0;
- rv->put((s = v4->newString(QStringLiteral("x"))).getPointer(), (v = QV4::Primitive::fromDouble(p.x())));
- rv->put((s = v4->newString(QStringLiteral("y"))).getPointer(), (v = QV4::Primitive::fromDouble(p.y())));
- }
+ result = mapRectToItem(itemObj, QRectF(x, y, w, h));
+ } else {
+ result = mapToItem(itemObj, QPointF(x, y));
}
+
+ QV4::ScopedObject rv(scope, v4->fromVariant(result));
+ args->setReturnValue(rv.asReturnedValue());
}
/*!
@@ -4265,7 +4244,7 @@ void QQuickItem::mapToItem(QQmlV4Function *args) const
This method sets focus on the item and ensures that all ancestor
FocusScope objects in the object hierarchy are also given \l focus.
- The reason for the focus change will be \a Qt::OtherFocusReason. Use
+ The reason for the focus change will be \l [CPP] Qt::OtherFocusReason. Use
the overloaded method to specify the focus reason to enable better
handling of the focus change.
@@ -4757,7 +4736,7 @@ void QQuickItem::itemChange(ItemChange change, const ItemChangeData &value)
void QQuickItem::updateInputMethod(Qt::InputMethodQueries queries)
{
if (hasActiveFocus())
- qApp->inputMethod()->update(queries);
+ QGuiApplication::inputMethod()->update(queries);
}
#endif // QT_NO_IM
@@ -6126,7 +6105,7 @@ qreal QQuickItem::implicitWidth() const
Defines the natural width or height of the Item if no \l width or \l height is specified.
The default implicit size for most items is 0x0, however some items have an inherent
- implicit size which cannot be overridden, e.g. Image, Text.
+ implicit size which cannot be overridden, for example, \l [QML] Image and \l [QML] Text.
Setting the implicit size is useful for defining components that have a preferred size
based on their content, for example:
@@ -6150,7 +6129,7 @@ qreal QQuickItem::implicitWidth() const
}
\endqml
- \b Note: using implicitWidth of Text or TextEdit and setting the width explicitly
+ \note Using implicitWidth of \l [QML] Text or \l [QML] TextEdit and setting the width explicitly
incurs a performance penalty as the text must be laid out twice.
*/
/*!
@@ -6160,7 +6139,7 @@ qreal QQuickItem::implicitWidth() const
Defines the natural width or height of the Item if no \l width or \l height is specified.
The default implicit size for most items is 0x0, however some items have an inherent
- implicit size which cannot be overridden, e.g. Image, Text.
+ implicit size which cannot be overridden, for example, \l [QML] Image and \l [QML] Text.
Setting the implicit size is useful for defining components that have a preferred size
based on their content, for example:
@@ -6184,7 +6163,7 @@ qreal QQuickItem::implicitWidth() const
}
\endqml
- \b Note: using implicitWidth of Text or TextEdit and setting the width explicitly
+ \note Using implicitWidth of \l [QML] Text or \l [QML] TextEdit and setting the width explicitly
incurs a performance penalty as the text must be laid out twice.
*/
void QQuickItem::setImplicitWidth(qreal w)
@@ -6733,15 +6712,27 @@ void QQuickItem::setAcceptHoverEvents(bool enabled)
d->hoverEnabled = enabled;
}
-void QQuickItemPrivate::incrementCursorCount(int delta)
+void QQuickItemPrivate::setHasCursorInChild(bool hasCursor)
{
#ifndef QT_NO_CURSOR
Q_Q(QQuickItem);
- extra.value().numItemsWithCursor += delta;
+
+ // if we're asked to turn it off (because of an unsetcursor call, or a node
+ // removal) then we should check our children and make sure it's really ok
+ // to turn it off.
+ if (!hasCursor && hasCursorInChild) {
+ foreach (QQuickItem *otherChild, childItems) {
+ QQuickItemPrivate *otherChildPrivate = QQuickItemPrivate::get(otherChild);
+ if (otherChildPrivate->hasCursorInChild)
+ return; // nope! sorry, something else wants it kept on.
+ }
+ }
+
+ hasCursorInChild = hasCursor;
QQuickItem *parent = q->parentItem();
if (parent) {
QQuickItemPrivate *parentPrivate = QQuickItemPrivate::get(parent);
- parentPrivate->incrementCursorCount(delta);
+ parentPrivate->setHasCursorInChild(hasCursor);
}
#endif
}
@@ -6749,9 +6740,7 @@ void QQuickItemPrivate::incrementCursorCount(int delta)
void QQuickItemPrivate::markObjects(QV4::ExecutionEngine *e)
{
Q_Q(QQuickItem);
- QQmlData *ddata = QQmlData::get(q);
- if (ddata)
- ddata->jsWrapper.markOnce(e);
+ QV4::QObjectWrapper::markWrapper(q, e);
foreach (QQuickItem *child, childItems)
QQuickItemPrivate::get(child)->markObjects(e);
@@ -6804,7 +6793,7 @@ void QQuickItem::setCursor(const QCursor &cursor)
}
if (!d->hasCursor) {
- d->incrementCursorCount(+1);
+ d->setHasCursorInChild(true);
d->hasCursor = true;
if (d->window) {
QWindow *renderWindow = QQuickRenderControl::renderWindowFor(d->window);
@@ -6827,7 +6816,7 @@ void QQuickItem::unsetCursor()
Q_D(QQuickItem);
if (!d->hasCursor)
return;
- d->incrementCursorCount(-1);
+ d->setHasCursorInChild(false);
d->hasCursor = false;
if (d->extra.isAllocated())
d->extra->cursor = QCursor();
@@ -7298,6 +7287,9 @@ bool QQuickItem::event(QEvent *ev)
dropEvent(static_cast<QDropEvent*>(ev));
break;
#endif // QT_NO_DRAGANDDROP
+ case QEvent::NativeGesture:
+ ev->ignore();
+ break;
default:
return QObject::event(ev);
}
@@ -7306,18 +7298,27 @@ bool QQuickItem::event(QEvent *ev)
}
#ifndef QT_NO_DEBUG_STREAM
+// FIXME: Qt 6: Make this QDebug operator<<(QDebug debug, const QQuickItem *item)
QDebug operator<<(QDebug debug, QQuickItem *item)
{
+ QDebugStateSaver saver(debug);
+ debug.nospace();
if (!item) {
debug << "QQuickItem(0)";
return debug;
}
- debug << item->metaObject()->className() << "(this =" << ((void*)item)
- << ", name=" << item->objectName()
- << ", parent =" << ((void*)item->parentItem())
- << ", geometry =" << QRectF(item->position(), QSizeF(item->width(), item->height()))
- << ", z =" << item->z() << ')';
+ const QRectF rect(item->position(), QSizeF(item->width(), item->height()));
+
+ debug << item->metaObject()->className() << '(' << static_cast<void *>(item);
+ if (!item->objectName().isEmpty())
+ debug << ", name=" << item->objectName();
+ debug << ", parent=" << static_cast<void *>(item->parentItem())
+ << ", geometry=";
+ QtDebugUtils::formatQRect(debug, rect);
+ if (const qreal z = item->z())
+ debug << ", z=" << z;
+ debug << ')';
return debug;
}
#endif
@@ -7816,11 +7817,8 @@ QQuickItemPrivate::ExtraData::ExtraData()
: z(0), scale(1), rotation(0), opacity(1),
contents(0), screenAttached(0), layoutDirectionAttached(0),
keyHandler(0), layer(0),
-#ifndef QT_NO_CURSOR
- numItemsWithCursor(0),
-#endif
effectRefCount(0), hideRefCount(0),
- opacityNode(0), clipNode(0), rootNode(0), beforePaintNode(0),
+ opacityNode(0), clipNode(0), rootNode(0),
acceptedMouseButtons(0), origin(QQuickItem::Center),
transparentForPositioner(false)
{
diff --git a/src/quick/items/qquickitem.h b/src/quick/items/qquickitem.h
index c17f6a6a7d..463113386b 100644
--- a/src/quick/items/qquickitem.h
+++ b/src/quick/items/qquickitem.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -376,7 +376,7 @@ Q_SIGNALS:
void implicitHeightChanged();
protected:
- virtual bool event(QEvent *);
+ bool event(QEvent *) Q_DECL_OVERRIDE;
bool isComponentComplete() const;
virtual void itemChange(ItemChange, const ItemChangeData &);
@@ -389,8 +389,8 @@ protected:
bool heightValid() const; // ### better name?
void setImplicitSize(qreal, qreal);
- virtual void classBegin();
- virtual void componentComplete();
+ void classBegin() Q_DECL_OVERRIDE;
+ void componentComplete() Q_DECL_OVERRIDE;
virtual void keyPressEvent(QKeyEvent *event);
virtual void keyReleaseEvent(QKeyEvent *event);
diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h
index 7ef0f903b5..64d8bd0ede 100644
--- a/src/quick/items/qquickitem_p.h
+++ b/src/quick/items/qquickitem_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -58,7 +58,7 @@
#include <private/qpodvector_p.h>
#include <QtQuick/private/qquickstate_p.h>
-#include <private/qqmlnullablevalue_p_p.h>
+#include <private/qqmlnullablevalue_p.h>
#include <private/qqmlnotifier_p.h>
#include <private/qqmlglobal_p.h>
#include <private/qlazilyallocated_p.h>
@@ -92,10 +92,10 @@ public:
void complete();
protected:
- void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry);
- void itemDestroyed(QQuickItem *item);
- void itemChildAdded(QQuickItem *, QQuickItem *);
- void itemChildRemoved(QQuickItem *, QQuickItem *);
+ void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+ void itemDestroyed(QQuickItem *item) Q_DECL_OVERRIDE;
+ void itemChildAdded(QQuickItem *, QQuickItem *) Q_DECL_OVERRIDE;
+ void itemChildRemoved(QQuickItem *, QQuickItem *) Q_DECL_OVERRIDE;
//void itemVisibilityChanged(QQuickItem *item)
private:
@@ -178,11 +178,11 @@ public:
QQuickShaderEffectSource *effectSource() const { return m_effectSource; }
- void itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &);
- void itemOpacityChanged(QQuickItem *);
- void itemParentChanged(QQuickItem *, QQuickItem *);
- void itemSiblingOrderChanged(QQuickItem *);
- void itemVisibilityChanged(QQuickItem *);
+ void itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &) Q_DECL_OVERRIDE;
+ void itemOpacityChanged(QQuickItem *) Q_DECL_OVERRIDE;
+ void itemParentChanged(QQuickItem *, QQuickItem *) Q_DECL_OVERRIDE;
+ void itemSiblingOrderChanged(QQuickItem *) Q_DECL_OVERRIDE;
+ void itemVisibilityChanged(QQuickItem *) Q_DECL_OVERRIDE;
void updateMatrix();
void updateGeometry();
@@ -342,7 +342,6 @@ public:
mutable QQuickItemLayer *layer;
#ifndef QT_NO_CURSOR
QCursor cursor;
- int numItemsWithCursor;
#endif
QPointF userTransformOriginPoint;
@@ -352,7 +351,8 @@ public:
QSGOpacityNode *opacityNode;
QQuickDefaultClipNode *clipNode;
QSGRootNode *rootNode;
- QSGNode *beforePaintNode;
+
+ QObjectList resourcesList;
// Although acceptedMouseButtons is inside ExtraData, we actually store
// the LeftButton flag in the extra.flag() bit. This is because it is
@@ -363,7 +363,7 @@ public:
QQuickItem::TransformOrigin origin:5;
uint transparentForPositioner : 1;
- QObjectList resourcesList;
+ // 26 bits padding
};
QLazilyAllocated<ExtraData> extra;
@@ -415,6 +415,7 @@ public:
bool culled:1;
bool hasCursor:1;
// Bit 32
+ bool hasCursorInChild:1;
bool activeFocusOnTab:1;
bool implicitAntialiasing:1;
bool antialiasingValid:1;
@@ -491,7 +492,6 @@ public:
static bool focusNextPrev(QQuickItem *item, bool forward);
static QQuickItem *nextPrevItemInTabFocusChain(QQuickItem *item, bool forward);
- static bool qt_tab_all_widgets(); //todo: move to QGuiApplication?
static bool canAcceptTabFocus(QQuickItem *item);
qreal x;
@@ -556,8 +556,7 @@ public:
- itemNode
- (opacityNode)
- (clipNode)
- - (effectNode)
- - groupNode
+ - (rootNode) (shader effect source's root node)
*/
QSGOpacityNode *opacityNode() const { return extra.isAllocated()?extra->opacityNode:0; }
@@ -565,7 +564,6 @@ public:
QSGRootNode *rootNode() const { return extra.isAllocated()?extra->rootNode:0; }
QSGTransformNode *itemNodeInstance;
- QSGNode *groupNode;
QSGNode *paintNode;
virtual QSGTransformNode *createTransformNode();
@@ -579,7 +577,7 @@ public:
virtual void mirrorChange() {}
- void incrementCursorCount(int delta);
+ void setHasCursorInChild(bool hasCursor);
// recursive helper to let a visual parent mark its visual children
void markObjects(QV4::ExecutionEngine *e);
@@ -681,8 +679,8 @@ Q_SIGNALS:
void priorityChanged();
private:
- virtual void keyPressed(QKeyEvent *event, bool post);
- virtual void keyReleased(QKeyEvent *event, bool post);
+ void keyPressed(QKeyEvent *event, bool post) Q_DECL_OVERRIDE;
+ void keyReleased(QKeyEvent *event, bool post) Q_DECL_OVERRIDE;
void setFocusNavigation(QQuickItem *currentItem, const char *dir,
Qt::FocusReason reason = Qt::OtherFocusReason);
};
@@ -765,7 +763,7 @@ public:
return QQmlListProperty<QQuickItem>(this, d->targets);
}
- virtual void componentComplete();
+ void componentComplete() Q_DECL_OVERRIDE;
static QQuickKeysAttached *qmlAttachedProperties(QObject *);
@@ -816,11 +814,11 @@ Q_SIGNALS:
void volumeDownPressed(QQuickKeyEvent *event);
private:
- virtual void keyPressed(QKeyEvent *event, bool post);
- virtual void keyReleased(QKeyEvent *event, bool post);
+ void keyPressed(QKeyEvent *event, bool post) Q_DECL_OVERRIDE;
+ void keyReleased(QKeyEvent *event, bool post) Q_DECL_OVERRIDE;
#ifndef QT_NO_IM
- virtual void inputMethodEvent(QInputMethodEvent *, bool post);
- virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
+ void inputMethodEvent(QInputMethodEvent *, bool post) Q_DECL_OVERRIDE;
+ QVariant inputMethodQuery(Qt::InputMethodQuery query) const Q_DECL_OVERRIDE;
#endif
const QByteArray keyToSignal(int key);
@@ -868,7 +866,7 @@ QSGTransformNode *QQuickItemPrivate::itemNode()
itemNodeInstance->setFlag(QSGNode::OwnedByParent, false);
#ifdef QSG_RUNTIME_DESCRIPTION
Q_Q(QQuickItem);
- qsgnode_set_description(itemNodeInstance, QString::fromLatin1("QQuickItem(%1)").arg(QString::fromLatin1(q->metaObject()->className())));
+ qsgnode_set_description(itemNodeInstance, QString::fromLatin1("QQuickItem(%1:%2)").arg(QString::fromLatin1(q->metaObject()->className())).arg(q->objectName()));
#endif
}
return itemNodeInstance;
@@ -876,21 +874,14 @@ QSGTransformNode *QQuickItemPrivate::itemNode()
QSGNode *QQuickItemPrivate::childContainerNode()
{
- if (!groupNode) {
- groupNode = new QSGNode();
- if (rootNode())
- rootNode()->appendChildNode(groupNode);
- else if (clipNode())
- clipNode()->appendChildNode(groupNode);
- else if (opacityNode())
- opacityNode()->appendChildNode(groupNode);
- else
- itemNode()->appendChildNode(groupNode);
-#ifdef QSG_RUNTIME_DESCRIPTION
- qsgnode_set_description(groupNode, QLatin1String("group"));
-#endif
- }
- return groupNode;
+ if (rootNode())
+ return rootNode();
+ else if (clipNode())
+ return clipNode();
+ else if (opacityNode())
+ return opacityNode();
+ else
+ return itemNode();
}
Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickItemPrivate::ChangeTypes)
diff --git a/src/quick/items/qquickitemanimation.cpp b/src/quick/items/qquickitemanimation.cpp
index c7c40980dc..9d140b3156 100644
--- a/src/quick/items/qquickitemanimation.cpp
+++ b/src/quick/items/qquickitemanimation.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -37,12 +37,12 @@
#include <private/qqmlproperty_p.h>
#include <private/qquickpath_p.h>
+#include "private/qparallelanimationgroupjob_p.h"
+#include "private/qsequentialanimationgroupjob_p.h"
-#include <QtQml/qqmlinfo.h>
#include <QtCore/qmath.h>
-#include "private/qsequentialanimationgroupjob_p.h"
-#include "private/qparallelanimationgroupjob_p.h"
#include <QtGui/qtransform.h>
+#include <QtQml/qqmlinfo.h>
QT_BEGIN_NAMESPACE
@@ -210,7 +210,7 @@ QAbstractAnimationJob* QQuickParentAnimation::transition(QQuickStateActions &act
//### reverse should probably apply on a per-action basis
bool reverse;
QList<QQuickParentChange *> pc;
- virtual void doAction()
+ void doAction() Q_DECL_OVERRIDE
{
for (int ii = 0; ii < actions.count(); ++ii) {
const QQuickStateAction &action = actions.at(ii);
@@ -319,7 +319,7 @@ QAbstractAnimationJob* QQuickParentAnimation::transition(QQuickStateActions &act
}
if (scale != 0)
- rotation = atan2(transform.m12()/scale, transform.m11()/scale) * 180/M_PI;
+ rotation = qAtan2(transform.m12()/scale, transform.m11()/scale) * 180/M_PI;
else {
qmlInfo(this) << QQuickParentAnimation::tr("Unable to preserve appearance under scale of 0");
ok = false;
@@ -581,11 +581,11 @@ QQuickPathAnimation::QQuickPathAnimation(QObject *parent)
QQuickPathAnimation::~QQuickPathAnimation()
{
+ typedef QHash<QQuickItem*, QQuickPathAnimationAnimator* >::iterator ActiveAnimationsIt;
+
Q_D(QQuickPathAnimation);
- QHash<QQuickItem*, QQuickPathAnimationAnimator* >::iterator it;
- for (it = d->activeAnimations.begin(); it != d->activeAnimations.end(); ++it) {
+ for (ActiveAnimationsIt it = d->activeAnimations.begin(), end = d->activeAnimations.end(); it != end; ++it)
it.value()->clearTemplate();
- }
}
/*!
diff --git a/src/quick/items/qquickitemanimation_p.h b/src/quick/items/qquickitemanimation_p.h
index d16c9f8107..907687a2bd 100644
--- a/src/quick/items/qquickitemanimation_p.h
+++ b/src/quick/items/qquickitemanimation_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -69,10 +69,10 @@ Q_SIGNALS:
void viaChanged();
protected:
- virtual QAbstractAnimationJob* transition(QQuickStateActions &actions,
+ QAbstractAnimationJob* transition(QQuickStateActions &actions,
QQmlProperties &modified,
TransitionDirection direction,
- QObject *defaultTarget = 0);
+ QObject *defaultTarget = 0) Q_DECL_OVERRIDE;
};
class QQuickAnchorAnimationPrivate;
@@ -101,10 +101,10 @@ Q_SIGNALS:
void easingChanged(const QEasingCurve&);
protected:
- virtual QAbstractAnimationJob* transition(QQuickStateActions &actions,
+ QAbstractAnimationJob* transition(QQuickStateActions &actions,
QQmlProperties &modified,
TransitionDirection direction,
- QObject *defaultTarget = 0);
+ QObject *defaultTarget = 0) Q_DECL_OVERRIDE;
};
class QQuickItem;
@@ -166,10 +166,10 @@ public:
void setEndRotation(qreal);
protected:
- virtual QAbstractAnimationJob* transition(QQuickStateActions &actions,
+ QAbstractAnimationJob* transition(QQuickStateActions &actions,
QQmlProperties &modified,
TransitionDirection direction,
- QObject *defaultTarget = 0);
+ QObject *defaultTarget = 0) Q_DECL_OVERRIDE;
Q_SIGNALS:
void durationChanged(int);
void easingChanged(const QEasingCurve &);
diff --git a/src/quick/items/qquickitemanimation_p_p.h b/src/quick/items/qquickitemanimation_p_p.h
index 26bbd3f168..c8c93e33dd 100644
--- a/src/quick/items/qquickitemanimation_p_p.h
+++ b/src/quick/items/qquickitemanimation_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickitemchangelistener_p.h b/src/quick/items/qquickitemchangelistener_p.h
index 8d81fe5df1..d987b62454 100644
--- a/src/quick/items/qquickitemchangelistener_p.h
+++ b/src/quick/items/qquickitemchangelistener_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickitemgrabresult.cpp b/src/quick/items/qquickitemgrabresult.cpp
index 8809c26d85..93797d9ce8 100644
--- a/src/quick/items/qquickitemgrabresult.cpp
+++ b/src/quick/items/qquickitemgrabresult.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickitemgrabresult.h b/src/quick/items/qquickitemgrabresult.h
index de2a568592..055cd09095 100644
--- a/src/quick/items/qquickitemgrabresult.h
+++ b/src/quick/items/qquickitemgrabresult.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp
index eb3e617e7c..5fbae66b6c 100644
--- a/src/quick/items/qquickitemsmodule.cpp
+++ b/src/quick/items/qquickitemsmodule.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -83,8 +83,7 @@ static QQmlPrivate::AutoParentResult qquickitem_autoParent(QObject *obj, QObject
{
// When setting a parent (especially during dynamic object creation) in QML,
// also try to set up the analogous item/window relationship.
- QQuickItem *parentItem = qmlobject_cast<QQuickItem *>(parent);
- if (parentItem) {
+ if (QQuickItem *parentItem = qmlobject_cast<QQuickItem *>(parent)) {
QQuickItem *item = qmlobject_cast<QQuickItem *>(obj);
if (item) {
// An Item has another Item
@@ -99,26 +98,25 @@ static QQmlPrivate::AutoParentResult qquickitem_autoParent(QObject *obj, QObject
}
}
return QQmlPrivate::IncompatibleObject;
- } else {
- QQuickWindow *parentWindow = qmlobject_cast<QQuickWindow *>(parent);
- if (parentWindow) {
- QQuickWindow *win = qmlobject_cast<QQuickWindow *>(obj);
- if (win) {
- // A Window inside a Window should be transient for it
- win->setTransientParent(parentWindow);
+ } else if (QQuickWindow *parentWindow = qmlobject_cast<QQuickWindow *>(parent)) {
+ QQuickWindow *win = qmlobject_cast<QQuickWindow *>(obj);
+ if (win) {
+ // A Window inside a Window should be transient for it
+ win->setTransientParent(parentWindow);
+ return QQmlPrivate::Parented;
+ } else {
+ QQuickItem *item = qmlobject_cast<QQuickItem *>(obj);
+ if (item) {
+ // The parent of an Item inside a Window is actually the implicit content Item
+ item->setParentItem(parentWindow->contentItem());
return QQmlPrivate::Parented;
- } else {
- QQuickItem *item = qmlobject_cast<QQuickItem *>(obj);
- if (item) {
- // The parent of an Item inside a Window is actually the implicit content Item
- item->setParentItem(parentWindow->contentItem());
- return QQmlPrivate::Parented;
- }
}
- return QQmlPrivate::IncompatibleObject;
}
+ return QQmlPrivate::IncompatibleObject;
+ } else if (qmlobject_cast<QQuickItem *>(obj)) {
+ return QQmlPrivate::IncompatibleParent;
}
- return QQmlPrivate::IncompatibleParent;
+ return QQmlPrivate::IncompatibleObject;
}
static void qt_quickitems_defineModule(const char *uri, int major, int minor)
@@ -128,7 +126,7 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor)
QQuickItemPrivate::registerAccessorProperties();
#ifdef QT_NO_MOVIE
- qmlRegisterTypeNotAvailable(uri,major,minor,"AnimatedImage", qApp->translate("QQuickAnimatedImage","Qt was built without support for QMovie"));
+ qmlRegisterTypeNotAvailable(uri,major,minor,"AnimatedImage", QCoreApplication::translate("QQuickAnimatedImage","Qt was built without support for QMovie"));
#else
qmlRegisterType<QQuickAnimatedImage>(uri,major,minor,"AnimatedImage");
#endif
@@ -267,6 +265,10 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor)
qmlRegisterType<QQuickMouseArea, 1>(uri, 2, 4, "MouseArea");
qmlRegisterType<QQuickShaderEffect, 1>(uri, 2, 4, "ShaderEffect");
qmlRegisterUncreatableType<QQuickOpenGLInfo>(uri, 2, 4,"OpenGLInfo", QQuickOpenGLInfo::tr("OpenGLInfo is only available via attached properties"));
+
+ qmlRegisterType<QQuickPinchArea, 1>(uri, 2, 5,"PinchArea");
+ qmlRegisterType<QQuickImage, 2>(uri, 2, 5,"Image");
+ qmlRegisterType<QQuickMouseArea, 2>(uri, 2, 5, "MouseArea");
}
static void initResources()
diff --git a/src/quick/items/qquickitemsmodule_p.h b/src/quick/items/qquickitemsmodule_p.h
index 3665e05a82..a7442e972a 100644
--- a/src/quick/items/qquickitemsmodule_p.h
+++ b/src/quick/items/qquickitemsmodule_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp
index 93cb5e4e9d..01ef1e65f7 100644
--- a/src/quick/items/qquickitemview.cpp
+++ b/src/quick/items/qquickitemview.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -2415,20 +2415,22 @@ void QQuickItemViewPrivate::updateTrackedItem()
void QQuickItemViewPrivate::updateUnrequestedIndexes()
{
Q_Q(QQuickItemView);
- for (QHash<QQuickItem*,int>::iterator it = unrequestedItems.begin(); it != unrequestedItems.end(); ++it)
+ for (QHash<QQuickItem*,int>::iterator it = unrequestedItems.begin(), end = unrequestedItems.end(); it != end; ++it)
*it = model->indexOf(it.key(), q);
}
void QQuickItemViewPrivate::updateUnrequestedPositions()
{
- for (QHash<QQuickItem*,int>::const_iterator it = unrequestedItems.begin(); it != unrequestedItems.end(); ++it)
+ for (QHash<QQuickItem*,int>::const_iterator it = unrequestedItems.begin(), cend = unrequestedItems.end(); it != cend; ++it)
repositionPackageItemAt(it.key(), it.value());
}
void QQuickItemViewPrivate::updateVisibleIndex()
{
+ typedef QList<FxViewItem*>::const_iterator FxViewItemListConstIt;
+
visibleIndex = 0;
- for (QList<FxViewItem*>::Iterator it = visibleItems.begin(); it != visibleItems.end(); ++it) {
+ for (FxViewItemListConstIt it = visibleItems.constBegin(), cend = visibleItems.constEnd(); it != cend; ++it) {
if ((*it)->index != -1) {
visibleIndex = (*it)->index;
break;
diff --git a/src/quick/items/qquickitemview_p.h b/src/quick/items/qquickitemview_p.h
index 89c3bec465..6e5ae032c2 100644
--- a/src/quick/items/qquickitemview_p.h
+++ b/src/quick/items/qquickitemview_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -208,10 +208,10 @@ public:
Q_INVOKABLE void positionViewAtEnd();
Q_REVISION(1) Q_INVOKABLE void forceLayout();
- virtual void setContentX(qreal pos);
- virtual void setContentY(qreal pos);
- virtual qreal originX() const;
- virtual qreal originY() const;
+ void setContentX(qreal pos) Q_DECL_OVERRIDE;
+ void setContentY(qreal pos) Q_DECL_OVERRIDE;
+ qreal originX() const Q_DECL_OVERRIDE;
+ qreal originY() const Q_DECL_OVERRIDE;
Q_SIGNALS:
void modelChanged();
@@ -252,13 +252,13 @@ Q_SIGNALS:
void highlightMoveDurationChanged();
protected:
- virtual void updatePolish();
- virtual void componentComplete();
- virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
- virtual qreal minYExtent() const;
- virtual qreal maxYExtent() const;
- virtual qreal minXExtent() const;
- virtual qreal maxXExtent() const;
+ void updatePolish() Q_DECL_OVERRIDE;
+ void componentComplete() Q_DECL_OVERRIDE;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+ qreal minYExtent() const Q_DECL_OVERRIDE;
+ qreal maxYExtent() const Q_DECL_OVERRIDE;
+ qreal minXExtent() const Q_DECL_OVERRIDE;
+ qreal maxXExtent() const Q_DECL_OVERRIDE;
protected Q_SLOTS:
void destroyRemoved();
diff --git a/src/quick/items/qquickitemview_p_p.h b/src/quick/items/qquickitemview_p_p.h
index 76fc326367..5ac88a7585 100644
--- a/src/quick/items/qquickitemview_p_p.h
+++ b/src/quick/items/qquickitemview_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -181,7 +181,7 @@ public:
virtual void animationFinished(QAbstractAnimationJob *);
void refill();
void refill(qreal from, qreal to);
- void mirrorChange();
+ void mirrorChange() Q_DECL_OVERRIDE;
FxViewItem *createItem(int modelIndex, bool asynchronous = false);
virtual bool releaseItem(FxViewItem *item);
@@ -211,7 +211,7 @@ public:
void prepareVisibleItemTransitions();
void prepareRemoveTransitions(QHash<QQmlChangeSet::MoveKey, FxViewItem *> *removedItems);
bool prepareNonVisibleItemTransition(FxViewItem *item, const QRectF &viewBounds);
- virtual void viewItemTransitionFinished(QQuickItemViewTransitionableItem *item);
+ void viewItemTransitionFinished(QQuickItemViewTransitionableItem *item) Q_DECL_OVERRIDE;
int findMoveKeyIndex(QQmlChangeSet::MoveKey key, const QVector<QQmlChangeSet::Change> &changes) const;
@@ -353,7 +353,7 @@ protected:
virtual void updateSectionCriteria() {}
virtual void updateSections() {}
- virtual void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry);
+ void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
};
diff --git a/src/quick/items/qquickitemviewtransition.cpp b/src/quick/items/qquickitemviewtransition.cpp
index 41ee9bb1f2..7fa6cdc161 100644
--- a/src/quick/items/qquickitemviewtransition.cpp
+++ b/src/quick/items/qquickitemviewtransition.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -57,7 +57,7 @@ public:
bool *m_wasDeleted;
protected:
- virtual void finished();
+ void finished() Q_DECL_OVERRIDE;
};
@@ -162,7 +162,9 @@ QQuickItemViewTransitioner::QQuickItemViewTransitioner()
QQuickItemViewTransitioner::~QQuickItemViewTransitioner()
{
- for (QSet<QQuickItemViewTransitionJob *>::iterator it = runningJobs.begin(); it != runningJobs.end(); ++it)
+ typedef QSet<QQuickItemViewTransitionJob *>::iterator JobIt;
+
+ for (JobIt it = runningJobs.begin(), end = runningJobs.end(); it != end; ++it)
(*it)->m_transitioner = 0;
}
diff --git a/src/quick/items/qquickitemviewtransition_p.h b/src/quick/items/qquickitemviewtransition_p.h
index 14c16ff335..170072a814 100644
--- a/src/quick/items/qquickitemviewtransition_p.h
+++ b/src/quick/items/qquickitemviewtransition_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp
index d381fe2030..cc500956f5 100644
--- a/src/quick/items/qquicklistview.cpp
+++ b/src/quick/items/qquicklistview.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -39,8 +39,8 @@
#include <QtQml/qqmlengine.h>
#include <QtQml/qqmlinfo.h>
#include <QtGui/qevent.h>
-#include <QtCore/qmath.h>
#include <QtCore/qcoreapplication.h>
+#include <QtCore/qmath.h>
#include <private/qquicksmoothedanimation_p_p.h>
#include "qplatformdefs.h"
@@ -59,49 +59,49 @@ class QQuickListViewPrivate : public QQuickItemViewPrivate
public:
static QQuickListViewPrivate* get(QQuickListView *item) { return item->d_func(); }
- virtual Qt::Orientation layoutOrientation() const;
- virtual bool isContentFlowReversed() const;
+ Qt::Orientation layoutOrientation() const Q_DECL_OVERRIDE;
+ bool isContentFlowReversed() const Q_DECL_OVERRIDE;
bool isRightToLeft() const;
bool isBottomToTop() const;
- virtual qreal positionAt(int index) const;
- virtual qreal endPositionAt(int index) const;
- virtual qreal originPosition() const;
- virtual qreal lastPosition() const;
+ qreal positionAt(int index) const Q_DECL_OVERRIDE;
+ qreal endPositionAt(int index) const Q_DECL_OVERRIDE;
+ qreal originPosition() const Q_DECL_OVERRIDE;
+ qreal lastPosition() const Q_DECL_OVERRIDE;
FxViewItem *itemBefore(int modelIndex) const;
QString sectionAt(int modelIndex);
qreal snapPosAt(qreal pos);
FxViewItem *snapItemAt(qreal pos);
- virtual void init();
- virtual void clear();
+ void init() Q_DECL_OVERRIDE;
+ void clear() Q_DECL_OVERRIDE;
- virtual bool addVisibleItems(qreal fillFrom, qreal fillTo, qreal bufferFrom, qreal bufferTo, bool doBuffer);
- virtual bool removeNonVisibleItems(qreal bufferFrom, qreal bufferTo);
- virtual void visibleItemsChanged();
+ bool addVisibleItems(qreal fillFrom, qreal fillTo, qreal bufferFrom, qreal bufferTo, bool doBuffer) Q_DECL_OVERRIDE;
+ bool removeNonVisibleItems(qreal bufferFrom, qreal bufferTo) Q_DECL_OVERRIDE;
+ void visibleItemsChanged() Q_DECL_OVERRIDE;
- virtual FxViewItem *newViewItem(int index, QQuickItem *item);
- virtual void initializeViewItem(FxViewItem *item);
- virtual bool releaseItem(FxViewItem *item);
- virtual void repositionItemAt(FxViewItem *item, int index, qreal sizeBuffer);
- virtual void repositionPackageItemAt(QQuickItem *item, int index);
- virtual void resetFirstItemPosition(qreal pos = 0.0);
- virtual void adjustFirstItem(qreal forwards, qreal backwards, int);
- virtual void updateSizeChangesBeforeVisiblePos(FxViewItem *item, ChangeResult *removeResult);
+ FxViewItem *newViewItem(int index, QQuickItem *item) Q_DECL_OVERRIDE;
+ void initializeViewItem(FxViewItem *item) Q_DECL_OVERRIDE;
+ bool releaseItem(FxViewItem *item) Q_DECL_OVERRIDE;
+ void repositionItemAt(FxViewItem *item, int index, qreal sizeBuffer) Q_DECL_OVERRIDE;
+ void repositionPackageItemAt(QQuickItem *item, int index) Q_DECL_OVERRIDE;
+ void resetFirstItemPosition(qreal pos = 0.0) Q_DECL_OVERRIDE;
+ void adjustFirstItem(qreal forwards, qreal backwards, int) Q_DECL_OVERRIDE;
+ void updateSizeChangesBeforeVisiblePos(FxViewItem *item, ChangeResult *removeResult) Q_DECL_OVERRIDE;
- virtual void createHighlight();
- virtual void updateHighlight();
- virtual void resetHighlightPosition();
+ void createHighlight() Q_DECL_OVERRIDE;
+ void updateHighlight() Q_DECL_OVERRIDE;
+ void resetHighlightPosition() Q_DECL_OVERRIDE;
- virtual void setPosition(qreal pos);
- virtual void layoutVisibleItems(int fromModelIndex = 0);
+ void setPosition(qreal pos) Q_DECL_OVERRIDE;
+ void layoutVisibleItems(int fromModelIndex = 0) Q_DECL_OVERRIDE;
- virtual bool applyInsertionChange(const QQmlChangeSet::Change &insert, ChangeResult *changeResult, QList<FxViewItem *> *addedItems, QList<MovedItem> *movingIntoView);
- virtual void translateAndTransitionItemsAfter(int afterIndex, const ChangeResult &insertionResult, const ChangeResult &removalResult);
+ bool applyInsertionChange(const QQmlChangeSet::Change &insert, ChangeResult *changeResult, QList<FxViewItem *> *addedItems, QList<MovedItem> *movingIntoView) Q_DECL_OVERRIDE;
+ void translateAndTransitionItemsAfter(int afterIndex, const ChangeResult &insertionResult, const ChangeResult &removalResult) Q_DECL_OVERRIDE;
- virtual void updateSectionCriteria();
- virtual void updateSections();
+ void updateSectionCriteria() Q_DECL_OVERRIDE;
+ void updateSections() Q_DECL_OVERRIDE;
QQuickItem *getSectionItem(const QString &section);
void releaseSectionItem(QQuickItem *item);
void releaseSectionItems();
@@ -109,25 +109,25 @@ public:
void updateCurrentSection();
void updateStickySections();
- virtual qreal headerSize() const;
- virtual qreal footerSize() const;
- virtual bool showHeaderForIndex(int index) const;
- virtual bool showFooterForIndex(int index) const;
- virtual void updateHeader();
- virtual void updateFooter();
+ qreal headerSize() const Q_DECL_OVERRIDE;
+ qreal footerSize() const Q_DECL_OVERRIDE;
+ bool showHeaderForIndex(int index) const Q_DECL_OVERRIDE;
+ bool showFooterForIndex(int index) const Q_DECL_OVERRIDE;
+ void updateHeader() Q_DECL_OVERRIDE;
+ void updateFooter() Q_DECL_OVERRIDE;
bool hasStickyHeader() const;
bool hasStickyFooter() const;
- virtual void changedVisibleIndex(int newIndex);
- virtual void initializeCurrentItem();
+ void changedVisibleIndex(int newIndex) Q_DECL_OVERRIDE;
+ void initializeCurrentItem() Q_DECL_OVERRIDE;
void updateAverage();
- void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry);
- virtual void fixupPosition();
- virtual void fixup(AxisData &data, qreal minExtent, qreal maxExtent);
- virtual bool flick(QQuickItemViewPrivate::AxisData &data, qreal minExtent, qreal maxExtent, qreal vSize,
- QQuickTimeLineCallback::Callback fixupCallback, qreal velocity);
+ void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+ void fixupPosition() Q_DECL_OVERRIDE;
+ void fixup(AxisData &data, qreal minExtent, qreal maxExtent) Q_DECL_OVERRIDE;
+ bool flick(QQuickItemViewPrivate::AxisData &data, qreal minExtent, qreal maxExtent, qreal vSize,
+ QQuickTimeLineCallback::Callback fixupCallback, qreal velocity) Q_DECL_OVERRIDE;
QQuickListView::Orientation orient;
qreal visiblePos;
@@ -319,7 +319,7 @@ public:
else
item->setWidth(size);
}
- bool contains(qreal x, qreal y) const {
+ bool contains(qreal x, qreal y) const Q_DECL_OVERRIDE {
return (x >= itemX() && x < itemX() + item->width() &&
y >= itemY() && y < itemY() + item->height());
}
@@ -1145,9 +1145,11 @@ void QQuickListViewPrivate::updateSections()
if (visibleIndex > 0)
prevSection = sectionAt(visibleIndex-1);
QQuickListViewAttached *prevAtt = 0;
+ int prevIdx = -1;
int idx = -1;
for (int i = 0; i < visibleItems.count(); ++i) {
- QQuickListViewAttached *attached = static_cast<QQuickListViewAttached*>(visibleItems.at(i)->attached);
+ FxViewItem *item = visibleItems.at(i);
+ QQuickListViewAttached *attached = static_cast<QQuickListViewAttached*>(item->attached);
attached->setPrevSection(prevSection);
if (visibleItems.at(i)->index != -1) {
QString propValue = model->stringValue(visibleItems.at(i)->index, sectionCriteria->property());
@@ -1156,9 +1158,10 @@ void QQuickListViewPrivate::updateSections()
}
updateInlineSection(static_cast<FxListItemSG*>(visibleItems.at(i)));
if (prevAtt)
- prevAtt->setNextSection(attached->section());
+ prevAtt->setNextSection(sectionAt(prevIdx+1));
prevSection = attached->section();
prevAtt = attached;
+ prevIdx = item->index;
}
if (prevAtt) {
if (idx > 0 && idx < model->count()-1)
@@ -1572,7 +1575,7 @@ bool QQuickListViewPrivate::flick(AxisData &data, qreal minExtent, qreal maxExte
if (snapMode == QQuickListView::NoSnap && highlightRange != QQuickListView::StrictlyEnforceRange)
data.flickTarget = maxExtent;
}
- bool overShoot = boundsBehavior == QQuickFlickable::DragAndOvershootBounds;
+ bool overShoot = boundsBehavior & QQuickFlickable::OvershootBounds;
if (maxDistance > 0 || overShoot) {
// These modes require the list to stop exactly on an item boundary.
// The initial flick will estimate the boundary to stop on.
@@ -1603,10 +1606,10 @@ bool QQuickListViewPrivate::flick(AxisData &data, qreal minExtent, qreal maxExte
}
data.flickTarget = isContentFlowReversed() ? -data.flickTarget+size() : data.flickTarget;
if (overShoot) {
- if (data.flickTarget >= minExtent) {
+ if (data.flickTarget > minExtent) {
overshootDist = overShootDistance(vSize);
data.flickTarget += overshootDist;
- } else if (data.flickTarget <= maxExtent) {
+ } else if (data.flickTarget < maxExtent) {
overshootDist = overShootDistance(vSize);
data.flickTarget -= overshootDist;
}
@@ -1626,10 +1629,10 @@ bool QQuickListViewPrivate::flick(AxisData &data, qreal minExtent, qreal maxExte
accel = v2 / (2.0f * qAbs(dist));
} else if (overShoot) {
data.flickTarget = data.move.value() - dist;
- if (data.flickTarget >= minExtent) {
+ if (data.flickTarget > minExtent) {
overshootDist = overShootDistance(vSize);
data.flickTarget += overshootDist;
- } else if (data.flickTarget <= maxExtent) {
+ } else if (data.flickTarget < maxExtent) {
overshootDist = overShootDistance(vSize);
data.flickTarget -= overshootDist;
}
@@ -3075,6 +3078,18 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch
: visibleItems.last()->endPosition()+spacing;
}
+ // Update the indexes of the following visible items.
+ for (int i = 0; i < visibleItems.count(); ++i) {
+ FxViewItem *item = visibleItems.at(i);
+ if (item->index != -1 && item->index >= modelIndex) {
+ item->index += count;
+ if (change.isMove())
+ item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::MoveTransition, false);
+ else
+ item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::AddTransition, false);
+ }
+ }
+
int prevVisibleCount = visibleItems.count();
if (insertResult->visiblePos.isValid() && pos < insertResult->visiblePos) {
// Insert items before the visible item.
@@ -3140,17 +3155,6 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch
}
}
- for (; index < visibleItems.count(); ++index) {
- FxViewItem *item = visibleItems.at(index);
- if (item->index != -1) {
- item->index += count;
- if (change.isMove())
- item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::MoveTransition, false);
- else
- item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::AddTransition, false);
- }
- }
-
updateVisibleIndex();
return visibleItems.count() > prevVisibleCount;
diff --git a/src/quick/items/qquicklistview_p.h b/src/quick/items/qquicklistview_p.h
index a02fba258e..bcb4e18751 100644
--- a/src/quick/items/qquicklistview_p.h
+++ b/src/quick/items/qquicklistview_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -126,7 +126,7 @@ public:
QQuickViewSection *sectionCriteria();
QString currentSection() const;
- virtual void setHighlightFollowsCurrentItem(bool);
+ void setHighlightFollowsCurrentItem(bool) Q_DECL_OVERRIDE;
qreal highlightMoveVelocity() const;
void setHighlightMoveVelocity(qreal);
@@ -137,7 +137,7 @@ public:
int highlightResizeDuration() const;
void setHighlightResizeDuration(int);
- virtual void setHighlightMoveDuration(int);
+ void setHighlightMoveDuration(int) Q_DECL_OVERRIDE;
enum SnapMode { NoSnap, SnapToItem, SnapOneItem };
SnapMode snapMode() const;
@@ -169,10 +169,10 @@ Q_SIGNALS:
Q_REVISION(2) void footerPositioningChanged();
protected:
- virtual void viewportMoved(Qt::Orientations orient);
- virtual void keyPressEvent(QKeyEvent *);
- virtual void geometryChanged(const QRectF &newGeometry,const QRectF &oldGeometry);
- virtual void initItem(int index, QObject *item);
+ void viewportMoved(Qt::Orientations orient) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
+ void geometryChanged(const QRectF &newGeometry,const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+ void initItem(int index, QObject *item) Q_DECL_OVERRIDE;
};
class QQuickListViewAttached : public QQuickItemViewAttached
diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp
index 906126b433..dd04568db2 100644
--- a/src/quick/items/qquickloader.cpp
+++ b/src/quick/items/qquickloader.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -217,7 +217,7 @@ qreal QQuickLoaderPrivate::getImplicitHeight() const
loads \c MyItem.qml, and is able to receive the \c message signal from
the loaded item through a \l Connections object:
- \table
+ \table 70%
\row
\li application.qml
\li MyItem.qml
@@ -263,7 +263,6 @@ qreal QQuickLoaderPrivate::getImplicitHeight() const
In some cases you may wish to use a Loader within a view delegate to improve delegate
loading performance. This works well in most cases, but there is one important issue to
- be aware of related to the \l{QtQml::Component#Creation Context}{creation context} of a Component.
In the following example, the \c index context property inserted by the ListView into \c delegateComponent's
context will be inaccessible to Text, as the Loader will use the creation context of \c myComponent as the parent
@@ -466,7 +465,7 @@ void QQuickLoader::setSourceComponent(QQmlComponent *comp)
d->component = comp;
if (comp) {
if (QQmlData *ddata = QQmlData::get(comp))
- d->componentStrongReference = ddata->jsWrapper.value();
+ d->componentStrongReference = ddata->jsWrapper;
}
d->loadingFromSource = false;
@@ -516,7 +515,7 @@ void QQuickLoader::loadFromSourceComponent()
is changed after calling this function but prior to setting the loader \l active.
Example:
- \table
+ \table 70%
\row
\li
\qml
@@ -545,11 +544,13 @@ void QQuickLoader::loadFromSourceComponent()
Item {
Loader {
id: squareLoader
- onLoaded: console.log(squareLoader.item.width); // prints [10], not [30]
+ onLoaded: console.log(squareLoader.item.width);
+ // prints [10], not [30]
}
Component.onCompleted: {
- squareLoader.setSource("ExampleComponent.qml", { "color": "blue" });
+ squareLoader.setSource("ExampleComponent.qml",
+ { "color": "blue" });
// will trigger the onLoaded code when complete.
}
}
@@ -574,8 +575,8 @@ void QQuickLoader::setSource(QQmlV4Function *args)
QUrl sourceUrl = d->resolveSourceUrl(args);
if (!ipv->isUndefined()) {
d->disposeInitialPropertyValues();
- d->initialPropertyValues = ipv.asReturnedValue();
- d->qmlGlobalForIpv = args->qmlGlobal();
+ d->initialPropertyValues.set(args->v4engine(), ipv);
+ d->qmlGlobalForIpv.set(args->v4engine(), args->qmlGlobal());
}
setSource(sourceUrl, false); // already cleared and set ipv above.
@@ -645,7 +646,7 @@ void QQuickLoaderPrivate::setInitialState(QObject *obj)
Q_ASSERT(v4);
QV4::Scope scope(v4);
QV4::ScopedValue ipv(scope, initialPropertyValues.value());
- d->initializeObjectWithInitialProperties(qmlGlobalForIpv, ipv, obj);
+ d->initializeObjectWithInitialProperties(*qmlGlobalForIpv.valueRef(), ipv, obj);
}
void QQuickLoaderIncubator::statusChanged(Status status)
@@ -951,7 +952,7 @@ QV4::ReturnedValue QQuickLoaderPrivate::extractInitialPropertyValues(QQmlV4Funct
}
}
- return valuemap.asReturnedValue();
+ return valuemap->asReturnedValue();
}
#include <moc_qquickloader_p.cpp>
diff --git a/src/quick/items/qquickloader_p.h b/src/quick/items/qquickloader_p.h
index 3e0cba5865..2c0e98de59 100644
--- a/src/quick/items/qquickloader_p.h
+++ b/src/quick/items/qquickloader_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -88,8 +88,8 @@ Q_SIGNALS:
void asynchronousChanged();
protected:
- void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
- void componentComplete();
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+ void componentComplete() Q_DECL_OVERRIDE;
private:
void setSource(const QUrl &sourceUrl, bool needsClear);
diff --git a/src/quick/items/qquickloader_p_p.h b/src/quick/items/qquickloader_p_p.h
index cae42a79ad..621419d1a7 100644
--- a/src/quick/items/qquickloader_p_p.h
+++ b/src/quick/items/qquickloader_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -62,8 +62,8 @@ public:
QQuickLoaderIncubator(QQuickLoaderPrivate *l, IncubationMode mode) : QQmlIncubator(mode), loader(l) {}
protected:
- virtual void statusChanged(Status);
- virtual void setInitialState(QObject *);
+ void statusChanged(Status) Q_DECL_OVERRIDE;
+ void setInitialState(QObject *) Q_DECL_OVERRIDE;
private:
QQuickLoaderPrivate *loader;
@@ -78,9 +78,9 @@ public:
QQuickLoaderPrivate();
~QQuickLoaderPrivate();
- void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry);
- void itemImplicitWidthChanged(QQuickItem *);
- void itemImplicitHeightChanged(QQuickItem *);
+ void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+ void itemImplicitWidthChanged(QQuickItem *) Q_DECL_OVERRIDE;
+ void itemImplicitHeightChanged(QQuickItem *) Q_DECL_OVERRIDE;
void clear();
void initResize();
void load();
@@ -91,8 +91,8 @@ public:
QUrl resolveSourceUrl(QQmlV4Function *args);
QV4::ReturnedValue extractInitialPropertyValues(QQmlV4Function *args, QObject *loader, bool *error);
- virtual qreal getImplicitWidth() const;
- virtual qreal getImplicitHeight() const;
+ qreal getImplicitWidth() const Q_DECL_OVERRIDE;
+ qreal getImplicitHeight() const Q_DECL_OVERRIDE;
QUrl source;
QQuickItem *item;
diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp
index df9ed1810d..4a44760035 100644
--- a/src/quick/items/qquickmousearea.cpp
+++ b/src/quick/items/qquickmousearea.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
DEFINE_BOOL_CONFIG_OPTION(qmlVisualTouchDebugging, QML_VISUAL_TOUCH_DEBUGGING)
QQuickMouseAreaPrivate::QQuickMouseAreaPrivate()
-: enabled(true), hovered(false), longPress(false),
+: enabled(true), scrollGestureEnabled(true), hovered(false), longPress(false),
moved(false), stealMouse(false), doubleClick(false), preventStealing(false),
propagateComposedEvents(false), pressed(0)
#ifndef QT_NO_DRAGANDDROP
@@ -497,6 +497,37 @@ void QQuickMouseArea::setEnabled(bool a)
}
/*!
+ \qmlproperty bool QtQuick::MouseArea::scrollGestureEnabled
+ \since 5.5
+
+ This property controls whether this MouseArea responds to scroll gestures
+ from non-mouse devices, such as the 2-finger flick gesture on a trackpad.
+ If set to false, the \l wheel signal be emitted only when the wheel event
+ comes from an actual mouse with a wheel, while scroll gesture events will
+ pass through to any other Item that will handle them. For example, the user
+ might perform a flick gesture while the cursor is over an item containing a
+ MouseArea, intending to interact with a Flickable which is underneath.
+ Setting this property to false will allow the PinchArea to handle the mouse
+ wheel or the pinch gesture, while the Flickable handles the flick gesture.
+
+ By default, this property is true.
+*/
+bool QQuickMouseArea::isScrollGestureEnabled() const
+{
+ Q_D(const QQuickMouseArea);
+ return d->scrollGestureEnabled;
+}
+
+void QQuickMouseArea::setScrollGestureEnabled(bool e)
+{
+ Q_D(QQuickMouseArea);
+ if (e != d->scrollGestureEnabled) {
+ d->scrollGestureEnabled = e;
+ emit scrollGestureEnabledChanged();
+ }
+}
+
+/*!
\qmlproperty bool QtQuick::MouseArea::preventStealing
This property holds whether the mouse events may be stolen from this
MouseArea.
@@ -646,7 +677,7 @@ void QQuickMouseArea::mousePressEvent(QMouseEvent *event)
#endif
setHovered(true);
d->startScene = event->windowPos();
- d->pressAndHoldTimer.start(qApp->styleHints()->mousePressAndHoldInterval(), this);
+ d->pressAndHoldTimer.start(QGuiApplication::styleHints()->mousePressAndHoldInterval(), this);
setKeepMouseGrab(d->stealMouse);
event->setAccepted(setPressed(event->button(), true));
}
@@ -821,7 +852,7 @@ void QQuickMouseArea::hoverLeaveEvent(QHoverEvent *event)
void QQuickMouseArea::wheelEvent(QWheelEvent *event)
{
Q_D(QQuickMouseArea);
- if (!d->enabled) {
+ if (!d->enabled || (!isScrollGestureEnabled() && event->source() != Qt::MouseEventNotSynthesized)) {
QQuickItem::wheelEvent(event);
return;
}
diff --git a/src/quick/items/qquickmousearea_p.h b/src/quick/items/qquickmousearea_p.h
index 8348a255d9..4ad14e6bdd 100644
--- a/src/quick/items/qquickmousearea_p.h
+++ b/src/quick/items/qquickmousearea_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -54,6 +54,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickMouseArea : public QQuickItem
Q_PROPERTY(bool containsMouse READ hovered NOTIFY hoveredChanged)
Q_PROPERTY(bool pressed READ pressed NOTIFY pressedChanged)
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
+ Q_PROPERTY(bool scrollGestureEnabled READ isScrollGestureEnabled WRITE setScrollGestureEnabled NOTIFY scrollGestureEnabledChanged REVISION 2)
Q_PROPERTY(Qt::MouseButtons pressedButtons READ pressedButtons NOTIFY pressedButtonsChanged)
Q_PROPERTY(Qt::MouseButtons acceptedButtons READ acceptedButtons WRITE setAcceptedButtons NOTIFY acceptedButtonsChanged)
Q_PROPERTY(bool hoverEnabled READ hoverEnabled WRITE setHoverEnabled NOTIFY hoverEnabledChanged)
@@ -77,6 +78,9 @@ public:
bool isEnabled() const;
void setEnabled(bool);
+ bool isScrollGestureEnabled() const;
+ void setScrollGestureEnabled(bool);
+
bool hovered() const;
bool pressed() const;
bool containsPress() const;
@@ -108,6 +112,7 @@ Q_SIGNALS:
void hoveredChanged();
void pressedChanged();
void enabledChanged();
+ Q_REVISION(2) void scrollGestureEnabledChanged();
void pressedButtonsChanged();
void acceptedButtonsChanged();
void hoverEnabledChanged();
diff --git a/src/quick/items/qquickmousearea_p_p.h b/src/quick/items/qquickmousearea_p_p.h
index 73db6ea36f..014729b651 100644
--- a/src/quick/items/qquickmousearea_p_p.h
+++ b/src/quick/items/qquickmousearea_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -78,6 +78,7 @@ public:
bool isWheelConnected();
bool enabled : 1;
+ bool scrollGestureEnabled : 1;
bool hovered : 1;
bool longPress : 1;
bool moved : 1;
diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp
index ac9135d4c0..e6b63d32f2 100644
--- a/src/quick/items/qquickmultipointtoucharea.cpp
+++ b/src/quick/items/qquickmultipointtoucharea.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -38,7 +38,6 @@
#include <private/qguiapplication_p.h>
#include <QEvent>
#include <QMouseEvent>
-#include <math.h>
#include <QDebug>
#include <qpa/qplatformnativeinterface.h>
@@ -556,7 +555,7 @@ void QQuickMultiPointTouchArea::updateTouchData(QEvent *event)
//see if we should be grabbing the gesture
if (!_stealMouse /* !ignoring gesture*/) {
bool offerGrab = false;
- const int dragThreshold = qApp->styleHints()->startDragDistance();
+ const int dragThreshold = QGuiApplication::styleHints()->startDragDistance();
foreach (const QTouchEvent::TouchPoint &p, touchPoints) {
if (p.state() == Qt::TouchPointReleased)
continue;
diff --git a/src/quick/items/qquickmultipointtoucharea_p.h b/src/quick/items/qquickmultipointtoucharea_p.h
index 6d3e607d08..e5c547da81 100644
--- a/src/quick/items/qquickmultipointtoucharea_p.h
+++ b/src/quick/items/qquickmultipointtoucharea_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -160,7 +160,7 @@ class QQuickGrabGestureEvent : public QObject
Q_PROPERTY(QQmlListProperty<QObject> touchPoints READ touchPoints)
Q_PROPERTY(qreal dragThreshold READ dragThreshold)
public:
- QQuickGrabGestureEvent() : _grab(false), _dragThreshold(qApp->styleHints()->startDragDistance()) {}
+ QQuickGrabGestureEvent() : _grab(false), _dragThreshold(QGuiApplication::styleHints()->startDragDistance()) {}
Q_INVOKABLE void grab() { _grab = true; }
bool wantsGrab() const { return _grab; }
@@ -228,13 +228,13 @@ Q_SIGNALS:
void mouseEnabledChanged();
protected:
- void touchEvent(QTouchEvent *);
- bool childMouseEventFilter(QQuickItem *i, QEvent *event);
- void mousePressEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
- void mouseUngrabEvent();
- void touchUngrabEvent();
+ void touchEvent(QTouchEvent *) Q_DECL_OVERRIDE;
+ bool childMouseEventFilter(QQuickItem *i, QEvent *event) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseUngrabEvent() Q_DECL_OVERRIDE;
+ void touchUngrabEvent() Q_DECL_OVERRIDE;
void addTouchPrototype(QQuickTouchPoint* prototype);
void addTouchPoint(const QTouchEvent::TouchPoint *p);
@@ -248,10 +248,10 @@ protected:
bool sendMouseEvent(QMouseEvent *event);
bool shouldFilter(QEvent *event);
void grabGesture();
- virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
+ QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
#ifdef Q_OS_OSX
- void hoverEnterEvent(QHoverEvent *event);
- void hoverLeaveEvent(QHoverEvent *event);
+ void hoverEnterEvent(QHoverEvent *event) Q_DECL_OVERRIDE;
+ void hoverLeaveEvent(QHoverEvent *event) Q_DECL_OVERRIDE;
void setTouchEventsEnabled(bool enable);
#endif
diff --git a/src/quick/items/qquickopenglinfo.cpp b/src/quick/items/qquickopenglinfo.cpp
index 65328331a9..29f81061db 100644
--- a/src/quick/items/qquickopenglinfo.cpp
+++ b/src/quick/items/qquickopenglinfo.cpp
@@ -1,8 +1,8 @@
/****************************************************************************
**
** Copyright (C) 2014 BlackBerry Ltd.
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -11,9 +11,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -24,8 +24,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickopenglinfo_p.h b/src/quick/items/qquickopenglinfo_p.h
index 71b1eea08a..2a2e2a719b 100644
--- a/src/quick/items/qquickopenglinfo_p.h
+++ b/src/quick/items/qquickopenglinfo_p.h
@@ -1,8 +1,8 @@
/****************************************************************************
**
** Copyright (C) 2014 BlackBerry Ltd.
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -11,9 +11,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -24,8 +24,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickpainteditem.cpp b/src/quick/items/qquickpainteditem.cpp
index a79f0b523c..b3e4906c41 100644
--- a/src/quick/items/qquickpainteditem.cpp
+++ b/src/quick/items/qquickpainteditem.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickpainteditem.h b/src/quick/items/qquickpainteditem.h
index b5e04694bf..356e4a46f6 100644
--- a/src/quick/items/qquickpainteditem.h
+++ b/src/quick/items/qquickpainteditem.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -107,7 +107,7 @@ Q_SIGNALS:
protected:
QQuickPaintedItem(QQuickPaintedItemPrivate &dd, QQuickItem *parent = 0);
- virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
+ QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
void releaseResources() Q_DECL_OVERRIDE;
private Q_SLOTS:
diff --git a/src/quick/items/qquickpainteditem_p.h b/src/quick/items/qquickpainteditem_p.h
index f7da2f49b0..3712e964f8 100644
--- a/src/quick/items/qquickpainteditem_p.h
+++ b/src/quick/items/qquickpainteditem_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp
index 6cf3e33de9..58605f79dd 100644
--- a/src/quick/items/qquickpathview.cpp
+++ b/src/quick/items/qquickpathview.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -35,6 +35,7 @@
#include "qquickpathview_p_p.h"
#include "qquickwindow.h"
#include "qquickflickablebehavior_p.h" //Contains flicking behavior defines
+#include "qquicktext_p.h"
#include <QtQuick/private/qquickstate_p.h>
#include <private/qqmlglobal_p.h>
@@ -47,21 +48,19 @@
#include <QtGui/qguiapplication.h>
#include <QtGui/qstylehints.h>
#include <QtCore/qmath.h>
-#include <math.h>
+#include <cmath>
QT_BEGIN_NAMESPACE
+Q_DECLARE_LOGGING_CATEGORY(lcItemViewDelegateLifecycle)
+
const qreal MinimumFlickVelocity = 75.0;
inline qreal qmlMod(qreal x, qreal y)
{
-#ifdef QT_USE_MATH_H_FLOATS
- if (sizeof(qreal) == sizeof(float))
- return fmodf(float(x), float(y));
- else
-#endif
- return fmod(x, y);
+ using std::fmod;
+ return fmod(x, y);
}
static QQmlOpenMetaObjectType *qPathViewAttachedType = 0;
@@ -198,6 +197,7 @@ void QQuickPathViewPrivate::releaseItem(QQuickItem *item)
{
if (!item || !model)
return;
+ qCDebug(lcItemViewDelegateLifecycle) << "release" << item;
QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
itemPrivate->removeItemChangeListener(this, QQuickItemPrivate::Geometry);
QQmlInstanceModel::ReleaseFlags flags = model->release(item);
@@ -828,9 +828,11 @@ void QQuickPathViewPrivate::setOffset(qreal o)
Q_Q(QQuickPathView);
if (offset != o) {
if (isValid() && q->isComponentComplete()) {
+ qreal oldOffset = offset;
offset = qmlMod(o, qreal(modelCount));
if (offset < 0)
offset += qreal(modelCount);
+ qCDebug(lcItemViewDelegateLifecycle) << o << "was" << oldOffset << "now" << offset;
q->refill();
} else {
offset = o;
@@ -1640,8 +1642,9 @@ void QQuickPathViewPrivate::handleMouseMoveEvent(QMouseEvent *event)
// then we'll assume that this gesture targets the PathView. This ensures PathView gesture grabbing
// is in sync with other items.
QPointF pathDelta = pathPoint - startPoint;
- if (qAbs(pathDelta.x()) > qApp->styleHints()->startDragDistance() * 0.8
- || qAbs(pathDelta.y()) > qApp->styleHints()->startDragDistance() * 0.8) {
+ const int startDragDistance = QGuiApplication::styleHints()->startDragDistance();
+ if (qAbs(pathDelta.x()) > startDragDistance * 0.8
+ || qAbs(pathDelta.y()) > startDragDistance * 0.8) {
stealMouse = true;
q->setKeepMouseGrab(true);
}
@@ -1790,7 +1793,7 @@ bool QQuickPathView::sendMouseEvent(QMouseEvent *event)
default:
break;
}
- grabber = c->mouseGrabberItem();
+ grabber = c ? c->mouseGrabberItem() : 0;
if ((grabber && stealThisEvent && !grabber->keepMouseGrab() && grabber != this) || grabberDisabled) {
grabMouse();
}
@@ -1894,10 +1897,18 @@ void QQuickPathView::refill()
// first move existing items and remove items off path
int idx = d->firstIndex;
+ qCDebug(lcItemViewDelegateLifecycle) << "firstIndex" << idx << "currentIndex" << d->currentIndex << "offset" << d->offset;
QList<QQuickItem*>::iterator it = d->items.begin();
while (it != d->items.end()) {
qreal pos = d->positionOfIndex(idx);
QQuickItem *item = *it;
+ if (lcItemViewDelegateLifecycle().isDebugEnabled()) {
+ QQuickText *text = qmlobject_cast<QQuickText*>(item);
+ if (text)
+ qCDebug(lcItemViewDelegateLifecycle) << "idx" << idx << "@" << pos << ": QQuickText" << text->objectName() << text->text().left(40);
+ else
+ qCDebug(lcItemViewDelegateLifecycle) << "idx" << idx << "@" << pos << ":" << item;
+ }
if (pos < 1.0) {
d->updateItem(item, pos);
if (idx == d->currentIndex) {
@@ -1910,7 +1921,7 @@ void QQuickPathView::refill()
if (QQuickPathViewAttached *att = d->attached(item))
att->setOnPath(pos < 1.0);
if (!d->isInBound(pos, d->mappedRange - d->mappedCache, 1.0 + d->mappedCache)) {
-// qDebug() << "release";
+ qCDebug(lcItemViewDelegateLifecycle) << "release" << idx << "@" << pos << ", !isInBound: lower" << (d->mappedRange - d->mappedCache) << "upper" << (1.0 + d->mappedCache);
d->releaseItem(item);
if (it == d->items.begin()) {
if (++d->firstIndex >= d->modelCount) {
@@ -1945,7 +1956,7 @@ void QQuickPathView::refill()
}
qreal pos = d->positionOfIndex(idx);
while ((d->isInBound(pos, startPos, 1.0 + d->mappedCache) || !d->items.count()) && d->items.count() < count+d->cacheSize) {
-// qDebug() << "append" << idx;
+ qCDebug(lcItemViewDelegateLifecycle) << "append" << idx << "@" << pos << (d->currentIndex == idx ? "current" : "") << "items count was" << d->items.count();
QQuickItem *item = d->getItem(idx, idx+1, pos >= 1.0);
if (!item) {
waiting = true;
@@ -1970,7 +1981,7 @@ void QQuickPathView::refill()
idx = d->modelCount - 1;
pos = d->positionOfIndex(idx);
while (!waiting && d->isInBound(pos, d->mappedRange - d->mappedCache, startPos) && d->items.count() < count+d->cacheSize) {
-// qDebug() << "prepend" << idx;
+ qCDebug(lcItemViewDelegateLifecycle) << "prepend" << idx << "@" << pos << (d->currentIndex == idx ? "current" : "") << "items count was" << d->items.count();
QQuickItem *item = d->getItem(idx, idx+1, pos >= 1.0);
if (!item) {
waiting = true;
diff --git a/src/quick/items/qquickpathview_p.h b/src/quick/items/qquickpathview_p.h
index 74ee4908b2..8062e07795 100644
--- a/src/quick/items/qquickpathview_p.h
+++ b/src/quick/items/qquickpathview_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -193,14 +193,14 @@ Q_SIGNALS:
void cacheItemCountChanged();
protected:
- virtual void updatePolish();
- void mousePressEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *);
+ void updatePolish() Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
bool sendMouseEvent(QMouseEvent *event);
- bool childMouseEventFilter(QQuickItem *, QEvent *);
- void mouseUngrabEvent();
- void componentComplete();
+ bool childMouseEventFilter(QQuickItem *, QEvent *) Q_DECL_OVERRIDE;
+ void mouseUngrabEvent() Q_DECL_OVERRIDE;
+ void componentComplete() Q_DECL_OVERRIDE;
private Q_SLOTS:
void refill();
diff --git a/src/quick/items/qquickpathview_p_p.h b/src/quick/items/qquickpathview_p_p.h
index cd52dd10bb..35ea8616a5 100644
--- a/src/quick/items/qquickpathview_p_p.h
+++ b/src/quick/items/qquickpathview_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -69,7 +69,7 @@ public:
void init();
- void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) {
+ void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE {
if ((newGeometry.size() != oldGeometry.size())
&& (!highlightItem || item != highlightItem)) {
if (QQuickPathViewAttached *att = attached(item))
diff --git a/src/quick/items/qquickpincharea.cpp b/src/quick/items/qquickpincharea.cpp
index 7e934316d8..07bf268309 100644
--- a/src/quick/items/qquickpincharea.cpp
+++ b/src/quick/items/qquickpincharea.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSG module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -34,13 +34,16 @@
#include "qquickpincharea_p_p.h"
#include "qquickwindow.h"
+#include <QtCore/qmath.h>
#include <QtGui/qevent.h>
#include <QtGui/qguiapplication.h>
#include <QtGui/qstylehints.h>
+#include <qpa/qplatformintegration.h>
#include <qpa/qplatformnativeinterface.h>
+#include <private/qguiapplication_p.h>
+#include <QVariant>
#include <float.h>
-#include <math.h>
QT_BEGIN_NAMESPACE
@@ -178,7 +181,10 @@ QQuickPinchAreaPrivate::~QQuickPinchAreaPrivate()
\li using the onPinchStarted, onPinchUpdated and onPinchFinished handlers
\endlist
- \sa PinchEvent
+ Since Qt 5.5, PinchArea can react to native pinch gesture events from the
+ operating system if available; otherwise it reacts only to touch events.
+
+ \sa PinchEvent, QNativeGestureEvent, QTouchEvent
*/
/*!
@@ -228,6 +234,22 @@ QQuickPinchAreaPrivate::~QQuickPinchAreaPrivate()
The corresponding handler is \c onPinchFinished.
*/
+/*!
+ \qmlsignal QtQuick::PinchArea::smartZoom()
+ \since 5.5
+
+ This signal is emitted when the pinch area detects the smart zoom gesture.
+ This gesture occurs only on certain operating systems such as OS X.
+
+ The \l {PinchEvent}{pinch} parameter provides information about the pinch
+ gesture, including the location where the gesture occurred. \c pinch.scale
+ will be greater than zero when the gesture indicates that the user wishes to
+ enter smart zoom, and zero when exiting (even though typically the same gesture
+ is used to toggle between the two states).
+
+ The corresponding handler is \c onSmartZoom.
+*/
+
/*!
\qmlpropertygroup QtQuick::PinchArea::pinch
@@ -324,8 +346,11 @@ void QQuickPinchArea::touchEvent(QTouchEvent *event)
case QEvent::TouchEnd:
clearPinch();
break;
+ case QEvent::TouchCancel:
+ cancelPinch();
+ break;
default:
- QQuickItem::event(event);
+ QQuickItem::touchEvent(event);
}
}
@@ -362,6 +387,47 @@ void QQuickPinchArea::clearPinch()
setKeepMouseGrab(false);
}
+void QQuickPinchArea::cancelPinch()
+{
+ Q_D(QQuickPinchArea);
+
+ d->touchPoints.clear();
+ if (d->inPinch) {
+ d->inPinch = false;
+ QPointF pinchCenter = mapFromScene(d->sceneLastCenter);
+ QQuickPinchEvent pe(d->pinchStartCenter, d->pinchStartScale, d->pinchStartAngle, d->pinchStartRotation);
+ pe.setStartCenter(d->pinchStartCenter);
+ pe.setPreviousCenter(pinchCenter);
+ pe.setPreviousAngle(d->pinchLastAngle);
+ pe.setPreviousScale(d->pinchLastScale);
+ pe.setStartPoint1(mapFromScene(d->sceneStartPoint1));
+ pe.setStartPoint2(mapFromScene(d->sceneStartPoint2));
+ pe.setPoint1(pe.startPoint1());
+ pe.setPoint2(pe.startPoint2());
+ emit pinchFinished(&pe);
+
+ d->pinchLastScale = d->pinchStartScale;
+ d->sceneLastCenter = d->sceneStartCenter;
+ d->pinchLastAngle = d->pinchStartAngle;
+ d->lastPoint1 = pe.startPoint1();
+ d->lastPoint2 = pe.startPoint2();
+ updatePinchTarget();
+
+ if (d->pinch && d->pinch->target())
+ d->pinch->setActive(false);
+ }
+ d->pinchStartDist = 0;
+ d->pinchActivated = false;
+ d->initPinch = false;
+ d->pinchRejected = false;
+ d->stealMouse = false;
+ d->id1 = -1;
+ QQuickWindow *win = window();
+ if (win && win->mouseGrabberItem() == this)
+ ungrabMouse();
+ setKeepMouseGrab(false);
+}
+
void QQuickPinchArea::updatePinch()
{
Q_D(QQuickPinchArea);
@@ -428,12 +494,12 @@ void QQuickPinchArea::updatePinch()
}
}
if (d->pinchActivated && !d->pinchRejected) {
- const int dragThreshold = qApp->styleHints()->startDragDistance();
+ const int dragThreshold = QGuiApplication::styleHints()->startDragDistance();
QPointF p1 = touchPoint1.scenePos();
QPointF p2 = touchPoint2.scenePos();
qreal dx = p1.x() - p2.x();
qreal dy = p1.y() - p2.y();
- qreal dist = sqrt(dx*dx + dy*dy);
+ qreal dist = qSqrt(dx*dx + dy*dy);
QPointF sceneCenter = (p1 + p2)/2;
qreal angle = QLineF(p1, p2).angle();
if (d->touchPoints.count() == 1) {
@@ -526,34 +592,40 @@ void QQuickPinchArea::updatePinch()
d->lastPoint1 = touchPoint1.scenePos();
d->lastPoint2 = touchPoint2.scenePos();
emit pinchUpdated(&pe);
- if (d->pinch && d->pinch->target()) {
- qreal s = d->pinchStartScale * scale;
- s = qMin(qMax(pinch()->minimumScale(),s), pinch()->maximumScale());
- pinch()->target()->setScale(s);
- QPointF pos = sceneCenter - d->sceneStartCenter + d->pinchStartPos;
- if (pinch()->axis() & QQuickPinch::XAxis) {
- qreal x = pos.x();
- if (x < pinch()->xmin())
- x = pinch()->xmin();
- else if (x > pinch()->xmax())
- x = pinch()->xmax();
- pinch()->target()->setX(x);
- }
- if (pinch()->axis() & QQuickPinch::YAxis) {
- qreal y = pos.y();
- if (y < pinch()->ymin())
- y = pinch()->ymin();
- else if (y > pinch()->ymax())
- y = pinch()->ymax();
- pinch()->target()->setY(y);
- }
- if (d->pinchStartRotation >= pinch()->minimumRotation()
- && d->pinchStartRotation <= pinch()->maximumRotation()) {
- qreal r = d->pinchRotation + d->pinchStartRotation;
- r = qMin(qMax(pinch()->minimumRotation(),r), pinch()->maximumRotation());
- pinch()->target()->setRotation(r);
- }
- }
+ updatePinchTarget();
+ }
+ }
+}
+
+void QQuickPinchArea::updatePinchTarget()
+{
+ Q_D(QQuickPinchArea);
+ if (d->pinch && d->pinch->target()) {
+ qreal s = d->pinchStartScale * d->pinchLastScale;
+ s = qMin(qMax(pinch()->minimumScale(),s), pinch()->maximumScale());
+ pinch()->target()->setScale(s);
+ QPointF pos = d->sceneLastCenter - d->sceneStartCenter + d->pinchStartPos;
+ if (pinch()->axis() & QQuickPinch::XAxis) {
+ qreal x = pos.x();
+ if (x < pinch()->xmin())
+ x = pinch()->xmin();
+ else if (x > pinch()->xmax())
+ x = pinch()->xmax();
+ pinch()->target()->setX(x);
+ }
+ if (pinch()->axis() & QQuickPinch::YAxis) {
+ qreal y = pos.y();
+ if (y < pinch()->ymin())
+ y = pinch()->ymin();
+ else if (y > pinch()->ymax())
+ y = pinch()->ymax();
+ pinch()->target()->setY(y);
+ }
+ if (d->pinchStartRotation >= pinch()->minimumRotation()
+ && d->pinchStartRotation <= pinch()->maximumRotation()) {
+ qreal r = d->pinchRotation + d->pinchStartRotation;
+ r = qMin(qMax(pinch()->minimumRotation(),r), pinch()->maximumRotation());
+ pinch()->target()->setRotation(r);
}
}
}
@@ -597,31 +669,116 @@ void QQuickPinchArea::itemChange(ItemChange change, const ItemChangeData &value)
QQuickItem::itemChange(change, value);
}
-#ifdef Q_OS_OSX
-void QQuickPinchArea::hoverEnterEvent(QHoverEvent *event)
+bool QQuickPinchArea::event(QEvent *event)
{
- Q_UNUSED(event);
- setTouchEventsEnabled(true);
-}
+ Q_D(QQuickPinchArea);
+ if (!d->enabled || !isVisible())
+ return QQuickItem::event(event);
-void QQuickPinchArea::hoverLeaveEvent(QHoverEvent *event)
-{
- Q_UNUSED(event);
- setTouchEventsEnabled(false);
-}
+ switch (event->type()) {
+#ifndef QT_NO_GESTURES
+ case QEvent::NativeGesture: {
+ QNativeGestureEvent *gesture = static_cast<QNativeGestureEvent *>(event);
+ switch (gesture->gestureType()) {
+ case Qt::BeginNativeGesture:
+ clearPinch(); // probably not necessary; JIC
+ d->pinchStartCenter = gesture->localPos();
+ d->pinchStartAngle = 0.0;
+ d->pinchStartRotation = 0.0;
+ d->pinchRotation = 0.0;
+ d->pinchStartScale = 1.0;
+ d->pinchLastAngle = 0.0;
+ d->pinchLastScale = 1.0;
+ d->sceneStartPoint1 = gesture->windowPos();
+ d->sceneStartPoint2 = gesture->windowPos(); // TODO we never really know
+ d->lastPoint1 = gesture->windowPos();
+ d->lastPoint2 = gesture->windowPos(); // TODO we never really know
+ if (d->pinch && d->pinch->target()) {
+ d->pinchStartPos = d->pinch->target()->position();
+ d->pinchStartScale = d->pinch->target()->scale();
+ d->pinchStartRotation = d->pinch->target()->rotation();
+ d->pinch->setActive(true);
+ }
+ break;
+ case Qt::EndNativeGesture:
+ clearPinch();
+ break;
+ case Qt::ZoomNativeGesture: {
+ qreal scale = d->pinchLastScale * (1.0 + gesture->value());
+ QQuickPinchEvent pe(d->pinchStartCenter, scale, d->pinchLastAngle, 0.0);
+ pe.setStartCenter(d->pinchStartCenter);
+ pe.setPreviousCenter(d->pinchStartCenter);
+ pe.setPreviousAngle(d->pinchLastAngle);
+ pe.setPreviousScale(d->pinchLastScale);
+ pe.setStartPoint1(mapFromScene(d->sceneStartPoint1));
+ pe.setStartPoint2(mapFromScene(d->sceneStartPoint2));
+ pe.setPoint1(mapFromScene(d->lastPoint1));
+ pe.setPoint2(mapFromScene(d->lastPoint2));
+ pe.setPointCount(2);
+ d->pinchLastScale = scale;
+ if (d->inPinch)
+ emit pinchUpdated(&pe);
+ else
+ emit pinchStarted(&pe);
+ d->inPinch = true;
+ updatePinchTarget();
+ } break;
+ case Qt::SmartZoomNativeGesture: {
+ if (gesture->value() > 0.0 && d->pinch && d->pinch->target()) {
+ d->pinchStartPos = pinch()->target()->position();
+ d->pinchStartCenter = mapToItem(pinch()->target()->parentItem(), pinch()->target()->boundingRect().center());
+ d->pinchStartScale = d->pinch->target()->scale();
+ d->pinchStartRotation = d->pinch->target()->rotation();
+ d->pinchLastScale = d->pinchStartScale = d->pinch->target()->scale();
+ d->pinchLastAngle = d->pinchStartRotation = d->pinch->target()->rotation();
+ }
+ QQuickPinchEvent pe(gesture->localPos(), gesture->value(), d->pinchLastAngle, 0.0);
+ pe.setStartCenter(gesture->localPos());
+ pe.setPreviousCenter(d->pinchStartCenter);
+ pe.setPreviousAngle(d->pinchLastAngle);
+ pe.setPreviousScale(d->pinchLastScale);
+ pe.setStartPoint1(gesture->localPos());
+ pe.setStartPoint2(gesture->localPos());
+ pe.setPoint1(mapFromScene(gesture->windowPos()));
+ pe.setPoint2(mapFromScene(gesture->windowPos()));
+ pe.setPointCount(2);
+ emit smartZoom(&pe);
+ } break;
+ case Qt::RotateNativeGesture: {
+ qreal angle = d->pinchLastAngle + gesture->value();
+ QQuickPinchEvent pe(d->pinchStartCenter, d->pinchLastScale, angle, 0.0);
+ pe.setStartCenter(d->pinchStartCenter);
+ pe.setPreviousCenter(d->pinchStartCenter);
+ pe.setPreviousAngle(d->pinchLastAngle);
+ pe.setPreviousScale(d->pinchLastScale);
+ pe.setStartPoint1(mapFromScene(d->sceneStartPoint1));
+ pe.setStartPoint2(mapFromScene(d->sceneStartPoint2));
+ pe.setPoint1(mapFromScene(d->lastPoint1));
+ pe.setPoint2(mapFromScene(d->lastPoint2));
+ pe.setPointCount(2);
+ d->pinchLastAngle = angle;
+ if (d->inPinch)
+ emit pinchUpdated(&pe);
+ else
+ emit pinchStarted(&pe);
+ d->inPinch = true;
+ d->pinchRotation = angle;
+ updatePinchTarget();
+ } break;
+#endif // QT_NO_GESTURES
+ default:
+ return QQuickItem::event(event);
+ }
+ } break;
+ case QEvent::Wheel:
+ event->ignore();
+ return false;
+ default:
+ return QQuickItem::event(event);
+ }
-void QQuickPinchArea::setTouchEventsEnabled(bool enable)
-{
- // Resolve function for enabling touch events from the (cocoa) platform plugin.
- typedef void (*RegisterTouchWindowFunction)(QWindow *, bool);
- RegisterTouchWindowFunction registerTouchWindow = reinterpret_cast<RegisterTouchWindowFunction>(
- QGuiApplication::platformNativeInterface()->nativeResourceFunctionForIntegration("registertouchwindow"));
- if (!registerTouchWindow)
- return; // Not necessarily an error, Qt might be using a different platform plugin.
-
- registerTouchWindow(window(), enable);
+ return true;
}
-#endif // Q_OS_OSX
QQuickPinch *QQuickPinchArea::pinch()
{
diff --git a/src/quick/items/qquickpincharea_p.h b/src/quick/items/qquickpincharea_p.h
index b82db035e5..d2de59b5d6 100644
--- a/src/quick/items/qquickpincharea_p.h
+++ b/src/quick/items/qquickpincharea_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSG module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -266,23 +266,22 @@ Q_SIGNALS:
void pinchStarted(QQuickPinchEvent *pinch);
void pinchUpdated(QQuickPinchEvent *pinch);
void pinchFinished(QQuickPinchEvent *pinch);
+ Q_REVISION(1) void smartZoom(QQuickPinchEvent *pinch);
protected:
- virtual bool childMouseEventFilter(QQuickItem *i, QEvent *e);
- virtual void touchEvent(QTouchEvent *event);
-
- virtual void geometryChanged(const QRectF &newGeometry,
- const QRectF &oldGeometry);
- virtual void itemChange(ItemChange change, const ItemChangeData& value);
-#ifdef Q_OS_OSX
- void hoverEnterEvent(QHoverEvent *event);
- void hoverLeaveEvent(QHoverEvent *event);
- void setTouchEventsEnabled(bool enable);
-#endif
+ bool childMouseEventFilter(QQuickItem *i, QEvent *e) Q_DECL_OVERRIDE;
+ void touchEvent(QTouchEvent *event) Q_DECL_OVERRIDE;
+
+ void geometryChanged(const QRectF &newGeometry,
+ const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+ void itemChange(ItemChange change, const ItemChangeData& value) Q_DECL_OVERRIDE;
+ bool event(QEvent *) Q_DECL_OVERRIDE;
private:
void clearPinch();
+ void cancelPinch();
void updatePinch();
+ void updatePinchTarget();
void handlePress();
void handleRelease();
diff --git a/src/quick/items/qquickpincharea_p_p.h b/src/quick/items/qquickpincharea_p_p.h
index 14e8b82718..41ecdb998b 100644
--- a/src/quick/items/qquickpincharea_p_p.h
+++ b/src/quick/items/qquickpincharea_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtSG module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickpositioners.cpp b/src/quick/items/qquickpositioners.cpp
index 627b2e4952..887d317069 100644
--- a/src/quick/items/qquickpositioners.cpp
+++ b/src/quick/items/qquickpositioners.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -36,7 +36,6 @@
#include <QtQml/qqml.h>
#include <QtQml/qqmlinfo.h>
-#include <QtCore/qmath.h>
#include <QtCore/qcoreapplication.h>
#include <QtQuick/private/qquickstate_p.h>
diff --git a/src/quick/items/qquickpositioners_p.h b/src/quick/items/qquickpositioners_p.h
index 7df4ee3b9a..ea779695eb 100644
--- a/src/quick/items/qquickpositioners_p.h
+++ b/src/quick/items/qquickpositioners_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -110,10 +110,10 @@ public:
protected:
QQuickBasePositioner(QQuickBasePositionerPrivate &dd, PositionerType at, QQuickItem *parent);
- virtual void componentComplete();
- virtual void itemChange(ItemChange, const ItemChangeData &);
+ void componentComplete() Q_DECL_OVERRIDE;
+ void itemChange(ItemChange, const ItemChangeData &) Q_DECL_OVERRIDE;
- virtual void updatePolish();
+ void updatePolish() Q_DECL_OVERRIDE;
Q_SIGNALS:
void spacingChanged();
@@ -173,8 +173,8 @@ public:
QQuickColumn(QQuickItem *parent=0);
protected:
- virtual void doPositioning(QSizeF *contentSize);
- virtual void reportConflictingAnchors();
+ void doPositioning(QSizeF *contentSize) Q_DECL_OVERRIDE;
+ void reportConflictingAnchors() Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QQuickColumn)
};
@@ -197,8 +197,8 @@ Q_SIGNALS:
void effectiveLayoutDirectionChanged();
protected:
- virtual void doPositioning(QSizeF *contentSize);
- virtual void reportConflictingAnchors();
+ void doPositioning(QSizeF *contentSize) Q_DECL_OVERRIDE;
+ void reportConflictingAnchors() Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QQuickRow)
Q_DECLARE_PRIVATE(QQuickRow)
@@ -274,8 +274,8 @@ Q_SIGNALS:
Q_REVISION(1) void verticalAlignmentChanged(VAlignment alignment);
protected:
- virtual void doPositioning(QSizeF *contentSize);
- virtual void reportConflictingAnchors();
+ void doPositioning(QSizeF *contentSize) Q_DECL_OVERRIDE;
+ void reportConflictingAnchors() Q_DECL_OVERRIDE;
private:
int m_rows;
@@ -316,8 +316,8 @@ Q_SIGNALS:
void effectiveLayoutDirectionChanged();
protected:
- virtual void doPositioning(QSizeF *contentSize);
- virtual void reportConflictingAnchors();
+ void doPositioning(QSizeF *contentSize) Q_DECL_OVERRIDE;
+ void reportConflictingAnchors() Q_DECL_OVERRIDE;
protected:
QQuickFlow(QQuickFlowPrivate &dd, QQuickItem *parent);
private:
diff --git a/src/quick/items/qquickpositioners_p_p.h b/src/quick/items/qquickpositioners_p_p.h
index e77997d4e9..3a8fe20351 100644
--- a/src/quick/items/qquickpositioners_p_p.h
+++ b/src/quick/items/qquickpositioners_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -98,7 +98,7 @@ public:
Qt::LayoutDirection layoutDirection;
- void mirrorChange() {
+ void mirrorChange() Q_DECL_OVERRIDE {
effectiveLayoutDirectionChange();
}
bool isLeftToRight() const {
@@ -108,24 +108,24 @@ public:
return effectiveLayoutMirror ? layoutDirection == Qt::RightToLeft : layoutDirection == Qt::LeftToRight;
}
- virtual void itemSiblingOrderChanged(QQuickItem* other)
+ void itemSiblingOrderChanged(QQuickItem* other) Q_DECL_OVERRIDE
{
Q_UNUSED(other);
setPositioningDirty();
}
- void itemGeometryChanged(QQuickItem *, const QRectF &newGeometry, const QRectF &oldGeometry)
+ void itemGeometryChanged(QQuickItem *, const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE
{
if (newGeometry.size() != oldGeometry.size())
setPositioningDirty();
}
- virtual void itemVisibilityChanged(QQuickItem *)
+ void itemVisibilityChanged(QQuickItem *) Q_DECL_OVERRIDE
{
setPositioningDirty();
}
- void itemDestroyed(QQuickItem *item)
+ void itemDestroyed(QQuickItem *item) Q_DECL_OVERRIDE
{
Q_Q(QQuickBasePositioner);
int index = q->positionedItems.find(QQuickBasePositioner::PositionedItem(item));
diff --git a/src/quick/items/qquickrectangle.cpp b/src/quick/items/qquickrectangle.cpp
index fd48f6abb9..eb17187ad5 100644
--- a/src/quick/items/qquickrectangle.cpp
+++ b/src/quick/items/qquickrectangle.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickrectangle_p.h b/src/quick/items/qquickrectangle_p.h
index 2e9eabd1d5..8a00dbaf92 100644
--- a/src/quick/items/qquickrectangle_p.h
+++ b/src/quick/items/qquickrectangle_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -153,7 +153,7 @@ Q_SIGNALS:
void radiusChanged();
protected:
- virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
+ QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
private Q_SLOTS:
void doUpdate();
diff --git a/src/quick/items/qquickrectangle_p_p.h b/src/quick/items/qquickrectangle_p_p.h
index 51cf1afad4..30d38a0a10 100644
--- a/src/quick/items/qquickrectangle_p_p.h
+++ b/src/quick/items/qquickrectangle_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickrendercontrol.cpp b/src/quick/items/qquickrendercontrol.cpp
index a666bb59c9..fd4787be98 100644
--- a/src/quick/items/qquickrendercontrol.cpp
+++ b/src/quick/items/qquickrendercontrol.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -36,7 +36,7 @@
#include <QtCore/QCoreApplication>
#include <QtCore/QTime>
-#include <QtCore/private/qabstractanimation_p.h>
+#include <QtQuick/private/qquickanimatorcontroller_p.h>
#include <QtGui/QOpenGLContext>
#include <QtGui/private/qguiapplication_p.h>
@@ -170,6 +170,20 @@ void QQuickRenderControlPrivate::windowDestroyed()
}
/*!
+ Prepares rendering the Qt Quick scene outside the gui thread.
+
+ \a targetThread specifies the thread on which synchronization and
+ rendering will happen. There is no need to call this function in a
+ single threaded scenario.
+ */
+void QQuickRenderControl::prepareThread(QThread *targetThread)
+{
+ Q_D(QQuickRenderControl);
+ d->rc->moveToThread(targetThread);
+ QQuickWindowPrivate::get(d->window)->animationController->moveToThread(targetThread);
+}
+
+/*!
Initializes the scene graph resources. The context \a gl has to
be the current context.
@@ -353,6 +367,11 @@ void QQuickRenderControlPrivate::maybeUpdate()
If \a offset in non-null, it is set to the offset of the control
inside the window.
+
+ \note While not mandatory, reimplementing this function becomes essential for
+ supporting multiple screens with different device pixel ratios and properly positioning
+ popup windows opened from QML. Therefore providing it in subclasses is highly
+ recommended.
*/
/*!
diff --git a/src/quick/items/qquickrendercontrol.h b/src/quick/items/qquickrendercontrol.h
index e6903653c2..ff80acf766 100644
--- a/src/quick/items/qquickrendercontrol.h
+++ b/src/quick/items/qquickrendercontrol.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -42,6 +42,7 @@ QT_BEGIN_NAMESPACE
class QQuickWindow;
class QOpenGLContext;
class QQuickRenderControlPrivate;
+class QThread;
class Q_QUICK_EXPORT QQuickRenderControl : public QObject
{
@@ -51,6 +52,7 @@ public:
QQuickRenderControl(QObject *parent = 0);
~QQuickRenderControl();
+ void prepareThread(QThread *targetThread);
void initialize(QOpenGLContext *gl);
void invalidate();
diff --git a/src/quick/items/qquickrendercontrol_p.h b/src/quick/items/qquickrendercontrol_p.h
index 832e17f928..8837ed79dc 100644
--- a/src/quick/items/qquickrendercontrol_p.h
+++ b/src/quick/items/qquickrendercontrol_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickrepeater.cpp b/src/quick/items/qquickrepeater.cpp
index e2a3043857..0168d73c8f 100644
--- a/src/quick/items/qquickrepeater.cpp
+++ b/src/quick/items/qquickrepeater.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -44,7 +44,11 @@
QT_BEGIN_NAMESPACE
QQuickRepeaterPrivate::QQuickRepeaterPrivate()
- : model(0), ownModel(false), inRequest(false), dataSourceIsObject(false), delegateValidated(false), itemCount(0), createFrom(-1)
+ : model(0)
+ , ownModel(false)
+ , dataSourceIsObject(false)
+ , delegateValidated(false)
+ , itemCount(0)
{
}
@@ -350,7 +354,9 @@ void QQuickRepeater::clear()
bool complete = isComponentComplete();
if (d->model) {
- for (int i = 0; i < d->deletables.count(); ++i) {
+ // We remove in reverse order deliberately; so that signals are emitted
+ // with sensible indices.
+ for (int i = d->deletables.count() - 1; i >= 0; --i) {
if (QQuickItem *item = d->deletables.at(i)) {
if (complete)
emit itemRemoved(i, item);
@@ -376,57 +382,51 @@ void QQuickRepeater::regenerate()
d->itemCount = count();
d->deletables.resize(d->itemCount);
- d->createFrom = 0;
- d->createItems();
+ d->requestItems();
}
-void QQuickRepeaterPrivate::createItems()
+void QQuickRepeaterPrivate::requestItems()
{
- Q_Q(QQuickRepeater);
- if (createFrom == -1)
- return;
- inRequest = true;
- for (int ii = createFrom; ii < itemCount; ++ii) {
- if (!deletables.at(ii)) {
- QObject *object = model->object(ii, false);
- QQuickItem *item = qmlobject_cast<QQuickItem*>(object);
- if (!item) {
- if (object) {
- model->release(object);
- if (!delegateValidated) {
- delegateValidated = true;
- QObject* delegate = q->delegate();
- qmlInfo(delegate ? delegate : q) << QQuickRepeater::tr("Delegate must be of Item type");
- }
+ for (int i = 0; i < itemCount; i++) {
+ QObject *object = model->object(i, false);
+ if (object)
+ model->release(object);
+ }
+}
+
+void QQuickRepeater::createdItem(int index, QObject *)
+{
+ Q_D(QQuickRepeater);
+ if (!d->deletables.at(index)) {
+ QObject *object = d->model->object(index, false);
+ QQuickItem *item = qmlobject_cast<QQuickItem*>(object);
+ if (!item) {
+ if (object) {
+ d->model->release(object);
+ if (!d->delegateValidated) {
+ d->delegateValidated = true;
+ QObject* delegate = this->delegate();
+ qmlInfo(delegate ? delegate : this) << QQuickRepeater::tr("Delegate must be of Item type");
}
- createFrom = ii;
- break;
}
- deletables[ii] = item;
- item->setParentItem(q->parentItem());
- if (ii > 0 && deletables.at(ii-1)) {
- item->stackAfter(deletables.at(ii-1));
- } else {
- QQuickItem *after = q;
- for (int si = ii+1; si < itemCount; ++si) {
- if (deletables.at(si)) {
- after = deletables.at(si);
- break;
- }
+ return;
+ }
+ d->deletables[index] = item;
+ item->setParentItem(parentItem());
+ if (index > 0 && d->deletables.at(index-1)) {
+ item->stackAfter(d->deletables.at(index-1));
+ } else {
+ QQuickItem *after = this;
+ for (int si = index+1; si < d->itemCount; ++si) {
+ if (d->deletables.at(si)) {
+ after = d->deletables.at(si);
+ break;
}
- item->stackBefore(after);
}
- emit q->itemAdded(ii, item);
+ item->stackBefore(after);
}
+ emit itemAdded(index, item);
}
- inRequest = false;
-}
-
-void QQuickRepeater::createdItem(int, QObject *)
-{
- Q_D(QQuickRepeater);
- if (!d->inRequest)
- d->createItems();
}
void QQuickRepeater::initItem(int, QObject *object)
@@ -474,7 +474,6 @@ void QQuickRepeater::modelUpdated(const QQmlChangeSet &changeSet, bool reset)
difference -= remove.count;
}
- d->createFrom = -1;
foreach (const QQmlChangeSet::Change &insert, changeSet.inserts()) {
int index = qMin(insert.index, d->deletables.count());
if (insert.isMove()) {
@@ -489,14 +488,13 @@ void QQuickRepeater::modelUpdated(const QQmlChangeSet &changeSet, bool reset)
int modelIndex = index + i;
++d->itemCount;
d->deletables.insert(modelIndex, 0);
- if (d->createFrom == -1)
- d->createFrom = modelIndex;
+ QObject *object = d->model->object(modelIndex, false);
+ if (object)
+ d->model->release(object);
}
difference += insert.count;
}
- d->createItems();
-
if (difference != 0)
emit countChanged();
}
diff --git a/src/quick/items/qquickrepeater_p.h b/src/quick/items/qquickrepeater_p.h
index 159520a89d..5f652da975 100644
--- a/src/quick/items/qquickrepeater_p.h
+++ b/src/quick/items/qquickrepeater_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -77,8 +77,8 @@ private:
void regenerate();
protected:
- virtual void componentComplete();
- void itemChange(ItemChange change, const ItemChangeData &value);
+ void componentComplete() Q_DECL_OVERRIDE;
+ void itemChange(ItemChange change, const ItemChangeData &value) Q_DECL_OVERRIDE;
private Q_SLOTS:
void createdItem(int index, QObject *item);
diff --git a/src/quick/items/qquickrepeater_p_p.h b/src/quick/items/qquickrepeater_p_p.h
index 7874899379..732ba4d5b8 100644
--- a/src/quick/items/qquickrepeater_p_p.h
+++ b/src/quick/items/qquickrepeater_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -63,17 +63,15 @@ public:
~QQuickRepeaterPrivate();
private:
- void createItems();
+ void requestItems();
QPointer<QQmlInstanceModel> model;
QVariant dataSource;
QPointer<QObject> dataSourceAsObject;
bool ownModel : 1;
- bool inRequest : 1;
bool dataSourceIsObject : 1;
bool delegateValidated : 1;
int itemCount;
- int createFrom;
QVector<QPointer<QQuickItem> > deletables;
};
diff --git a/src/quick/items/qquickscalegrid.cpp b/src/quick/items/qquickscalegrid.cpp
index ed7ce56dc1..bc2f52b66f 100644
--- a/src/quick/items/qquickscalegrid.cpp
+++ b/src/quick/items/qquickscalegrid.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickscalegrid_p_p.h b/src/quick/items/qquickscalegrid_p_p.h
index 0b4897d6bc..7e0c021c19 100644
--- a/src/quick/items/qquickscalegrid_p_p.h
+++ b/src/quick/items/qquickscalegrid_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickscreen.cpp b/src/quick/items/qquickscreen.cpp
index 0900adbb4b..3bf7229b33 100644
--- a/src/quick/items/qquickscreen.cpp
+++ b/src/quick/items/qquickscreen.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -37,6 +37,7 @@
#include "qquickitem_p.h"
#include "qquickwindow.h"
+#include <QGuiApplication>
#include <QScreen>
QT_BEGIN_NAMESPACE
@@ -219,6 +220,9 @@ QQuickScreenAttached::QQuickScreenAttached(QObject* attachee)
if (window)
windowChanged(window);
}
+
+ if (!m_screen)
+ screenChanged(QGuiApplication::primaryScreen());
}
QString QQuickScreenAttached::name() const
diff --git a/src/quick/items/qquickscreen_p.h b/src/quick/items/qquickscreen_p.h
index a36641cc71..3d0f00b22c 100644
--- a/src/quick/items/qquickscreen_p.h
+++ b/src/quick/items/qquickscreen_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp
index 0358495a3b..0be305b693 100644
--- a/src/quick/items/qquickshadereffect.cpp
+++ b/src/quick/items/qquickshadereffect.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -601,7 +601,7 @@ void QQuickShaderEffectCommon::propertyChanged(QQuickItem *item, int mappedId,
\l blending is enabled, source-over blending is used. However, additive
blending can be achieved by outputting zero in the alpha channel.
- \table
+ \table 70%
\row
\li \image declarative-shadereffectitem.png
\li \qml
@@ -610,7 +610,8 @@ void QQuickShaderEffectCommon::propertyChanged(QQuickItem *item, int mappedId,
Rectangle {
width: 200; height: 100
Row {
- Image { id: img; sourceSize { width: 100; height: 100 } source: "qt-logo.png" }
+ Image { id: img;
+ sourceSize { width: 100; height: 100 } source: "qt-logo.png" }
ShaderEffect {
width: 100; height: 100
property variant src: img
@@ -629,7 +630,9 @@ void QQuickShaderEffectCommon::propertyChanged(QQuickItem *item, int mappedId,
uniform lowp float qt_Opacity;
void main() {
lowp vec4 tex = texture2D(src, coord);
- gl_FragColor = vec4(vec3(dot(tex.rgb, vec3(0.344, 0.5, 0.156))), tex.a) * qt_Opacity;
+ gl_FragColor = vec4(vec3(dot(tex.rgb,
+ vec3(0.344, 0.5, 0.156))),
+ tex.a) * qt_Opacity;
}"
}
}
@@ -649,6 +652,7 @@ void QQuickShaderEffectCommon::propertyChanged(QQuickItem *item, int mappedId,
\row
\li \b {Layer with effect disabled} \inlineimage qml-shadereffect-nolayereffect.png
\li \b {Layer with effect enabled} \inlineimage qml-shadereffect-layereffect.png
+ \row
\li \snippet qml/layerwitheffect.qml 1
\endtable
@@ -657,6 +661,7 @@ void QQuickShaderEffectCommon::propertyChanged(QQuickItem *item, int mappedId,
\table
\row
\li \inlineimage qml-shadereffect-opacitymask.png
+ \row
\li \snippet qml/opacitymask.qml 1
\endtable
@@ -854,12 +859,17 @@ void QQuickShaderEffect::setCullMode(CullMode face)
/*!
\qmlproperty bool QtQuick::ShaderEffect::supportsAtlasTextures
- Set this property true to indicate that the ShaderEffect is able to
- use the default source texture without first removing it from an atlas.
- In this case the range of qt_MultiTexCoord0 will based on the position of
- the texture within the atlas, rather than (0,0) to (1,1).
+ Set this property true to confirm that your shader code doesn't rely on
+ qt_MultiTexCoord0 ranging from (0,0) to (1,1) relative to the mesh.
+ In this case the range of qt_MultiTexCoord0 will rather be based on the position
+ of the texture within the atlas. This property currently has no effect if there
+ is less, or more, than one sampler uniform used as input to your shader.
- Setting this to true may enable some optimizations.
+ This differs from providing qt_SubRect_<name> uniforms in that the latter allows
+ drawing one or more textures from the atlas in a single ShaderEffect item, while
+ supportsAtlasTextures allows multiple instances of a ShaderEffect component using
+ a different source image from the atlas to be batched in a single draw.
+ Both prevent a texture from being copied out of the atlas when referenced by a ShaderEffect.
The default value is false.
@@ -1029,24 +1039,23 @@ QSGNode *QQuickShaderEffect::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDa
m_dirtyUniforms = m_dirtyUniformValues = m_dirtyTextureProviders = false;
}
- int textureCount = material->textureProviders.size();
- bool preventBatching = m_customVertexShader || textureCount > 1 || (textureCount > 0 && !m_supportsAtlasTextures);
-
QRectF srcRect(0, 0, 1, 1);
- if (m_supportsAtlasTextures && textureCount != 0) {
- if (QSGTextureProvider *provider = material->textureProviders.at(0)) {
- if (provider->texture())
- srcRect = provider->texture()->normalizedTextureSubRect();
+ bool geometryUsesTextureSubRect = false;
+ if (m_supportsAtlasTextures && material->textureProviders.size() == 1) {
+ QSGTextureProvider *provider = material->textureProviders.at(0);
+ if (provider->texture()) {
+ srcRect = provider->texture()->normalizedTextureSubRect();
+ geometryUsesTextureSubRect = true;
}
}
- if (bool(material->flags() & QSGMaterial::RequiresFullMatrix) != preventBatching) {
- material->setFlag(QSGMaterial::RequiresFullMatrix, preventBatching);
+ if (bool(material->flags() & QSGMaterial::RequiresFullMatrix) != m_customVertexShader) {
+ material->setFlag(QSGMaterial::RequiresFullMatrix, m_customVertexShader);
node->markDirty(QSGNode::DirtyMaterial);
}
- if (material->supportsAtlasTextures != m_supportsAtlasTextures) {
- material->supportsAtlasTextures = m_supportsAtlasTextures;
+ if (material->geometryUsesTextureSubRect != geometryUsesTextureSubRect) {
+ material->geometryUsesTextureSubRect = geometryUsesTextureSubRect;
node->markDirty(QSGNode::DirtyMaterial);
}
diff --git a/src/quick/items/qquickshadereffect_p.h b/src/quick/items/qquickshadereffect_p.h
index 99e88a653d..1c60d9feaa 100644
--- a/src/quick/items/qquickshadereffect_p.h
+++ b/src/quick/items/qquickshadereffect_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -136,7 +136,7 @@ public:
QString parseLog();
- virtual bool event(QEvent *);
+ bool event(QEvent *) Q_DECL_OVERRIDE;
Q_SIGNALS:
void fragmentShaderChanged();
@@ -149,10 +149,10 @@ Q_SIGNALS:
void supportsAtlasTexturesChanged();
protected:
- virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
- virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
- virtual void componentComplete();
- virtual void itemChange(ItemChange change, const ItemChangeData &value);
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+ QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
+ void componentComplete() Q_DECL_OVERRIDE;
+ void itemChange(ItemChange change, const ItemChangeData &value) Q_DECL_OVERRIDE;
private Q_SLOTS:
void updateGeometry();
diff --git a/src/quick/items/qquickshadereffectmesh.cpp b/src/quick/items/qquickshadereffectmesh.cpp
index 1eab3b4148..8feebcc4cd 100644
--- a/src/quick/items/qquickshadereffectmesh.cpp
+++ b/src/quick/items/qquickshadereffectmesh.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -59,7 +59,6 @@ QQuickGridMesh::QQuickGridMesh(QObject *parent)
: QQuickShaderEffectMesh(parent)
, m_resolution(1, 1)
{
- connect(this, SIGNAL(resolutionChanged()), this, SIGNAL(geometryChanged()));
}
QSGGeometry *QQuickGridMesh::updateGeometry(QSGGeometry *geometry, const QVector<QByteArray> &attributes, const QRectF &srcRect, const QRectF &dstRect)
@@ -204,6 +203,7 @@ void QQuickGridMesh::setResolution(const QSize &res)
}
m_resolution = res;
emit resolutionChanged();
+ emit geometryChanged();
}
QSize QQuickGridMesh::resolution() const
diff --git a/src/quick/items/qquickshadereffectmesh_p.h b/src/quick/items/qquickshadereffectmesh_p.h
index 5bcf633fa3..b392753bf8 100644
--- a/src/quick/items/qquickshadereffectmesh_p.h
+++ b/src/quick/items/qquickshadereffectmesh_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -69,8 +69,8 @@ class QQuickGridMesh : public QQuickShaderEffectMesh
Q_PROPERTY(QSize resolution READ resolution WRITE setResolution NOTIFY resolutionChanged)
public:
QQuickGridMesh(QObject *parent = 0);
- virtual QSGGeometry *updateGeometry(QSGGeometry *geometry, const QVector<QByteArray> &attributes, const QRectF &srcRect, const QRectF &rect);
- virtual QString log() const { return m_log; }
+ QSGGeometry *updateGeometry(QSGGeometry *geometry, const QVector<QByteArray> &attributes, const QRectF &srcRect, const QRectF &rect) Q_DECL_OVERRIDE;
+ QString log() const Q_DECL_OVERRIDE { return m_log; }
void setResolution(const QSize &res);
QSize resolution() const;
diff --git a/src/quick/items/qquickshadereffectnode.cpp b/src/quick/items/qquickshadereffectnode.cpp
index 43220a0e29..de6cae0ea6 100644
--- a/src/quick/items/qquickshadereffectnode.cpp
+++ b/src/quick/items/qquickshadereffectnode.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -38,23 +38,34 @@
#include <QtQuick/private/qsgrenderer_p.h>
#include <QtQuick/private/qsgshadersourcebuilder_p.h>
#include <QtQuick/private/qsgtexture_p.h>
+#include <QtCore/qmutex.h>
QT_BEGIN_NAMESPACE
+static bool hasAtlasTexture(const QVector<QSGTextureProvider *> &textureProviders)
+{
+ for (int i = 0; i < textureProviders.size(); ++i) {
+ QSGTextureProvider *t = textureProviders.at(i);
+ if (t->texture() && t->texture()->isAtlasTexture())
+ return true;
+ }
+ return false;
+}
+
class QQuickCustomMaterialShader : public QSGMaterialShader
{
public:
QQuickCustomMaterialShader(const QQuickShaderEffectMaterialKey &key, const QVector<QByteArray> &attributes);
- virtual void deactivate();
- virtual void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect);
- virtual char const *const *attributeNames() const;
+ void deactivate() Q_DECL_OVERRIDE;
+ void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) Q_DECL_OVERRIDE;
+ char const *const *attributeNames() const Q_DECL_OVERRIDE;
protected:
friend class QQuickShaderEffectNode;
- virtual void compile();
- virtual const char *vertexShader() const;
- virtual const char *fragmentShader() const;
+ void compile() Q_DECL_OVERRIDE;
+ const char *vertexShader() const Q_DECL_OVERRIDE;
+ const char *fragmentShader() const Q_DECL_OVERRIDE;
const QQuickShaderEffectMaterialKey m_key;
QVector<QByteArray> m_attributes;
@@ -137,7 +148,7 @@ void QQuickCustomMaterialShader::updateState(const RenderState &state, QSGMateri
if (loc >= 0) {
QRectF r = texture->normalizedTextureSubRect();
program()->setUniformValue(loc, r.x(), r.y(), r.width(), r.height());
- } else if (texture->isAtlasTexture() && (idx != 0 || !material->supportsAtlasTextures)) {
+ } else if (texture->isAtlasTexture() && !material->geometryUsesTextureSubRect) {
texture = texture->removedFromAtlas();
}
texture->bind();
@@ -330,7 +341,7 @@ bool QQuickShaderEffectMaterialKey::operator != (const QQuickShaderEffectMateria
uint qHash(const QQuickShaderEffectMaterialKey &key)
{
- uint hash = qHash((void *)key.className);
+ uint hash = qHash((const void *)key.className);
typedef QQuickShaderEffectMaterialKey Key;
for (int shaderType = 0; shaderType < Key::ShaderTypeCount; ++shaderType)
hash = hash * 31337 + qHash(key.sourceCode[shaderType]);
@@ -338,11 +349,14 @@ uint qHash(const QQuickShaderEffectMaterialKey &key)
}
-QHash<QQuickShaderEffectMaterialKey, QSharedPointer<QSGMaterialType> > QQuickShaderEffectMaterial::materialMap;
+typedef QHash<QQuickShaderEffectMaterialKey, QWeakPointer<QSGMaterialType> > MaterialHash;
+
+Q_GLOBAL_STATIC(MaterialHash, materialHash)
+Q_GLOBAL_STATIC(QMutex, materialHashMutex)
QQuickShaderEffectMaterial::QQuickShaderEffectMaterial(QQuickShaderEffectNode *node)
: cullMode(NoCulling)
- , supportsAtlasTextures(false)
+ , geometryUsesTextureSubRect(false)
, m_node(node)
, m_emittedLogChanged(false)
{
@@ -367,11 +381,10 @@ bool QQuickShaderEffectMaterial::UniformData::operator == (const UniformData &ot
return false;
if (specialType == UniformData::Sampler) {
- QQuickItem *source = qobject_cast<QQuickItem *>(qvariant_cast<QObject *>(value));
- QQuickItem *otherSource = qobject_cast<QQuickItem *>(qvariant_cast<QObject *>(other.value));
- if (!source || !otherSource || !source->isTextureProvider() || !otherSource->isTextureProvider())
- return false;
- return source->textureProvider()->texture()->textureId() == otherSource->textureProvider()->texture()->textureId();
+ // We can't check the source objects as these live in the GUI thread,
+ // so return true here and rely on the textureProvider check for
+ // equality of these..
+ return true;
} else {
return value == other.value;
}
@@ -380,29 +393,60 @@ bool QQuickShaderEffectMaterial::UniformData::operator == (const UniformData &ot
int QQuickShaderEffectMaterial::compare(const QSGMaterial *o) const
{
const QQuickShaderEffectMaterial *other = static_cast<const QQuickShaderEffectMaterial *>(o);
- if (!supportsAtlasTextures || !other->supportsAtlasTextures)
- return 1;
- if (bool(flags() & QSGMaterial::RequiresFullMatrix) || bool(other->flags() & QSGMaterial::RequiresFullMatrix))
+ if ((hasAtlasTexture(textureProviders) && !geometryUsesTextureSubRect) || (hasAtlasTexture(other->textureProviders) && !other->geometryUsesTextureSubRect))
return 1;
if (cullMode != other->cullMode)
return 1;
- if (m_source != other->m_source)
- return 1;
for (int shaderType = 0; shaderType < QQuickShaderEffectMaterialKey::ShaderTypeCount; ++shaderType) {
if (uniforms[shaderType] != other->uniforms[shaderType])
return 1;
}
+
+ // Check the texture providers..
+ if (textureProviders.size() != other->textureProviders.size())
+ return 1;
+ for (int i=0; i<textureProviders.size(); ++i) {
+ QSGTextureProvider *tp1 = textureProviders.at(i);
+ QSGTextureProvider *tp2 = other->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;
+ // Check texture id's as textures may be in the same atlas.
+ if (t1->textureId() != t2->textureId())
+ return 1;
+ }
return 0;
}
void QQuickShaderEffectMaterial::setProgramSource(const QQuickShaderEffectMaterialKey &source)
{
+ QMutexLocker locker(materialHashMutex);
+ Q_UNUSED(locker);
+
m_source = source;
m_emittedLogChanged = false;
- m_type = materialMap.value(m_source);
+ QWeakPointer<QSGMaterialType> weakPtr = materialHash->value(m_source);
+ m_type = weakPtr.toStrongRef();
+
if (m_type.isNull()) {
m_type = QSharedPointer<QSGMaterialType>(new QSGMaterialType);
- materialMap.insert(m_source, m_type);
+ materialHash->insert(m_source, m_type.toWeakRef());
+ }
+}
+
+void QQuickShaderEffectMaterial::cleanupMaterialCache()
+{
+ QMutexLocker locker(materialHashMutex);
+ Q_UNUSED(locker);
+
+ for (MaterialHash::iterator it = materialHash->begin(); it != materialHash->end(); ) {
+ if (!it.value().toStrongRef())
+ it = materialHash->erase(it);
+ else
+ ++it;
}
}
diff --git a/src/quick/items/qquickshadereffectnode_p.h b/src/quick/items/qquickshadereffectnode_p.h
index fc7c643aea..28382c483c 100644
--- a/src/quick/items/qquickshadereffectnode_p.h
+++ b/src/quick/items/qquickshadereffectnode_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -87,20 +87,22 @@ public:
};
explicit QQuickShaderEffectMaterial(QQuickShaderEffectNode *node = 0);
- virtual QSGMaterialType *type() const;
- virtual QSGMaterialShader *createShader() const;
- virtual int compare(const QSGMaterial *other) const;
+ QSGMaterialType *type() const Q_DECL_OVERRIDE;
+ QSGMaterialShader *createShader() const Q_DECL_OVERRIDE;
+ int compare(const QSGMaterial *other) const Q_DECL_OVERRIDE;
QVector<QByteArray> attributes;
QVector<UniformData> uniforms[QQuickShaderEffectMaterialKey::ShaderTypeCount];
QVector<QSGTextureProvider *> textureProviders;
CullMode cullMode;
- bool supportsAtlasTextures;
+ bool geometryUsesTextureSubRect;
void setProgramSource(const QQuickShaderEffectMaterialKey &source);
void updateTextures() const;
void invalidateTextureProvider(QSGTextureProvider *provider);
+ static void cleanupMaterialCache();
+
protected:
friend class QQuickCustomMaterialShader;
@@ -115,8 +117,6 @@ protected:
QQuickShaderEffectNode *m_node;
bool m_emittedLogChanged;
-
- static QHash<QQuickShaderEffectMaterialKey, QSharedPointer<QSGMaterialType> > materialMap;
};
@@ -129,7 +129,7 @@ public:
QQuickShaderEffectNode();
virtual ~QQuickShaderEffectNode();
- virtual void preprocess();
+ void preprocess() Q_DECL_OVERRIDE;
Q_SIGNALS:
void logAndStatusChanged(const QString &, int status);
diff --git a/src/quick/items/qquickshadereffectsource.cpp b/src/quick/items/qquickshadereffectsource.cpp
index ccff98828c..bf69fe4277 100644
--- a/src/quick/items/qquickshadereffectsource.cpp
+++ b/src/quick/items/qquickshadereffectsource.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquickshadereffectsource_p.h b/src/quick/items/qquickshadereffectsource_p.h
index 69e65f927f..31e503be42 100644
--- a/src/quick/items/qquickshadereffectsource_p.h
+++ b/src/quick/items/qquickshadereffectsource_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -112,8 +112,8 @@ public:
bool recursive() const;
void setRecursive(bool enabled);
- bool isTextureProvider() const { return true; }
- QSGTextureProvider *textureProvider() const;
+ bool isTextureProvider() const Q_DECL_OVERRIDE { return true; }
+ QSGTextureProvider *textureProvider() const Q_DECL_OVERRIDE;
Q_INVOKABLE void scheduleUpdate();
@@ -135,11 +135,11 @@ private Q_SLOTS:
void invalidateSceneGraph();
protected:
- virtual void releaseResources();
- virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
+ void releaseResources() Q_DECL_OVERRIDE;
+ QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
- virtual void itemGeometryChanged(QQuickItem *item, const QRectF &newRect, const QRectF &oldRect);
- virtual void itemChange(ItemChange change, const ItemChangeData &value);
+ void itemGeometryChanged(QQuickItem *item, const QRectF &newRect, const QRectF &oldRect) Q_DECL_OVERRIDE;
+ void itemChange(ItemChange change, const ItemChangeData &value) Q_DECL_OVERRIDE;
private:
void ensureTexture();
diff --git a/src/quick/items/qquicksprite.cpp b/src/quick/items/qquicksprite.cpp
index c72579973d..e69e12d967 100644
--- a/src/quick/items/qquicksprite.cpp
+++ b/src/quick/items/qquicksprite.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquicksprite_p.h b/src/quick/items/qquicksprite_p.h
index 1bd625001d..86350738a0 100644
--- a/src/quick/items/qquicksprite_p.h
+++ b/src/quick/items/qquicksprite_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -138,7 +138,7 @@ public:
return m_frameDurationVariation;
}
- int variedDuration() const;
+ int variedDuration() const Q_DECL_OVERRIDE;
bool frameSync() const
{
diff --git a/src/quick/items/qquickspriteengine.cpp b/src/quick/items/qquickspriteengine.cpp
index c5e70c9a8b..243feef683 100644
--- a/src/quick/items/qquickspriteengine.cpp
+++ b/src/quick/items/qquickspriteengine.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -201,10 +201,12 @@ int QQuickSpriteEngine::spriteFrames(int sprite)
extra = (m_sprites[state]->m_generatedCount - 1) - extra;
- if (extra == m_sprites[state]->m_generatedCount - 1)//last state
- return m_sprites[state]->frames() % m_sprites[state]->m_framesPerRow;
- else
- return m_sprites[state]->m_framesPerRow;
+ if (extra == m_sprites[state]->m_generatedCount - 1) {//last state
+ const int framesRemaining = m_sprites[state]->frames() % m_sprites[state]->m_framesPerRow;
+ if (framesRemaining > 0)
+ return framesRemaining;
+ }
+ return m_sprites[state]->m_framesPerRow;
}
int QQuickSpriteEngine::spriteDuration(int sprite)//Full duration, not per frame
@@ -219,10 +221,12 @@ int QQuickSpriteEngine::spriteDuration(int sprite)//Full duration, not per frame
if (m_sprites[state]->reverse())
extra = (m_sprites[state]->m_generatedCount - 1) - extra;
- if (extra == m_sprites[state]->m_generatedCount - 1)//last state
- return m_duration[sprite] % rowDuration;
- else
- return rowDuration;
+ if (extra == m_sprites[state]->m_generatedCount - 1) {//last state
+ const int durationRemaining = m_duration[sprite] % rowDuration;
+ if (durationRemaining > 0)
+ return durationRemaining;
+ }
+ return rowDuration;
}
int QQuickSpriteEngine::spriteY(int sprite)
@@ -512,7 +516,9 @@ void QQuickStochasticEngine::start(int index, int state)
else
m_startTimes[index] = 0;
m_goals[index] = -1;
+ m_addAdvance = false;
restart(index);
+ m_addAdvance = true;
}
void QQuickStochasticEngine::stop(int index)
diff --git a/src/quick/items/qquickspriteengine_p.h b/src/quick/items/qquickspriteengine_p.h
index 1705ab3ee3..ef52bcc9fe 100644
--- a/src/quick/items/qquickspriteengine_p.h
+++ b/src/quick/items/qquickspriteengine_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -268,8 +268,8 @@ public:
int spriteCount();//Like state count
int maxFrames();
- virtual void restart(int index=0);
- virtual void advance(int index=0);
+ void restart(int index=0) Q_DECL_OVERRIDE;
+ void advance(int index=0) Q_DECL_OVERRIDE;
//Similar API to QQuickPixmap for async loading convenience
bool isNull() { return status() == QQuickPixmap::Null; }
diff --git a/src/quick/items/qquickspritesequence.cpp b/src/quick/items/qquickspritesequence.cpp
index a9a823c2ce..854582e58e 100644
--- a/src/quick/items/qquickspritesequence.cpp
+++ b/src/quick/items/qquickspritesequence.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -53,9 +53,9 @@ class QQuickSpriteSequenceMaterial : public QSGMaterial
public:
QQuickSpriteSequenceMaterial();
~QQuickSpriteSequenceMaterial();
- virtual QSGMaterialType *type() const { static QSGMaterialType type; return &type; }
- virtual QSGMaterialShader *createShader() const;
- virtual int compare(const QSGMaterial *other) const
+ QSGMaterialType *type() const Q_DECL_OVERRIDE{ static QSGMaterialType type; return &type; }
+ QSGMaterialShader *createShader() const Q_DECL_OVERRIDE;
+ int compare(const QSGMaterial *other) const Q_DECL_OVERRIDE
{
return this - static_cast<const QQuickSpriteSequenceMaterial *>(other);
}
@@ -99,7 +99,7 @@ public:
setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/items/shaders/sprite.frag"));
}
- virtual void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *)
+ void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *) Q_DECL_OVERRIDE
{
QQuickSpriteSequenceMaterial *m = static_cast<QQuickSpriteSequenceMaterial *>(newEffect);
m->texture->bind();
@@ -112,14 +112,14 @@ public:
program()->setUniformValue(m_matrix_id, state.combinedMatrix());
}
- virtual void initialize() {
+ void initialize() Q_DECL_OVERRIDE {
m_matrix_id = program()->uniformLocation("qt_Matrix");
m_opacity_id = program()->uniformLocation("qt_Opacity");
m_animData_id = program()->uniformLocation("animData");
m_animPos_id = program()->uniformLocation("animPos");
}
- virtual char const *const *attributeNames() const {
+ char const *const *attributeNames() const Q_DECL_OVERRIDE {
static const char *attr[] = {
"vPos",
"vTex",
@@ -424,7 +424,7 @@ void QQuickSpriteSequence::prepareNextFrame()
if (frameDuration > 0) {
qreal frame = (time - animT)/(frameDuration / 1000.0);
frame = qBound(qreal(0.0), frame, frameCount - qreal(1.0));//Stop at count-1 frames until we have between anim interpolation
- progress = modf(frame,&frameAt);
+ progress = std::modf(frame,&frameAt);
} else {
m_curFrame++;
if (m_curFrame >= frameCount){
diff --git a/src/quick/items/qquickspritesequence_p.h b/src/quick/items/qquickspritesequence_p.h
index a32f5ead4f..f5d467580d 100644
--- a/src/quick/items/qquickspritesequence_p.h
+++ b/src/quick/items/qquickspritesequence_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -114,7 +114,7 @@ private Q_SLOTS:
protected:
void reset();
- QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
+ QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
private:
void prepareNextFrame();
QSGGeometryNode* buildNode();
diff --git a/src/quick/items/qquickstateoperations.cpp b/src/quick/items/qquickstateoperations.cpp
index ad442512a7..579919db27 100644
--- a/src/quick/items/qquickstateoperations.cpp
+++ b/src/quick/items/qquickstateoperations.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -95,7 +95,7 @@ void QQuickParentChangePrivate::doChange(QQuickItem *targetParent, QQuickItem *s
}
if (scale != 0)
- rotation = atan2(transform.m12()/scale, transform.m11()/scale) * 180/M_PI;
+ rotation = qAtan2(transform.m12()/scale, transform.m11()/scale) * 180/M_PI;
else {
qmlInfo(q) << QQuickParentChange::tr("Unable to preserve appearance under scale of 0");
ok = false;
@@ -134,7 +134,7 @@ void QQuickParentChangePrivate::doChange(QQuickItem *targetParent, QQuickItem *s
//restore the original stack position.
//### if stackBefore has also been reparented this won't work
- if (stackBefore)
+ if (target && stackBefore)
target->stackBefore(stackBefore);
}
diff --git a/src/quick/items/qquickstateoperations_p.h b/src/quick/items/qquickstateoperations_p.h
index 79facf2445..8d4231c5fa 100644
--- a/src/quick/items/qquickstateoperations_p.h
+++ b/src/quick/items/qquickstateoperations_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -93,17 +93,17 @@ public:
void setRotation(QQmlScriptString rotation);
bool rotationIsSet() const;
- virtual ActionList actions();
+ ActionList actions() Q_DECL_OVERRIDE;
- virtual void saveOriginals();
+ void saveOriginals() Q_DECL_OVERRIDE;
//virtual void copyOriginals(QQuickStateActionEvent*);
- virtual void execute(Reason reason = ActualChange);
- virtual bool isReversable();
- virtual void reverse(Reason reason = ActualChange);
- virtual EventType type() const;
- virtual bool override(QQuickStateActionEvent*other);
- virtual void rewind();
- virtual void saveCurrentValues();
+ void execute(Reason reason = ActualChange) Q_DECL_OVERRIDE;
+ bool isReversable() Q_DECL_OVERRIDE;
+ void reverse(Reason reason = ActualChange) Q_DECL_OVERRIDE;
+ EventType type() const Q_DECL_OVERRIDE;
+ bool override(QQuickStateActionEvent*other) Q_DECL_OVERRIDE;
+ void rewind() Q_DECL_OVERRIDE;
+ void saveCurrentValues() Q_DECL_OVERRIDE;
};
class QQuickAnchorChanges;
@@ -173,28 +173,28 @@ public:
QQuickAnchorChanges(QObject *parent=0);
~QQuickAnchorChanges();
- virtual ActionList actions();
+ ActionList actions() Q_DECL_OVERRIDE;
QQuickAnchorSet *anchors();
QQuickItem *object() const;
void setObject(QQuickItem *);
- virtual void execute(Reason reason = ActualChange);
- virtual bool isReversable();
- virtual void reverse(Reason reason = ActualChange);
- virtual EventType type() const;
- virtual bool override(QQuickStateActionEvent*other);
- virtual bool changesBindings();
- virtual void saveOriginals();
- virtual bool needsCopy() { return true; }
- virtual void copyOriginals(QQuickStateActionEvent*);
- virtual void clearBindings();
- virtual void rewind();
- virtual void saveCurrentValues();
+ void execute(Reason reason = ActualChange) Q_DECL_OVERRIDE;
+ bool isReversable() Q_DECL_OVERRIDE;
+ void reverse(Reason reason = ActualChange) Q_DECL_OVERRIDE;
+ EventType type() const Q_DECL_OVERRIDE;
+ bool override(QQuickStateActionEvent*other) Q_DECL_OVERRIDE;
+ bool changesBindings() Q_DECL_OVERRIDE;
+ void saveOriginals() Q_DECL_OVERRIDE;
+ bool needsCopy() Q_DECL_OVERRIDE { return true; }
+ void copyOriginals(QQuickStateActionEvent*) Q_DECL_OVERRIDE;
+ void clearBindings() Q_DECL_OVERRIDE;
+ void rewind() Q_DECL_OVERRIDE;
+ void saveCurrentValues() Q_DECL_OVERRIDE;
QList<QQuickStateAction> additionalActions();
- virtual void saveTargetValues();
+ void saveTargetValues() Q_DECL_OVERRIDE;
};
QT_END_NAMESPACE
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp
index 03b656cbb2..dd4f57bfdb 100644
--- a/src/quick/items/qquicktext.cpp
+++ b/src/quick/items/qquicktext.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -144,10 +144,10 @@ QSizeF QQuickTextDocumentWithImageResources::intrinsicSize(
if (format.isImageFormat()) {
QTextImageFormat imageFormat = format.toImageFormat();
- const bool hasWidth = imageFormat.hasProperty(QTextFormat::ImageWidth);
const int width = qRound(imageFormat.width());
- const bool hasHeight = imageFormat.hasProperty(QTextFormat::ImageHeight);
+ const bool hasWidth = imageFormat.hasProperty(QTextFormat::ImageWidth) && width > 0;
const int height = qRound(imageFormat.height());
+ const bool hasHeight = imageFormat.hasProperty(QTextFormat::ImageHeight) && height > 0;
QSizeF size(width, height);
if (!hasWidth || !hasHeight) {
@@ -254,8 +254,11 @@ QQuickTextPrivate::~QQuickTextPrivate()
{
delete elideLayout;
delete textLine; textLine = 0;
- qDeleteAll(imgTags);
- imgTags.clear();
+
+ if (extra.isAllocated()) {
+ qDeleteAll(extra->imgTags);
+ extra->imgTags.clear();
+ }
}
qreal QQuickTextPrivate::getImplicitWidth() const
@@ -305,8 +308,8 @@ void QQuickTextPrivate::updateLayout()
updateOnComponentComplete = false;
layoutTextElided = false;
- if (!visibleImgTags.isEmpty())
- visibleImgTags.clear();
+ if (extra.isAllocated())
+ extra->visibleImgTags.clear();
needToUpdateLayout = false;
// Setup instance of QTextLayout for all cases other than richtext
@@ -316,7 +319,10 @@ void QQuickTextPrivate::updateLayout()
layout.setFont(font);
// needs temporary bool because formatModifiesFontSize is in a bit-field
bool fontSizeModified = false;
- QQuickStyledText::parse(text, layout, imgTags, q->baseUrl(), qmlContext(q), !maximumLineCountValid, &fontSizeModified);
+ QList<QQuickStyledTextImgTag*> someImgTags = extra.isAllocated() ? extra->imgTags : QList<QQuickStyledTextImgTag*>();
+ QQuickStyledText::parse(text, layout, someImgTags, q->baseUrl(), qmlContext(q), !maximumLineCountValid, &fontSizeModified);
+ if (someImgTags.size() || extra.isAllocated())
+ extra.value().imgTags = someImgTags;
formatModifiesFontSize = fontSizeModified;
multilengthEos = -1;
} else {
@@ -373,7 +379,7 @@ void QQuickText::imageDownloadFinished()
if (d->extra.isAllocated() && d->extra->nbActiveDownloads == 0) {
bool needToUpdateLayout = false;
- foreach (QQuickStyledTextImgTag *img, d->visibleImgTags) {
+ foreach (QQuickStyledTextImgTag *img, d->extra->visibleImgTags) {
if (!img->size.isValid()) {
img->size = img->pix->implicitSize();
needToUpdateLayout = true;
@@ -705,8 +711,8 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline)
}
bool shouldUseDesignMetrics = renderType != QQuickText::NativeRendering;
- if (!visibleImgTags.isEmpty())
- visibleImgTags.clear();
+ if (extra.isAllocated())
+ extra->visibleImgTags.clear();
layout.setCacheEnabled(true);
QTextOption textOption = layout.textOption();
if (textOption.alignment() != q->effectiveHAlign()
@@ -743,6 +749,7 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline)
: largeFont;
int scaledFontSize = largeFont;
+ bool widthChanged = false;
widthExceeded = q->width() <= 0 && (singlelineElide || canWrap || horizontalFit);
heightExceeded = q->height() <= 0 && (multilineElide || verticalFit);
@@ -812,8 +819,8 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline)
QTextLine previousLine = layout.lineAt(visibleCount - 1);
elideText = layoutText.at(line.textStart() - 1) != QChar::LineSeparator
- ? elidedText(lineWidth, previousLine, &line)
- : elidedText(lineWidth, previousLine);
+ ? elidedText(line.width(), previousLine, &line)
+ : elidedText(line.width(), previousLine);
elideStart = previousLine.textStart();
// elideEnd isn't required for right eliding.
@@ -824,7 +831,7 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline)
const QTextLine previousLine = line;
line = layout.createLine();
if (!line.isValid()) {
- if (singlelineElide && visibleCount == 1 && previousLine.naturalTextWidth() > lineWidth) {
+ if (singlelineElide && visibleCount == 1 && previousLine.naturalTextWidth() > previousLine.width()) {
// Elide a single previousLine of text if its width exceeds the element width.
elide = true;
widthExceeded = true;
@@ -834,7 +841,7 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline)
truncated = true;
elideText = layout.engine()->elidedText(
Qt::TextElideMode(elideMode),
- QFixed::fromReal(lineWidth),
+ QFixed::fromReal(previousLine.width()),
0,
previousLine.textStart(),
previousLine.textLength());
@@ -863,8 +870,8 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline)
if (eos != -1) // There's an abbreviated string available
break;
elideText = wrappedLine
- ? elidedText(lineWidth, previousLine, &line)
- : elidedText(lineWidth, previousLine);
+ ? elidedText(previousLine.width(), previousLine, &line)
+ : elidedText(previousLine.width(), previousLine);
elideStart = previousLine.textStart();
// elideEnd isn't required for right eliding.
} else {
@@ -939,6 +946,7 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline)
if ((lineWidth < qMin(oldWidth, naturalWidth) || (widthExceeded && lineWidth > oldWidth))
&& (singlelineElide || multilineElide || canWrap || horizontalFit
|| q->effectiveHAlign() != QQuickText::AlignLeft)) {
+ widthChanged = true;
widthExceeded = false;
heightExceeded = false;
continue;
@@ -960,6 +968,39 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline)
heightExceeded = false;
continue;
}
+ } else if (widthChanged) {
+ widthChanged = false;
+ if (line.isValid()) {
+ for (int lineCount = layout.lineCount(); lineCount < maxLineCount; ++lineCount) {
+ line = layout.createLine();
+ if (!line.isValid())
+ break;
+ setLineGeometry(line, lineWidth, naturalHeight);
+ }
+ }
+ layout.endLayout();
+
+ bool wasInLayout = internalWidthUpdate;
+ internalWidthUpdate = true;
+ q->setImplicitHeight(naturalHeight);
+ internalWidthUpdate = wasInLayout;
+
+ multilineElide = elideMode == QQuickText::ElideRight
+ && q->widthValid()
+ && (q->heightValid() || maximumLineCountValid);
+ verticalFit = fontSizeMode() & QQuickText::VerticalFit
+ && (q->heightValid() || (maximumLineCountValid && canWrap));
+
+ const qreal oldHeight = maxHeight;
+ maxHeight = q->heightValid() ? q->height() : FLT_MAX;
+ // If the height of the item has changed and it's possible the result of eliding,
+ // line count truncation or scaling has changed, do another layout.
+ if ((maxHeight < qMin(oldHeight, naturalHeight) || (heightExceeded && maxHeight > oldHeight))
+ && (multilineElide || (canWrap && maximumLineCountValid))) {
+ widthExceeded = false;
+ heightExceeded = false;
+ continue;
+ }
} else {
layout.endLayout();
}
@@ -1106,7 +1147,7 @@ void QQuickTextPrivate::setLineGeometry(QTextLine &line, qreal lineWidth, qreal
Q_Q(QQuickText);
line.setLineWidth(lineWidth);
- if (imgTags.isEmpty()) {
+ if (extra.isAllocated() && extra->imgTags.isEmpty()) {
line.setPosition(QPointF(line.position().x(), height));
height += (lineHeightMode() == QQuickText::FixedHeight) ? lineHeight() : line.height() * lineHeight();
return;
@@ -1118,39 +1159,41 @@ void QQuickTextPrivate::setLineGeometry(QTextLine &line, qreal lineWidth, qreal
QList<QQuickStyledTextImgTag *> imagesInLine;
- foreach (QQuickStyledTextImgTag *image, imgTags) {
- if (image->position >= line.textStart() &&
- image->position < line.textStart() + line.textLength()) {
-
- if (!image->pix) {
- QUrl url = q->baseUrl().resolved(image->url);
- image->pix = new QQuickPixmap(qmlEngine(q), url, image->size);
- if (image->pix->isLoading()) {
- image->pix->connectFinished(q, SLOT(imageDownloadFinished()));
- if (!extra.isAllocated() || !extra->nbActiveDownloads)
- extra.value().nbActiveDownloads = 0;
- extra->nbActiveDownloads++;
- } else if (image->pix->isReady()) {
- if (!image->size.isValid()) {
- image->size = image->pix->implicitSize();
- // if the size of the image was not explicitly set, we need to
- // call updateLayout() once again.
- needToUpdateLayout = true;
+ if (extra.isAllocated()) {
+ foreach (QQuickStyledTextImgTag *image, extra->imgTags) {
+ if (image->position >= line.textStart() &&
+ image->position < line.textStart() + line.textLength()) {
+
+ if (!image->pix) {
+ QUrl url = q->baseUrl().resolved(image->url);
+ image->pix = new QQuickPixmap(qmlEngine(q), url, image->size);
+ if (image->pix->isLoading()) {
+ image->pix->connectFinished(q, SLOT(imageDownloadFinished()));
+ if (!extra.isAllocated() || !extra->nbActiveDownloads)
+ extra.value().nbActiveDownloads = 0;
+ extra->nbActiveDownloads++;
+ } else if (image->pix->isReady()) {
+ if (!image->size.isValid()) {
+ image->size = image->pix->implicitSize();
+ // if the size of the image was not explicitly set, we need to
+ // call updateLayout() once again.
+ needToUpdateLayout = true;
+ }
+ } else if (image->pix->isError()) {
+ qmlInfo(q) << image->pix->error();
}
- } else if (image->pix->isError()) {
- qmlInfo(q) << image->pix->error();
}
- }
- qreal ih = qreal(image->size.height());
- if (image->align == QQuickStyledTextImgTag::Top)
- image->pos.setY(0);
- else if (image->align == QQuickStyledTextImgTag::Middle)
- image->pos.setY((textHeight / 2.0) - (ih / 2.0));
- else
- image->pos.setY(textHeight - ih);
- imagesInLine << image;
- textTop = qMax(textTop, qAbs(image->pos.y()));
+ qreal ih = qreal(image->size.height());
+ if (image->align == QQuickStyledTextImgTag::Top)
+ image->pos.setY(0);
+ else if (image->align == QQuickStyledTextImgTag::Middle)
+ image->pos.setY((textHeight / 2.0) - (ih / 2.0));
+ else
+ image->pos.setY(textHeight - ih);
+ imagesInLine << image;
+ textTop = qMax(textTop, qAbs(image->pos.y()));
+ }
}
}
@@ -1158,7 +1201,7 @@ void QQuickTextPrivate::setLineGeometry(QTextLine &line, qreal lineWidth, qreal
totalLineHeight = qMax(totalLineHeight, textTop + image->pos.y() + image->size.height());
image->pos.setX(line.cursorToX(image->position));
image->pos.setY(image->pos.y() + height + textTop);
- visibleImgTags << image;
+ extra->visibleImgTags << image;
}
line.setPosition(QPointF(line.position().x(), height + textTop));
@@ -1329,10 +1372,14 @@ QQuickText::~QQuickText()
The weight can be one of:
\list
+ \li Font.Thin
\li Font.Light
+ \li Font.ExtraLight
\li Font.Normal - the default
+ \li Font.Medium
\li Font.DemiBold
\li Font.Bold
+ \li Font.ExtraBold
\li Font.Black
\endlist
@@ -1500,8 +1547,11 @@ void QQuickText::setText(const QString &n)
d->textHasChanged = true;
d->implicitWidthValid = false;
d->implicitHeightValid = false;
- qDeleteAll(d->imgTags);
- d->imgTags.clear();
+
+ if (d->extra.isAllocated()) {
+ qDeleteAll(d->extra->imgTags);
+ d->extra->imgTags.clear();
+ }
d->updateLayout();
setAcceptHoverEvents(d->richText || d->styledText);
emit textChanged(d->text);
@@ -1573,7 +1623,10 @@ void QQuickText::setLinkColor(const QColor &color)
return;
d->linkColor = rgb;
- update();
+ if (isComponentComplete()) {
+ d->updateType = QQuickTextPrivate::UpdatePaintNode;
+ update();
+ }
emit linkColorChanged();
}
@@ -1742,7 +1795,7 @@ bool QQuickTextPrivate::determineHorizontalAlignment()
{
if (hAlignImplicit) {
#ifndef QT_NO_IM
- bool alignToRight = text.isEmpty() ? qApp->inputMethod()->inputDirection() == Qt::RightToLeft : rightToLeftText;
+ bool alignToRight = text.isEmpty() ? QGuiApplication::inputMethod()->inputDirection() == Qt::RightToLeft : rightToLeftText;
#else
bool alignToRight = rightToLeftText;
#endif
@@ -2059,18 +2112,21 @@ void QQuickText::setElideMode(QQuickText::TextElideMode mode)
QUrl QQuickText::baseUrl() const
{
Q_D(const QQuickText);
- if (d->baseUrl.isEmpty()) {
+ if (!d->extra.isAllocated() || d->extra->baseUrl.isEmpty()) {
if (QQmlContext *context = qmlContext(this))
- const_cast<QQuickTextPrivate *>(d)->baseUrl = context->baseUrl();
+ return context->baseUrl();
+ else
+ return QUrl();
+ } else {
+ return d->extra->baseUrl;
}
- return d->baseUrl;
}
void QQuickText::setBaseUrl(const QUrl &url)
{
Q_D(QQuickText);
if (baseUrl() != url) {
- d->baseUrl = url;
+ d->extra.value().baseUrl = url;
if (d->richText) {
d->ensureDoc();
@@ -2078,8 +2134,10 @@ void QQuickText::setBaseUrl(const QUrl &url)
}
if (d->styledText) {
d->textHasChanged = true;
- qDeleteAll(d->imgTags);
- d->imgTags.clear();
+ if (d->extra.isAllocated()) {
+ qDeleteAll(d->extra->imgTags);
+ d->extra->imgTags.clear();
+ }
d->updateLayout();
}
emit baseUrlChanged();
@@ -2256,10 +2314,12 @@ QSGNode *QQuickText::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data
if (d->elideLayout)
node->addTextLayout(QPointF(dx, dy), d->elideLayout, color, d->style, styleColor, linkColor);
- foreach (QQuickStyledTextImgTag *img, d->visibleImgTags) {
- QQuickPixmap *pix = img->pix;
- if (pix && pix->isReady())
- node->addImage(QRectF(img->pos.x() + dx, img->pos.y() + dy, pix->width(), pix->height()), pix->image());
+ if (d->extra.isAllocated()) {
+ foreach (QQuickStyledTextImgTag *img, d->extra->visibleImgTags) {
+ QQuickPixmap *pix = img->pix;
+ if (pix && pix->isReady())
+ node->addImage(QRectF(img->pos.x() + dx, img->pos.y() + dy, pix->width(), pix->height()), pix->image());
+ }
}
}
diff --git a/src/quick/items/qquicktext_p.h b/src/quick/items/qquicktext_p.h
index c3fa9e6935..283e3b510b 100644
--- a/src/quick/items/qquicktext_p.h
+++ b/src/quick/items/qquicktext_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -186,15 +186,15 @@ public:
FontSizeMode fontSizeMode() const;
void setFontSizeMode(FontSizeMode mode);
- virtual void componentComplete();
+ void componentComplete() Q_DECL_OVERRIDE;
int resourcesLoading() const; // mainly for testing
qreal contentWidth() const;
qreal contentHeight() const;
- QRectF boundingRect() const;
- QRectF clipRect() const;
+ QRectF boundingRect() const Q_DECL_OVERRIDE;
+ QRectF clipRect() const Q_DECL_OVERRIDE;
Q_INVOKABLE void doLayout();
RenderType renderType() const;
@@ -233,18 +233,18 @@ Q_SIGNALS:
void renderTypeChanged();
protected:
- void mousePressEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
- virtual void itemChange(ItemChange change, const ItemChangeData &value);
- virtual void geometryChanged(const QRectF &newGeometry,
- const QRectF &oldGeometry);
- virtual QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
-
- void updatePolish();
-
- void hoverEnterEvent(QHoverEvent *event);
- void hoverMoveEvent(QHoverEvent *event);
- void hoverLeaveEvent(QHoverEvent *event);
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void itemChange(ItemChange change, const ItemChangeData &value) Q_DECL_OVERRIDE;
+ void geometryChanged(const QRectF &newGeometry,
+ const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+ QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
+
+ void updatePolish() Q_DECL_OVERRIDE;
+
+ void hoverEnterEvent(QHoverEvent *event) Q_DECL_OVERRIDE;
+ void hoverMoveEvent(QHoverEvent *event) Q_DECL_OVERRIDE;
+ void hoverLeaveEvent(QHoverEvent *event) Q_DECL_OVERRIDE;
void invalidateFontCaches();
private Q_SLOTS:
diff --git a/src/quick/items/qquicktext_p_p.h b/src/quick/items/qquicktext_p_p.h
index 35cdb68104..9a6da3736e 100644
--- a/src/quick/items/qquicktext_p_p.h
+++ b/src/quick/items/qquicktext_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -72,7 +72,7 @@ public:
void updateLayout();
bool determineHorizontalAlignment();
bool setHAlign(QQuickText::HAlignment, bool forceAlign = false);
- void mirrorChange();
+ void mirrorChange() Q_DECL_OVERRIDE;
bool isLineLaidOutConnected();
void setLineGeometry(QTextLine &line, qreal lineWidth, qreal &height);
@@ -97,15 +97,15 @@ public:
int maximumLineCount;
QQuickText::LineHeightMode lineHeightMode;
QQuickText::FontSizeMode fontSizeMode;
+ QList<QQuickStyledTextImgTag*> imgTags;
+ QList<QQuickStyledTextImgTag*> visibleImgTags;
+ QUrl baseUrl;
};
QLazilyAllocated<ExtraData> extra;
QString text;
- QUrl baseUrl;
QFont font;
QFont sourceFont;
- QList<QQuickStyledTextImgTag*> imgTags;
- QList<QQuickStyledTextImgTag*> visibleImgTags;
QTextLayout layout;
QTextLayout *elideLayout;
@@ -156,8 +156,8 @@ public:
static const QChar elideChar;
- virtual qreal getImplicitWidth() const;
- virtual qreal getImplicitHeight() const;
+ qreal getImplicitWidth() const Q_DECL_OVERRIDE;
+ qreal getImplicitHeight() const Q_DECL_OVERRIDE;
void ensureDoc();
diff --git a/src/quick/items/qquicktextcontrol.cpp b/src/quick/items/qquicktextcontrol.cpp
index 0ad21ccff3..6929bb44a2 100644
--- a/src/quick/items/qquicktextcontrol.cpp
+++ b/src/quick/items/qquicktextcontrol.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -225,7 +225,7 @@ bool QQuickTextControlPrivate::cursorMoveKeyEvent(QKeyEvent *e)
return false;
}
-// Except for pageup and pagedown, Mac OS X has very different behavior, we don't do it all, but
+// Except for pageup and pagedown, OS X has very different behavior, we don't do it all, but
// here's the breakdown:
// Shift still works as an anchor, but only one of the other keys can be down Ctrl (Command),
// Alt (Option), or Meta (Control).
@@ -448,8 +448,8 @@ void QQuickTextControlPrivate::setBlinkingCursorEnabled(bool enable)
{
Q_Q(QQuickTextControl);
- if (enable && qApp->styleHints()->cursorFlashTime() > 0)
- cursorBlinkTimer.start(qApp->styleHints()->cursorFlashTime() / 2, q);
+ if (enable && QGuiApplication::styleHints()->cursorFlashTime() > 0)
+ cursorBlinkTimer.start(QGuiApplication::styleHints()->cursorFlashTime() / 2, q);
else
cursorBlinkTimer.stop();
@@ -1031,7 +1031,7 @@ void QQuickTextControlPrivate::mousePressEvent(QMouseEvent *e, const QPointF &po
#endif
if (tripleClickTimer.isActive()
- && ((pos - tripleClickPoint).toPoint().manhattanLength() < qApp->styleHints()->startDragDistance())) {
+ && ((pos - tripleClickPoint).toPoint().manhattanLength() < QGuiApplication::styleHints()->startDragDistance())) {
cursor.movePosition(QTextCursor::StartOfBlock);
cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
@@ -1231,7 +1231,7 @@ void QQuickTextControlPrivate::mouseDoubleClickEvent(QMouseEvent *e, const QPoin
selectedWordOnDoubleClick = cursor;
tripleClickPoint = pos;
- tripleClickTimer.start(qApp->styleHints()->mouseDoubleClickInterval(), q);
+ tripleClickTimer.start(QGuiApplication::styleHints()->mouseDoubleClickInterval(), q);
if (doEmit) {
selectionChanged();
#ifndef QT_NO_CLIPBOARD
@@ -1258,7 +1258,7 @@ bool QQuickTextControlPrivate::sendMouseEventToInputContext(QMouseEvent *e, cons
if (cursorPos >= 0 && cursorPos <= layout->preeditAreaText().length()) {
if (e->type() == QEvent::MouseButtonRelease) {
- qApp->inputMethod()->invokeAction(QInputMethod::Click, cursorPos);
+ QGuiApplication::inputMethod()->invokeAction(QInputMethod::Click, cursorPos);
}
return true;
@@ -1676,7 +1676,7 @@ void QQuickTextControlPrivate::commitPreedit()
if (!hasImState)
return;
- qApp->inputMethod()->commit();
+ QGuiApplication::inputMethod()->commit();
if (!hasImState)
return;
@@ -1692,7 +1692,7 @@ void QQuickTextControlPrivate::cancelPreedit()
if (!hasImState)
return;
- qApp->inputMethod()->reset();
+ QGuiApplication::inputMethod()->reset();
QInputMethodEvent event;
QCoreApplication::sendEvent(q->parent(), &event);
diff --git a/src/quick/items/qquicktextcontrol_p.h b/src/quick/items/qquicktextcontrol_p.h
index d0af4a1cc9..c5f1bef067 100644
--- a/src/quick/items/qquicktextcontrol_p.h
+++ b/src/quick/items/qquicktextcontrol_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -162,9 +162,9 @@ public:
bool cursorOn() const;
protected:
- virtual void timerEvent(QTimerEvent *e);
+ void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
- virtual bool event(QEvent *e);
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QQuickTextControl)
diff --git a/src/quick/items/qquicktextcontrol_p_p.h b/src/quick/items/qquicktextcontrol_p_p.h
index bd07d86f9c..4c3e03a552 100644
--- a/src/quick/items/qquicktextcontrol_p_p.h
+++ b/src/quick/items/qquicktextcontrol_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquicktextdocument.cpp b/src/quick/items/qquicktextdocument.cpp
index 952db775b1..b34ae24461 100644
--- a/src/quick/items/qquicktextdocument.cpp
+++ b/src/quick/items/qquicktextdocument.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquicktextdocument.h b/src/quick/items/qquicktextdocument.h
index b392d95312..8f68c059e5 100644
--- a/src/quick/items/qquicktextdocument.h
+++ b/src/quick/items/qquicktextdocument.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp
index 99e64b55f9..8237ad10e4 100644
--- a/src/quick/items/qquicktextedit.cpp
+++ b/src/quick/items/qquicktextedit.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -40,15 +40,15 @@
#include "qquicktextnode_p.h"
#include "qquicktextnodeengine_p.h"
#include "qquicktextutil_p.h"
-#include <QtQuick/qsgsimplerectnode.h>
-#include <QtQml/qqmlinfo.h>
+#include <QtCore/qmath.h>
#include <QtGui/qguiapplication.h>
#include <QtGui/qevent.h>
#include <QtGui/qpainter.h>
#include <QtGui/qtextobject.h>
#include <QtGui/qtexttable.h>
-#include <QtCore/qmath.h>
+#include <QtQml/qqmlinfo.h>
+#include <QtQuick/qsgsimplerectnode.h>
#include <private/qqmlglobal_p.h>
#include <private/qqmlproperty_p.h>
@@ -211,10 +211,14 @@ QString QQuickTextEdit::text() const
The weight can be one of:
\list
+ \li Font.Thin
\li Font.Light
+ \li Font.ExtraLight
\li Font.Normal - the default
+ \li Font.Medium
\li Font.DemiBold
\li Font.Bold
+ \li Font.ExtraBold
\li Font.Black
\endlist
@@ -1232,15 +1236,21 @@ void QQuickTextEdit::setTextMargin(qreal margin)
\endlist
*/
-#ifndef QT_NO_IM
Qt::InputMethodHints QQuickTextEdit::inputMethodHints() const
{
+#ifdef QT_NO_IM
+ return Qt::ImhNone;
+#else
Q_D(const QQuickTextEdit);
return d->inputMethodHints;
+#endif // QT_NO_IM
}
void QQuickTextEdit::setInputMethodHints(Qt::InputMethodHints hints)
{
+#ifdef QT_NO_IM
+ Q_UNUSED(hints);
+#else
Q_D(QQuickTextEdit);
if (hints == d->inputMethodHints)
@@ -1249,8 +1259,8 @@ void QQuickTextEdit::setInputMethodHints(Qt::InputMethodHints hints)
d->inputMethodHints = hints;
updateInputMethod(Qt::ImHints);
emit inputMethodHintsChanged();
-}
#endif // QT_NO_IM
+}
void QQuickTextEdit::geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry)
@@ -1426,6 +1436,11 @@ void QQuickTextEdit::setReadOnly(bool r)
emit readOnlyChanged(r);
if (!d->selectByKeyboardSet)
emit selectByKeyboardChanged(!r);
+ if (r) {
+ setCursorVisible(false);
+ } else if (hasActiveFocus()) {
+ setCursorVisible(true);
+ }
}
bool QQuickTextEdit::isReadOnly() const
@@ -1828,6 +1843,10 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
int currentNodeSize = 0;
int nodeStart = firstDirtyPos;
QPointF basePosition(d->xoff, d->yoff);
+ QMatrix4x4 basePositionMatrix;
+ basePositionMatrix.translate(basePosition.x(), basePosition.y());
+ rootNode->setMatrix(basePositionMatrix);
+
QPointF nodeOffset;
TextNode *firstCleanNode = (nodeIterator != d->textNodeMap.end()) ? *nodeIterator : 0;
@@ -1839,7 +1858,6 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
frames.append(textFrame->childFrames());
rootNode->frameDecorationsNode->m_engine->addFrameDecorations(d->document, textFrame);
-
if (textFrame->lastPosition() < firstDirtyPos || (firstCleanNode && textFrame->firstPosition() >= firstCleanNode->startPos()))
continue;
node = d->createTextNode();
@@ -1860,7 +1878,7 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
nodeOffset = d->document->documentLayout()->frameBoundingRect(textFrame).topLeft();
updateNodeTransform(node, nodeOffset);
while (!it.atEnd())
- node->m_engine->addTextBlock(d->document, (it++).currentBlock(), basePosition - nodeOffset, d->color, QColor(), selectionStart(), selectionEnd() - 1);
+ node->m_engine->addTextBlock(d->document, (it++).currentBlock(), -nodeOffset, d->color, QColor(), selectionStart(), selectionEnd() - 1);
nodeStart = textFrame->firstPosition();
} else {
// Having nodes spanning across frame boundaries will break the current bookkeeping mechanism. We need to prevent that.
@@ -1883,7 +1901,7 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
nodeStart = block.position();
}
- node->m_engine->addTextBlock(d->document, block, basePosition - nodeOffset, d->color, QColor(), selectionStart(), selectionEnd() - 1);
+ node->m_engine->addTextBlock(d->document, block, -nodeOffset, d->color, QColor(), selectionStart(), selectionEnd() - 1);
currentNodeSize += block.length();
if ((it.atEnd()) || (firstCleanNode && block.next().position() >= firstCleanNode->startPos())) // last node that needed replacing or last block of the frame
@@ -1924,10 +1942,10 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
std::sort(d->textNodeMap.begin(), d->textNodeMap.end(), &comesBefore);
}
- if (d->cursorComponent == 0 && !isReadOnly()) {
+ if (d->cursorComponent == 0) {
QSGRectangleNode* cursor = 0;
- if (d->cursorVisible && d->control->cursorOn())
- cursor = d->sceneGraphContext()->createRectangleNode(cursorRectangle(), d->color);
+ if (!isReadOnly() && d->cursorVisible && d->control->cursorOn())
+ cursor = d->sceneGraphContext()->createRectangleNode(d->control->cursorRect(), d->color);
rootNode->resetCursorNode(cursor);
}
@@ -1983,7 +2001,6 @@ bool QQuickTextEdit::canRedo() const
return d->document->isRedoAvailable();
}
-#ifndef QT_NO_IM
/*!
\qmlproperty bool QtQuick::TextEdit::inputMethodComposing
@@ -1998,10 +2015,13 @@ bool QQuickTextEdit::canRedo() const
*/
bool QQuickTextEdit::isInputMethodComposing() const
{
+#ifdef QT_NO_IM
+ return false;
+#else
Q_D(const QQuickTextEdit);
return d->control->hasImState();
-}
#endif // QT_NO_IM
+}
void QQuickTextEditPrivate::init()
{
@@ -2284,7 +2304,14 @@ void QQuickTextEdit::updateWholeDocument()
void QQuickTextEdit::invalidateBlock(const QTextBlock &block)
{
+ Q_D(QQuickTextEdit);
markDirtyNodesForRange(block.position(), block.position() + block.length(), 0);
+
+ polish();
+ if (isComponentComplete()) {
+ d->updateType = QQuickTextEditPrivate::UpdatePaintNode;
+ update();
+ }
}
void QQuickTextEdit::updateCursor()
@@ -2386,17 +2413,18 @@ void QQuickTextEditPrivate::handleFocusEvent(QFocusEvent *event)
{
Q_Q(QQuickTextEdit);
bool focus = event->type() == QEvent::FocusIn;
- q->setCursorVisible(focus);
+ if (!q->isReadOnly())
+ q->setCursorVisible(focus);
control->processEvent(event, QPointF(-xoff, -yoff));
if (focus) {
q->q_updateAlignment();
#ifndef QT_NO_IM
if (focusOnPress && !q->isReadOnly())
qGuiApp->inputMethod()->show();
- q->connect(qApp->inputMethod(), SIGNAL(inputDirectionChanged(Qt::LayoutDirection)),
+ q->connect(QGuiApplication::inputMethod(), SIGNAL(inputDirectionChanged(Qt::LayoutDirection)),
q, SLOT(q_updateAlignment()));
} else {
- q->disconnect(qApp->inputMethod(), SIGNAL(inputDirectionChanged(Qt::LayoutDirection)),
+ q->disconnect(QGuiApplication::inputMethod(), SIGNAL(inputDirectionChanged(Qt::LayoutDirection)),
q, SLOT(q_updateAlignment()));
#endif
}
diff --git a/src/quick/items/qquicktextedit_p.h b/src/quick/items/qquicktextedit_p.h
index da88fd4917..bf6763f772 100644
--- a/src/quick/items/qquicktextedit_p.h
+++ b/src/quick/items/qquicktextedit_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -81,18 +81,14 @@ class Q_QUICK_PRIVATE_EXPORT QQuickTextEdit : public QQuickImplicitSizeItem
Q_PROPERTY(bool activeFocusOnPress READ focusOnPress WRITE setFocusOnPress NOTIFY activeFocusOnPressChanged)
Q_PROPERTY(bool persistentSelection READ persistentSelection WRITE setPersistentSelection NOTIFY persistentSelectionChanged)
Q_PROPERTY(qreal textMargin READ textMargin WRITE setTextMargin NOTIFY textMarginChanged)
-#ifndef QT_NO_IM
Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints NOTIFY inputMethodHintsChanged)
-#endif
Q_PROPERTY(bool selectByKeyboard READ selectByKeyboard WRITE setSelectByKeyboard NOTIFY selectByKeyboardChanged REVISION 1)
Q_PROPERTY(bool selectByMouse READ selectByMouse WRITE setSelectByMouse NOTIFY selectByMouseChanged)
Q_PROPERTY(SelectionMode mouseSelectionMode READ mouseSelectionMode WRITE setMouseSelectionMode NOTIFY mouseSelectionModeChanged)
Q_PROPERTY(bool canPaste READ canPaste NOTIFY canPasteChanged)
Q_PROPERTY(bool canUndo READ canUndo NOTIFY canUndoChanged)
Q_PROPERTY(bool canRedo READ canRedo NOTIFY canRedoChanged)
-#ifndef QT_NO_IM
Q_PROPERTY(bool inputMethodComposing READ isInputMethodComposing NOTIFY inputMethodComposingChanged)
-#endif
Q_PROPERTY(QUrl baseUrl READ baseUrl WRITE setBaseUrl RESET resetBaseUrl NOTIFY baseUrlChanged)
Q_PROPERTY(RenderType renderType READ renderType WRITE setRenderType NOTIFY renderTypeChanged)
Q_PROPERTY(QQuickTextDocument *textDocument READ textDocument FINAL REVISION 1)
@@ -192,10 +188,8 @@ public:
qreal textMargin() const;
void setTextMargin(qreal margin);
-#ifndef QT_NO_IM
Qt::InputMethodHints inputMethodHints() const;
void setInputMethodHints(Qt::InputMethodHints hints);
-#endif
bool selectByKeyboard() const;
void setSelectByKeyboard(bool);
@@ -211,7 +205,7 @@ public:
bool canUndo() const;
bool canRedo() const;
- virtual void componentComplete();
+ void componentComplete() Q_DECL_OVERRIDE;
/* FROM EDIT */
void setReadOnly(bool);
@@ -220,7 +214,7 @@ public:
QRectF cursorRectangle() const;
#ifndef QT_NO_IM
- QVariant inputMethodQuery(Qt::InputMethodQuery property) const;
+ QVariant inputMethodQuery(Qt::InputMethodQuery property) const Q_DECL_OVERRIDE;
Q_REVISION(4) Q_INVOKABLE QVariant inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const;
#endif
@@ -236,12 +230,10 @@ public:
Q_INVOKABLE void moveCursorSelection(int pos);
Q_INVOKABLE void moveCursorSelection(int pos, SelectionMode mode);
- QRectF boundingRect() const;
- QRectF clipRect() const;
+ QRectF boundingRect() const Q_DECL_OVERRIDE;
+ QRectF clipRect() const Q_DECL_OVERRIDE;
-#ifndef QT_NO_IM
bool isInputMethodComposing() const;
-#endif
RenderType renderType() const;
void setRenderType(RenderType renderType);
@@ -286,14 +278,10 @@ Q_SIGNALS:
void canPasteChanged();
void canUndoChanged();
void canRedoChanged();
-#ifndef QT_NO_IM
void inputMethodComposingChanged();
-#endif
void effectiveHorizontalAlignmentChanged();
void baseUrlChanged();
-#ifndef QT_NO_IM
void inputMethodHintsChanged();
-#endif
void renderTypeChanged();
public Q_SLOTS:
@@ -333,29 +321,29 @@ private:
void invalidateFontCaches();
protected:
- virtual void geometryChanged(const QRectF &newGeometry,
- const QRectF &oldGeometry);
+ void geometryChanged(const QRectF &newGeometry,
+ const QRectF &oldGeometry) Q_DECL_OVERRIDE;
- bool event(QEvent *);
- void keyPressEvent(QKeyEvent *);
- void keyReleaseEvent(QKeyEvent *);
- void focusInEvent(QFocusEvent *event);
- void focusOutEvent(QFocusEvent *event);
+ bool event(QEvent *) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
+ void keyReleaseEvent(QKeyEvent *) Q_DECL_OVERRIDE;
+ void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
+ void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
- void hoverEnterEvent(QHoverEvent *event);
- void hoverMoveEvent(QHoverEvent *event);
- void hoverLeaveEvent(QHoverEvent *event);
+ void hoverEnterEvent(QHoverEvent *event) Q_DECL_OVERRIDE;
+ void hoverMoveEvent(QHoverEvent *event) Q_DECL_OVERRIDE;
+ void hoverLeaveEvent(QHoverEvent *event) Q_DECL_OVERRIDE;
// mouse filter?
- void mousePressEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
- void mouseDoubleClickEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
#ifndef QT_NO_IM
- void inputMethodEvent(QInputMethodEvent *e);
+ void inputMethodEvent(QInputMethodEvent *e) Q_DECL_OVERRIDE;
#endif
- QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData);
- void updatePolish();
+ QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData) Q_DECL_OVERRIDE;
+ void updatePolish() Q_DECL_OVERRIDE;
friend class QQuickTextUtil;
friend class QQuickTextDocument;
diff --git a/src/quick/items/qquicktextedit_p_p.h b/src/quick/items/qquicktextedit_p_p.h
index ae00303dd1..0cf0f46532 100644
--- a/src/quick/items/qquicktextedit_p_p.h
+++ b/src/quick/items/qquicktextedit_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -117,8 +117,8 @@ public:
void relayoutDocument();
bool determineHorizontalAlignment();
bool setHAlign(QQuickTextEdit::HAlignment, bool forceAlign = false);
- void mirrorChange();
- qreal getImplicitWidth() const;
+ void mirrorChange() Q_DECL_OVERRIDE;
+ qreal getImplicitWidth() const Q_DECL_OVERRIDE;
Qt::LayoutDirection textDirection(const QString &text) const;
bool isLinkHoveredConnected();
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index c45f3dc40c..5c67d914a5 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -78,7 +78,7 @@ DEFINE_BOOL_CONFIG_OPTION(qmlDisableDistanceField, QML_DISABLE_DISTANCEFIELD)
and setting \l echoMode to an appropriate value enables TextInput to be used for
a password input field.
- On Mac OS X, the Up/Down key bindings for Home/End are explicitly disabled.
+ On OS X, the Up/Down key bindings for Home/End are explicitly disabled.
If you want such bindings (on any platform), you will need to construct them in QML.
\sa TextEdit, Text
@@ -234,10 +234,14 @@ QString QQuickTextInputPrivate::realText() const
The weight can be one of:
\list
+ \li Font.Thin
\li Font.Light
+ \li Font.ExtraLight
\li Font.Normal - the default
+ \li Font.Medium
\li Font.DemiBold
\li Font.Bold
+ \li Font.ExtraBold
\li Font.Black
\endlist
@@ -543,7 +547,7 @@ Qt::LayoutDirection QQuickTextInputPrivate::layoutDirection() const
direction = textDirection();
#ifndef QT_NO_IM
if (direction == Qt::LayoutDirectionAuto)
- direction = qApp->inputMethod()->inputDirection();
+ direction = QGuiApplication::inputMethod()->inputDirection();
#endif
}
return (direction == Qt::LayoutDirectionAuto) ? Qt::LeftToRight : direction;
@@ -556,7 +560,7 @@ bool QQuickTextInputPrivate::determineHorizontalAlignment()
Qt::LayoutDirection direction = textDirection();
#ifndef QT_NO_IM
if (direction == Qt::LayoutDirectionAuto)
- direction = qApp->inputMethod()->inputDirection();
+ direction = QGuiApplication::inputMethod()->inputDirection();
#endif
return setHAlign(direction == Qt::RightToLeft ? QQuickTextInput::AlignRight : QQuickTextInput::AlignLeft);
}
@@ -658,6 +662,12 @@ void QQuickTextInput::setReadOnly(bool ro)
q_canPasteChanged();
d->emitUndoRedoChanged();
emit readOnlyChanged(ro);
+ if (ro) {
+ setCursorVisible(false);
+ } else if (hasActiveFocus()) {
+ setCursorVisible(true);
+ }
+ update();
}
/*!
@@ -727,7 +737,7 @@ void QQuickTextInput::setCursorVisible(bool on)
if (on && isComponentComplete())
QQuickTextUtil::createCursor(d);
if (!d->cursorItem) {
- d->setCursorBlinkPeriod(on ? qApp->styleHints()->cursorFlashTime() : 0);
+ d->setCursorBlinkPeriod(on ? QGuiApplication::styleHints()->cursorFlashTime() : 0);
d->updateType = QQuickTextInputPrivate::UpdatePaintNode;
polish();
update();
@@ -1028,6 +1038,8 @@ void QQuickDoubleValidator::resetLocaleName()
}
}
+#endif // QT_NO_VALIDATOR
+
/*!
\qmlproperty real QtQuick::DoubleValidator::top
@@ -1106,12 +1118,19 @@ void QQuickDoubleValidator::resetLocaleName()
QValidator* QQuickTextInput::validator() const
{
+#ifdef QT_NO_VALIDATOR
+ return 0;
+#else
Q_D(const QQuickTextInput);
return d->m_validator;
+#endif // QT_NO_VALIDATOR
}
void QQuickTextInput::setValidator(QValidator* v)
{
+#ifdef QT_NO_VALIDATOR
+ Q_UNUSED(v);
+#else
Q_D(QQuickTextInput);
if (d->m_validator == v)
return;
@@ -1134,14 +1153,15 @@ void QQuickTextInput::setValidator(QValidator* v)
d->checkIsValid();
emit validatorChanged();
+#endif // QT_NO_VALIDATOR
}
+#ifndef QT_NO_VALIDATOR
void QQuickTextInput::q_validatorChanged()
{
Q_D(QQuickTextInput);
d->checkIsValid();
}
-
#endif // QT_NO_VALIDATOR
void QQuickTextInputPrivate::checkIsValid()
@@ -1274,7 +1294,6 @@ void QQuickTextInput::setEchoMode(QQuickTextInput::EchoMode echo)
emit echoModeChanged(echoMode());
}
-#ifndef QT_NO_IM
/*!
\qmlproperty enumeration QtQuick::TextInput::inputMethodHints
@@ -1323,12 +1342,19 @@ void QQuickTextInput::setEchoMode(QQuickTextInput::EchoMode echo)
Qt::InputMethodHints QQuickTextInput::inputMethodHints() const
{
+#ifdef QT_NO_IM
+ return Qt::ImhNone;
+#else
Q_D(const QQuickTextInput);
return d->inputMethodHints;
+#endif // QT_NO_IM
}
void QQuickTextInput::setInputMethodHints(Qt::InputMethodHints hints)
{
+#ifdef QT_NO_IM
+ Q_UNUSED(hints);
+#else
Q_D(QQuickTextInput);
if (hints == d->inputMethodHints)
@@ -1337,8 +1363,8 @@ void QQuickTextInput::setInputMethodHints(Qt::InputMethodHints hints)
d->inputMethodHints = hints;
updateInputMethod(Qt::ImHints);
emit inputMethodHintsChanged();
-}
#endif // QT_NO_IM
+}
/*!
\qmlproperty Component QtQuick::TextInput::cursorDelegate
@@ -1553,7 +1579,7 @@ void QQuickTextInput::mousePressEvent(QMouseEvent *event)
d->selectPressed = true;
QPointF distanceVector = d->pressPos - d->tripleClickStartPoint;
if (d->hasPendingTripleClick()
- && distanceVector.manhattanLength() < qApp->styleHints()->startDragDistance()) {
+ && distanceVector.manhattanLength() < QGuiApplication::styleHints()->startDragDistance()) {
event->setAccepted(true);
selectAll();
return;
@@ -1564,15 +1590,8 @@ void QQuickTextInput::mousePressEvent(QMouseEvent *event)
int cursor = d->positionAt(event->localPos());
d->moveCursor(cursor, mark);
- if (d->focusOnPress) {
- bool hadActiveFocus = hasActiveFocus();
- forceActiveFocus();
-#ifndef QT_NO_IM
- // re-open input panel on press if already focused
- if (hasActiveFocus() && hadActiveFocus && !d->m_readOnly)
- qGuiApp->inputMethod()->show();
-#endif
- }
+ if (d->focusOnPress && !qGuiApp->styleHints()->setFocusOnTouchRelease())
+ ensureActiveFocus();
event->setAccepted(true);
}
@@ -1582,7 +1601,7 @@ void QQuickTextInput::mouseMoveEvent(QMouseEvent *event)
Q_D(QQuickTextInput);
if (d->selectPressed) {
- if (qAbs(int(event->localPos().x() - d->pressPos.x())) > qApp->styleHints()->startDragDistance())
+ if (qAbs(int(event->localPos().x() - d->pressPos.x())) > QGuiApplication::styleHints()->startDragDistance())
setKeepMouseGrab(true);
#ifndef QT_NO_IM
@@ -1622,6 +1641,10 @@ void QQuickTextInput::mouseReleaseEvent(QMouseEvent *event)
}
}
#endif
+
+ if (d->focusOnPress && qGuiApp->styleHints()->setFocusOnTouchRelease())
+ ensureActiveFocus();
+
if (!event->isAccepted())
QQuickImplicitSizeItem::mouseReleaseEvent(event);
}
@@ -1634,7 +1657,7 @@ bool QQuickTextInputPrivate::sendMouseEventToInputContext(QMouseEvent *event)
int mousePos = tmp_cursor - m_cursor;
if (mousePos >= 0 && mousePos <= m_textLayout.preeditAreaText().length()) {
if (event->type() == QEvent::MouseButtonRelease) {
- qApp->inputMethod()->invokeAction(QInputMethod::Click, mousePos);
+ QGuiApplication::inputMethod()->invokeAction(QInputMethod::Click, mousePos);
}
return true;
}
@@ -1854,6 +1877,19 @@ void QQuickTextInput::invalidateFontCaches()
d->m_textLayout.engine()->resetFontEngineCache();
}
+void QQuickTextInput::ensureActiveFocus()
+{
+ Q_D(QQuickTextInput);
+
+ bool hadActiveFocus = hasActiveFocus();
+ forceActiveFocus();
+#ifndef QT_NO_IM
+ // re-open input panel on press if already focused
+ if (hasActiveFocus() && hadActiveFocus && !d->m_readOnly)
+ qGuiApp->inputMethod()->show();
+#endif
+}
+
QSGNode *QQuickTextInput::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data)
{
Q_UNUSED(data);
@@ -2576,13 +2612,14 @@ void QQuickTextInputPrivate::handleFocusEvent(QFocusEvent *event)
{
Q_Q(QQuickTextInput);
bool focus = event->gotFocus();
- q->setCursorVisible(focus);
+ if (!m_readOnly)
+ q->setCursorVisible(focus);
if (focus) {
q->q_updateAlignment();
#ifndef QT_NO_IM
if (focusOnPress && !m_readOnly)
qGuiApp->inputMethod()->show();
- q->connect(qApp->inputMethod(), SIGNAL(inputDirectionChanged(Qt::LayoutDirection)),
+ q->connect(QGuiApplication::inputMethod(), SIGNAL(inputDirectionChanged(Qt::LayoutDirection)),
q, SLOT(q_updateAlignment()));
#endif
} else {
@@ -2600,7 +2637,7 @@ void QQuickTextInputPrivate::handleFocusEvent(QFocusEvent *event)
emit q->editingFinished();
#ifndef QT_NO_IM
- q->disconnect(qApp->inputMethod(), SIGNAL(inputDirectionChanged(Qt::LayoutDirection)),
+ q->disconnect(QGuiApplication::inputMethod(), SIGNAL(inputDirectionChanged(Qt::LayoutDirection)),
q, SLOT(q_updateAlignment()));
#endif
}
@@ -2613,7 +2650,6 @@ void QQuickTextInput::focusOutEvent(QFocusEvent *event)
QQuickImplicitSizeItem::focusOutEvent(event);
}
-#ifndef QT_NO_IM
/*!
\qmlproperty bool QtQuick::TextInput::inputMethodComposing
@@ -2628,10 +2664,13 @@ void QQuickTextInput::focusOutEvent(QFocusEvent *event)
*/
bool QQuickTextInput::isInputMethodComposing() const
{
+#ifdef QT_NO_IM
+ return false;
+#else
Q_D(const QQuickTextInput);
return d->hasImState;
-}
#endif
+}
void QQuickTextInputPrivate::init()
{
@@ -2991,7 +3030,7 @@ void QQuickTextInputPrivate::commitPreedit()
if (!hasImState)
return;
- qApp->inputMethod()->commit();
+ QGuiApplication::inputMethod()->commit();
if (!hasImState)
return;
@@ -3007,7 +3046,7 @@ void QQuickTextInputPrivate::cancelPreedit()
if (!hasImState)
return;
- qApp->inputMethod()->reset();
+ QGuiApplication::inputMethod()->reset();
QInputMethodEvent ev;
QCoreApplication::sendEvent(q, &ev);
diff --git a/src/quick/items/qquicktextinput_p.h b/src/quick/items/qquicktextinput_p.h
index 34b0c81495..3bcbe0fa25 100644
--- a/src/quick/items/qquicktextinput_p.h
+++ b/src/quick/items/qquicktextinput_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -74,13 +74,9 @@ class Q_QUICK_PRIVATE_EXPORT QQuickTextInput : public QQuickImplicitSizeItem
Q_PROPERTY(QString selectedText READ selectedText NOTIFY selectedTextChanged)
Q_PROPERTY(int maximumLength READ maxLength WRITE setMaxLength NOTIFY maximumLengthChanged)
-#ifndef QT_NO_VALIDATOR
Q_PROPERTY(QValidator* validator READ validator WRITE setValidator NOTIFY validatorChanged)
-#endif
Q_PROPERTY(QString inputMask READ inputMask WRITE setInputMask NOTIFY inputMaskChanged)
-#ifndef QT_NO_IM
Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints NOTIFY inputMethodHintsChanged)
-#endif
Q_PROPERTY(bool acceptableInput READ hasAcceptableInput NOTIFY acceptableInputChanged)
Q_PROPERTY(EchoMode echoMode READ echoMode WRITE setEchoMode NOTIFY echoModeChanged)
@@ -95,9 +91,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickTextInput : public QQuickImplicitSizeItem
Q_PROPERTY(bool canPaste READ canPaste NOTIFY canPasteChanged)
Q_PROPERTY(bool canUndo READ canUndo NOTIFY canUndoChanged)
Q_PROPERTY(bool canRedo READ canRedo NOTIFY canRedoChanged)
-#ifndef QT_NO_IM
Q_PROPERTY(bool inputMethodComposing READ isInputMethodComposing NOTIFY inputMethodComposingChanged)
-#endif
Q_PROPERTY(qreal contentWidth READ contentWidth NOTIFY contentSizeChanged)
Q_PROPERTY(qreal contentHeight READ contentHeight NOTIFY contentSizeChanged)
Q_PROPERTY(RenderType renderType READ renderType WRITE setRenderType NOTIFY renderTypeChanged)
@@ -106,7 +100,7 @@ public:
QQuickTextInput(QQuickItem * parent=0);
~QQuickTextInput();
- void componentComplete();
+ void componentComplete() Q_DECL_OVERRIDE;
enum EchoMode {//To match QLineEdit::EchoMode
Normal,
@@ -205,10 +199,9 @@ public:
int maxLength() const;
void setMaxLength(int ml);
-#ifndef QT_NO_VALIDATOR
QValidator * validator() const;
void setValidator(QValidator* v);
-#endif
+
QString inputMask() const;
void setInputMask(const QString &im);
@@ -245,24 +238,22 @@ public:
bool hasAcceptableInput() const;
#ifndef QT_NO_IM
- QVariant inputMethodQuery(Qt::InputMethodQuery property) const;
+ QVariant inputMethodQuery(Qt::InputMethodQuery property) const Q_DECL_OVERRIDE;
Q_REVISION(3) Q_INVOKABLE QVariant inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const;
#endif
- QRectF boundingRect() const;
- QRectF clipRect() const;
+ QRectF boundingRect() const Q_DECL_OVERRIDE;
+ QRectF clipRect() const Q_DECL_OVERRIDE;
bool canPaste() const;
bool canUndo() const;
bool canRedo() const;
-#ifndef QT_NO_IM
bool isInputMethodComposing() const;
Qt::InputMethodHints inputMethodHints() const;
void setInputMethodHints(Qt::InputMethodHints hints);
-#endif
Q_INVOKABLE QString getText(int start, int end) const;
@@ -304,38 +295,35 @@ Q_SIGNALS:
void canPasteChanged();
void canUndoChanged();
void canRedoChanged();
-#ifndef QT_NO_IM
void inputMethodComposingChanged();
-#endif
void effectiveHorizontalAlignmentChanged();
void contentSizeChanged();
-#ifndef QT_NO_IM
void inputMethodHintsChanged();
-#endif
void renderTypeChanged();
private:
void invalidateFontCaches();
+ void ensureActiveFocus();
protected:
- virtual void geometryChanged(const QRectF &newGeometry,
- const QRectF &oldGeometry);
-
- void mousePressEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
- void mouseDoubleClickEvent(QMouseEvent *event);
- void keyPressEvent(QKeyEvent* ev);
+ void geometryChanged(const QRectF &newGeometry,
+ const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent* ev) Q_DECL_OVERRIDE;
#ifndef QT_NO_IM
- void inputMethodEvent(QInputMethodEvent *);
+ void inputMethodEvent(QInputMethodEvent *) Q_DECL_OVERRIDE;
#endif
- void mouseUngrabEvent();
- bool event(QEvent *e);
- void focusOutEvent(QFocusEvent *event);
- void focusInEvent(QFocusEvent *event);
- void timerEvent(QTimerEvent *event);
- QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data);
- void updatePolish();
+ void mouseUngrabEvent() Q_DECL_OVERRIDE;
+ bool event(QEvent *e) Q_DECL_OVERRIDE;
+ void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
+ void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
+ QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) Q_DECL_OVERRIDE;
+ void updatePolish() Q_DECL_OVERRIDE;
public Q_SLOTS:
void selectAll();
diff --git a/src/quick/items/qquicktextinput_p_p.h b/src/quick/items/qquicktextinput_p_p.h
index 7d9f3ff9ce..3038573bb3 100644
--- a/src/quick/items/qquicktextinput_p_p.h
+++ b/src/quick/items/qquicktextinput_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -102,8 +102,8 @@ public:
, updateType(UpdatePaintNode)
, mouseSelectionMode(QQuickTextInput::SelectCharacters)
, m_layoutDirection(Qt::LayoutDirectionAuto)
- , m_passwordCharacter(qApp->styleHints()->passwordMaskCharacter())
- , m_passwordMaskDelay(qApp->styleHints()->passwordMaskDelay())
+ , m_passwordCharacter(QGuiApplication::styleHints()->passwordMaskCharacter())
+ , m_passwordMaskDelay(QGuiApplication::styleHints()->passwordMaskDelay())
, focusOnPress(true)
, cursorVisible(false)
, cursorPending(false)
@@ -145,7 +145,7 @@ public:
void updateVerticalScroll();
bool determineHorizontalAlignment();
bool setHAlign(QQuickTextInput::HAlignment, bool forceAlign = false);
- void mirrorChange();
+ void mirrorChange() Q_DECL_OVERRIDE;
bool sendMouseEventToInputContext(QMouseEvent *event);
#ifndef QT_NO_IM
Qt::InputMethodHints effectiveInputMethodHints() const;
@@ -276,11 +276,11 @@ public:
return t->d_func();
}
bool hasPendingTripleClick() const {
- return !tripleClickTimer.hasExpired(qApp->styleHints()->mouseDoubleClickInterval());
+ return !tripleClickTimer.hasExpired(QGuiApplication::styleHints()->mouseDoubleClickInterval());
}
void setNativeCursorEnabled(bool enabled) {
- setCursorBlinkPeriod(enabled && cursorVisible ? qApp->styleHints()->cursorFlashTime() : 0); }
+ setCursorBlinkPeriod(enabled && cursorVisible ? QGuiApplication::styleHints()->cursorFlashTime() : 0); }
int nextMaskBlank(int pos)
{
@@ -418,7 +418,7 @@ public:
void updateLayout();
void updateBaselineOffset();
- qreal getImplicitWidth() const;
+ qreal getImplicitWidth() const Q_DECL_OVERRIDE;
private:
void removeSelectedText();
diff --git a/src/quick/items/qquicktextnode.cpp b/src/quick/items/qquicktextnode.cpp
index 5f246682ec..010a443d18 100644
--- a/src/quick/items/qquicktextnode.cpp
+++ b/src/quick/items/qquicktextnode.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -42,7 +42,6 @@
#include <QtQuick/private/qsgcontext_p.h>
#include <QtCore/qpoint.h>
-#include <qmath.h>
#include <qtextdocument.h>
#include <qtextlayout.h>
#include <qabstracttextdocumentlayout.h>
diff --git a/src/quick/items/qquicktextnode_p.h b/src/quick/items/qquicktextnode_p.h
index 7f9cd77152..c7b9804ea6 100644
--- a/src/quick/items/qquicktextnode_p.h
+++ b/src/quick/items/qquicktextnode_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquicktextnodeengine.cpp b/src/quick/items/qquicktextnodeengine.cpp
index e99c5c158b..7903f79e89 100644
--- a/src/quick/items/qquicktextnodeengine.cpp
+++ b/src/quick/items/qquicktextnodeengine.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -50,6 +50,14 @@
QT_BEGIN_NAMESPACE
+QQuickTextNodeEngine::BinaryTreeNodeKey::BinaryTreeNodeKey(BinaryTreeNode *node)
+ : fontEngine(QRawFontPrivate::get(node->glyphRun.rawFont())->fontEngine)
+ , clipNode(node->clipNode)
+ , color(node->color.rgba())
+ , selectionState(node->selectionState)
+{
+}
+
QQuickTextNodeEngine::BinaryTreeNode::BinaryTreeNode(const QGlyphRun &g,
SelectionState selState,
const QRectF &brect,
@@ -191,7 +199,10 @@ void QQuickTextNodeEngine::addTextDecorations(const QVarLengthArray<TextDecorati
{
QRectF &rect = textDecoration.rect;
- rect.setY(qRound(rect.y() + m_currentLine.ascent() + offset));
+ rect.setY(qRound(rect.y()
+ + m_currentLine.ascent()
+ + (m_currentLine.leadingIncluded() ? m_currentLine.leading() : qreal(0.0f))
+ + offset));
rect.setHeight(thickness);
}
@@ -667,61 +678,82 @@ void QQuickTextNodeEngine::addFrameDecorations(QTextDocument *document, QTextFra
}
}
-void QQuickTextNodeEngine::addToSceneGraph(QQuickTextNode *parentNode,
- QQuickText::TextStyle style,
- const QColor &styleColor)
+uint qHash(const QQuickTextNodeEngine::BinaryTreeNodeKey &key)
{
- if (m_currentLine.isValid())
- processCurrentLine();
+ // Just use the default hash for pairs
+ return qHash(qMakePair(key.fontEngine, qMakePair(key.clipNode,
+ qMakePair(key.color, key.selectionState))));
+}
+
+void QQuickTextNodeEngine::mergeProcessedNodes(QList<BinaryTreeNode *> *regularNodes,
+ QList<BinaryTreeNode *> *imageNodes)
+{
+ QHash<BinaryTreeNodeKey, QList<BinaryTreeNode *> > map;
- // Then, go through all the nodes for all lines and combine all QGlyphRuns with a common
- // font, selection state and clip node.
- typedef QPair<QFontEngine *, QPair<QQuickDefaultClipNode *, QPair<QRgb, int> > > KeyType;
- QHash<KeyType, BinaryTreeNode *> map;
- QList<BinaryTreeNode *> nodes;
- QList<BinaryTreeNode *> imageNodes;
for (int i = 0; i < m_processedNodes.size(); ++i) {
BinaryTreeNode *node = m_processedNodes.data() + i;
if (node->image.isNull()) {
- QGlyphRun glyphRun = node->glyphRun;
- QRawFont rawFont = glyphRun.rawFont();
- QRawFontPrivate *rawFontD = QRawFontPrivate::get(rawFont);
+ BinaryTreeNodeKey key(node);
- QFontEngine *fontEngine = rawFontD->fontEngine;
+ QList<BinaryTreeNode *> &nodes = map[key];
+ if (nodes.isEmpty())
+ regularNodes->append(node);
- KeyType key(qMakePair(fontEngine,
- qMakePair(node->clipNode,
- qMakePair(node->color.rgba(), int(node->selectionState)))));
+ nodes.append(node);
+ } else {
+ imageNodes->append(node);
+ }
+ }
- BinaryTreeNode *otherNode = map.value(key, 0);
- if (otherNode != 0) {
- QGlyphRun &otherGlyphRun = otherNode->glyphRun;
+ for (int i = 0; i < regularNodes->size(); ++i) {
+ BinaryTreeNode *primaryNode = regularNodes->at(i);
+ BinaryTreeNodeKey key(primaryNode);
- QVector<quint32> otherGlyphIndexes = otherGlyphRun.glyphIndexes();
- QVector<QPointF> otherGlyphPositions = otherGlyphRun.positions();
+ const QList<BinaryTreeNode *> &nodes = map.value(key);
+ Q_ASSERT(nodes.first() == primaryNode);
- otherGlyphIndexes += glyphRun.glyphIndexes();
+ int count = 0;
+ for (int j = 0; j < nodes.size(); ++j)
+ count += nodes.at(j)->glyphRun.glyphIndexes().size();
- QVector<QPointF> glyphPositions = glyphRun.positions();
- otherGlyphPositions.reserve(otherGlyphPositions.size() + glyphPositions.size());
- for (int j = 0; j < glyphPositions.size(); ++j) {
- otherGlyphPositions += glyphPositions.at(j) + (node->position - otherNode->position);
- }
+ if (count != primaryNode->glyphRun.glyphIndexes().size()) {
+ QGlyphRun &glyphRun = primaryNode->glyphRun;
+ QVector<quint32> glyphIndexes = glyphRun.glyphIndexes();
+ glyphIndexes.reserve(count);
- otherGlyphRun.setGlyphIndexes(otherGlyphIndexes);
- otherGlyphRun.setPositions(otherGlyphPositions);
+ QVector<QPointF> glyphPositions = glyphRun.positions();
+ glyphPositions.reserve(count);
- otherNode->ranges += node->ranges;
+ for (int j = 1; j < nodes.size(); ++j) {
+ BinaryTreeNode *otherNode = nodes.at(j);
+ glyphIndexes += otherNode->glyphRun.glyphIndexes();
+ primaryNode->ranges += otherNode->ranges;
- } else {
- map.insert(key, node);
- nodes.append(node);
+ QVector<QPointF> otherPositions = otherNode->glyphRun.positions();
+ for (int k = 0; k < otherPositions.size(); ++k)
+ glyphPositions += otherPositions.at(k) + (otherNode->position - primaryNode->position);
}
- } else {
- imageNodes.append(node);
+
+ Q_ASSERT(glyphPositions.size() == count);
+ Q_ASSERT(glyphIndexes.size() == count);
+
+ glyphRun.setGlyphIndexes(glyphIndexes);
+ glyphRun.setPositions(glyphPositions);
}
}
+}
+
+void QQuickTextNodeEngine::addToSceneGraph(QQuickTextNode *parentNode,
+ QQuickText::TextStyle style,
+ const QColor &styleColor)
+{
+ if (m_currentLine.isValid())
+ processCurrentLine();
+
+ QList<BinaryTreeNode *> nodes;
+ QList<BinaryTreeNode *> imageNodes;
+ mergeProcessedNodes(&nodes, &imageNodes);
for (int i = 0; i < m_backgrounds.size(); ++i) {
const QRectF &rect = m_backgrounds.at(i).first;
@@ -980,7 +1012,18 @@ void QQuickTextNodeEngine::addTextBlock(QTextDocument *textDocument, const QText
continue;
QTextCharFormat charFormat = fragment.charFormat();
- setPosition(blockPosition);
+ QFont font(charFormat.font());
+ QFontMetricsF fontMetrics(font);
+
+ int fontHeight = fontMetrics.descent() + fontMetrics.ascent();
+ int valign = charFormat.verticalAlignment();
+ if (valign == QTextCharFormat::AlignSuperScript)
+ setPosition(QPointF(blockPosition.x(), blockPosition.y() - fontHeight / 2));
+ else if (valign == QTextCharFormat::AlignSubScript)
+ setPosition(QPointF(blockPosition.x(), blockPosition.y() + fontHeight / 6));
+ else
+ setPosition(blockPosition);
+
if (text.contains(QChar::ObjectReplacementCharacter)) {
QTextFrame *frame = qobject_cast<QTextFrame *>(textDocument->objectForFormat(charFormat));
if (frame && frame->frameFormat().position() == QTextFrameFormat::InFlow) {
@@ -1016,6 +1059,13 @@ void QQuickTextNodeEngine::addTextBlock(QTextDocument *textDocument, const QText
fragmentEnd += preeditLength;
}
#endif
+ if (charFormat.background().style() != Qt::NoBrush) {
+ QTextLayout::FormatRange additionalFormat;
+ additionalFormat.start = textPos - block.position();
+ additionalFormat.length = fragmentEnd - textPos;
+ additionalFormat.format = charFormat;
+ colorChanges << additionalFormat;
+ }
textPos = addText(block, charFormat, textColor, colorChanges, textPos, fragmentEnd,
selectionStart, selectionEnd);
diff --git a/src/quick/items/qquicktextnodeengine_p.h b/src/quick/items/qquicktextnodeengine_p.h
index f0d52683c6..2f6cacf601 100644
--- a/src/quick/items/qquicktextnodeengine_p.h
+++ b/src/quick/items/qquicktextnodeengine_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -102,6 +102,24 @@ public:
static void inOrder(const QVarLengthArray<BinaryTreeNode, 16> &binaryTree, QVarLengthArray<int> *sortedIndexes, int currentIndex = 0);
};
+ struct BinaryTreeNodeKey
+ {
+ BinaryTreeNodeKey(BinaryTreeNode *node);
+
+ bool operator==(const BinaryTreeNodeKey &otherKey) const
+ {
+ return fontEngine == otherKey.fontEngine
+ && clipNode == otherKey.clipNode
+ && color == otherKey.color
+ && selectionState == otherKey.selectionState;
+ }
+
+ QFontEngine *fontEngine;
+ QQuickDefaultClipNode *clipNode;
+ QRgb color;
+ int selectionState;
+ };
+
QQuickTextNodeEngine() : m_hasSelection(false), m_hasContents(false) {}
bool hasContents() const { return m_hasContents; }
@@ -141,6 +159,8 @@ public:
int start, int end,
int selectionStart, int selectionEnd);
+ void mergeProcessedNodes(QList<BinaryTreeNode *> *regularNodes,
+ QList<BinaryTreeNode *> *imageNodes);
void addToSceneGraph(QQuickTextNode *parent,
QQuickText::TextStyle style = QQuickText::Normal,
const QColor &styleColor = QColor());
diff --git a/src/quick/items/qquicktextutil.cpp b/src/quick/items/qquicktextutil.cpp
index 6ad6b00745..a54dfe427f 100644
--- a/src/quick/items/qquicktextutil.cpp
+++ b/src/quick/items/qquicktextutil.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquicktextutil_p.h b/src/quick/items/qquicktextutil_p.h
index 2ae20455b4..f0480bd524 100644
--- a/src/quick/items/qquicktextutil_p.h
+++ b/src/quick/items/qquicktextutil_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/items/qquicktranslate.cpp b/src/quick/items/qquicktranslate.cpp
index bc0d19db6b..2550432bba 100644
--- a/src/quick/items/qquicktranslate.cpp
+++ b/src/quick/items/qquicktranslate.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -34,8 +34,6 @@
#include "qquicktranslate_p.h"
#include "qquickitem_p.h"
-#include <QtCore/qmath.h>
-
QT_BEGIN_NAMESPACE
class QQuickTranslatePrivate : public QQuickTransformPrivate
diff --git a/src/quick/items/qquicktranslate_p.h b/src/quick/items/qquicktranslate_p.h
index ca49349f74..6dfb5a08b7 100644
--- a/src/quick/items/qquicktranslate_p.h
+++ b/src/quick/items/qquicktranslate_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -58,7 +58,7 @@ public:
qreal y() const;
void setY(qreal);
- void applyTo(QMatrix4x4 *matrix) const;
+ void applyTo(QMatrix4x4 *matrix) const Q_DECL_OVERRIDE;
Q_SIGNALS:
void xChanged();
@@ -94,7 +94,7 @@ public:
qreal zScale() const;
void setZScale(qreal);
- void applyTo(QMatrix4x4 *matrix) const;
+ void applyTo(QMatrix4x4 *matrix) const Q_DECL_OVERRIDE;
Q_SIGNALS:
void originChanged();
@@ -129,7 +129,7 @@ public:
void setAxis(const QVector3D &axis);
void setAxis(Qt::Axis axis);
- void applyTo(QMatrix4x4 *matrix) const;
+ void applyTo(QMatrix4x4 *matrix) const Q_DECL_OVERRIDE;
Q_SIGNALS:
void originChanged();
@@ -153,7 +153,7 @@ public:
QMatrix4x4 matrix() const;
void setMatrix(const QMatrix4x4& matrix);
- void applyTo(QMatrix4x4 *matrix) const;
+ void applyTo(QMatrix4x4 *matrix) const Q_DECL_OVERRIDE;
Q_SIGNALS:
void matrixChanged();
diff --git a/src/quick/items/qquickview.cpp b/src/quick/items/qquickview.cpp
index b5b542a791..5b5413a4ba 100644
--- a/src/quick/items/qquickview.cpp
+++ b/src/quick/items/qquickview.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -48,17 +48,17 @@
QT_BEGIN_NAMESPACE
-DEFINE_OBJECT_VTABLE(QQuickRootItemMarker);
+DEFINE_OBJECT_VTABLE(QV4::QQuickRootItemMarker);
-QQuickRootItemMarker *QQuickRootItemMarker::create(QQmlEngine *engine, QQuickWindow *window)
+QV4::Heap::QQuickRootItemMarker *QV4::QQuickRootItemMarker::create(QQmlEngine *engine, QQuickWindow *window)
{
QV4::ExecutionEngine *e = QQmlEnginePrivate::getV4Engine(engine);
return e->memoryManager->alloc<QQuickRootItemMarker>(e, window);
}
-void QQuickRootItemMarker::markObjects(QV4::Managed *that, QV4::ExecutionEngine *e)
+void QV4::QQuickRootItemMarker::markObjects(QV4::Heap::Base *that, QV4::ExecutionEngine *e)
{
- QQuickItem *root = static_cast<QQuickRootItemMarker*>(that)->d()->window->contentItem();
+ QQuickItem *root = static_cast<QQuickRootItemMarker::Data *>(that)->window->contentItem();
if (root) {
QQuickItemPrivate *rootPrivate = QQuickItemPrivate::get(root);
rootPrivate->markObjects(e);
@@ -82,8 +82,8 @@ void QQuickViewPrivate::init(QQmlEngine* e)
{
QV4::ExecutionEngine *v4 = QQmlEnginePrivate::getV4Engine(engine.data());
QV4::Scope scope(v4);
- QV4::Scoped<QQuickRootItemMarker> v(scope, QQuickRootItemMarker::create(engine.data(), q));
- rootItemMarker = v;
+ QV4::Scoped<QV4::QQuickRootItemMarker> v(scope, QV4::QQuickRootItemMarker::create(engine.data(), q));
+ rootItemMarker.set(v4, v);
}
if (QQmlDebugService::isDebuggingEnabled())
diff --git a/src/quick/items/qquickview.h b/src/quick/items/qquickview.h
index d8017782aa..f094c5a216 100644
--- a/src/quick/items/qquickview.h
+++ b/src/quick/items/qquickview.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -90,14 +90,14 @@ private Q_SLOTS:
void continueExecute();
protected:
- virtual void resizeEvent(QResizeEvent *);
- virtual void timerEvent(QTimerEvent*);
-
- virtual void keyPressEvent(QKeyEvent *);
- virtual void keyReleaseEvent(QKeyEvent *);
- virtual void mousePressEvent(QMouseEvent *);
- virtual void mouseReleaseEvent(QMouseEvent *);
- virtual void mouseMoveEvent(QMouseEvent *);
+ void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent*) Q_DECL_OVERRIDE;
+
+ void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
+ void keyReleaseEvent(QKeyEvent *) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(QQuickView)
Q_DECLARE_PRIVATE(QQuickView)
diff --git a/src/quick/items/qquickview_p.h b/src/quick/items/qquickview_p.h
index 2d3323a59c..6f673368d5 100644
--- a/src/quick/items/qquickview_p.h
+++ b/src/quick/items/qquickview_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -71,7 +71,7 @@ public:
~QQuickViewPrivate();
void execute();
- void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry);
+ void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
void initResize();
void updateSize();
void setRootObject(QObject *);
@@ -94,26 +94,36 @@ public:
QV4::PersistentValue rootItemMarker;
};
-struct QQuickRootItemMarker : public QV4::Object
-{
- struct Data : QV4::Object::Data {
- Data(QV4::ExecutionEngine *engine, QQuickWindow *window)
- : Object::Data(engine)
- , window(window)
- {
- setVTable(staticVTable());
- }
+namespace QV4 {
+namespace Heap {
- QQuickWindow *window;
- };
- V4_OBJECT(QV4::Object)
+struct QQuickRootItemMarker : Object {
+ inline QQuickRootItemMarker(QV4::ExecutionEngine *engine, QQuickWindow *window);
+
+ QQuickWindow *window;
+};
- static QQuickRootItemMarker *create(QQmlEngine *engine, QQuickWindow *window);
+}
+
+struct QQuickRootItemMarker : public Object
+{
+ V4_OBJECT2(QQuickRootItemMarker, Object)
- static void markObjects(Managed *that, QV4::ExecutionEngine *e);
+ static Heap::QQuickRootItemMarker *create(QQmlEngine *engine, QQuickWindow *window);
+
+ static void markObjects(QV4::Heap::Base *that, QV4::ExecutionEngine *e);
};
+inline
+Heap::QQuickRootItemMarker::QQuickRootItemMarker(QV4::ExecutionEngine *engine, QQuickWindow *window)
+ : Heap::Object(engine)
+ , window(window)
+{
+}
+
+}
+
QT_END_NAMESPACE
#endif // QQUICKVIEW_P_H
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index f21a93b83c..a17d4a4357 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -72,6 +72,7 @@
QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(DBG_TOUCH, "qt.quick.touch");
+Q_LOGGING_CATEGORY(DBG_TOUCH_TARGET, "qt.quick.touch.target");
Q_LOGGING_CATEGORY(DBG_MOUSE, "qt.quick.mouse");
Q_LOGGING_CATEGORY(DBG_FOCUS, "qt.quick.focus");
Q_LOGGING_CATEGORY(DBG_DIRTY, "qt.quick.dirty");
@@ -85,10 +86,10 @@ void QQuickWindowPrivate::updateFocusItemTransform()
Q_Q(QQuickWindow);
#ifndef QT_NO_IM
QQuickItem *focus = q->activeFocusItem();
- if (focus && qApp->focusObject() == focus) {
+ if (focus && QGuiApplication::focusObject() == focus) {
QQuickItemPrivate *focusPrivate = QQuickItemPrivate::get(focus);
- qApp->inputMethod()->setInputItemTransform(focusPrivate->itemToWindowTransform());
- qApp->inputMethod()->setInputItemRectangle(QRectF(0, 0, focusPrivate->width, focusPrivate->height));
+ QGuiApplication::inputMethod()->setInputItemTransform(focusPrivate->itemToWindowTransform());
+ QGuiApplication::inputMethod()->setInputItemRectangle(QRectF(0, 0, focusPrivate->width, focusPrivate->height));
}
#endif
}
@@ -143,7 +144,7 @@ public slots:
void animationStopped() { incubate(); }
protected:
- virtual void incubatingObjectCountChanged(int count)
+ void incubatingObjectCountChanged(int count) Q_DECL_OVERRIDE
{
if (count && !m_renderLoop->interleaveIncubation())
incubateAgain();
@@ -366,19 +367,21 @@ void QQuickWindowPrivate::renderSceneGraph(const QSize &size)
animationController->advance();
emit q->beforeRendering();
runAndClearJobs(&beforeRenderingJobs);
- int fboId = 0;
- const qreal devicePixelRatio = q->effectiveDevicePixelRatio();
- renderer->setDeviceRect(QRect(QPoint(0, 0), size * devicePixelRatio));
- if (renderTargetId) {
- fboId = renderTargetId;
- renderer->setViewportRect(QRect(QPoint(0, 0), renderTargetSize));
- } else {
- renderer->setViewportRect(QRect(QPoint(0, 0), size * devicePixelRatio));
- }
- renderer->setProjectionMatrixToRect(QRect(QPoint(0, 0), size));
- renderer->setDevicePixelRatio(devicePixelRatio);
+ if (!customRenderStage || !customRenderStage->render()) {
+ int fboId = 0;
+ const qreal devicePixelRatio = q->effectiveDevicePixelRatio();
+ renderer->setDeviceRect(QRect(QPoint(0, 0), size * devicePixelRatio));
+ if (renderTargetId) {
+ fboId = renderTargetId;
+ renderer->setViewportRect(QRect(QPoint(0, 0), renderTargetSize));
+ } else {
+ renderer->setViewportRect(QRect(QPoint(0, 0), size * devicePixelRatio));
+ }
+ renderer->setProjectionMatrixToRect(QRect(QPoint(0, 0), size));
+ renderer->setDevicePixelRatio(devicePixelRatio);
- context->renderNextFrame(renderer, fboId);
+ context->renderNextFrame(renderer, fboId);
+ }
emit q->afterRendering();
runAndClearJobs(&afterRenderingJobs);
}
@@ -401,6 +404,7 @@ QQuickWindowPrivate::QQuickWindowPrivate()
, windowManager(0)
, renderControl(0)
, touchRecursionGuard(0)
+ , customRenderStage(0)
, clearColor(Qt::white)
, clearBeforeRendering(true)
, persistentGLContext(true)
@@ -420,6 +424,7 @@ QQuickWindowPrivate::QQuickWindowPrivate()
QQuickWindowPrivate::~QQuickWindowPrivate()
{
+ delete customRenderStage;
}
void QQuickWindowPrivate::init(QQuickWindow *c, QQuickRenderControl *control)
@@ -462,8 +467,6 @@ void QQuickWindowPrivate::init(QQuickWindow *c, QQuickRenderControl *control)
animationController = new QQuickAnimatorController(q);
- delayedTouch = 0;
-
QObject::connect(context, SIGNAL(initialized()), q, SIGNAL(sceneGraphInitialized()), Qt::DirectConnection);
QObject::connect(context, SIGNAL(invalidated()), q, SIGNAL(sceneGraphInvalidated()), Qt::DirectConnection);
QObject::connect(context, SIGNAL(invalidated()), q, SLOT(cleanupSceneGraph()), Qt::DirectConnection);
@@ -515,7 +518,7 @@ bool QQuickWindowPrivate::checkIfDoubleClicked(ulong newPressEventTimestamp)
doubleClicked = false;
} else {
ulong timeBetweenPresses = newPressEventTimestamp - touchMousePressTimestamp;
- ulong doubleClickInterval = static_cast<ulong>(qApp->styleHints()->
+ ulong doubleClickInterval = static_cast<ulong>(QGuiApplication::styleHints()->
mouseDoubleClickInterval());
doubleClicked = timeBetweenPresses < doubleClickInterval;
if (doubleClicked) {
@@ -548,6 +551,7 @@ bool QQuickWindowPrivate::translateTouchToMouse(QQuickItem *item, QTouchEvent *e
// handler spins the event loop all subsequent moves and releases get lost.
touchMouseId = p.id();
itemForTouchPointId[touchMouseId] = item;
+ qCDebug(DBG_TOUCH_TARGET) << "TP (mouse)" << p.id() << "->" << item;
QScopedPointer<QMouseEvent> mousePress(touchToMouseEvent(QEvent::MouseButtonPress, p, event, item, false));
// Send a single press and see if that's accepted
@@ -559,8 +563,10 @@ bool QQuickWindowPrivate::translateTouchToMouse(QQuickItem *item, QTouchEvent *e
event->setAccepted(mousePress->isAccepted());
if (!mousePress->isAccepted()) {
touchMouseId = -1;
- if (itemForTouchPointId.value(p.id()) == item)
+ if (itemForTouchPointId.value(p.id()) == item) {
+ qCDebug(DBG_TOUCH_TARGET) << "TP (mouse)" << p.id() << "disassociated";
itemForTouchPointId.remove(p.id());
+ }
if (mouseGrabberItem == item)
item->ungrabMouse();
@@ -595,6 +601,7 @@ bool QQuickWindowPrivate::translateTouchToMouse(QQuickItem *item, QTouchEvent *e
QCoreApplication::sendEvent(item, me.data());
event->setAccepted(me->isAccepted());
if (me->isAccepted()) {
+ qCDebug(DBG_TOUCH_TARGET) << "TP (mouse)" << p.id() << "->" << mouseGrabberItem;
itemForTouchPointId[p.id()] = mouseGrabberItem; // N.B. the mouseGrabberItem may be different after returning from sendEvent()
return true;
}
@@ -646,8 +653,10 @@ void QQuickWindowPrivate::setMouseGrabber(QQuickItem *grabber)
if (touchMouseId != -1) {
// update the touch item for mouse touch id to the new grabber
itemForTouchPointId.remove(touchMouseId);
- if (grabber)
+ if (grabber) {
+ qCDebug(DBG_TOUCH_TARGET) << "TP (mouse)" << touchMouseId << "->" << mouseGrabberItem;
itemForTouchPointId[touchMouseId] = grabber;
+ }
}
if (oldGrabber) {
@@ -746,7 +755,7 @@ void QQuickWindowPrivate::setFocusInScope(QQuickItem *scope, QQuickItem *item, Q
if (oldActiveFocusItem) {
#ifndef QT_NO_IM
- qApp->inputMethod()->commit();
+ QGuiApplication::inputMethod()->commit();
#endif
activeFocusItem = 0;
@@ -843,7 +852,7 @@ void QQuickWindowPrivate::clearFocusInScope(QQuickItem *scope, QQuickItem *item,
newActiveFocusItem = scope;
#ifndef QT_NO_IM
- qApp->inputMethod()->commit();
+ QGuiApplication::inputMethod()->commit();
#endif
activeFocusItem = 0;
@@ -1103,7 +1112,6 @@ QQuickWindow::~QQuickWindow()
{
Q_D(QQuickWindow);
- d->animationController->deleteLater();
if (d->renderControl) {
QQuickRenderControlPrivate::get(d->renderControl)->windowDestroyed();
} else if (d->windowManager) {
@@ -1344,7 +1352,7 @@ bool QQuickWindow::event(QEvent *e)
QTouchEvent *touch = static_cast<QTouchEvent*>(e);
d->translateTouchEvent(touch);
d->deliverTouchEvent(touch);
- if (Q_LIKELY(qApp->testAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents))) {
+ if (Q_LIKELY(QCoreApplication::testAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents))) {
// we consume all touch events ourselves to avoid duplicate
// mouse delivery by QtGui mouse synthesis
e->accept();
@@ -1387,10 +1395,21 @@ bool QQuickWindow::event(QEvent *e)
if (d->mouseGrabberItem)
d->mouseGrabberItem->ungrabMouse();
break;
+ case QEvent::UpdateRequest: {
+ if (d->windowManager)
+ d->windowManager->handleUpdateRequest(this);
+ break;
+ }
+ case QEvent::NativeGesture:
+ d->deliverNativeGestureEvent(d->contentItem, static_cast<QNativeGestureEvent*>(e));
+ break;
default:
break;
}
+ if (e->type() == QEvent::Type(QQuickWindowPrivate::FullUpdateRequest))
+ update();
+
return QWindow::event(e);
}
@@ -1429,7 +1448,7 @@ void QQuickWindowPrivate::deliverKeyEvent(QKeyEvent *e)
// toplevel non-popup window (the application current "key window") will
// receive them. (QWidgetWindow does something similar for widgets, by keeping
// a list of popup windows, and forwarding the key event to the top-most popup.)
- QWindow *focusWindow = qApp->focusWindow();
+ QWindow *focusWindow = QGuiApplication::focusWindow();
if (focusWindow && focusWindow != q
&& (focusWindow->flags() & Qt::Popup) == Qt::Popup)
QGuiApplication::sendEvent(focusWindow, e);
@@ -1589,6 +1608,11 @@ bool QQuickWindowPrivate::sendHoverEvent(QEvent::Type type, QQuickItem *item,
QHoverEvent hoverEvent(type, transform.map(scenePos), transform.map(lastScenePos), modifiers);
hoverEvent.setAccepted(accepted);
+ QSet<QQuickItem *> hasFiltered;
+ if (sendFilteredMouseEvent(item->parentItem(), item, &hoverEvent, &hasFiltered)) {
+ return true;
+ }
+
q->sendEvent(item, &hoverEvent);
return hoverEvent.isAccepted();
@@ -1727,7 +1751,7 @@ bool QQuickWindowPrivate::deliverWheelEvent(QQuickItem *item, QWheelEvent *event
if (item->contains(p)) {
QWheelEvent wheel(p, p, event->pixelDelta(), event->angleDelta(), event->delta(),
- event->orientation(), event->buttons(), event->modifiers(), event->phase());
+ event->orientation(), event->buttons(), event->modifiers(), event->phase(), event->source());
wheel.accept();
q->sendEvent(item, &wheel);
if (wheel.isAccepted()) {
@@ -1743,7 +1767,7 @@ bool QQuickWindowPrivate::deliverWheelEvent(QQuickItem *item, QWheelEvent *event
void QQuickWindow::wheelEvent(QWheelEvent *event)
{
Q_D(QQuickWindow);
- qCDebug(DBG_MOUSE) << "QQuickWindow::wheelEvent()" << event->pixelDelta() << event->angleDelta();
+ qCDebug(DBG_MOUSE) << "QQuickWindow::wheelEvent()" << event->pixelDelta() << event->angleDelta() << event->phase();
//if the actual wheel event was accepted, accept the compatibility wheel event and return early
if (d->lastWheelEventAccepted && event->angleDelta().isNull() && event->phase() == Qt::ScrollUpdate)
@@ -1755,6 +1779,37 @@ void QQuickWindow::wheelEvent(QWheelEvent *event)
}
#endif // QT_NO_WHEELEVENT
+bool QQuickWindowPrivate::deliverNativeGestureEvent(QQuickItem *item, QNativeGestureEvent *event)
+{
+ QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
+
+ if ((itemPrivate->flags & QQuickItem::ItemClipsChildrenToShape) && !item->contains(event->localPos()))
+ return false;
+
+ QList<QQuickItem *> children = itemPrivate->paintOrderChildItems();
+ for (int ii = children.count() - 1; ii >= 0; --ii) {
+ QQuickItem *child = children.at(ii);
+ if (!child->isVisible() || !child->isEnabled() || QQuickItemPrivate::get(child)->culled)
+ continue;
+ if (deliverNativeGestureEvent(child, event))
+ return true;
+ }
+
+ QPointF p = item->mapFromScene(event->localPos());
+
+ if (item->contains(p)) {
+ QNativeGestureEvent copy(event->gestureType(), p, event->windowPos(), event->screenPos(),
+ event->value(), 0L, 0L); // TODO can't copy things I can't access
+ event->accept();
+ item->event(&copy);
+ if (copy.isAccepted()) {
+ event->accept();
+ return true;
+ }
+ }
+
+ return false;
+}
bool QQuickWindowPrivate::deliverTouchCancelEvent(QTouchEvent *event)
{
@@ -1777,6 +1832,15 @@ bool QQuickWindowPrivate::deliverTouchCancelEvent(QTouchEvent *event)
return true;
}
+void QQuickWindowPrivate::deliverDelayedTouchEvent()
+{
+ // Deliver and delete delayedTouch.
+ // Set delayedTouch to 0 before delivery to avoid redelivery in case of
+ // event loop recursions (e.g if it the touch starts a dnd session).
+ QScopedPointer<QTouchEvent> e(delayedTouch.take());
+ reallyDeliverTouchEvent(e.data());
+}
+
static bool qquickwindow_no_touch_compression = qEnvironmentVariableIsSet("QML_NO_TOUCH_COMPRESSION");
// check what kind of touch we have (begin/update) and
@@ -1796,7 +1860,7 @@ void QQuickWindowPrivate::deliverTouchEvent(QTouchEvent *event)
&& ((states & (Qt::TouchPointPressed | Qt::TouchPointReleased)) == 0)) {
// we can only compress something that isn't a press or release
if (!delayedTouch) {
- delayedTouch = new QTouchEvent(event->type(), event->device(), event->modifiers(), event->touchPointStates(), event->touchPoints());
+ delayedTouch.reset(new QTouchEvent(event->type(), event->device(), event->modifiers(), event->touchPointStates(), event->touchPoints()));
delayedTouch->setTimestamp(event->timestamp());
if (renderControl)
QQuickRenderControlPrivate::get(renderControl)->maybeUpdate();
@@ -1817,19 +1881,23 @@ void QQuickWindowPrivate::deliverTouchEvent(QTouchEvent *event)
Qt::TouchPointStates states;
for (int i = 0; i < event->touchPoints().count(); ++i) {
const QTouchEvent::TouchPoint &tp = tpts.at(i);
- const QTouchEvent::TouchPoint &tp2 = delayedTouch->touchPoints().at(i);
- if (tp.id() != tp2.id()) {
+ const QTouchEvent::TouchPoint &tpDelayed = delayedTouch->touchPoints().at(i);
+ if (tp.id() != tpDelayed.id()) {
mismatch = true;
break;
}
- if (tp2.state() == Qt::TouchPointMoved && tp.state() == Qt::TouchPointStationary)
+ if (tpDelayed.state() == Qt::TouchPointMoved && tp.state() == Qt::TouchPointStationary)
tpts[i].setState(Qt::TouchPointMoved);
+ tpts[i].setLastPos(tpDelayed.lastPos());
+ tpts[i].setLastScenePos(tpDelayed.lastScenePos());
+ tpts[i].setLastScreenPos(tpDelayed.lastScreenPos());
+ tpts[i].setLastNormalizedPos(tpDelayed.lastNormalizedPos());
states |= tpts.at(i).state();
}
- // same touch event? then merge if so
+ // matching touch event? then merge the new event into the old one
if (!mismatch) {
delayedTouch->setTouchPoints(tpts);
delayedTouch->setTimestamp(event->timestamp());
@@ -1837,21 +1905,15 @@ void QQuickWindowPrivate::deliverTouchEvent(QTouchEvent *event)
}
}
- // otherwise; we need to deliver the delayed event first, and
- // then delay this one..
- reallyDeliverTouchEvent(delayedTouch);
- delete delayedTouch;
- delayedTouch = new QTouchEvent(event->type(), event->device(), event->modifiers(), event->touchPointStates(), event->touchPoints());
+ // merging wasn't possible, so deliver the delayed event first, and then delay this one
+ deliverDelayedTouchEvent();
+ delayedTouch.reset(new QTouchEvent(event->type(), event->device(), event->modifiers(), event->touchPointStates(), event->touchPoints()));
delayedTouch->setTimestamp(event->timestamp());
return;
}
} else {
- if (delayedTouch) {
- // deliver the delayed touch first
- reallyDeliverTouchEvent(delayedTouch);
- delete delayedTouch;
- delayedTouch = 0;
- }
+ if (delayedTouch)
+ deliverDelayedTouchEvent();
reallyDeliverTouchEvent(event);
}
}
@@ -1859,9 +1921,7 @@ void QQuickWindowPrivate::deliverTouchEvent(QTouchEvent *event)
void QQuickWindowPrivate::flushDelayedTouchEvent()
{
if (delayedTouch) {
- reallyDeliverTouchEvent(delayedTouch);
- delete delayedTouch;
- delayedTouch = 0;
+ deliverDelayedTouchEvent();
// Touch events which constantly start animations (such as a behavior tracking
// the mouse point) need animations to start.
@@ -1918,6 +1978,7 @@ void QQuickWindowPrivate::reallyDeliverTouchEvent(QTouchEvent *event)
if (event->touchPointStates() & Qt::TouchPointReleased) {
for (int i=0; i<touchPoints.count(); i++) {
if (touchPoints[i].state() == Qt::TouchPointReleased) {
+ qCDebug(DBG_TOUCH_TARGET) << "TP" << touchPoints[i].id() << "released";
itemForTouchPointId.remove(touchPoints[i].id());
if (touchPoints[i].id() == touchMouseId)
touchMouseId = -1;
@@ -1927,7 +1988,12 @@ void QQuickWindowPrivate::reallyDeliverTouchEvent(QTouchEvent *event)
}
if (event->type() == QEvent::TouchEnd) {
- Q_ASSERT(itemForTouchPointId.isEmpty());
+ if (!itemForTouchPointId.isEmpty()) {
+ qWarning() << "No release received for" << itemForTouchPointId.size()
+ << "touch points over" << itemForTouchPointId.begin().value()
+ << "on touch end.";
+ itemForTouchPointId.clear();
+ }
}
--touchRecursionGuard;
@@ -2025,21 +2091,27 @@ bool QQuickWindowPrivate::deliverMatchingPointsToItem(QQuickItem *item, QTouchEv
touchEvent.data()->setTarget(item);
bool touchEventAccepted = false;
+ qCDebug(DBG_TOUCH) << " - considering delivering " << touchEvent.data() << " to " << item;
+
// First check whether the parent wants to be a filter,
// and if the parent accepts the event we are done.
if (sendFilteredTouchEvent(item->parentItem(), item, event, hasFiltered)) {
// If the touch was accepted (regardless by whom or in what form),
// update acceptedNewPoints
+ qCDebug(DBG_TOUCH) << " - can't. intercepted " << touchEvent.data() << " to " << item->parentItem() << " instead of " << item;
foreach (int id, matchingNewPoints)
acceptedNewPoints->insert(id);
return true;
}
// Since it can change in sendEvent, update itemForTouchPointId now
- foreach (int id, matchingNewPoints)
+ foreach (int id, matchingNewPoints) {
+ qCDebug(DBG_TOUCH_TARGET) << "TP" << id << "->" << item;
itemForTouchPointId[id] = item;
+ }
// Deliver the touch event to the given item
+ qCDebug(DBG_TOUCH) << " - actually delivering " << touchEvent.data() << " to " << item;
QCoreApplication::sendEvent(item, touchEvent.data());
touchEventAccepted = touchEvent->isAccepted();
@@ -2062,8 +2134,10 @@ bool QQuickWindowPrivate::deliverMatchingPointsToItem(QQuickItem *item, QTouchEv
// But if the event was not accepted then we know this item
// will not be interested in further updates for those touchpoint IDs either.
foreach (int id, matchingNewPoints)
- if (itemForTouchPointId[id] == item)
+ if (itemForTouchPointId[id] == item) {
+ qCDebug(DBG_TOUCH_TARGET) << "TP" << id << "disassociated";
itemForTouchPointId.remove(id);
+ }
}
return touchEventAccepted;
@@ -2276,10 +2350,7 @@ QQuickItem *QQuickWindowPrivate::findCursorItem(QQuickItem *item, const QPointF
return 0;
}
- const int numCursorsInHierarchy = itemPrivate->extra.isAllocated() ? itemPrivate->extra.value().numItemsWithCursor : 0;
- const int numChildrenWithCursor = itemPrivate->hasCursor ? numCursorsInHierarchy-1 : numCursorsInHierarchy;
-
- if (numChildrenWithCursor > 0) {
+ if (itemPrivate->hasCursorInChild) {
QList<QQuickItem *> children = itemPrivate->paintOrderChildItems();
for (int ii = children.count() - 1; ii >= 0; --ii) {
QQuickItem *child = children.at(ii);
@@ -2312,6 +2383,7 @@ bool QQuickWindowPrivate::sendFilteredTouchEvent(QQuickItem *target, QQuickItem
QScopedPointer<QTouchEvent> targetEvent(touchEventForItemBounds(target, *event));
if (!targetEvent->touchPoints().isEmpty()) {
if (target->childMouseEventFilter(item, targetEvent.data())) {
+ qCDebug(DBG_TOUCH) << " - first chance intercepted on childMouseEventFilter by " << target;
QVector<int> touchIds;
for (int i = 0; i < targetEvent->touchPoints().size(); ++i)
touchIds.append(targetEvent->touchPoints().at(i).id());
@@ -2352,7 +2424,9 @@ bool QQuickWindowPrivate::sendFilteredTouchEvent(QQuickItem *target, QQuickItem
// targetEvent is already transformed wrt local position, velocity, etc.
QScopedPointer<QMouseEvent> mouseEvent(touchToMouseEvent(t, tp, event, item, false));
if (target->childMouseEventFilter(item, mouseEvent.data())) {
+ qCDebug(DBG_TOUCH) << " - second chance intercepted on childMouseEventFilter by " << target;
if (t != QEvent::MouseButtonRelease) {
+ qCDebug(DBG_TOUCH_TARGET) << "TP" << tp.id() << "->" << target;
itemForTouchPointId[tp.id()] = target;
touchMouseId = tp.id();
target->grabMouse();
@@ -2389,7 +2463,7 @@ bool QQuickWindowPrivate::sendFilteredMouseEvent(QQuickItem *target, QQuickItem
bool QQuickWindowPrivate::dragOverThreshold(qreal d, Qt::Axis axis, QMouseEvent *event, int startDragThreshold)
{
- QStyleHints *styleHints = qApp->styleHints();
+ QStyleHints *styleHints = QGuiApplication::styleHints();
int caps = QGuiApplicationPrivate::mouseEventCaps(event);
bool dragVelocityLimitAvailable = (caps & QTouchDevice::Velocity)
&& styleHints->startDragVelocity();
@@ -2564,7 +2638,9 @@ bool QQuickWindow::sendEvent(QQuickItem *item, QEvent *e)
case QEvent::TouchUpdate:
case QEvent::TouchEnd: {
QSet<QQuickItem*> hasFiltered;
- d->sendFilteredTouchEvent(item->parentItem(), item, static_cast<QTouchEvent *>(e), &hasFiltered);
+ QTouchEvent *ev = static_cast<QTouchEvent *>(e);
+ qCDebug(DBG_TOUCH) << " - sendEvent for " << ev << " to " << item->parentItem() << " and " << item;
+ d->sendFilteredTouchEvent(item->parentItem(), item, ev, &hasFiltered);
}
break;
default:
@@ -2594,7 +2670,6 @@ void QQuickWindowPrivate::cleanupNodesOnShutdown(QQuickItem *item)
p->extra->rootNode = 0;
}
- p->groupNode = 0;
p->paintNode = 0;
p->dirty(QQuickItemPrivate::Window);
@@ -2622,8 +2697,7 @@ void QQuickWindowPrivate::cleanupNodesOnShutdown()
Q_Q(QQuickWindow);
cleanupNodes();
cleanupNodesOnShutdown(contentItem);
- QSet<QQuickItem *>::const_iterator it = parentlessItems.begin();
- for (; it != parentlessItems.end(); ++it)
+ for (QSet<QQuickItem *>::const_iterator it = parentlessItems.begin(), cend = parentlessItems.end(); it != cend; ++it)
cleanupNodesOnShutdown(*it);
animationController->windowNodesDestroyed();
q->cleanupSceneGraph();
@@ -2649,6 +2723,53 @@ void QQuickWindowPrivate::updateDirtyNodes()
}
}
+static inline QSGNode *qquickitem_before_paintNode(QQuickItemPrivate *d)
+{
+ const QList<QQuickItem *> childItems = d->paintOrderChildItems();
+ QQuickItem *before = 0;
+ for (int i=0; i<childItems.size(); ++i) {
+ QQuickItemPrivate *dd = QQuickItemPrivate::get(childItems.at(i));
+ // Perform the same check as the in buildOrderNodeList below.
+ if (dd->z() < 0 && (dd->explicitVisible || (dd->extra.isAllocated() && dd->extra->effectRefCount)))
+ before = childItems.at(i);
+ else
+ break;
+ }
+ return Q_UNLIKELY(before) ? QQuickItemPrivate::get(before)->itemNode() : 0;
+}
+
+static QVector<QSGNode *> buildOrderedNodeList(QQuickItemPrivate *itemPriv)
+{
+ QList<QQuickItem *> orderedChildren = itemPriv->paintOrderChildItems();
+ QVector<QSGNode *> desiredNodes;
+ desiredNodes.reserve(orderedChildren.size() + 1); // + 1 for the paintNode
+
+ int ii = 0;
+
+ for (; ii < orderedChildren.count() && orderedChildren.at(ii)->z() < 0; ++ii) {
+ QQuickItemPrivate *childPrivate = QQuickItemPrivate::get(orderedChildren.at(ii));
+ if (!childPrivate->explicitVisible &&
+ (!childPrivate->extra.isAllocated() || !childPrivate->extra->effectRefCount))
+ continue;
+
+ desiredNodes.append(childPrivate->itemNode());
+ }
+
+ if (itemPriv->paintNode)
+ desiredNodes.append(itemPriv->paintNode);
+
+ for (; ii < orderedChildren.count(); ++ii) {
+ QQuickItemPrivate *childPrivate = QQuickItemPrivate::get(orderedChildren.at(ii));
+ if (!childPrivate->explicitVisible &&
+ (!childPrivate->extra.isAllocated() || !childPrivate->extra->effectRefCount))
+ continue;
+
+ desiredNodes.append(childPrivate->itemNode());
+ }
+
+ return desiredNodes;
+}
+
void QQuickWindowPrivate::updateDirtyNode(QQuickItem *item)
{
QQuickItemPrivate *itemPriv = QQuickItemPrivate::get(item);
@@ -2688,101 +2809,139 @@ void QQuickWindowPrivate::updateDirtyNode(QQuickItem *item)
if (clipEffectivelyChanged) {
QSGNode *parent = itemPriv->opacityNode() ? (QSGNode *) itemPriv->opacityNode() :
- (QSGNode *)itemPriv->itemNode();
- QSGNode *child = itemPriv->rootNode() ? (QSGNode *)itemPriv->rootNode() :
- (QSGNode *)itemPriv->groupNode;
+ (QSGNode *) itemPriv->itemNode();
+ QSGNode *child = itemPriv->rootNode();
if (item->clip()) {
Q_ASSERT(itemPriv->clipNode() == 0);
- itemPriv->extra.value().clipNode = new QQuickDefaultClipNode(item->clipRect());
- itemPriv->clipNode()->update();
+ QQuickDefaultClipNode *clip = new QQuickDefaultClipNode(item->clipRect());
+ itemPriv->extra.value().clipNode = clip;
+ clip->update();
- if (child)
+ if (!child) {
+ parent->reparentChildNodesTo(clip);
+ parent->appendChildNode(clip);
+ } else {
parent->removeChildNode(child);
- parent->appendChildNode(itemPriv->clipNode());
- if (child)
- itemPriv->clipNode()->appendChildNode(child);
+ clip->appendChildNode(child);
+ parent->appendChildNode(clip);
+ }
} else {
- Q_ASSERT(itemPriv->clipNode() != 0);
- parent->removeChildNode(itemPriv->clipNode());
- if (child)
- itemPriv->clipNode()->removeChildNode(child);
+ QQuickDefaultClipNode *clip = itemPriv->clipNode();
+ Q_ASSERT(clip);
+ parent->removeChildNode(clip);
+ if (child) {
+ clip->removeChildNode(child);
+ parent->appendChildNode(child);
+ } else {
+ clip->reparentChildNodesTo(parent);
+ }
+
delete itemPriv->clipNode();
itemPriv->extra->clipNode = 0;
- if (child)
- parent->appendChildNode(child);
}
}
- if (dirty & QQuickItemPrivate::ChildrenUpdateMask)
- itemPriv->childContainerNode()->removeAllChildNodes();
-
if (effectRefEffectivelyChanged) {
+ if (dirty & QQuickItemPrivate::ChildrenUpdateMask)
+ itemPriv->childContainerNode()->removeAllChildNodes();
+
QSGNode *parent = itemPriv->clipNode();
if (!parent)
parent = itemPriv->opacityNode();
if (!parent)
parent = itemPriv->itemNode();
- QSGNode *child = itemPriv->groupNode;
if (itemPriv->extra.isAllocated() && itemPriv->extra->effectRefCount) {
Q_ASSERT(itemPriv->rootNode() == 0);
- itemPriv->extra->rootNode = new QSGRootNode;
-
- if (child)
- parent->removeChildNode(child);
- parent->appendChildNode(itemPriv->rootNode());
- if (child)
- itemPriv->rootNode()->appendChildNode(child);
+ QSGRootNode *root = new QSGRootNode();
+ itemPriv->extra->rootNode = root;
+ parent->reparentChildNodesTo(root);
+ parent->appendChildNode(root);
} else {
Q_ASSERT(itemPriv->rootNode() != 0);
- parent->removeChildNode(itemPriv->rootNode());
- if (child)
- itemPriv->rootNode()->removeChildNode(child);
+ QSGRootNode *root = itemPriv->rootNode();
+ parent->removeChildNode(root);
+ root->reparentChildNodesTo(parent);
delete itemPriv->rootNode();
itemPriv->extra->rootNode = 0;
- if (child)
- parent->appendChildNode(child);
}
}
if (dirty & QQuickItemPrivate::ChildrenUpdateMask) {
- QSGNode *groupNode = itemPriv->groupNode;
- if (groupNode)
- groupNode->removeAllChildNodes();
-
- QList<QQuickItem *> orderedChildren = itemPriv->paintOrderChildItems();
- int ii = 0;
+ QVector<QSGNode *> desiredNodes = buildOrderedNodeList(itemPriv);
+
+ // now start making current state match the promised land of
+ // desiredNodes. in the case of our current state matching desiredNodes
+ // (though why would we get ChildrenUpdateMask with no changes?) then we
+ // should make no changes at all.
+
+ // how many nodes did we process, when examining changes
+ int desiredNodesProcessed = 0;
+
+ // currentNode is how far, in our present tree, we have processed. we
+ // make use of this later on to trim the current child list if the
+ // desired list is shorter.
+ QSGNode *groupNode = itemPriv->childContainerNode();
+ QSGNode *currentNode = groupNode->firstChild();
+ int added = 0;
+ int removed = 0;
+ int replaced = 0;
+#if defined(CHILDRENUPDATE_DEBUG)
+ // This is slow! Do not do this in a normal/profiling build!
+ int initialCount = groupNode->childCount();
+#endif
- for (; ii < orderedChildren.count() && orderedChildren.at(ii)->z() < 0; ++ii) {
- QQuickItemPrivate *childPrivate = QQuickItemPrivate::get(orderedChildren.at(ii));
- if (!childPrivate->explicitVisible &&
- (!childPrivate->extra.isAllocated() || !childPrivate->extra->effectRefCount))
- continue;
- if (childPrivate->itemNode()->parent())
- childPrivate->itemNode()->parent()->removeChildNode(childPrivate->itemNode());
+ while (currentNode && desiredNodesProcessed < desiredNodes.size()) {
+ QSGNode *desiredNode = desiredNodes.at(desiredNodesProcessed);
+
+ // uh oh... reality and our utopic paradise are diverging!
+ // we need to reconcile this...
+ if (currentNode != desiredNode) {
+ // for now, we're just removing the node from the children -
+ // and replacing it with the new node.
+ if (desiredNode->parent())
+ desiredNode->parent()->removeChildNode(desiredNode);
+ groupNode->insertChildNodeAfter(desiredNode, currentNode);
+ groupNode->removeChildNode(currentNode);
+ replaced++;
+
+ // since we just replaced currentNode, we also need to reset
+ // the pointer.
+ currentNode = desiredNode;
+ }
- itemPriv->childContainerNode()->appendChildNode(childPrivate->itemNode());
+ currentNode = currentNode->nextSibling();
+ desiredNodesProcessed++;
}
- QSGNode *beforePaintNode = itemPriv->groupNode ? itemPriv->groupNode->lastChild() : 0;
- if (beforePaintNode || itemPriv->extra.isAllocated())
- itemPriv->extra.value().beforePaintNode = beforePaintNode;
-
- if (itemPriv->paintNode)
- itemPriv->childContainerNode()->appendChildNode(itemPriv->paintNode);
-
- for (; ii < orderedChildren.count(); ++ii) {
- QQuickItemPrivate *childPrivate = QQuickItemPrivate::get(orderedChildren.at(ii));
- if (!childPrivate->explicitVisible &&
- (!childPrivate->extra.isAllocated() || !childPrivate->extra->effectRefCount))
- continue;
- if (childPrivate->itemNode()->parent())
- childPrivate->itemNode()->parent()->removeChildNode(childPrivate->itemNode());
-
- itemPriv->childContainerNode()->appendChildNode(childPrivate->itemNode());
+ // if we didn't process as many nodes as in the new list, then we have
+ // more nodes at the end of desiredNodes to append to our list.
+ // this will be the case when adding new nodes, for instance.
+ if (desiredNodesProcessed < desiredNodes.size()) {
+ for (int i = desiredNodesProcessed; i < desiredNodes.size(); ++i) {
+ QSGNode *desiredNode = desiredNodes.at(i);
+ if (desiredNode->parent())
+ desiredNode->parent()->removeChildNode(desiredNode);
+ groupNode->appendChildNode(desiredNode);
+ added++;
+ }
+ } else if (currentNode) {
+ // on the other hand, if we processed less than our current node
+ // tree, then nodes have been _removed_ from the scene, and we need
+ // to take care of that here.
+ while (currentNode) {
+ QSGNode *node = currentNode->nextSibling();
+ groupNode->removeChildNode(currentNode);
+ currentNode = node;
+ removed++;
+ }
}
+
+#if defined(CHILDRENUPDATE_DEBUG)
+ qDebug() << "Done children update for " << itemPriv << "- before:" << initialCount << "after:" << groupNode->childCount() << "added:" << added << "removed:" << removed << "replaced:" << replaced;
+#endif
}
if ((dirty & QQuickItemPrivate::Size) && itemPriv->clipNode()) {
@@ -2797,20 +2956,22 @@ void QQuickWindowPrivate::updateDirtyNode(QQuickItem *item)
? itemPriv->opacity() : qreal(0);
if (opacity != 1 && !itemPriv->opacityNode()) {
- itemPriv->extra.value().opacityNode = new QSGOpacityNode;
+ QSGOpacityNode *node = new QSGOpacityNode;
+ itemPriv->extra.value().opacityNode = node;
QSGNode *parent = itemPriv->itemNode();
QSGNode *child = itemPriv->clipNode();
if (!child)
child = itemPriv->rootNode();
- if (!child)
- child = itemPriv->groupNode;
- if (child)
+ if (child) {
parent->removeChildNode(child);
- parent->appendChildNode(itemPriv->opacityNode());
- if (child)
- itemPriv->opacityNode()->appendChildNode(child);
+ node->appendChildNode(child);
+ parent->appendChildNode(node);
+ } else {
+ parent->reparentChildNodesTo(node);
+ parent->appendChildNode(node);
+ }
}
if (itemPriv->opacityNode())
itemPriv->opacityNode()->setOpacity(opacity);
@@ -2827,8 +2988,9 @@ void QQuickWindowPrivate::updateDirtyNode(QQuickItem *item)
itemPriv->paintNode->parent() == itemPriv->childContainerNode());
if (itemPriv->paintNode && itemPriv->paintNode->parent() == 0) {
- if (itemPriv->extra.isAllocated() && itemPriv->extra->beforePaintNode)
- itemPriv->childContainerNode()->insertChildNodeAfter(itemPriv->paintNode, itemPriv->extra->beforePaintNode);
+ QSGNode *before = qquickitem_before_paintNode(itemPriv);
+ if (before)
+ itemPriv->childContainerNode()->insertChildNodeAfter(itemPriv->paintNode, before);
else
itemPriv->childContainerNode()->prependChildNode(itemPriv->paintNode);
}
@@ -2840,37 +3002,22 @@ void QQuickWindowPrivate::updateDirtyNode(QQuickItem *item)
#ifndef QT_NO_DEBUG
// Check consistency.
- const QSGNode *nodeChain[] = {
- itemPriv->itemNodeInstance,
- itemPriv->opacityNode(),
- itemPriv->clipNode(),
- itemPriv->rootNode(),
- itemPriv->groupNode,
- itemPriv->paintNode,
- };
-
- int ip = 0;
- for (;;) {
- while (ip < 5 && nodeChain[ip] == 0)
- ++ip;
- if (ip == 5)
- break;
- int ic = ip + 1;
- while (ic < 5 && nodeChain[ic] == 0)
- ++ic;
- const QSGNode *parent = nodeChain[ip];
- const QSGNode *child = nodeChain[ic];
- if (child == 0) {
- Q_ASSERT(parent == itemPriv->groupNode || parent->childCount() == 0);
- } else {
- Q_ASSERT(parent == itemPriv->groupNode || parent->childCount() == 1);
- Q_ASSERT(child->parent() == parent);
- bool containsChild = false;
- for (QSGNode *n = parent->firstChild(); n; n = n->nextSibling())
- containsChild |= (n == child);
- Q_ASSERT(containsChild);
- }
- ip = ic;
+
+ QList<QSGNode *> nodes;
+ nodes << itemPriv->itemNodeInstance
+ << itemPriv->opacityNode()
+ << itemPriv->clipNode()
+ << itemPriv->rootNode()
+ << itemPriv->paintNode;
+ nodes.removeAll(0);
+
+ Q_ASSERT(nodes.first() == itemPriv->itemNodeInstance);
+ for (int i=1; i<nodes.size(); ++i) {
+ QSGNode *n = nodes.at(i);
+ // Failing this means we messed up reparenting
+ Q_ASSERT(n->parent() == nodes.at(i-1));
+ // Only the paintNode and the one who is childContainer may have more than one child.
+ Q_ASSERT(n == itemPriv->paintNode || n == itemPriv->childContainerNode() || n->childCount() == 1);
}
#endif
@@ -2939,6 +3086,15 @@ QOpenGLContext *QQuickWindow::openglContext() const
}
/*!
+ Returns true if the scene graph has been initialized; otherwise returns false.
+ */
+bool QQuickWindow::isSceneGraphInitialized() const
+{
+ Q_D(const QQuickWindow);
+ return d->context != 0 && d->context->isValid();
+}
+
+/*!
\fn void QQuickWindow::frameSwapped()
This signal is emitted when the frame buffers have been swapped.
@@ -3021,11 +3177,11 @@ QOpenGLContext *QQuickWindow::openglContext() const
*/
/*!
- \fn void QQuickWindow::closing()
+ \fn void QQuickWindow::closing(QQuickCloseEvent *close)
\since 5.1
- This signal is emitted when the window receives a QCloseEvent from the
- windowing system.
+ This signal is emitted when the window receives the event \a close from
+ the windowing system.
*/
/*!
@@ -3374,7 +3530,7 @@ QQmlIncubationController *QQuickWindow::incubationController() const
slot function needs to finish before execution continues, you must make sure that
the connection is direct (see Qt::ConnectionType).
- \warning Make very sure that a signal handler for afterRendering() leaves the GL
+ \warning Make very sure that a signal handler for sceneGraphAboutToStop() leaves the GL
context in the same state as it was when the signal handler was entered. Failing to
do so can result in the scene not rendering properly.
@@ -3674,6 +3830,15 @@ void QQuickWindow::resetOpenGLState()
*/
/*!
+ \qmlattachedproperty int Window::width
+ \qmlattachedproperty int Window::height
+ \since 5.5
+
+ These attached properties hold the size of the item's window.
+ The Window attached property can be attached to any Item.
+*/
+
+/*!
\qmlproperty int Window::x
\qmlproperty int Window::y
\qmlproperty int Window::width
diff --git a/src/quick/items/qquickwindow.h b/src/quick/items/qquickwindow.h
index ddf9722313..f7a1956120 100644
--- a/src/quick/items/qquickwindow.h
+++ b/src/quick/items/qquickwindow.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -95,7 +95,7 @@ public:
QQuickItem *contentItem() const;
QQuickItem *activeFocusItem() const;
- QObject *focusObject() const;
+ QObject *focusObject() const Q_DECL_OVERRIDE;
QQuickItem *mouseGrabberItem() const;
@@ -115,7 +115,7 @@ public:
QQmlIncubationController *incubationController() const;
#ifndef QT_NO_ACCESSIBILITY
- virtual QAccessibleInterface *accessibleRoot() const;
+ QAccessibleInterface *accessibleRoot() const Q_DECL_OVERRIDE;
#endif
// Scene graph specific functions
@@ -139,6 +139,7 @@ public:
bool isPersistentSceneGraph() const;
QOpenGLContext *openglContext() const;
+ bool isSceneGraphInitialized() const;
void scheduleRenderJob(QRunnable *job, RenderStage schedule);
@@ -169,25 +170,25 @@ public Q_SLOTS:
protected:
QQuickWindow(QQuickWindowPrivate &dd, QWindow *parent = 0);
- virtual void exposeEvent(QExposeEvent *);
- virtual void resizeEvent(QResizeEvent *);
+ void exposeEvent(QExposeEvent *) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
- virtual void showEvent(QShowEvent *);
- virtual void hideEvent(QHideEvent *);
+ void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
+ void hideEvent(QHideEvent *) Q_DECL_OVERRIDE;
// TODO Qt 6: reimplement QWindow::closeEvent to emit closing
- virtual void focusInEvent(QFocusEvent *);
- virtual void focusOutEvent(QFocusEvent *);
+ void focusInEvent(QFocusEvent *) Q_DECL_OVERRIDE;
+ void focusOutEvent(QFocusEvent *) Q_DECL_OVERRIDE;
- virtual bool event(QEvent *);
- virtual void keyPressEvent(QKeyEvent *);
- virtual void keyReleaseEvent(QKeyEvent *);
- virtual void mousePressEvent(QMouseEvent *);
- virtual void mouseReleaseEvent(QMouseEvent *);
- virtual void mouseDoubleClickEvent(QMouseEvent *);
- virtual void mouseMoveEvent(QMouseEvent *);
+ bool event(QEvent *) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
+ void keyReleaseEvent(QKeyEvent *) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void mouseDoubleClickEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
#ifndef QT_NO_WHEELEVENT
- virtual void wheelEvent(QWheelEvent *);
+ void wheelEvent(QWheelEvent *) Q_DECL_OVERRIDE;
#endif
private Q_SLOTS:
diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h
index 6cd41950cb..605a36fb1d 100644
--- a/src/quick/items/qquickwindow_p.h
+++ b/src/quick/items/qquickwindow_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -49,7 +49,6 @@
#include "qquickwindow.h"
#include <QtQuick/private/qsgcontext_p.h>
-#include <private/qsgbatchrenderer_p.h>
#include <QtCore/qthread.h>
#include <QtCore/qmutex.h>
@@ -89,11 +88,23 @@ class QQuickWindowIncubationController;
class QOpenGLVertexArrayObjectHelper;
+class Q_QUICK_PRIVATE_EXPORT QQuickCustomRenderStage
+{
+public:
+ virtual ~QQuickCustomRenderStage() {}
+ virtual bool render() = 0;
+ virtual bool swap() = 0;
+};
+
class Q_QUICK_PRIVATE_EXPORT QQuickWindowPrivate : public QWindowPrivate
{
public:
Q_DECLARE_PUBLIC(QQuickWindow)
+ enum CustomEvents {
+ FullUpdateRequest = QEvent::User + 1
+ };
+
static inline QQuickWindowPrivate *get(QQuickWindow *c) { return c->d_func(); }
QQuickWindowPrivate();
@@ -134,11 +145,13 @@ public:
#ifndef QT_NO_WHEELEVENT
bool deliverWheelEvent(QQuickItem *, QWheelEvent *);
#endif
+ bool deliverNativeGestureEvent(QQuickItem *, QNativeGestureEvent *);
bool deliverTouchPoints(QQuickItem *, QTouchEvent *, const QList<QTouchEvent::TouchPoint> &, QSet<int> *,
QHash<QQuickItem *, QList<QTouchEvent::TouchPoint> > *, QSet<QQuickItem*> *filtered);
void deliverTouchEvent(QTouchEvent *);
void reallyDeliverTouchEvent(QTouchEvent *);
bool deliverTouchCancelEvent(QTouchEvent *);
+ void deliverDelayedTouchEvent();
void flushDelayedTouchEvent();
bool deliverHoverEvent(QQuickItem *, const QPointF &scenePos, const QPointF &lastScenePos, Qt::KeyboardModifiers modifiers, bool &accepted);
bool deliverMatchingPointsToItem(QQuickItem *item, QTouchEvent *event, QSet<int> *acceptedNewPoints, const QSet<int> &matchingNewPoints, const QList<QTouchEvent::TouchPoint> &matchingPoints, QSet<QQuickItem*> *filtered);
@@ -207,8 +220,9 @@ public:
QSGRenderLoop *windowManager;
QQuickRenderControl *renderControl;
QQuickAnimatorController *animationController;
- QTouchEvent *delayedTouch;
+ QScopedPointer<QTouchEvent> delayedTouch;
int touchRecursionGuard;
+ QQuickCustomRenderStage *customRenderStage;
QColor clearColor;
diff --git a/src/quick/items/qquickwindowattached.cpp b/src/quick/items/qquickwindowattached.cpp
index f74e903be3..e33e32631c 100644
--- a/src/quick/items/qquickwindowattached.cpp
+++ b/src/quick/items/qquickwindowattached.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -70,6 +70,16 @@ QQuickItem *QQuickWindowAttached::contentItem() const
return (m_window ? m_window->contentItem() : Q_NULLPTR);
}
+int QQuickWindowAttached::width() const
+{
+ return (m_window ? m_window->width() : 0);
+}
+
+int QQuickWindowAttached::height() const
+{
+ return (m_window ? m_window->height() : 0);
+}
+
void QQuickWindowAttached::windowChanged(QQuickWindow *window)
{
if (window != m_window) {
@@ -89,6 +99,10 @@ void QQuickWindowAttached::windowChanged(QQuickWindow *window)
if (!oldWindow || window->activeFocusItem() != oldWindow->activeFocusItem())
emit activeFocusItemChanged();
emit contentItemChanged();
+ if (!oldWindow || window->width() != oldWindow->width())
+ emit widthChanged();
+ if (!oldWindow || window->height() != oldWindow->height())
+ emit heightChanged();
// QQuickWindowQmlImpl::visibilityChanged also exists, and window might even
// be QQuickWindowQmlImpl, but that's not what we are connecting to.
@@ -102,6 +116,10 @@ void QQuickWindowAttached::windowChanged(QQuickWindow *window)
this, &QQuickWindowAttached::activeChanged);
connect(window, &QQuickWindow::activeFocusItemChanged,
this, &QQuickWindowAttached::activeFocusItemChanged);
+ connect(window, &QQuickWindow::widthChanged,
+ this, &QQuickWindowAttached::widthChanged);
+ connect(window, &QQuickWindow::heightChanged,
+ this, &QQuickWindowAttached::heightChanged);
}
}
diff --git a/src/quick/items/qquickwindowattached_p.h b/src/quick/items/qquickwindowattached_p.h
index 7c2b0bc873..8138ab216a 100644
--- a/src/quick/items/qquickwindowattached_p.h
+++ b/src/quick/items/qquickwindowattached_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -50,6 +50,8 @@ class Q_AUTOTEST_EXPORT QQuickWindowAttached : public QObject
Q_PROPERTY(bool active READ isActive NOTIFY activeChanged)
Q_PROPERTY(QQuickItem* activeFocusItem READ activeFocusItem NOTIFY activeFocusItemChanged)
Q_PROPERTY(QQuickItem* contentItem READ contentItem NOTIFY contentItemChanged)
+ Q_PROPERTY(int width READ width NOTIFY widthChanged)
+ Q_PROPERTY(int height READ height NOTIFY heightChanged)
public:
QQuickWindowAttached(QObject* attachee);
@@ -58,6 +60,8 @@ public:
bool isActive() const;
QQuickItem* activeFocusItem() const;
QQuickItem* contentItem() const;
+ int width() const;
+ int height() const;
Q_SIGNALS:
@@ -65,6 +69,8 @@ Q_SIGNALS:
void activeChanged();
void activeFocusItemChanged();
void contentItemChanged();
+ void widthChanged();
+ void heightChanged();
protected Q_SLOTS:
void windowChanged(QQuickWindow*);
diff --git a/src/quick/items/qquickwindowmodule.cpp b/src/quick/items/qquickwindowmodule.cpp
index 371abd163b..5c66a2ef84 100644
--- a/src/quick/items/qquickwindowmodule.cpp
+++ b/src/quick/items/qquickwindowmodule.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -45,127 +45,126 @@
QT_BEGIN_NAMESPACE
-class QQuickWindowQmlImpl : public QQuickWindow, public QQmlParserStatus
+class QQuickWindowQmlImplPrivate : public QQuickWindowPrivate
{
- Q_INTERFACES(QQmlParserStatus)
- Q_OBJECT
-
- Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
- Q_PROPERTY(Visibility visibility READ visibility WRITE setVisibility NOTIFY visibilityChanged)
-
public:
- QQuickWindowQmlImpl(QWindow *parent = 0)
- : QQuickWindow(parent)
- , m_complete(false)
- , m_visible(isVisible())
- , m_visibility(AutomaticVisibility)
+ QQuickWindowQmlImplPrivate()
+ : complete(false)
+ , visible(false)
+ , visibility(QQuickWindow::AutomaticVisibility)
{
- connect(this, &QWindow::visibleChanged, this, &QQuickWindowQmlImpl::visibleChanged);
- connect(this, &QWindow::visibilityChanged, this, &QQuickWindowQmlImpl::visibilityChanged);
}
- void setVisible(bool visible) {
- if (!m_complete)
- m_visible = visible;
- else if (!transientParent() || transientParent()->isVisible())
- QQuickWindow::setVisible(visible);
- }
+ bool complete;
+ bool visible;
+ QQuickWindow::Visibility visibility;
+ QV4::PersistentValue rootItemMarker;
+};
- void setVisibility(Visibility visibility)
- {
- if (!m_complete)
- m_visibility = visibility;
- else
- QQuickWindow::setVisibility(visibility);
- }
+QQuickWindowQmlImpl::QQuickWindowQmlImpl(QWindow *parent)
+ : QQuickWindow(*(new QQuickWindowQmlImplPrivate), parent)
+{
+ connect(this, &QWindow::visibleChanged, this, &QQuickWindowQmlImpl::visibleChanged);
+ connect(this, &QWindow::visibilityChanged, this, &QQuickWindowQmlImpl::visibilityChanged);
+}
+
+void QQuickWindowQmlImpl::setVisible(bool visible)
+{
+ Q_D(QQuickWindowQmlImpl);
+ if (!d->complete)
+ d->visible = visible;
+ else if (!transientParent() || transientParent()->isVisible())
+ QQuickWindow::setVisible(visible);
+}
+
+void QQuickWindowQmlImpl::setVisibility(Visibility visibility)
+{
+ Q_D(QQuickWindowQmlImpl);
+ if (!d->complete)
+ d->visibility = visibility;
+ else
+ QQuickWindow::setVisibility(visibility);
+}
+
+QQuickWindowAttached *QQuickWindowQmlImpl::qmlAttachedProperties(QObject *object)
+{
+ return new QQuickWindowAttached(object);
+}
- static QQuickWindowAttached *qmlAttachedProperties(QObject *object)
+void QQuickWindowQmlImpl::classBegin()
+{
+ Q_D(QQuickWindowQmlImpl);
+ QQmlEngine* e = qmlEngine(this);
+ //Give QQuickView behavior when created from QML with QQmlApplicationEngine
+ if (QCoreApplication::instance()->property("__qml_using_qqmlapplicationengine") == QVariant(true)) {
+ if (e && !e->incubationController())
+ e->setIncubationController(incubationController());
+ }
+ Q_ASSERT(e);
{
- return new QQuickWindowAttached(object);
+ QV4::ExecutionEngine *v4 = QQmlEnginePrivate::getV4Engine(e);
+ QV4::Scope scope(v4);
+ QV4::ScopedObject v(scope, QV4::QQuickRootItemMarker::create(e, this));
+ d->rootItemMarker = v;
}
+}
-Q_SIGNALS:
- void visibleChanged(bool arg);
- void visibilityChanged(QWindow::Visibility visibility);
-
-protected:
- void classBegin() {
- QQmlEngine* e = qmlEngine(this);
- //Give QQuickView behavior when created from QML with QQmlApplicationEngine
- if (QCoreApplication::instance()->property("__qml_using_qqmlapplicationengine") == QVariant(true)) {
- if (e && !e->incubationController())
- e->setIncubationController(incubationController());
- }
- Q_ASSERT(e);
- {
- QV4::ExecutionEngine *v4 = QQmlEnginePrivate::getV4Engine(e);
- QV4::Scope scope(v4);
- QV4::ScopedObject v(scope, QQuickRootItemMarker::create(e, this));
- rootItemMarker = v;
- }
+void QQuickWindowQmlImpl::componentComplete()
+{
+ Q_D(QQuickWindowQmlImpl);
+ d->complete = true;
+ if (transientParent() && !transientParent()->isVisible()) {
+ connect(transientParent(), &QQuickWindow::visibleChanged, this,
+ &QQuickWindowQmlImpl::setWindowVisibility, Qt::QueuedConnection);
+ } else {
+ setWindowVisibility();
}
+}
- void componentComplete() {
- m_complete = true;
- if (transientParent() && !transientParent()->isVisible()) {
- connect(transientParent(), &QQuickWindow::visibleChanged, this,
- &QQuickWindowQmlImpl::setWindowVisibility, Qt::QueuedConnection);
- } else {
- setWindowVisibility();
- }
+void QQuickWindowQmlImpl::setWindowVisibility()
+{
+ Q_D(QQuickWindowQmlImpl);
+ if (transientParent() && !transientParent()->isVisible())
+ return;
+
+ if (sender()) {
+ disconnect(transientParent(), &QWindow::visibleChanged, this,
+ &QQuickWindowQmlImpl::setWindowVisibility);
}
-private Q_SLOTS:
- void setWindowVisibility()
- {
- if (transientParent() && !transientParent()->isVisible())
- return;
-
- if (sender()) {
- disconnect(transientParent(), &QWindow::visibleChanged, this,
- &QQuickWindowQmlImpl::setWindowVisibility);
- }
-
- // We have deferred window creation until we have the full picture of what
- // the user wanted in terms of window state, geometry, visibility, etc.
-
- if ((m_visibility == Hidden && m_visible) || (m_visibility > AutomaticVisibility && !m_visible)) {
- QQmlData *data = QQmlData::get(this);
- Q_ASSERT(data && data->context);
-
- QQmlError error;
- error.setObject(this);
-
- const QQmlContextData* urlContext = data->context;
- while (urlContext && urlContext->url.isEmpty())
- urlContext = urlContext->parent;
- error.setUrl(urlContext ? urlContext->url : QUrl());
-
- QString objectId = data->context->findObjectId(this);
- if (!objectId.isEmpty())
- error.setDescription(QCoreApplication::translate("QQuickWindowQmlImpl",
- "Conflicting properties 'visible' and 'visibility' for Window '%1'").arg(objectId));
- else
- error.setDescription(QCoreApplication::translate("QQuickWindowQmlImpl",
- "Conflicting properties 'visible' and 'visibility'"));
-
- QQmlEnginePrivate::get(data->context->engine)->warning(error);
- }
-
- if (m_visibility == AutomaticVisibility) {
- setWindowState(QGuiApplicationPrivate::platformIntegration()->defaultWindowState(flags()));
- setVisible(m_visible);
- } else {
- setVisibility(m_visibility);
- }
+ // We have deferred window creation until we have the full picture of what
+ // the user wanted in terms of window state, geometry, visibility, etc.
+
+ if ((d->visibility == Hidden && d->visible) || (d->visibility > AutomaticVisibility && !d->visible)) {
+ QQmlData *data = QQmlData::get(this);
+ Q_ASSERT(data && data->context);
+
+ QQmlError error;
+ error.setObject(this);
+
+ const QQmlContextData* urlContext = data->context;
+ while (urlContext && urlContext->url().isEmpty())
+ urlContext = urlContext->parent;
+ error.setUrl(urlContext ? urlContext->url() : QUrl());
+
+ QString objectId = data->context->findObjectId(this);
+ if (!objectId.isEmpty())
+ error.setDescription(QCoreApplication::translate("QQuickWindowQmlImpl",
+ "Conflicting properties 'visible' and 'visibility' for Window '%1'").arg(objectId));
+ else
+ error.setDescription(QCoreApplication::translate("QQuickWindowQmlImpl",
+ "Conflicting properties 'visible' and 'visibility'"));
+
+ QQmlEnginePrivate::get(data->context->engine)->warning(error);
}
-private:
- bool m_complete;
- bool m_visible;
- Visibility m_visibility;
- QV4::PersistentValue rootItemMarker;
-};
+ if (d->visibility == AutomaticVisibility) {
+ setWindowState(QGuiApplicationPrivate::platformIntegration()->defaultWindowState(flags()));
+ setVisible(d->visible);
+ } else {
+ setVisibility(d->visibility);
+ }
+}
void QQuickWindowModule::defineModule()
{
@@ -181,8 +180,6 @@ void QQuickWindowModule::defineModule()
qmlRegisterUncreatableType<QQuickScreen>(uri, 2, 0, "Screen", QStringLiteral("Screen can only be used via the attached property."));
}
-#include "qquickwindowmodule.moc"
-
QT_END_NAMESPACE
QML_DECLARE_TYPEINFO(QQuickWindowQmlImpl, QML_HAS_ATTACHED_PROPERTIES)
diff --git a/src/quick/items/qquickwindowmodule_p.h b/src/quick/items/qquickwindowmodule_p.h
index 41f263a1ec..bfc51953ca 100644
--- a/src/quick/items/qquickwindowmodule_p.h
+++ b/src/quick/items/qquickwindowmodule_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -35,9 +35,45 @@
#define QQUICKWINDOWMODULE_H
#include <private/qtquickglobal_p.h>
+#include <qquickwindow.h>
+#include <qqmlparserstatus.h>
QT_BEGIN_NAMESPACE
+class QQuickWindowAttached;
+class QQuickWindowQmlImplPrivate;
+
+class Q_QUICK_PRIVATE_EXPORT QQuickWindowQmlImpl : public QQuickWindow, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+
+ Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
+ Q_PROPERTY(Visibility visibility READ visibility WRITE setVisibility NOTIFY visibilityChanged)
+
+public:
+ QQuickWindowQmlImpl(QWindow *parent = Q_NULLPTR);
+
+ void setVisible(bool visible);
+ void setVisibility(Visibility visibility);
+
+ static QQuickWindowAttached *qmlAttachedProperties(QObject *object);
+
+Q_SIGNALS:
+ void visibleChanged(bool arg);
+ void visibilityChanged(QWindow::Visibility visibility);
+
+protected:
+ void classBegin() Q_DECL_OVERRIDE;
+ void componentComplete() Q_DECL_OVERRIDE;
+
+private Q_SLOTS:
+ void setWindowVisibility();
+
+private:
+ Q_DISABLE_COPY(QQuickWindowQmlImpl)
+ Q_DECLARE_PRIVATE(QQuickWindowQmlImpl)
+};
class Q_QUICK_PRIVATE_EXPORT QQuickWindowModule
{
diff --git a/src/quick/qtquick2.cpp b/src/quick/qtquick2.cpp
index 09784d161a..524ee02952 100644
--- a/src/quick/qtquick2.cpp
+++ b/src/quick/qtquick2.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/qtquick2_p.h b/src/quick/qtquick2_p.h
index 8f415cbd02..f501323cde 100644
--- a/src/quick/qtquick2_p.h
+++ b/src/quick/qtquick2_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/qtquickglobal.h b/src/quick/qtquickglobal.h
index c86b2874a4..3bd193a3a6 100644
--- a/src/quick/qtquickglobal.h
+++ b/src/quick/qtquickglobal.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/qtquickglobal_p.h b/src/quick/qtquickglobal_p.h
index 7fe09da92e..df351d850f 100644
--- a/src/quick/qtquickglobal_p.h
+++ b/src/quick/qtquickglobal_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/coreapi/qsgabstractrenderer.cpp b/src/quick/scenegraph/coreapi/qsgabstractrenderer.cpp
index 13d328c764..c6e699e320 100644
--- a/src/quick/scenegraph/coreapi/qsgabstractrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgabstractrenderer.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/coreapi/qsgabstractrenderer.h b/src/quick/scenegraph/coreapi/qsgabstractrenderer.h
index a368eb50c2..2f7da6f610 100644
--- a/src/quick/scenegraph/coreapi/qsgabstractrenderer.h
+++ b/src/quick/scenegraph/coreapi/qsgabstractrenderer.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/coreapi/qsgabstractrenderer_p.h b/src/quick/scenegraph/coreapi/qsgabstractrenderer_p.h
index 4b986881c4..c5504513f4 100644
--- a/src/quick/scenegraph/coreapi/qsgabstractrenderer_p.h
+++ b/src/quick/scenegraph/coreapi/qsgabstractrenderer_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
index b9266974e0..63938d50a9 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
@@ -1,8 +1,8 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2015 The Qt Company Ltd.
** Copyright (C) 2014 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -11,9 +11,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -24,8 +24,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -46,6 +46,7 @@
#include <QtGui/QOpenGLFramebufferObject>
#include <QtGui/QOpenGLVertexArrayObject>
#include <QtGui/QOpenGLFunctions_1_0>
+#include <QtGui/QOpenGLFunctions_3_2_Core>
#include <private/qquickprofiler_p.h>
#include "qsgmaterialshader_p.h"
@@ -128,8 +129,9 @@ ShaderManager::Shader *ShaderManager::prepareMaterial(QSGMaterial *material)
if (shader)
return shader;
- if (QSG_LOG_TIME_COMPILATION().isDebugEnabled() || QQuickProfiler::profilingSceneGraph())
+ if (QSG_LOG_TIME_COMPILATION().isDebugEnabled())
qsg_renderer_timer.start();
+ Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphContextFrame);
QSGMaterialShader *s = material->createShader();
QOpenGLContext *ctx = QOpenGLContext::currentContext();
@@ -159,8 +161,7 @@ ShaderManager::Shader *ShaderManager::prepareMaterial(QSGMaterial *material)
qCDebug(QSG_LOG_TIME_COMPILATION, "shader compiled in %dms", (int) qsg_renderer_timer.elapsed());
- Q_QUICK_SG_PROFILE(QQuickProfiler::SceneGraphContextFrame, (
- qsg_renderer_timer.nsecsElapsed()));
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphContextFrame);
rewrittenShaders[type] = shader;
return shader;
@@ -173,8 +174,9 @@ ShaderManager::Shader *ShaderManager::prepareMaterialNoRewrite(QSGMaterial *mate
if (shader)
return shader;
- if (QSG_LOG_TIME_COMPILATION().isDebugEnabled() || QQuickProfiler::profilingSceneGraph())
+ if (QSG_LOG_TIME_COMPILATION().isDebugEnabled())
qsg_renderer_timer.start();
+ Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphContextFrame);
QSGMaterialShader *s = static_cast<QSGMaterialShader *>(material->createShader());
context->compile(s, material);
@@ -190,8 +192,7 @@ ShaderManager::Shader *ShaderManager::prepareMaterialNoRewrite(QSGMaterial *mate
qCDebug(QSG_LOG_TIME_COMPILATION, "shader compiled in %dms (no rewrite)", (int) qsg_renderer_timer.elapsed());
- Q_QUICK_SG_PROFILE(QQuickProfiler::SceneGraphContextFrame, (
- qsg_renderer_timer.nsecsElapsed()));
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphContextFrame);
return shader;
}
@@ -760,6 +761,10 @@ Renderer::Renderer(QSGRenderContext *ctx)
, m_clipMatrixId(0)
, m_currentClip(0)
, m_currentClipType(NoClip)
+ , m_vertexUploadPool(256)
+#ifdef QSG_SEPARATE_INDEX_BUFFER
+ , m_indexUploadPool(64)
+#endif
, m_vao(0)
, m_visualizeMode(VisualizeNothing)
{
@@ -817,6 +822,11 @@ Renderer::Renderer(QSGRenderContext *ctx)
static void qsg_wipeBuffer(Buffer *buffer, QOpenGLFunctions *funcs)
{
funcs->glDeleteBuffers(1, &buffer->id);
+ // The free here is ok because we're in one of two situations.
+ // 1. We're using the upload pool in which case unmap will have set the
+ // data pointer to 0 and calling free on 0 is ok.
+ // 2. We're using dedicated buffers because of visualization or IBO workaround
+ // and the data something we malloced and must be freed.
free(buffer->data);
}
@@ -838,8 +848,8 @@ Renderer::~Renderer()
for (int i=0; i<m_batchPool.size(); ++i) qsg_wipeBatch(m_batchPool.at(i), this);
}
- // The shadowtree
- qDeleteAll(m_nodes.values());
+ foreach (Node *n, m_nodes.values())
+ m_nodeAllocator.release(n);
// Remaining elements...
for (int i=0; i<m_elementsToDelete.size(); ++i) {
@@ -847,7 +857,7 @@ Renderer::~Renderer()
if (e->isRenderNode)
delete static_cast<RenderNodeElement *>(e);
else
- delete e;
+ m_elementAllocator.release(e);
}
}
@@ -870,14 +880,26 @@ void Renderer::invalidateAndRecycleBatch(Batch *b)
*
* ref: http://www.opengl.org/wiki/Buffer_Object
*/
-void Renderer::map(Buffer *buffer, int byteSize)
+void Renderer::map(Buffer *buffer, int byteSize, bool isIndexBuf)
{
- if (buffer->size != byteSize) {
- if (buffer->data)
- free(buffer->data);
+ if (!m_context->hasBrokenIndexBufferObjects() && m_visualizeMode == VisualizeNothing) {
+ // Common case, use a shared memory pool for uploading vertex data to avoid
+ // excessive reevaluation
+ QDataBuffer<char> &pool =
+#ifdef QSG_SEPARATE_INDEX_BUFFER
+ isIndexBuf ? m_indexUploadPool : m_vertexUploadPool;
+#else
+ m_vertexUploadPool;
+ Q_UNUSED(isIndexBuf);
+#endif
+ if (byteSize > pool.size())
+ pool.resize(byteSize);
+ buffer->data = pool.data();
+ } else {
buffer->data = (char *) malloc(byteSize);
- buffer->size = byteSize;
}
+ buffer->size = byteSize;
+
}
void Renderer::unmap(Buffer *buffer, bool isIndexBuf)
@@ -887,6 +909,10 @@ void Renderer::unmap(Buffer *buffer, bool isIndexBuf)
GLenum target = isIndexBuf ? GL_ELEMENT_ARRAY_BUFFER : GL_ARRAY_BUFFER;
glBindBuffer(target, buffer->id);
glBufferData(target, buffer->size, buffer->data, m_bufferStrategy);
+
+ if (!m_context->hasBrokenIndexBufferObjects() && m_visualizeMode == VisualizeNothing) {
+ buffer->data = 0;
+ }
}
BatchRootInfo *Renderer::batchRootInfo(Node *node)
@@ -986,7 +1012,8 @@ void Renderer::nodeWasAdded(QSGNode *node, Node *shadowParent)
if (node->isSubtreeBlocked())
return;
- Node *snode = new Node(node);
+ Node *snode = m_nodeAllocator.allocate();
+ snode->sgNode = node;
m_nodes.insert(node, snode);
if (shadowParent) {
snode->parent = shadowParent;
@@ -994,7 +1021,8 @@ void Renderer::nodeWasAdded(QSGNode *node, Node *shadowParent)
}
if (node->type() == QSGNode::GeometryNodeType) {
- snode->data = new Element(static_cast<QSGGeometryNode *>(node));
+ snode->data = m_elementAllocator.allocate();
+ snode->element()->setNode(static_cast<QSGGeometryNode *>(node));
} else if (node->type() == QSGNode::ClipNodeType) {
snode->data = new ClipBatchRootInfo;
@@ -1057,7 +1085,7 @@ void Renderer::nodeWasRemoved(Node *node)
}
Q_ASSERT(m_nodes.contains(node->sgNode));
- delete m_nodes.take(node->sgNode);
+ m_nodeAllocator.release(m_nodes.take(node->sgNode));
}
void Renderer::turnNodeIntoBatchRoot(Node *node)
@@ -1240,8 +1268,8 @@ void Renderer::buildRenderLists(QSGNode *node)
if (node->isSubtreeBlocked())
return;
- Q_ASSERT(m_nodes.contains(node));
Node *shadowNode = m_nodes.value(node);
+ Q_ASSERT(shadowNode);
if (node->type() == QSGNode::GeometryNodeType) {
QSGGeometryNode *gn = static_cast<QSGGeometryNode *>(node);
@@ -1262,7 +1290,7 @@ void Renderer::buildRenderLists(QSGNode *node)
} else if (node->type() == QSGNode::ClipNodeType || shadowNode->isBatchRoot) {
Q_ASSERT(m_nodes.contains(node));
- BatchRootInfo *info = batchRootInfo(m_nodes.value(node));
+ BatchRootInfo *info = batchRootInfo(shadowNode);
if (node == m_partialRebuildRoot) {
m_nextRenderOrder = info->firstOrder;
QSGNODE_TRAVERSE(node)
@@ -1615,6 +1643,26 @@ void Renderer::prepareAlphaBatches()
}
+static inline int qsg_fixIndexCount(int iCount, GLenum drawMode) {
+ switch (drawMode) {
+ case GL_TRIANGLE_STRIP:
+ // Merged triangle strips need to contain degenerate triangles at the beginning and end.
+ // One could save 2 uploaded ushorts here by ditching the padding for the front of the
+ // first and the end of the last, but for simplicity, we simply don't care.
+ // Those extra triangles will be skipped while drawing to preserve the strip's parity
+ // anyhow.
+ return iCount + 2;
+ case GL_LINES:
+ // For lines we drop the last vertex if the number of vertices is uneven.
+ return iCount - (iCount % 2);
+ case GL_TRIANGLES:
+ // For triangles we drop trailing vertices until the result is divisible by 3.
+ return iCount - (iCount % 3);
+ default:
+ return iCount;
+ }
+}
+
/* These parameters warrant some explanation...
*
* vaOffset: The byte offset into the vertex data to the location of the
@@ -1645,8 +1693,8 @@ void Renderer::uploadMergedElement(Element *e, int vaOffset, char **vertexData,
if (((const QMatrix4x4_Accessor &) localx).flagBits == 1) {
for (int i=0; i<vCount; ++i) {
Pt *p = (Pt *) vdata;
- p->x += ((QMatrix4x4_Accessor &) localx).m[3][0];
- p->y += ((QMatrix4x4_Accessor &) localx).m[3][1];
+ p->x += ((const QMatrix4x4_Accessor &) localx).m[3][0];
+ p->y += ((const QMatrix4x4_Accessor &) localx).m[3][1];
vdata += vSize;
}
} else if (((const QMatrix4x4_Accessor &) localx).flagBits > 1) {
@@ -1668,15 +1716,21 @@ void Renderer::uploadMergedElement(Element *e, int vaOffset, char **vertexData,
quint16 *indices = (quint16 *) *indexData;
if (iCount == 0) {
+ iCount = vCount;
if (g->drawingMode() == GL_TRIANGLE_STRIP)
*indices++ = *iBase;
- iCount = vCount;
+ else
+ iCount = qsg_fixIndexCount(iCount, g->drawingMode());
+
for (int i=0; i<iCount; ++i)
indices[i] = *iBase + i;
} else {
const quint16 *srcIndices = g->indexDataAsUShort();
if (g->drawingMode() == GL_TRIANGLE_STRIP)
*indices++ = *iBase + srcIndices[0];
+ else
+ iCount = qsg_fixIndexCount(iCount, g->drawingMode());
+
for (int i=0; i<iCount; ++i)
indices[i] = *iBase + srcIndices[i];
}
@@ -1725,7 +1779,8 @@ void Renderer::uploadBatch(Batch *b)
QSGGeometryNode *gn = b->first->node;
QSGGeometry *g = gn->geometry();
QSGMaterial::Flags flags = gn->activeMaterial()->flags();
- bool canMerge = (g->drawingMode() == GL_TRIANGLES || g->drawingMode() == GL_TRIANGLE_STRIP)
+ bool canMerge = (g->drawingMode() == GL_TRIANGLES || g->drawingMode() == GL_TRIANGLE_STRIP ||
+ g->drawingMode() == GL_LINES || g->drawingMode() == GL_POINTS)
&& b->positionAttribute >= 0
&& g->indexType() == GL_UNSIGNED_SHORT
&& (flags & (QSGMaterial::CustomCompileStep | QSGMaterial_FullMatrix)) == 0
@@ -1747,11 +1802,7 @@ void Renderer::uploadBatch(Batch *b)
if (b->merged) {
if (iCount == 0)
iCount = eg->vertexCount();
- // merged Triangle strips need to contain degenerate triangles at the beginning and end.
- // One could save 2 ushorts here by ditching the padding for the front of the
- // first and the end of the last, but for simplicity, we simply don't care.
- if (g->drawingMode() == GL_TRIANGLE_STRIP)
- iCount += sizeof(quint16);
+ iCount = qsg_fixIndexCount(iCount, g->drawingMode());
} else {
unmergedIndexSize += iCount * eg->sizeOfIndex();
}
@@ -1787,7 +1838,7 @@ void Renderer::uploadBatch(Batch *b)
}
#ifdef QSG_SEPARATE_INDEX_BUFFER
- map(&b->ibo, ibufferSize);
+ map(&b->ibo, ibufferSize, true);
#else
bufferSize += ibufferSize;
#endif
@@ -1821,6 +1872,10 @@ void Renderer::uploadBatch(Batch *b)
verticesInSet += e->node->geometry()->vertexCount();
if (verticesInSet > 0xffff) {
b->drawSets.last().indexCount = indicesInSet;
+ if (g->drawingMode() == GL_TRIANGLE_STRIP) {
+ b->drawSets.last().indices += 1 * sizeof(quint16);
+ b->drawSets.last().indexCount -= 2;
+ }
#ifdef QSG_SEPARATE_INDEX_BUFFER
drawSetIndices = indexData - b->ibo.data;
#else
@@ -1837,6 +1892,12 @@ void Renderer::uploadBatch(Batch *b)
e = e->nextInBatch;
}
b->drawSets.last().indexCount = indicesInSet;
+ // We skip the very first and very last degenerate triangles since they aren't needed
+ // and the first one would reverse the vertex ordering of the merged strips.
+ if (g->drawingMode() == GL_TRIANGLE_STRIP) {
+ b->drawSets.last().indices += 1 * sizeof(quint16);
+ b->drawSets.last().indexCount -= 2;
+ }
} else {
char *vboData = b->vbo.data;
#ifdef QSG_SEPARATE_INDEX_BUFFER
@@ -1874,11 +1935,11 @@ void Renderer::uploadBatch(Batch *b)
if (attr.isVertexCoordinate)
dump << "* ";
for (int t=0; t<attr.tupleSize; ++t)
- dump << *(float *)(vd + offset + t * sizeof(float)) << " ";
+ dump << *(const float *)(vd + offset + t * sizeof(float)) << " ";
} else if (attr.type == GL_UNSIGNED_BYTE) {
dump << "ubyte ";
for (int t=0; t<attr.tupleSize; ++t)
- dump << *(unsigned char *)(vd + offset + t * sizeof(unsigned char)) << " ";
+ dump << *(const unsigned char *)(vd + offset + t * sizeof(unsigned char)) << " ";
}
dump << ") ";
offset += attr.tupleSize * size_of_type(attr.type);
@@ -2351,9 +2412,17 @@ void Renderer::renderUnmergedBatch(const Batch *batch)
glLineWidth(g->lineWidth());
#if !defined(QT_OPENGL_ES_2)
else if (!QOpenGLContext::currentContext()->isOpenGLES() && g->drawingMode() == GL_POINTS) {
- QOpenGLFunctions_1_0 *gl1funcs = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_1_0>();
- gl1funcs->initializeOpenGLFunctions();
- gl1funcs->glPointSize(g->lineWidth());
+ QOpenGLFunctions_1_0 *gl1funcs = 0;
+ QOpenGLFunctions_3_2_Core *gl3funcs = 0;
+ if (QOpenGLContext::currentContext()->format().profile() == QSurfaceFormat::CoreProfile)
+ gl3funcs = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_3_2_Core>();
+ else
+ gl1funcs = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_1_0>();
+ Q_ASSERT(gl1funcs || gl3funcs);
+ if (gl1funcs)
+ gl1funcs->glPointSize(g->lineWidth());
+ else
+ gl3funcs->glPointSize(g->lineWidth());
}
#endif
@@ -2466,22 +2535,11 @@ void Renderer::deleteRemovedElements()
if (e->isRenderNode)
delete static_cast<RenderNodeElement *>(e);
else
- delete e;
+ m_elementAllocator.release(e);
}
m_elementsToDelete.reset();
}
-void Renderer::preprocess()
-{
- // Bind our VAO. It's important that we do this here as the
- // QSGRenderer::preprocess() call may well do work that requires
- // a bound VAO.
- if (m_vao)
- m_vao->bind();
-
- QSGRenderer::preprocess();
-}
-
void Renderer::render()
{
if (Q_UNLIKELY(debug_dump())) {
@@ -2508,6 +2566,9 @@ void Renderer::render()
qDebug() << "Renderer::render()" << this << type;
}
+ if (m_vao)
+ m_vao->bind();
+
if (m_rebuild & (BuildRenderLists | BuildRenderListsForTaggedRoots)) {
bool complete = (m_rebuild & BuildRenderLists) != 0;
if (complete)
@@ -2578,14 +2639,37 @@ void Renderer::render()
m_zRange = 1.0 / (m_nextRenderOrder);
}
+ int largestVBO = 0;
+#ifdef QSG_SEPARATE_INDEX_BUFFER
+ int largestIBO = 0;
+#endif
if (Q_UNLIKELY(debug_upload())) qDebug() << "Uploading Opaque Batches:";
- for (int i=0; i<m_opaqueBatches.size(); ++i)
- uploadBatch(m_opaqueBatches.at(i));
+ for (int i=0; i<m_opaqueBatches.size(); ++i) {
+ Batch *b = m_opaqueBatches.at(i);
+ largestVBO = qMax(b->vbo.size, largestVBO);
+#ifdef QSG_SEPARATE_INDEX_BUFFER
+ largestIBO = qMax(b->ibo.size, largestIBO);
+#endif
+ uploadBatch(b);
+ }
if (Q_UNLIKELY(debug_upload())) qDebug() << "Uploading Alpha Batches:";
- for (int i=0; i<m_alphaBatches.size(); ++i)
- uploadBatch(m_alphaBatches.at(i));
+ for (int i=0; i<m_alphaBatches.size(); ++i) {
+ Batch *b = m_alphaBatches.at(i);
+ uploadBatch(b);
+ largestVBO = qMax(b->vbo.size, largestVBO);
+#ifdef QSG_SEPARATE_INDEX_BUFFER
+ largestIBO = qMax(b->ibo.size, largestIBO);
+#endif
+ }
+
+ if (largestVBO * 2 < m_vertexUploadPool.size())
+ m_vertexUploadPool.resize(largestVBO * 2);
+#ifdef QSG_SEPARATE_INDEX_BUFFER
+ if (largestIBO * 2 < m_indexUploadPool.size())
+ m_indexUploadPool.resize(largestIBO * 2);
+#endif
renderBatches();
@@ -2709,7 +2793,8 @@ public:
int color;
int matrix;
int rotation;
- int tweak;
+ int pattern;
+ int projection;
};
void Renderer::visualizeDrawGeometry(const QSGGeometry *g)
@@ -2742,8 +2827,7 @@ void Renderer::visualizeBatch(Batch *b)
if (b->root)
matrix = matrix * qsg_matrixForRoot(b->root);
- QRect viewport = viewportRect();
- shader->setUniformValue(shader->tweak, viewport.width(), viewport.height(), b->merged ? 0 : 1, 0);
+ shader->setUniformValue(shader->pattern, float(b->merged ? 0 : 1));
QColor color = QColor::fromHsvF((rand() & 1023) / 1023.0, 1.0, 1.0);
float cr = color.redF();
@@ -2826,9 +2910,7 @@ void Renderer::visualizeChanges(Node *n)
float cg = color.greenF() * ca;
float cb = color.blueF() * ca;
shader->setUniformValue(shader->color, cr, cg, cb, ca);
-
- QRect viewport = viewportRect();
- shader->setUniformValue(shader->tweak, viewport.width(), viewport.height(), tinted ? 0.5 : 0, 0);
+ shader->setUniformValue(shader->pattern, float(tinted ? 0.5 : 0));
QSGGeometryNode *gn = static_cast<QSGGeometryNode *>(n->sgNode);
@@ -2880,10 +2962,8 @@ void Renderer::visualizeOverdraw_helper(Node *node)
void Renderer::visualizeOverdraw()
{
VisualizeShader *shader = static_cast<VisualizeShader *>(m_shaderManager->visualizeProgram);
- shader->setUniformValue(shader->color, 0.5, 0.5, 1, 1);
-
- QRect viewport = viewportRect();
- shader->setUniformValue(shader->tweak, viewport.width(), viewport.height(), 0, 1);
+ shader->setUniformValue(shader->color, 0.5f, 0.5f, 1.0f, 1.0f);
+ shader->setUniformValue(shader->projection, 1);
glBlendFunc(GL_ONE, GL_ONE);
@@ -2891,7 +2971,7 @@ void Renderer::visualizeOverdraw()
step += static_cast<float>(M_PI * 2 / 1000.);
if (step > M_PI * 2)
step = 0;
- float angle = 80.0 * sin(step);
+ float angle = 80.0 * std::sin(step);
QMatrix4x4 xrot; xrot.rotate(20, 1, 0, 0);
QMatrix4x4 zrot; zrot.rotate(angle, 0, 0, 1);
@@ -2963,7 +3043,8 @@ void Renderer::visualize()
prog->link();
prog->bind();
prog->color = prog->uniformLocation("color");
- prog->tweak = prog->uniformLocation("tweak");
+ prog->pattern = prog->uniformLocation("pattern");
+ prog->projection = prog->uniformLocation("projection");
prog->matrix = prog->uniformLocation("matrix");
prog->rotation = prog->uniformLocation("rotation");
m_shaderManager->visualizeProgram = prog;
@@ -2973,7 +3054,6 @@ void Renderer::visualize()
VisualizeShader *shader = static_cast<VisualizeShader *>(m_shaderManager->visualizeProgram);
glDisable(GL_DEPTH_TEST);
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glEnableVertexAttribArray(0);
@@ -2983,10 +3063,11 @@ void Renderer::visualize()
if (m_visualizeMode == VisualizeBatches)
bgOpacity = 1.0;
float v[] = { -1, 1, 1, 1, -1, -1, 1, -1 };
- shader->setUniformValue(shader->color, 0, 0, 0, bgOpacity);
+ shader->setUniformValue(shader->color, 0.0f, 0.0f, 0.0f, bgOpacity);
shader->setUniformValue(shader->matrix, QMatrix4x4());
shader->setUniformValue(shader->rotation, QMatrix4x4());
- shader->setUniformValue(shader->tweak, 0, 0, 0, 0);
+ shader->setUniformValue(shader->pattern, 0.0f);
+ shader->setUniformValue(shader->projection, false);
glVertexAttribPointer(0, 2, GL_FLOAT, false, 0, v);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
@@ -2995,9 +3076,8 @@ void Renderer::visualize()
for (int i=0; i<m_opaqueBatches.size(); ++i) visualizeBatch(m_opaqueBatches.at(i));
for (int i=0; i<m_alphaBatches.size(); ++i) visualizeBatch(m_alphaBatches.at(i));
} else if (m_visualizeMode == VisualizeClipping) {
- QRect viewport = viewportRect();
- shader->setUniformValue(shader->tweak, viewport.width(), viewport.height(), 0.5, 0);
- shader->setUniformValue(shader->color, GLfloat(0.2), 0, 0, GLfloat(0.2));
+ shader->setUniformValue(shader->pattern, 0.5f);
+ shader->setUniformValue(shader->color, 0.2f, 0.0f, 0.0f, 0.2f);
visualizeClipping(rootNode());
} else if (m_visualizeMode == VisualizeChanges) {
visualizeChanges(m_nodes.value(rootNode()));
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
index 5447d9ea52..f87dd75c8c 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,16 +23,16 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifndef ULTRARENDERER_H
-#define ULTRARENDERER_H
+#ifndef QSGBATCHRENDERER_P_H
+#define QSGBATCHRENDERER_P_H
#include <private/qsgrenderer_p.h>
#include <private/qsgnodeupdater_p.h>
@@ -40,6 +40,8 @@
#include <private/qsgrendernode_p.h>
+#include <QtCore/QBitArray>
+
QT_BEGIN_NAMESPACE
class QOpenGLVertexArrayObject;
@@ -59,6 +61,120 @@ class Updater;
class Renderer;
class ShaderManager;
+template <typename Type, int PageSize> class AllocatorPage
+{
+public:
+ // The memory used by this allocator
+ char data[sizeof(Type) * PageSize];
+
+ // 'blocks' contains a list of free indices which can be allocated.
+ // The first available index is found in PageSize - available.
+ int blocks[PageSize];
+
+ // 'available' is the number of available instances this page has left to allocate.
+ int available;
+
+ // This is not strictly needed, but useful for sanity checking and anyway
+ // pretty small..
+ QBitArray allocated;
+
+ AllocatorPage()
+ : available(PageSize)
+ , allocated(PageSize)
+ {
+ for (int i=0; i<PageSize; ++i) blocks[i] = i;
+ }
+
+ const Type *at(uint index) const
+ {
+ return (Type *) &data[index * sizeof(Type)];
+ }
+
+ Type *at(uint index)
+ {
+ return (Type *) &data[index * sizeof(Type)];
+ }
+};
+
+template <typename Type, int PageSize> class Allocator
+{
+public:
+ Allocator()
+ {
+ pages.push_back(new AllocatorPage<Type, PageSize>());
+ }
+
+ ~Allocator()
+ {
+ qDeleteAll(pages);
+ }
+
+ Type *allocate()
+ {
+ AllocatorPage<Type, PageSize> *p = 0;
+ for (int i=0; i<pages.size(); ++i) {
+ if (pages.at(i)->available > 0) {
+ p = pages.at(i);
+ break;
+ }
+ }
+ if (!p) {
+ p = new AllocatorPage<Type, PageSize>();
+ pages.push_back(p);
+ }
+ uint pos = p->blocks[PageSize - p->available];
+ void *mem = p->at(pos);
+ p->available--;
+ p->allocated.setBit(pos);
+ Type *t = new (mem) Type();
+ return t;
+ }
+
+ void releaseExplicit(uint pageIndex, uint index)
+ {
+ AllocatorPage<Type, PageSize> *page = pages.at(pageIndex);
+ if (!page->allocated.testBit(index))
+ qFatal("Double delete in allocator: page=%d, index=%d", pageIndex , index);
+
+ // Call the destructor
+ page->at(index)->~Type();
+
+ page->allocated[index] = false;
+ page->available++;
+ page->blocks[PageSize - page->available] = index;
+
+ // Remove the pages if they are empty and they are the last ones. We need to keep the
+ // order of pages since we have references to their index, so we can only remove
+ // from the end.
+ while (page->available == PageSize && pages.size() > 1 && pages.back() == page) {
+ pages.pop_back();
+ delete page;
+ page = pages.back();
+ }
+ }
+
+ void release(Type *t)
+ {
+ int pageIndex = -1;
+ for (int i=0; i<pages.size(); ++i) {
+ AllocatorPage<Type, PageSize> *p = pages.at(i);
+ if ((Type *) (&p->data[0]) <= t && (Type *) (&p->data[PageSize * sizeof(Type)]) > t) {
+ pageIndex = i;
+ break;
+ }
+ }
+ Q_ASSERT(pageIndex >= 0);
+
+ AllocatorPage<Type, PageSize> *page = pages.at(pageIndex);
+ int index = (quint64(t) - quint64(&page->data[0])) / sizeof(Type);
+
+ releaseExplicit(pageIndex, index);
+ }
+
+ QVector<AllocatorPage<Type, PageSize> *> pages;
+};
+
+
inline bool hasMaterialWithBlending(QSGGeometryNode *n)
{
return (n->opaqueMaterial() ? n->opaqueMaterial()->flags() & QSGMaterial::Blending
@@ -144,13 +260,15 @@ inline QDebug operator << (QDebug d, const Rect &r) {
struct Buffer {
GLuint id;
int size;
+ // Data is only valid while preparing the upload. Exception is if we are using the
+ // broken IBO workaround or we are using a visualization mode.
char *data;
};
struct Element {
- Element(QSGGeometryNode *n)
- : node(n)
+ Element()
+ : node(0)
, batch(0)
, nextInBatch(0)
, root(0)
@@ -161,10 +279,15 @@ struct Element {
, removed(false)
, orphaned(false)
, isRenderNode(false)
- , isMaterialBlended(n ? hasMaterialWithBlending(n) : false)
+ , isMaterialBlended(false)
{
}
+ void setNode(QSGGeometryNode *n) {
+ node = n;
+ isMaterialBlended = hasMaterialWithBlending(n);
+ }
+
inline void ensureBoundsValid() {
if (!boundsComputed)
computeBounds();
@@ -192,8 +315,7 @@ struct Element {
struct RenderNodeElement : public Element {
RenderNodeElement(QSGRenderNode *rn)
- : Element(0)
- , renderNode(rn)
+ : renderNode(rn)
{
isRenderNode = true;
}
@@ -289,15 +411,14 @@ struct Batch
struct Node
{
- Node(QSGNode *node, Node *sparent = 0)
- : sgNode(node)
- , parent(sparent)
+ Node()
+ : sgNode(0)
+ , parent(0)
, data(0)
, dirtyState(0)
, isOpaque(false)
, isBatchRoot(false)
{
-
}
QSGNode *sgNode;
@@ -414,7 +535,6 @@ public:
protected:
void nodeChanged(QSGNode *node, QSGNode::DirtyState state);
- void preprocess() Q_DECL_OVERRIDE;
void render();
private:
@@ -435,8 +555,7 @@ private:
friend class Updater;
-
- void map(Buffer *buffer, int size);
+ void map(Buffer *buffer, int size, bool isIndexBuf = false);
void unmap(Buffer *buffer, bool isIndexBuf = false);
void buildRenderListsFromScratch();
@@ -527,11 +646,18 @@ private:
const QSGClipNode *m_currentClip;
ClipType m_currentClipType;
+ QDataBuffer<char> m_vertexUploadPool;
+#ifdef QSG_SEPARATE_INDEX_BUFFER
+ QDataBuffer<char> m_indexUploadPool;
+#endif
// For minimal OpenGL core profile support
QOpenGLVertexArrayObject *m_vao;
QHash<Node *, uint> m_visualizeChanceSet;
VisualizeMode m_visualizeMode;
+
+ Allocator<Node, 256> m_nodeAllocator;
+ Allocator<Element, 64> m_elementAllocator;
};
Batch *Renderer::newBatch()
@@ -556,4 +682,4 @@ Batch *Renderer::newBatch()
QT_END_NAMESPACE
-#endif // ULTRARENDERER_H
+#endif // QSGBATCHRENDERER_P_H
diff --git a/src/quick/scenegraph/coreapi/qsggeometry.cpp b/src/quick/scenegraph/coreapi/qsggeometry.cpp
index 7e43541ef7..1fd37be84a 100644
--- a/src/quick/scenegraph/coreapi/qsggeometry.cpp
+++ b/src/quick/scenegraph/coreapi/qsggeometry.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt scene graph research project.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/coreapi/qsggeometry.h b/src/quick/scenegraph/coreapi/qsggeometry.h
index 6ab53a64d6..78116a9ae2 100644
--- a/src/quick/scenegraph/coreapi/qsggeometry.h
+++ b/src/quick/scenegraph/coreapi/qsggeometry.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt scene graph research project.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/coreapi/qsggeometry_p.h b/src/quick/scenegraph/coreapi/qsggeometry_p.h
index 3b2fad3d74..c52a45b25b 100644
--- a/src/quick/scenegraph/coreapi/qsggeometry_p.h
+++ b/src/quick/scenegraph/coreapi/qsggeometry_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/coreapi/qsgmaterial.cpp b/src/quick/scenegraph/coreapi/qsgmaterial.cpp
index 26eda5ec00..c68c0b93d2 100644
--- a/src/quick/scenegraph/coreapi/qsgmaterial.cpp
+++ b/src/quick/scenegraph/coreapi/qsgmaterial.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -385,6 +385,7 @@ void QSGMaterialShader::compile()
\class QSGMaterialShader::RenderState
\brief The QSGMaterialShader::RenderState encapsulates the current rendering state
during a call to QSGMaterialShader::updateState().
+ \inmodule QtQuick
The render state contains a number of accessors that the shader needs to respect
in order to conform to the current state of the scene graph.
diff --git a/src/quick/scenegraph/coreapi/qsgmaterial.h b/src/quick/scenegraph/coreapi/qsgmaterial.h
index ba1df4f4b6..a58574f83d 100644
--- a/src/quick/scenegraph/coreapi/qsgmaterial.h
+++ b/src/quick/scenegraph/coreapi/qsgmaterial.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/coreapi/qsgmaterialshader_p.h b/src/quick/scenegraph/coreapi/qsgmaterialshader_p.h
index 88a6357a01..fab6d00f84 100644
--- a/src/quick/scenegraph/coreapi/qsgmaterialshader_p.h
+++ b/src/quick/scenegraph/coreapi/qsgmaterialshader_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/coreapi/qsgnode.cpp b/src/quick/scenegraph/coreapi/qsgnode.cpp
index 58b6462d23..71f4f62db9 100644
--- a/src/quick/scenegraph/coreapi/qsgnode.cpp
+++ b/src/quick/scenegraph/coreapi/qsgnode.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -504,7 +504,7 @@ void QSGNode::insertChildNodeAfter(QSGNode *node, QSGNode *after)
{
//Q_ASSERT_X(!m_children.contains(node), "QSGNode::insertChildNodeAfter", "QSGNode is already a child!");
Q_ASSERT_X(!node->m_parent, "QSGNode::insertChildNodeAfter", "QSGNode already has a parent");
- Q_ASSERT_X(after && after->m_parent == this, "QSGNode::insertChildNodeBefore", "The parent of \'before\' is wrong");
+ Q_ASSERT_X(after && after->m_parent == this, "QSGNode::insertChildNodeAfter", "The parent of \'after\' is wrong");
#ifndef QT_NO_DEBUG
if (node->type() == QSGNode::GeometryNodeType) {
@@ -575,6 +575,19 @@ void QSGNode::removeAllChildNodes()
}
}
+/*!
+ * \internal
+ *
+ * Reparents all nodes of this node to \a newParent.
+ */
+void QSGNode::reparentChildNodesTo(QSGNode *newParent)
+{
+ for (QSGNode *c = firstChild(); c; c = firstChild()) {
+ removeChildNode(c);
+ newParent->appendChildNode(c);
+ }
+}
+
int QSGNode::childCount() const
{
@@ -774,7 +787,7 @@ QSGBasicGeometryNode::~QSGBasicGeometryNode()
void QSGBasicGeometryNode::setGeometry(QSGGeometry *geometry)
{
- if (flags() & OwnsGeometry)
+ if ((flags() & OwnsGeometry) != 0 && m_geometry != geometry)
delete m_geometry;
m_geometry = geometry;
markDirty(DirtyGeometry);
@@ -941,7 +954,7 @@ void QSGGeometryNode::setRenderOrder(int order)
*/
void QSGGeometryNode::setMaterial(QSGMaterial *material)
{
- if (flags() & OwnsMaterial)
+ if ((flags() & OwnsMaterial) != 0 && m_material != material)
delete m_material;
m_material = material;
#ifndef QT_NO_DEBUG
@@ -972,7 +985,7 @@ void QSGGeometryNode::setMaterial(QSGMaterial *material)
*/
void QSGGeometryNode::setOpaqueMaterial(QSGMaterial *material)
{
- if (flags() & OwnsOpaqueMaterial)
+ if ((flags() & OwnsOpaqueMaterial) != 0 && m_opaque_material != m_material)
delete m_opaque_material;
m_opaque_material = material;
#ifndef QT_NO_DEBUG
@@ -1444,7 +1457,7 @@ QDebug operator<<(QDebug d, const QSGGeometryNode *n)
d << "Geometry(null)";
return d;
}
- d << "GeometryNode(" << hex << (void *) n << dec;
+ d << "GeometryNode(" << hex << (const void *) n << dec;
const QSGGeometry *g = n->geometry();
@@ -1495,7 +1508,7 @@ QDebug operator<<(QDebug d, const QSGClipNode *n)
d << "ClipNode(null)";
return d;
}
- d << "ClipNode(" << hex << (void *) n << dec;
+ d << "ClipNode(" << hex << (const void *) n << dec;
if (n->childCount())
d << "children=" << n->childCount();
@@ -1518,7 +1531,7 @@ QDebug operator<<(QDebug d, const QSGTransformNode *n)
}
const QMatrix4x4 m = n->matrix();
d << "TransformNode(";
- d << hex << (void *) n << dec;
+ d << hex << (const void *) n << dec;
if (m.isIdentity())
d << "identity";
else if (m.determinant() == 1 && m(0, 0) == 1 && m(1, 1) == 1 && m(2, 2) == 1)
@@ -1540,7 +1553,7 @@ QDebug operator<<(QDebug d, const QSGOpacityNode *n)
return d;
}
d << "OpacityNode(";
- d << hex << (void *) n << dec;
+ d << hex << (const void *) n << dec;
d << "opacity=" << n->opacity()
<< "combined=" << n->combinedOpacity()
<< (n->isSubtreeBlocked() ? "*BLOCKED*" : "");
@@ -1558,7 +1571,7 @@ QDebug operator<<(QDebug d, const QSGRootNode *n)
d << "RootNode(null)";
return d;
}
- d << "RootNode" << hex << (void *) n << (n->isSubtreeBlocked() ? "*BLOCKED*" : "");
+ d << "RootNode" << hex << (const void *) n << (n->isSubtreeBlocked() ? "*BLOCKED*" : "");
#ifdef QSG_RUNTIME_DESCRIPTION
d << QSGNodePrivate::description(n);
#endif
@@ -1591,7 +1604,7 @@ QDebug operator<<(QDebug d, const QSGNode *n)
d << static_cast<const QSGOpacityNode *>(n);
break;
case QSGNode::RenderNodeType:
- d << "RenderNode(" << hex << (void *) n << dec
+ d << "RenderNode(" << hex << (const void *) n << dec
<< "flags=" << (int) n->flags() << dec
<< (n->isSubtreeBlocked() ? "*BLOCKED*" : "");
#ifdef QSG_RUNTIME_DESCRIPTION
@@ -1600,7 +1613,7 @@ QDebug operator<<(QDebug d, const QSGNode *n)
d << ')';
break;
default:
- d << "Node(" << hex << (void *) n << dec
+ d << "Node(" << hex << (const void *) n << dec
<< "flags=" << (int) n->flags() << dec
<< (n->isSubtreeBlocked() ? "*BLOCKED*" : "");
#ifdef QSG_RUNTIME_DESCRIPTION
diff --git a/src/quick/scenegraph/coreapi/qsgnode.h b/src/quick/scenegraph/coreapi/qsgnode.h
index dfacd84288..4c9ae7251e 100644
--- a/src/quick/scenegraph/coreapi/qsgnode.h
+++ b/src/quick/scenegraph/coreapi/qsgnode.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -132,6 +132,7 @@ public:
void appendChildNode(QSGNode *node);
void insertChildNodeBefore(QSGNode *node, QSGNode *before);
void insertChildNodeAfter(QSGNode *node, QSGNode *after);
+ void reparentChildNodesTo(QSGNode *newParent);
int childCount() const;
QSGNode *childAtIndex(int i) const;
diff --git a/src/quick/scenegraph/coreapi/qsgnode_p.h b/src/quick/scenegraph/coreapi/qsgnode_p.h
index 860bdb66a7..c455e342c8 100644
--- a/src/quick/scenegraph/coreapi/qsgnode_p.h
+++ b/src/quick/scenegraph/coreapi/qsgnode_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/coreapi/qsgnodeupdater.cpp b/src/quick/scenegraph/coreapi/qsgnodeupdater.cpp
index a697760e45..8293c106b5 100644
--- a/src/quick/scenegraph/coreapi/qsgnodeupdater.cpp
+++ b/src/quick/scenegraph/coreapi/qsgnodeupdater.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/coreapi/qsgnodeupdater_p.h b/src/quick/scenegraph/coreapi/qsgnodeupdater_p.h
index 1772c39061..e578586a19 100644
--- a/src/quick/scenegraph/coreapi/qsgnodeupdater_p.h
+++ b/src/quick/scenegraph/coreapi/qsgnodeupdater_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/coreapi/qsgrenderer.cpp b/src/quick/scenegraph/coreapi/qsgrenderer.cpp
index dd089425f6..a9752cb9a9 100644
--- a/src/quick/scenegraph/coreapi/qsgrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgrenderer.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -176,10 +176,11 @@ void QSGRenderer::renderScene(const QSGBindable &bindable)
m_is_rendering = true;
- bool profileFrames = QSG_LOG_TIME_RENDERER().isDebugEnabled() ||
- QQuickProfiler::profilingSceneGraph();
+ bool profileFrames = QSG_LOG_TIME_RENDERER().isDebugEnabled();
if (profileFrames)
frameTimer.start();
+ Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphRendererFrame);
+
qint64 bindTime = 0;
qint64 renderTime = 0;
@@ -189,6 +190,7 @@ void QSGRenderer::renderScene(const QSGBindable &bindable)
bindable.bind();
if (profileFrames)
bindTime = frameTimer.nsecsElapsed();
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRendererFrame);
// Sanity check that attribute registers are disabled
if (qsg_sanity_check) {
@@ -206,6 +208,7 @@ void QSGRenderer::renderScene(const QSGBindable &bindable)
render();
if (profileFrames)
renderTime = frameTimer.nsecsElapsed();
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRendererFrame);
m_is_rendering = false;
m_changed_emitted = false;
@@ -218,13 +221,6 @@ void QSGRenderer::renderScene(const QSGBindable &bindable)
int((updatePassTime - preprocessTime) / 1000000),
int((bindTime - updatePassTime) / 1000000),
int((renderTime - bindTime) / 1000000));
-
- Q_QUICK_SG_PROFILE(QQuickProfiler::SceneGraphRendererFrame, (
- preprocessTime,
- updatePassTime - preprocessTime,
- bindTime - updatePassTime,
- renderTime - bindTime));
-
}
/*!
@@ -273,15 +269,16 @@ void QSGRenderer::preprocess()
}
}
- bool profileFrames = QSG_LOG_TIME_RENDERER().isDebugEnabled()||
- QQuickProfiler::profilingSceneGraph();
+ bool profileFrames = QSG_LOG_TIME_RENDERER().isDebugEnabled();
if (profileFrames)
preprocessTime = frameTimer.nsecsElapsed();
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRendererFrame);
nodeUpdater()->updateStates(root);
if (profileFrames)
updatePassTime = frameTimer.nsecsElapsed();
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRendererFrame);
}
void QSGRenderer::addNodesToPreprocess(QSGNode *node)
diff --git a/src/quick/scenegraph/coreapi/qsgrenderer_p.h b/src/quick/scenegraph/coreapi/qsgrenderer_p.h
index 0d25e4c9f8..7e4d52730a 100644
--- a/src/quick/scenegraph/coreapi/qsgrenderer_p.h
+++ b/src/quick/scenegraph/coreapi/qsgrenderer_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/coreapi/qsgrendernode.cpp b/src/quick/scenegraph/coreapi/qsgrendernode.cpp
index 5c1c026c9c..4f5903ca14 100644
--- a/src/quick/scenegraph/coreapi/qsgrendernode.cpp
+++ b/src/quick/scenegraph/coreapi/qsgrendernode.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/coreapi/qsgrendernode_p.h b/src/quick/scenegraph/coreapi/qsgrendernode_p.h
index 66c3a402df..701fbeb9a4 100644
--- a/src/quick/scenegraph/coreapi/qsgrendernode_p.h
+++ b/src/quick/scenegraph/coreapi/qsgrendernode_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/coreapi/qsgshaderrewriter.cpp b/src/quick/scenegraph/coreapi/qsgshaderrewriter.cpp
index 275db25f96..845fd0868a 100644
--- a/src/quick/scenegraph/coreapi/qsgshaderrewriter.cpp
+++ b/src/quick/scenegraph/coreapi/qsgshaderrewriter.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/qsgadaptationlayer.cpp b/src/quick/scenegraph/qsgadaptationlayer.cpp
index 83704cf0ec..4f5c4efe14 100644
--- a/src/quick/scenegraph/qsgadaptationlayer.cpp
+++ b/src/quick/scenegraph/qsgadaptationlayer.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -62,7 +62,9 @@ QSGDistanceFieldGlyphCache::QSGDistanceFieldGlyphCache(QSGDistanceFieldGlyphCach
m_doubleGlyphResolution = qt_fontHasNarrowOutlines(font) && m_glyphCount < QT_DISTANCEFIELD_HIGHGLYPHCOUNT;
m_referenceFont = font;
- m_referenceFont.setPixelSize(QT_DISTANCEFIELD_BASEFONTSIZE(m_doubleGlyphResolution));
+ // we set the same pixel size as used by the distance field internally.
+ // this allows us to call pathForGlyph once and reuse the result.
+ m_referenceFont.setPixelSize(QT_DISTANCEFIELD_BASEFONTSIZE(m_doubleGlyphResolution) * QT_DISTANCEFIELD_SCALE(m_doubleGlyphResolution));
Q_ASSERT(m_referenceFont.isValid());
m_coreProfile = (c->format().profile() == QSurfaceFormat::CoreProfile);
@@ -78,8 +80,12 @@ QSGDistanceFieldGlyphCache::GlyphData &QSGDistanceFieldGlyphCache::glyphData(gly
if (data == m_glyphsData.end()) {
GlyphData gd;
gd.texture = &s_emptyTexture;
- QPainterPath path = m_referenceFont.pathForGlyph(glyph);
- gd.boundingRect = path.boundingRect();
+ gd.path = m_referenceFont.pathForGlyph(glyph);
+ // need bounding rect in base font size scale
+ qreal scaleFactor = qreal(1) / QT_DISTANCEFIELD_SCALE(m_doubleGlyphResolution);
+ QTransform scaleDown;
+ scaleDown.scale(scaleFactor, scaleFactor);
+ gd.boundingRect = scaleDown.mapRect(gd.path.boundingRect());
data = m_glyphsData.insert(glyph, gd);
}
return data.value();
@@ -153,22 +159,25 @@ void QSGDistanceFieldGlyphCache::update()
if (m_pendingGlyphs.isEmpty())
return;
- bool profileFrames = QSG_LOG_TIME_GLYPH().isDebugEnabled() ||
- QQuickProfiler::profilingSceneGraph();
+ bool profileFrames = QSG_LOG_TIME_GLYPH().isDebugEnabled();
if (profileFrames)
qsg_render_timer.start();
+ Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphAdaptationLayerFrame);
QList<QDistanceField> distanceFields;
for (int i = 0; i < m_pendingGlyphs.size(); ++i) {
- distanceFields.append(QDistanceField(m_referenceFont,
+ GlyphData &gd = glyphData(m_pendingGlyphs.at(i));
+ distanceFields.append(QDistanceField(gd.path,
m_pendingGlyphs.at(i),
m_doubleGlyphResolution));
+ gd.path = QPainterPath(); // no longer needed, so release memory used by the painter path
}
qint64 renderTime = 0;
int count = m_pendingGlyphs.size();
if (profileFrames)
renderTime = qsg_render_timer.nsecsElapsed();
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphAdaptationLayerFrame);
m_pendingGlyphs.reset();
@@ -188,10 +197,8 @@ void QSGDistanceFieldGlyphCache::update()
int(renderTime / 1000000),
int((now - (renderTime / 1000000))));
}
- Q_QUICK_SG_PROFILE(QQuickProfiler::SceneGraphAdaptationLayerFrame, (
- count,
- renderTime,
- qsg_render_timer.nsecsElapsed() - renderTime));
+ Q_QUICK_SG_PROFILE_END_WITH_PAYLOAD(QQuickProfiler::SceneGraphAdaptationLayerFrame,
+ (qint64)count);
}
void QSGDistanceFieldGlyphCache::setGlyphsPosition(const QList<GlyphPosition> &glyphs)
diff --git a/src/quick/scenegraph/qsgadaptationlayer_p.h b/src/quick/scenegraph/qsgadaptationlayer_p.h
index ef21385ee6..1253711a94 100644
--- a/src/quick/scenegraph/qsgadaptationlayer_p.h
+++ b/src/quick/scenegraph/qsgadaptationlayer_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -323,6 +323,7 @@ protected:
Texture *texture;
TexCoord texCoord;
QRectF boundingRect;
+ QPainterPath path;
quint32 ref;
GlyphData() : texture(0), ref(0) { }
diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp
index 99695f058f..418d571ae6 100644
--- a/src/quick/scenegraph/qsgcontext.cpp
+++ b/src/quick/scenegraph/qsgcontext.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -256,12 +256,12 @@ public:
advanceAnimation();
}
- float m_time;
- float m_vsync;
+ double m_time;
+ double m_vsync;
Mode m_mode;
QElapsedTimer m_timer;
QElapsedTimer m_wallTime;
- float m_lag;
+ double m_lag;
int m_bad;
int m_good;
};
@@ -315,11 +315,11 @@ QSGContext::QSGContext(QObject *parent) :
// Adds compatibility with Qt 5.3 and earlier's QSG_RENDER_TIMING
if (qEnvironmentVariableIsSet("QSG_RENDER_TIMING")) {
- ((QLoggingCategory &) QSG_LOG_TIME_GLYPH()).setEnabled(QtDebugMsg, true);
- ((QLoggingCategory &) QSG_LOG_TIME_TEXTURE()).setEnabled(QtDebugMsg, true);
- ((QLoggingCategory &) QSG_LOG_TIME_RENDERER()).setEnabled(QtDebugMsg, true);
- ((QLoggingCategory &) QSG_LOG_TIME_RENDERLOOP()).setEnabled(QtDebugMsg, true);
- ((QLoggingCategory &) QSG_LOG_TIME_COMPILATION()).setEnabled(QtDebugMsg, true);
+ const_cast<QLoggingCategory &>(QSG_LOG_TIME_GLYPH()).setEnabled(QtDebugMsg, true);
+ const_cast<QLoggingCategory &>(QSG_LOG_TIME_TEXTURE()).setEnabled(QtDebugMsg, true);
+ const_cast<QLoggingCategory &>(QSG_LOG_TIME_RENDERER()).setEnabled(QtDebugMsg, true);
+ const_cast<QLoggingCategory &>(QSG_LOG_TIME_RENDERLOOP()).setEnabled(QtDebugMsg, true);
+ const_cast<QLoggingCategory &>(QSG_LOG_TIME_COMPILATION()).setEnabled(QtDebugMsg, true);
}
}
@@ -379,6 +379,7 @@ void QSGContext::renderContextInitialized(QSGRenderContext *renderContext)
QByteArray all; foreach (const QByteArray &e, exts) all += ' ' + e;
qCDebug(QSG_LOG_INFO) << "GL_EXTENSIONS: " << all.constData();
qCDebug(QSG_LOG_INFO) << "Max Texture Size: " << renderContext->maxTextureSize();
+ qCDebug(QSG_LOG_INFO) << "Debug context: " << format.testOption(QSurfaceFormat::DebugContext);
}
d->mutex.unlock();
@@ -469,8 +470,11 @@ QSurfaceFormat QSGContext::defaultSurfaceFormat() const
QSurfaceFormat format = QSurfaceFormat::defaultFormat();
static bool useDepth = qEnvironmentVariableIsEmpty("QSG_NO_DEPTH_BUFFER");
static bool useStencil = qEnvironmentVariableIsEmpty("QSG_NO_STENCIL_BUFFER");
+ static bool enableDebug = qEnvironmentVariableIsSet("QSG_OPENGL_DEBUG");
format.setDepthBufferSize(useDepth ? 24 : 0);
format.setStencilBufferSize(useStencil ? 8 : 0);
+ if (enableDebug)
+ format.setOption(QSurfaceFormat::DebugContext);
if (QQuickWindow::hasDefaultAlphaBuffer())
format.setAlphaBufferSize(8);
format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
@@ -802,10 +806,7 @@ QSGTexture *QSGRenderContext::textureForFactory(QQuickTextureFactory *factory, Q
m_mutex.unlock();
if (!texture) {
- if (QQuickDefaultTextureFactory *dtf = qobject_cast<QQuickDefaultTextureFactory *>(factory))
- texture = createTexture(dtf->image());
- else
- texture = factory->createTexture(window);
+ texture = factory->createTexture(window);
m_mutex.lock();
m_textures.insert(factory, texture);
diff --git a/src/quick/scenegraph/qsgcontext_p.h b/src/quick/scenegraph/qsgcontext_p.h
index 184b8248d5..d1897f20f9 100644
--- a/src/quick/scenegraph/qsgcontext_p.h
+++ b/src/quick/scenegraph/qsgcontext_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -93,7 +93,7 @@ public:
QOpenGLContext *openglContext() const { return m_gl; }
QSGContext *sceneGraphContext() const { return m_sg; }
- bool isValid() const { return m_gl; }
+ virtual bool isValid() const { return m_gl; }
virtual void initialize(QOpenGLContext *context);
virtual void invalidate();
diff --git a/src/quick/scenegraph/qsgcontextplugin.cpp b/src/quick/scenegraph/qsgcontextplugin.cpp
index c5b06b50ee..18eb3234e4 100644
--- a/src/quick/scenegraph/qsgcontextplugin.cpp
+++ b/src/quick/scenegraph/qsgcontextplugin.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/qsgcontextplugin_p.h b/src/quick/scenegraph/qsgcontextplugin_p.h
index 54bb59f9d1..66f28f3ac0 100644
--- a/src/quick/scenegraph/qsgcontextplugin_p.h
+++ b/src/quick/scenegraph/qsgcontextplugin_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp
index 3d958245d2..dcc485ce17 100644
--- a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp
+++ b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -38,6 +38,7 @@
#include <QtQml/private/qqmlglobal_p.h>
#include <QtQuick/private/qsgdistancefieldutil_p.h>
#include <qopenglfunctions.h>
+#include <qopenglframebufferobject.h>
#include <qmath.h>
#if !defined(QT_OPENGL_ES_2)
@@ -47,6 +48,7 @@
QT_BEGIN_NAMESPACE
DEFINE_BOOL_CONFIG_OPTION(qmlUseGlyphCacheWorkaround, QML_USE_GLYPHCACHE_WORKAROUND)
+DEFINE_BOOL_CONFIG_OPTION(qsgPreferFullSizeGlyphCacheTextures, QSG_PREFER_FULLSIZE_GLYPHCACHE_TEXTURES)
#if !defined(QSG_DEFAULT_DISTANCEFIELD_GLYPH_CACHE_PADDING)
# define QSG_DEFAULT_DISTANCEFIELD_GLYPH_CACHE_PADDING 2
@@ -145,7 +147,10 @@ void QSGDefaultDistanceFieldGlyphCache::requestGlyphs(const QSet<glyph_t> &glyph
void QSGDefaultDistanceFieldGlyphCache::storeGlyphs(const QList<QDistanceField> &glyphs)
{
- QHash<TextureInfo *, QVector<glyph_t> > glyphTextures;
+ typedef QHash<TextureInfo *, QVector<glyph_t> > GlyphTextureHash;
+ typedef GlyphTextureHash::const_iterator GlyphTextureHashConstIt;
+
+ GlyphTextureHash glyphTextures;
GLint alignment = 4; // default value
m_funcs->glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment);
@@ -202,8 +207,7 @@ void QSGDefaultDistanceFieldGlyphCache::storeGlyphs(const QList<QDistanceField>
// restore to previous alignment
m_funcs->glPixelStorei(GL_UNPACK_ALIGNMENT, alignment);
- QHash<TextureInfo *, QVector<glyph_t> >::const_iterator i;
- for (i = glyphTextures.constBegin(); i != glyphTextures.constEnd(); ++i) {
+ for (GlyphTextureHashConstIt i = glyphTextures.constBegin(), cend = glyphTextures.constEnd(); i != cend; ++i) {
Texture t;
t.textureId = i.key()->texture;
t.size = i.key()->size;
@@ -321,7 +325,7 @@ void QSGDefaultDistanceFieldGlyphCache::resizeTexture(TextureInfo *texInfo, int
GL_COLOR_BUFFER_BIT, GL_NEAREST);
// Reset the default framebuffer
- m_coreFuncs->glBindFramebuffer(GL_FRAMEBUFFER, 0);
+ QOpenGLFramebufferObject::bindDefault();
return;
} else if (useTextureResizeWorkaround()) {
@@ -446,7 +450,7 @@ void QSGDefaultDistanceFieldGlyphCache::resizeTexture(TextureInfo *texInfo, int
m_funcs->glDeleteTextures(1, &tmp_texture);
m_funcs->glDeleteTextures(1, &oldTexture);
- m_funcs->glBindFramebuffer(GL_FRAMEBUFFER, 0);
+ QOpenGLFramebufferObject::bindDefault();
// restore render states
if (stencilTestEnabled)
@@ -491,6 +495,11 @@ bool QSGDefaultDistanceFieldGlyphCache::useTextureUploadWorkaround() const
return useWorkaround;
}
+bool QSGDefaultDistanceFieldGlyphCache::createFullSizeTextures() const
+{
+ return qsgPreferFullSizeGlyphCacheTextures() && glyphCount() > QT_DISTANCEFIELD_HIGHGLYPHCOUNT;
+}
+
int QSGDefaultDistanceFieldGlyphCache::maxTextureSize() const
{
if (!m_maxTextureSize)
diff --git a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h
index 2f9331f6d8..cffe02330a 100644
--- a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h
+++ b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -62,6 +62,7 @@ public:
bool useTextureResizeWorkaround() const;
bool useTextureUploadWorkaround() const;
+ bool createFullSizeTextures() const;
int maxTextureSize() const;
void setMaxTextureCount(int max) { m_maxTextureCount = max; }
@@ -75,7 +76,7 @@ private:
QDistanceField image;
int padding;
- TextureInfo() : texture(0), padding(-1)
+ TextureInfo(const QRect &preallocRect = QRect()) : texture(0), allocatedArea(preallocRect), padding(-1)
{ }
};
@@ -84,8 +85,12 @@ private:
TextureInfo *textureInfo(int index)
{
- for (int i = m_textures.count(); i <= index; ++i)
- m_textures.append(TextureInfo());
+ for (int i = m_textures.count(); i <= index; ++i) {
+ if (createFullSizeTextures())
+ m_textures.append(QRect(0, 0, maxTextureSize(), maxTextureSize()));
+ else
+ m_textures.append(TextureInfo());
+ }
return &m_textures[index];
}
diff --git a/src/quick/scenegraph/qsgdefaultglyphnode.cpp b/src/quick/scenegraph/qsgdefaultglyphnode.cpp
index 1862de4b24..6bcc8cb1cf 100644
--- a/src/quick/scenegraph/qsgdefaultglyphnode.cpp
+++ b/src/quick/scenegraph/qsgdefaultglyphnode.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
index 9263d5676f..c84e6628a5 100644
--- a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
+++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -92,6 +92,7 @@ protected:
int m_matrix_id;
int m_color_id;
int m_textureScale_id;
+ float m_devicePixelRatio;
QFontEngine::GlyphFormat m_glyphFormat;
};
@@ -121,7 +122,8 @@ void QSGTextMaskShader::initialize()
m_matrix_id = program()->uniformLocation("matrix");
m_color_id = program()->uniformLocation("color");
m_textureScale_id = program()->uniformLocation("textureScale");
- program()->setUniformValue("dpr", (float) qsg_device_pixel_ratio(QOpenGLContext::currentContext()));
+ m_devicePixelRatio = (float) qsg_device_pixel_ratio(QOpenGLContext::currentContext());
+ program()->setUniformValue("dpr", m_devicePixelRatio);
}
void QSGTextMaskShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)
@@ -149,6 +151,12 @@ void QSGTextMaskShader::updateState(const RenderState &state, QSGMaterial *newEf
}
}
+ float devicePixelRatio = (float) qsg_device_pixel_ratio(QOpenGLContext::currentContext());
+ if (m_devicePixelRatio != devicePixelRatio) {
+ m_devicePixelRatio = devicePixelRatio;
+ program()->setUniformValue("dpr", m_devicePixelRatio);
+ }
+
if (state.isMatrixDirty())
program()->setUniformValue(m_matrix_id, state.combinedMatrix());
}
@@ -256,6 +264,30 @@ void QSG24BitTextMaskShader::updateState(const RenderState &state, QSGMaterial *
}
}
+class QSG32BitColorTextShader : public QSGTextMaskShader
+{
+public:
+ QSG32BitColorTextShader(QFontEngine::GlyphFormat glyphFormat)
+ : QSGTextMaskShader(glyphFormat)
+ {
+ setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/scenegraph/shaders/32bitcolortext.frag"));
+ }
+
+ void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) Q_DECL_OVERRIDE;
+};
+
+void QSG32BitColorTextShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)
+{
+ QSGTextMaskShader::updateState(state, newEffect, oldEffect);
+ QSGTextMaskMaterial *material = static_cast<QSGTextMaskMaterial *>(newEffect);
+ QSGTextMaskMaterial *oldMaterial = static_cast<QSGTextMaskMaterial *>(oldEffect);
+
+ if (oldMaterial == Q_NULLPTR || material->color() != oldMaterial->color() || state.isOpacityDirty()) {
+ float opacity = material->color().w() * state.opacity();
+ program()->setUniformValue(m_color_id, opacity);
+ }
+}
+
class QSGStyledTextShader : public QSG8BitTextMaskShader
{
public:
@@ -484,8 +516,16 @@ void QSGTextMaskMaterial::populate(const QPointF &p,
QSGMaterialType *QSGTextMaskMaterial::type() const
{
- static QSGMaterialType rgb, gray;
- return glyphCache()->glyphFormat() == QFontEngine::Format_A32 ? &rgb : &gray;
+ static QSGMaterialType argb, rgb, gray;
+ switch (glyphCache()->glyphFormat()) {
+ case QFontEngine::Format_ARGB:
+ return &argb;
+ case QFontEngine::Format_A32:
+ return &rgb;
+ case QFontEngine::Format_A8:
+ default:
+ return &gray;
+ }
}
QOpenGLTextureGlyphCache *QSGTextMaskMaterial::glyphCache() const
@@ -495,10 +535,15 @@ QOpenGLTextureGlyphCache *QSGTextMaskMaterial::glyphCache() const
QSGMaterialShader *QSGTextMaskMaterial::createShader() const
{
- QFontEngine::GlyphFormat glyphFormat = glyphCache()->glyphFormat();
- return glyphFormat == QFontEngine::Format_A32
- ? (QSGMaterialShader *) new QSG24BitTextMaskShader(glyphFormat)
- : (QSGMaterialShader *) new QSG8BitTextMaskShader(glyphFormat);
+ switch (QFontEngine::GlyphFormat glyphFormat = glyphCache()->glyphFormat()) {
+ case QFontEngine::Format_ARGB:
+ return new QSG32BitColorTextShader(glyphFormat);
+ case QFontEngine::Format_A32:
+ return new QSG24BitTextMaskShader(glyphFormat);
+ case QFontEngine::Format_A8:
+ default:
+ return new QSG8BitTextMaskShader(glyphFormat);
+ }
}
static inline int qsg_colorDiff(const QVector4D &a, const QVector4D &b)
diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.h b/src/quick/scenegraph/qsgdefaultglyphnode_p.h
index bddc2b5440..157c5f480c 100644
--- a/src/quick/scenegraph/qsgdefaultglyphnode_p.h
+++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p_p.h b/src/quick/scenegraph/qsgdefaultglyphnode_p_p.h
index dae647506e..736b2de9ea 100644
--- a/src/quick/scenegraph/qsgdefaultglyphnode_p_p.h
+++ b/src/quick/scenegraph/qsgdefaultglyphnode_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/qsgdefaultimagenode.cpp b/src/quick/scenegraph/qsgdefaultimagenode.cpp
index 7f85c31ccb..db79804908 100644
--- a/src/quick/scenegraph/qsgdefaultimagenode.cpp
+++ b/src/quick/scenegraph/qsgdefaultimagenode.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/qsgdefaultimagenode_p.h b/src/quick/scenegraph/qsgdefaultimagenode_p.h
index 26b087284b..c77321ae51 100644
--- a/src/quick/scenegraph/qsgdefaultimagenode_p.h
+++ b/src/quick/scenegraph/qsgdefaultimagenode_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/qsgdefaultlayer.cpp b/src/quick/scenegraph/qsgdefaultlayer.cpp
index 450a9fbee0..cca0712ece 100644
--- a/src/quick/scenegraph/qsgdefaultlayer.cpp
+++ b/src/quick/scenegraph/qsgdefaultlayer.cpp
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -57,7 +49,7 @@ namespace
public:
BindableFbo(QOpenGLFramebufferObject *fbo, QSGDepthStencilBuffer *depthStencil);
virtual ~BindableFbo();
- virtual void bind() const;
+ void bind() const Q_DECL_OVERRIDE;
private:
QOpenGLFramebufferObject *m_fbo;
QSGDepthStencilBuffer *m_depthStencil;
diff --git a/src/quick/scenegraph/qsgdefaultlayer_p.h b/src/quick/scenegraph/qsgdefaultlayer_p.h
index 44c74d7cfd..0ba7109ef6 100644
--- a/src/quick/scenegraph/qsgdefaultlayer_p.h
+++ b/src/quick/scenegraph/qsgdefaultlayer_p.h
@@ -1,40 +1,32 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -54,45 +46,45 @@ public:
QSGDefaultLayer(QSGRenderContext *context);
~QSGDefaultLayer();
- virtual bool updateTexture();
+ bool updateTexture() Q_DECL_OVERRIDE;
// The item's "paint node", not effect node.
QSGNode *item() const { return m_item; }
- void setItem(QSGNode *item);
+ void setItem(QSGNode *item) Q_DECL_OVERRIDE;
QRectF rect() const { return m_rect; }
- void setRect(const QRectF &rect);
+ void setRect(const QRectF &rect) Q_DECL_OVERRIDE;
QSize size() const { return m_size; }
- void setSize(const QSize &size);
+ void setSize(const QSize &size) Q_DECL_OVERRIDE;
- void setHasMipmaps(bool mipmap);
+ void setHasMipmaps(bool mipmap) Q_DECL_OVERRIDE;
- void bind();
+ void bind() Q_DECL_OVERRIDE;
- bool hasAlphaChannel() const;
- bool hasMipmaps() const;
- int textureId() const;
- QSize textureSize() const { return m_size; }
+ bool hasAlphaChannel() const Q_DECL_OVERRIDE;
+ bool hasMipmaps() const Q_DECL_OVERRIDE;
+ int textureId() const Q_DECL_OVERRIDE;
+ QSize textureSize() const Q_DECL_OVERRIDE { return m_size; }
GLenum format() const { return m_format; }
- void setFormat(GLenum format);
+ void setFormat(GLenum format) Q_DECL_OVERRIDE;
bool live() const { return bool(m_live); }
- void setLive(bool live);
+ void setLive(bool live) Q_DECL_OVERRIDE;
bool recursive() const { return bool(m_recursive); }
- void setRecursive(bool recursive);
+ void setRecursive(bool recursive) Q_DECL_OVERRIDE;
- void setDevicePixelRatio(qreal ratio) { m_device_pixel_ratio = ratio; }
+ void setDevicePixelRatio(qreal ratio) Q_DECL_OVERRIDE { m_device_pixel_ratio = ratio; }
- void scheduleUpdate();
+ void scheduleUpdate() Q_DECL_OVERRIDE;
- QImage toImage() const;
+ QImage toImage() const Q_DECL_OVERRIDE;
public Q_SLOTS:
- void markDirtyTexture();
- void invalidated();
+ void markDirtyTexture() Q_DECL_OVERRIDE;
+ void invalidated() Q_DECL_OVERRIDE;
private:
void grab();
diff --git a/src/quick/scenegraph/qsgdefaultrectanglenode.cpp b/src/quick/scenegraph/qsgdefaultrectanglenode.cpp
index 0e8129dcca..f3f5c7f79f 100644
--- a/src/quick/scenegraph/qsgdefaultrectanglenode.cpp
+++ b/src/quick/scenegraph/qsgdefaultrectanglenode.cpp
@@ -1,8 +1,8 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -11,9 +11,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -24,8 +24,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -323,11 +323,11 @@ void QSGDefaultRectangleNode::updateGeometry()
const QGradientStops &stops = m_gradient_stops;
int nextGradientStop = 0;
- float gradientPos = 0.5f * penWidth / height;
+ float gradientPos = penWidth / height;
while (nextGradientStop < stops.size() && stops.at(nextGradientStop).first <= gradientPos)
++nextGradientStop;
int lastGradientStop = stops.size() - 1;
- float lastGradientPos = 1.0f - 0.5f * penWidth / height;
+ float lastGradientPos = 1.0f - penWidth / height;
while (lastGradientStop >= nextGradientStop && stops.at(lastGradientStop).first >= lastGradientPos)
--lastGradientStop;
int gradientIntersections = (lastGradientStop - nextGradientStop + 1);
@@ -643,11 +643,11 @@ void QSGDefaultRectangleNode::updateGeometry()
for (int part = -1; part <= 1; part += 2) {
float y = (part == 1 ? innerRect.bottom() : innerRect.top());
float Y = (part == 1 ? outerRect.bottom() : outerRect.top());
- gradientPos = (y - innerRect.top() + 0.5f * penWidth) / height;
+ gradientPos = (y - innerRect.top() + penWidth) / height;
while (nextGradientStop <= lastGradientStop && stops.at(nextGradientStop).first <= gradientPos) {
// Insert vertices at gradient stops.
- float gy = (innerRect.top() - 0.5f * penWidth) + stops.at(nextGradientStop).first * height;
+ float gy = (innerRect.top() - penWidth) + stops.at(nextGradientStop).first * height;
fillColor = colorToColor4ub(stops.at(nextGradientStop).second);
diff --git a/src/quick/scenegraph/qsgdefaultrectanglenode_p.h b/src/quick/scenegraph/qsgdefaultrectanglenode_p.h
index bc262334a6..18e679d8b4 100644
--- a/src/quick/scenegraph/qsgdefaultrectanglenode_p.h
+++ b/src/quick/scenegraph/qsgdefaultrectanglenode_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp b/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp
index ed64a10320..7e602fc0bd 100644
--- a/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp
+++ b/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp
index e3d0267f8e..422e31ad96 100644
--- a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp
+++ b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h
index b19cb1c6fc..bce9379bee 100644
--- a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h
+++ b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode_p_p.h b/src/quick/scenegraph/qsgdistancefieldglyphnode_p_p.h
index a6ee534845..9aba26e5f0 100644
--- a/src/quick/scenegraph/qsgdistancefieldglyphnode_p_p.h
+++ b/src/quick/scenegraph/qsgdistancefieldglyphnode_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp
index 06d26c94a5..4d3f34c71c 100644
--- a/src/quick/scenegraph/qsgrenderloop.cpp
+++ b/src/quick/scenegraph/qsgrenderloop.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -34,6 +34,7 @@
#include "qsgrenderloop_p.h"
#include "qsgthreadedrenderloop_p.h"
#include "qsgwindowsrenderloop_p.h"
+#include <private/qquickanimatorcontroller_p.h>
#include <QtCore/QCoreApplication>
#include <QtCore/QTime>
@@ -52,6 +53,8 @@
#include <QtQuick/private/qsgcontext_p.h>
#include <private/qquickprofiler_p.h>
+#include <private/qquickshadereffectnode_p.h>
+
#ifdef Q_OS_WIN
# include <QtCore/qt_windows.h>
#endif
@@ -150,7 +153,7 @@ QSGRenderLoop *QSGRenderLoop::instance()
// For compatibility with 5.3 and earlier's QSG_INFO environment variables
if (qEnvironmentVariableIsSet("QSG_INFO"))
- ((QLoggingCategory &) QSG_LOG_INFO()).setEnabled(QtDebugMsg, true);
+ const_cast<QLoggingCategory &>(QSG_LOG_INFO()).setEnabled(QtDebugMsg, true);
s_instance = QSGContext::createWindowManager();
@@ -165,7 +168,12 @@ QSGRenderLoop *QSGRenderLoop::instance()
RenderLoopType loopType = BasicRenderLoop;
#ifdef Q_OS_WIN
- loopType = WindowsRenderLoop;
+ // With desktop OpenGL (opengl32.dll), use threaded. Otherwise (ANGLE) use windows.
+ if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL
+ && QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedOpenGL))
+ loopType = ThreadedRenderLoop;
+ else
+ loopType = WindowsRenderLoop;
#else
if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedOpenGL))
loopType = ThreadedRenderLoop;
@@ -288,6 +296,8 @@ void QSGGuiThreadRenderLoop::windowDestroyed(QQuickWindow *window)
if (Q_UNLIKELY(!current))
qCDebug(QSG_LOG_RENDERLOOP) << "cleanup without an OpenGL context";
+ QQuickShaderEffectMaterial::cleanupMaterialCache();
+
d->cleanupNodesOnShutdown();
if (m_windows.size() == 0) {
rc->invalidate();
@@ -296,6 +306,8 @@ void QSGGuiThreadRenderLoop::windowDestroyed(QQuickWindow *window)
} else if (gl && window == gl->surface() && current) {
gl->doneCurrent();
}
+
+ delete d->animationController;
}
void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
@@ -311,6 +323,7 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
if (!gl) {
gl = new QOpenGLContext();
gl->setFormat(window->requestedFormat());
+ gl->setScreen(window->screen());
if (qt_gl_global_share_context())
gl->setShareContext(qt_gl_global_share_context());
if (!gl->create()) {
@@ -342,17 +355,17 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
}
QElapsedTimer renderTimer;
qint64 renderTime = 0, syncTime = 0, polishTime = 0;
- bool profileFrames = QSG_LOG_TIME_RENDERLOOP().isDebugEnabled() ||
- QQuickProfiler::profilingSceneGraph();
+ bool profileFrames = QSG_LOG_TIME_RENDERLOOP().isDebugEnabled();
if (profileFrames)
renderTimer.start();
+ Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphPolishFrame);
cd->polishItems();
- if (profileFrames) {
+ if (profileFrames)
polishTime = renderTimer.nsecsElapsed();
- Q_QUICK_SG_PROFILE(QQuickProfiler::SceneGraphPolishFrame, (polishTime));
- }
+ Q_QUICK_SG_PROFILE_SWITCH(QQuickProfiler::SceneGraphPolishFrame,
+ QQuickProfiler::SceneGraphRenderLoopFrame);
emit window->afterAnimating();
@@ -360,11 +373,13 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
if (profileFrames)
syncTime = renderTimer.nsecsElapsed();
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame);
cd->renderSceneGraph(window->size());
if (profileFrames)
renderTime = renderTimer.nsecsElapsed();
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame);
if (data.grabOnly) {
grabContent = qt_gl_read_framebuffer(window->size() * window->effectiveDevicePixelRatio(), false, false);
@@ -372,13 +387,15 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
}
if (alsoSwap && window->isVisible()) {
- gl->swapBuffers(window);
+ if (!cd->customRenderStage || !cd->customRenderStage->swap())
+ gl->swapBuffers(window);
cd->fireFrameSwapped();
}
qint64 swapTime = 0;
if (profileFrames)
swapTime = renderTimer.nsecsElapsed();
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame);
if (QSG_LOG_TIME_RENDERLOOP().isDebugEnabled()) {
static QTime lastFrameTime = QTime::currentTime();
@@ -393,11 +410,6 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
lastFrameTime = QTime::currentTime();
}
- Q_QUICK_SG_PROFILE(QQuickProfiler::SceneGraphRenderLoopFrame, (
- syncTime - polishTime,
- renderTime - syncTime,
- swapTime - renderTime));
-
// Might have been set during syncSceneGraph()
if (data.updatePending)
maybeUpdate(window);
diff --git a/src/quick/scenegraph/qsgrenderloop_p.h b/src/quick/scenegraph/qsgrenderloop_p.h
index e9b58c60ba..4293015b96 100644
--- a/src/quick/scenegraph/qsgrenderloop_p.h
+++ b/src/quick/scenegraph/qsgrenderloop_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -64,6 +64,7 @@ public:
virtual void update(QQuickWindow *window) = 0;
virtual void maybeUpdate(QQuickWindow *window) = 0;
+ virtual void handleUpdateRequest(QQuickWindow *) { }
virtual QAnimationDriver *animationDriver() const = 0;
diff --git a/src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp b/src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp
index f635ccd17b..f1cc9d1a86 100644
--- a/src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp
+++ b/src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -251,6 +251,8 @@ QSGSharedDistanceFieldGlyphCache::~QSGSharedDistanceFieldGlyphCache()
void QSGSharedDistanceFieldGlyphCache::requestGlyphs(const QSet<glyph_t> &glyphs)
{
+ typedef QSet<glyph_t>::const_iterator GlyphSetConstIt;
+
QMutexLocker locker(&m_pendingGlyphsMutex);
#if defined(QSGSHAREDDISTANCEFIELDGLYPHCACHE_DEBUG)
@@ -264,8 +266,7 @@ void QSGSharedDistanceFieldGlyphCache::requestGlyphs(const QSet<glyph_t> &glyphs
QVector<quint32> glyphsVector;
glyphsVector.reserve(glyphs.size());
- QSet<glyph_t>::const_iterator it;
- for (it = glyphs.constBegin(); it != glyphs.constEnd(); ++it) {
+ for (GlyphSetConstIt it = glyphs.constBegin(), cend = glyphs.constEnd(); it != cend; ++it) {
Q_ASSERT(!m_bufferForGlyph.contains(*it));
glyphsVector.append(*it);
}
@@ -335,6 +336,8 @@ void QSGSharedDistanceFieldGlyphCache::referenceGlyphs(const QSet<glyph_t> &glyp
void QSGSharedDistanceFieldGlyphCache::releaseGlyphs(const QSet<glyph_t> &glyphs)
{
+ typedef QSet<glyph_t>::const_iterator GlyphSetConstIt;
+
#if defined(QSGSHAREDDISTANCEFIELDGLYPHCACHE_DEBUG)
qDebug("QSGSharedDistanceFieldGlyphCache::releaseGlyphs() called for %s (%d glyphs)",
m_cacheId.constData(), glyphs.size());
@@ -345,8 +348,7 @@ void QSGSharedDistanceFieldGlyphCache::releaseGlyphs(const QSet<glyph_t> &glyphs
QVector<quint32> glyphsVector;
glyphsVector.reserve(glyphs.size());
- QSet<glyph_t>::const_iterator glyphsIt;
- for (glyphsIt = glyphs.constBegin(); glyphsIt != glyphs.constEnd(); ++glyphsIt) {
+ for (GlyphSetConstIt glyphsIt = glyphs.constBegin(), cend = glyphs.constEnd(); glyphsIt != cend; ++glyphsIt) {
QHash<glyph_t, void *>::iterator bufferIt = m_bufferForGlyph.find(*glyphsIt);
if (bufferIt != m_bufferForGlyph.end()) {
void *buffer = bufferIt.value();
diff --git a/src/quick/scenegraph/qsgshareddistancefieldglyphcache_p.h b/src/quick/scenegraph/qsgshareddistancefieldglyphcache_p.h
index fdba38f6f1..aee77c49c6 100644
--- a/src/quick/scenegraph/qsgshareddistancefieldglyphcache_p.h
+++ b/src/quick/scenegraph/qsgshareddistancefieldglyphcache_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index 561ebff8dd..2cebbaf484 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -1,8 +1,8 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2015 The Qt Company Ltd.
** Copyright (C) 2014 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -11,9 +11,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -24,8 +24,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -56,6 +56,8 @@
#include <private/qquickprofiler_p.h>
#include <private/qqmldebugservice_p.h>
+#include <private/qquickshadereffectnode_p.h>
+
/*
Overall design:
@@ -105,16 +107,6 @@ QT_BEGIN_NAMESPACE
#define QSG_RT_PAD " (RT)"
-static int get_env_int(const char *name, int defaultValue)
-{
- QByteArray content = qgetenv(name);
-
- bool ok = false;
- int value = content.toInt(&ok);
- return ok ? value : defaultValue;
-}
-
-
static inline int qsgrl_animation_interval() {
qreal refreshRate = QGuiApplication::primaryScreen()->refreshRate();
// To work around that some platforms wrongfully return 0 or something
@@ -155,7 +147,7 @@ const QEvent::Type WM_TryRelease = QEvent::Type(QEvent::User + 4);
// called.
const QEvent::Type WM_Grab = QEvent::Type(QEvent::User + 5);
-template <typename T> T *windowFor(const QList<T> list, QQuickWindow *window)
+template <typename T> T *windowFor(const QList<T> &list, QQuickWindow *window)
{
for (int i=0; i<list.size(); ++i) {
const T &t = list.at(i);
@@ -459,9 +451,12 @@ void QSGRenderThread::invalidateOpenGL(QQuickWindow *window, bool inDestructor,
qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- cleanup without an OpenGL context";
}
+ QQuickWindowPrivate *dd = QQuickWindowPrivate::get(window);
+
+ QQuickShaderEffectMaterial::cleanupMaterialCache();
+
// The canvas nodes must be cleaned up regardless if we are in the destructor..
if (wipeSG) {
- QQuickWindowPrivate *dd = QQuickWindowPrivate::get(window);
dd->cleanupNodesOnShutdown();
} else {
qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- persistent SG, avoiding cleanup";
@@ -473,6 +468,8 @@ void QSGRenderThread::invalidateOpenGL(QQuickWindow *window, bool inDestructor,
sgrc->invalidate();
QCoreApplication::processEvents();
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ if (inDestructor)
+ delete dd->animationController;
if (current)
gl->doneCurrent();
qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- invalidating scene graph";
@@ -500,6 +497,14 @@ void QSGRenderThread::sync(bool inExpose)
bool current = false;
if (windowSize.width() > 0 && windowSize.height() > 0)
current = gl->makeCurrent(window);
+ // Check for context loss.
+ if (!current && !gl->isValid()) {
+ QQuickWindowPrivate::get(window)->cleanupNodesOnShutdown();
+ sgrc->invalidate();
+ current = gl->create() && gl->makeCurrent(window);
+ if (current)
+ sgrc->initialize(gl);
+ }
if (current) {
QQuickWindowPrivate *d = QQuickWindowPrivate::get(window);
bool hadRenderer = d->renderer != 0;
@@ -531,12 +536,12 @@ void QSGRenderThread::sync(bool inExpose)
void QSGRenderThread::syncAndRender()
{
- bool profileFrames = QSG_LOG_TIME_RENDERLOOP().isDebugEnabled() ||
- QQuickProfiler::profilingSceneGraph();
+ bool profileFrames = QSG_LOG_TIME_RENDERLOOP().isDebugEnabled();
if (profileFrames) {
sinceLastTime = threadTimer.nsecsElapsed();
threadTimer.start();
}
+ Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphRenderLoopFrame);
QElapsedTimer waitTimer;
waitTimer.start();
@@ -544,20 +549,24 @@ void QSGRenderThread::syncAndRender()
qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "syncAndRender()";
syncResultedInChanges = false;
+ QQuickWindowPrivate *d = QQuickWindowPrivate::get(window);
- uint pending = pendingUpdate;
+ bool repaintRequested = (pendingUpdate & RepaintRequest) || d->customRenderStage;
+ bool syncRequested = pendingUpdate & SyncRequest;
+ bool exposeRequested = (pendingUpdate & ExposeRequest) == ExposeRequest;
pendingUpdate = 0;
- if (pending & SyncRequest) {
+ if (syncRequested) {
qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- updatePending, doing sync";
- sync(pending == ExposeRequest);
+ sync(exposeRequested);
}
#ifndef QSG_NO_RENDER_TIMING
if (profileFrames)
syncTime = threadTimer.nsecsElapsed();
#endif
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame);
- if (!syncResultedInChanges && ((pending & RepaintRequest) == 0)) {
+ if (!syncResultedInChanges && !repaintRequested) {
qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- no changes, render aborted";
int waitTime = vsyncDelta - (int) waitTimer.elapsed();
if (waitTime > 0)
@@ -567,7 +576,6 @@ void QSGRenderThread::syncAndRender()
qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- rendering started";
- QQuickWindowPrivate *d = QQuickWindowPrivate::get(window);
if (animatorDriver->isRunning()) {
d->animationController->lock();
@@ -578,13 +586,22 @@ void QSGRenderThread::syncAndRender()
bool current = false;
if (d->renderer && windowSize.width() > 0 && windowSize.height() > 0)
current = gl->makeCurrent(window);
+ // Check for context loss.
+ if (!current && !gl->isValid()) {
+ // 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(window, new QEvent(QEvent::Type(QQuickWindowPrivate::FullUpdateRequest)));
+ }
if (current) {
d->renderSceneGraph(windowSize);
if (profileFrames)
renderTime = threadTimer.nsecsElapsed();
- gl->swapBuffers(window);
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame);
+ if (!d->customRenderStage || !d->customRenderStage->swap())
+ gl->swapBuffers(window);
d->fireFrameSwapped();
} else {
+ Q_QUICK_SG_PROFILE_SKIP(QQuickProfiler::SceneGraphRenderLoopFrame, 1);
qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- window not ready, skipping render";
}
@@ -595,7 +612,7 @@ void QSGRenderThread::syncAndRender()
// that to avoid blocking the GUI thread in the case where it
// has started rendering with a bad window, causing makeCurrent to
// fail or if the window has a bad size.
- if (pending == ExposeRequest) {
+ if (exposeRequested) {
qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- wake Gui after initial expose";
waitCondition.wakeOne();
mutex.unlock();
@@ -609,10 +626,7 @@ void QSGRenderThread::syncAndRender()
int(threadTimer.elapsed() - renderTime / 1000000));
- Q_QUICK_SG_PROFILE(QQuickProfiler::SceneGraphRenderLoopFrame, (
- syncTime,
- renderTime - syncTime,
- threadTimer.nsecsElapsed() - renderTime));
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame);
}
@@ -695,8 +709,6 @@ QSGThreadedRenderLoop::QSGThreadedRenderLoop()
m_animation_driver = sg->createAnimationDriver(this);
- m_exhaust_delay = get_env_int("QML_EXHAUST_DELAY", 5);
-
connect(m_animation_driver, SIGNAL(started()), this, SLOT(animationStarted()));
connect(m_animation_driver, SIGNAL(stopped()), this, SLOT(animationStopped()));
@@ -715,10 +727,7 @@ QSGRenderContext *QSGThreadedRenderLoop::createRenderContext(QSGContext *sg) con
void QSGThreadedRenderLoop::maybePostPolishRequest(Window *w)
{
- if (w->timerId == 0) {
- qCDebug(QSG_LOG_RENDERLOOP) << "- posting update";
- w->timerId = startTimer(m_exhaust_delay, Qt::PreciseTimer);
- }
+ w->window->requestUpdate();
}
QAnimationDriver *QSGThreadedRenderLoop::animationDriver() const
@@ -765,9 +774,9 @@ void QSGThreadedRenderLoop::animationStopped()
void QSGThreadedRenderLoop::startOrStopAnimationTimer()
{
int exposedWindows = 0;
- Window *theOne = 0;
+ const Window *theOne = 0;
for (int i=0; i<m_windows.size(); ++i) {
- Window &w = m_windows[i];
+ const Window &w = m_windows.at(i);
if (w.window->isVisible() && w.window->isExposed()) {
++exposedWindows;
theOne = &w;
@@ -779,7 +788,7 @@ void QSGThreadedRenderLoop::startOrStopAnimationTimer()
m_animation_timer = 0;
// If animations are running, make sure we keep on animating
if (m_animation_driver->isRunning())
- maybePostPolishRequest(theOne);
+ maybePostPolishRequest(const_cast<Window *>(theOne));
} else if (m_animation_timer == 0 && exposedWindows != 1 && m_animation_driver->isRunning()) {
m_animation_timer = startTimer(qsgrl_animation_interval());
@@ -868,7 +877,6 @@ void QSGThreadedRenderLoop::handleExposure(QQuickWindow *window)
win.window = window;
win.actualWindowFormat = window->format();
win.thread = new QSGRenderThread(this, QQuickWindowPrivate::get(window)->context);
- win.timerId = 0;
win.updateDuringSync = false;
win.forceRenderPass = true; // also covered by polishAndSync(inExpose=true), but doesn't hurt
m_windows << win;
@@ -880,9 +888,11 @@ void QSGThreadedRenderLoop::handleExposure(QQuickWindow *window)
w->thread->window = window;
if (w->window->width() <= 0 || w->window->height() <= 0
- || !w->window->geometry().intersects(w->window->screen()->availableGeometry())) {
+ || (w->window->isTopLevel() && !w->window->geometry().intersects(w->window->screen()->availableGeometry()))) {
#ifndef QT_NO_DEBUG
- qWarning("QSGThreadedRenderLoop: expose event received for window with invalid geometry.");
+ qWarning().noquote().nospace() << "QSGThreadedRenderLoop: expose event received for window "
+ << w->window << " with invalid geometry: " << w->window->geometry()
+ << " on " << w->window->screen();
#endif
}
@@ -901,6 +911,7 @@ void QSGThreadedRenderLoop::handleExposure(QQuickWindow *window)
if (qt_gl_global_share_context())
w->thread->gl->setShareContext(qt_gl_global_share_context());
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;
@@ -958,6 +969,14 @@ void QSGThreadedRenderLoop::handleObscurity(Window *w)
}
+void QSGThreadedRenderLoop::handleUpdateRequest(QQuickWindow *window)
+{
+ qCDebug(QSG_LOG_RENDERLOOP) << "- polish and sync update request";
+ Window *w = windowFor(m_windows, window);
+ if (w)
+ polishAndSync(w);
+}
+
void QSGThreadedRenderLoop::maybeUpdate(QQuickWindow *window)
{
Window *w = windowFor(m_windows, window);
@@ -1085,8 +1104,6 @@ void QSGThreadedRenderLoop::polishAndSync(Window *w, bool inExpose)
QQuickWindow *window = w->window;
if (!w->thread || !w->thread->window) {
qCDebug(QSG_LOG_RENDERLOOP) << "- not exposed, abort";
- killTimer(w->timerId);
- w->timerId = 0;
return;
}
@@ -1096,8 +1113,6 @@ void QSGThreadedRenderLoop::polishAndSync(Window *w, bool inExpose)
w = windowFor(m_windows, window);
if (!w || !w->thread || !w->thread->window) {
qCDebug(QSG_LOG_RENDERLOOP) << "- removed after event flushing, abort";
- killTimer(w->timerId);
- w->timerId = 0;
return;
}
@@ -1106,16 +1121,17 @@ void QSGThreadedRenderLoop::polishAndSync(Window *w, bool inExpose)
qint64 polishTime = 0;
qint64 waitTime = 0;
qint64 syncTime = 0;
- bool profileFrames = QSG_LOG_TIME_RENDERLOOP().isDebugEnabled() ||
- QQuickProfiler::profilingSceneGraph();
+ bool profileFrames = QSG_LOG_TIME_RENDERLOOP().isDebugEnabled();
if (profileFrames)
timer.start();
+ Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphPolishAndSync);
QQuickWindowPrivate *d = QQuickWindowPrivate::get(window);
d->polishItems();
if (profileFrames)
polishTime = timer.nsecsElapsed();
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync);
w->updateDuringSync = false;
@@ -1130,6 +1146,7 @@ void QSGThreadedRenderLoop::polishAndSync(Window *w, bool inExpose)
qCDebug(QSG_LOG_RENDERLOOP) << "- wait for sync";
if (profileFrames)
waitTime = timer.nsecsElapsed();
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync);
w->thread->waitCondition.wait(&w->thread->mutex);
m_lockedForSync = false;
w->thread->mutex.unlock();
@@ -1137,9 +1154,7 @@ void QSGThreadedRenderLoop::polishAndSync(Window *w, bool inExpose)
if (profileFrames)
syncTime = timer.nsecsElapsed();
-
- killTimer(w->timerId);
- w->timerId = 0;
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync);
if (m_animation_timer == 0 && m_animation_driver->isRunning()) {
qCDebug(QSG_LOG_RENDERLOOP) << "- advancing animations";
@@ -1160,22 +1175,7 @@ void QSGThreadedRenderLoop::polishAndSync(Window *w, bool inExpose)
<< ", animations=" << (timer.nsecsElapsed() - syncTime) / 1000000
<< " - (on Gui thread) " << window;
- Q_QUICK_SG_PROFILE(QQuickProfiler::SceneGraphPolishAndSync, (
- polishTime,
- waitTime - polishTime,
- syncTime - waitTime,
- timer.nsecsElapsed() - syncTime));
-}
-
-QSGThreadedRenderLoop::Window *QSGThreadedRenderLoop::windowForTimer(int timerId) const
-{
- for (int i=0; i<m_windows.size(); ++i) {
- if (m_windows.at(i).timerId == timerId) {
- return const_cast<Window *>(&m_windows.at(i));
- break;
- }
- }
- return 0;
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphPolishAndSync);
}
bool QSGThreadedRenderLoop::event(QEvent *e)
@@ -1188,15 +1188,8 @@ bool QSGThreadedRenderLoop::event(QEvent *e)
qCDebug(QSG_LOG_RENDERLOOP) << "- ticking non-visual timer";
m_animation_driver->advance();
emit timeToIncubate();
- } else {
- qCDebug(QSG_LOG_RENDERLOOP) << "- polish and sync timer";
- Window *w = windowForTimer(te->timerId());
- if (w)
- polishAndSync(w);
- else
- killTimer(te->timerId());
+ return true;
}
- return true;
}
default:
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop_p.h b/src/quick/scenegraph/qsgthreadedrenderloop_p.h
index 1039807acb..d5ffbf10a3 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop_p.h
+++ b/src/quick/scenegraph/qsgthreadedrenderloop_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -61,6 +61,8 @@ public:
void update(QQuickWindow *window);
void maybeUpdate(QQuickWindow *window);
+ void handleUpdateRequest(QQuickWindow *window);
+
QSGContext *sceneGraphContext() const;
QSGRenderContext *createRenderContext(QSGContext *) const;
@@ -81,7 +83,6 @@ private:
QQuickWindow *window;
QSGRenderThread *thread;
QSurfaceFormat actualWindowFormat;
- int timerId;
uint updateDuringSync : 1;
uint forceRenderPass : 1;
};
@@ -90,7 +91,6 @@ private:
void releaseResources(Window *window, bool inDestructor);
bool checkAndResetForceUpdate(QQuickWindow *window);
- Window *windowForTimer(int timerId) const;
bool anyoneShowing() const;
void initialize();
@@ -110,7 +110,6 @@ private:
QList<Window> m_windows;
int m_animation_timer;
- int m_exhaust_delay;
bool m_lockedForSync;
};
diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
index 83eae7a21a..7fd9651618 100644
--- a/src/quick/scenegraph/qsgwindowsrenderloop.cpp
+++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -32,9 +32,9 @@
****************************************************************************/
#include "qsgwindowsrenderloop_p.h"
-
#include <QtCore/QCoreApplication>
#include <QtCore/QLibraryInfo>
+#include <QtCore/QThread>
#include <QtGui/QScreen>
#include <QtGui/QGuiApplication>
@@ -46,6 +46,8 @@
#include <QtQuick/QQuickWindow>
#include <private/qquickprofiler_p.h>
+#include <private/qquickshadereffectnode_p.h>
+#include <private/qquickanimatorcontroller_p.h>
QT_BEGIN_NAMESPACE
@@ -54,10 +56,14 @@ extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_
#define RLDEBUG(x) qCDebug(QSG_LOG_RENDERLOOP) << x;
static QElapsedTimer qsg_render_timer;
-#define QSG_RENDER_TIMING_SAMPLE(sampleName) \
+#define QSG_LOG_TIME_SAMPLE(sampleName) \
qint64 sampleName = 0; \
- if (QSG_LOG_TIME_RENDERLOOP().isDebugEnabled() || QQuickProfiler::profilingSceneGraph()) \
- sampleName = qsg_render_timer.nsecsElapsed()
+ if (QSG_LOG_TIME_RENDERLOOP().isDebugEnabled()) \
+ sampleName = qsg_render_timer.nsecsElapsed(); \
+
+#define QSG_RENDER_TIMING_SAMPLE(frameType, sampleName) \
+ QSG_LOG_TIME_SAMPLE(sampleName) \
+ Q_QUICK_SG_PROFILE_RECORD(frameType);
QSGWindowsRenderLoop::QSGWindowsRenderLoop()
@@ -155,6 +161,7 @@ void QSGWindowsRenderLoop::show(QQuickWindow *window)
RLDEBUG(" - creating GL context");
m_gl = new QOpenGLContext();
m_gl->setFormat(window->requestedFormat());
+ m_gl->setScreen(window->screen());
if (qt_gl_global_share_context())
m_gl->setShareContext(qt_gl_global_share_context());
bool created = m_gl->create();
@@ -211,6 +218,7 @@ void QSGWindowsRenderLoop::windowDestroyed(QQuickWindow *window)
hide(window);
QQuickWindowPrivate *d = QQuickWindowPrivate::get(window);
+
bool current = false;
QScopedPointer<QOffscreenSurface> offscreenSurface;
if (m_gl) {
@@ -227,6 +235,8 @@ void QSGWindowsRenderLoop::windowDestroyed(QQuickWindow *window)
if (Q_UNLIKELY(!current))
qCDebug(QSG_LOG_RENDERLOOP) << "cleanup without an OpenGL context";
+ QQuickShaderEffectMaterial::cleanupMaterialCache();
+
d->cleanupNodesOnShutdown();
if (m_windows.size() == 0) {
d->context->invalidate();
@@ -235,6 +245,8 @@ void QSGWindowsRenderLoop::windowDestroyed(QQuickWindow *window)
} else if (m_gl && current) {
m_gl->doneCurrent();
}
+
+ delete d->animationController;
}
bool QSGWindowsRenderLoop::anyoneShowing() const
@@ -351,16 +363,24 @@ bool QSGWindowsRenderLoop::event(QEvent *event)
void QSGWindowsRenderLoop::render()
{
RLDEBUG("render");
+ bool rendered = false;
foreach (const WindowData &wd, m_windows) {
if (wd.pendingUpdate) {
const_cast<WindowData &>(wd).pendingUpdate = false;
renderWindow(wd.window);
+ rendered = true;
}
}
+ if (!rendered) {
+ RLDEBUG("no changes, sleep");
+ QThread::msleep(m_vsyncDelta);
+ }
+
if (m_animationDriver->isRunning()) {
RLDEBUG("advancing animations");
- QSG_RENDER_TIMING_SAMPLE(time_start);
+ QSG_LOG_TIME_SAMPLE(time_start);
+ Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphWindowsAnimations);
m_animationDriver->advance();
RLDEBUG("animations advanced");
@@ -368,8 +388,7 @@ void QSGWindowsRenderLoop::render()
"animations ticked in %dms",
int((qsg_render_timer.nsecsElapsed() - time_start)/1000000));
- Q_QUICK_SG_PROFILE(QQuickProfiler::SceneGraphWindowsAnimations, (
- qsg_render_timer.nsecsElapsed() - time_start));
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphWindowsAnimations);
// It is not given that animations triggered another maybeUpdate()
// and thus another render pass, so to keep things running,
@@ -396,35 +415,46 @@ void QSGWindowsRenderLoop::renderWindow(QQuickWindow *window)
if (!d->isRenderable())
return;
- if (!m_gl->makeCurrent(window))
- return;
+ if (!m_gl->makeCurrent(window)) {
+ // Check for context loss.
+ if (!m_gl->isValid()) {
+ d->cleanupNodesOnShutdown();
+ m_rc->invalidate();
+ if (m_gl->create() && m_gl->makeCurrent(window))
+ m_rc->initialize(m_gl);
+ else
+ return;
+ }
+ }
d->flushDelayedTouchEvent();
// Event delivery or processing has caused the window to stop rendering.
if (!windowData(window))
return;
- QSG_RENDER_TIMING_SAMPLE(time_start);
+ QSG_LOG_TIME_SAMPLE(time_start);
+ Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphPolishFrame);
RLDEBUG(" - polishing");
d->polishItems();
- QSG_RENDER_TIMING_SAMPLE(time_polished);
-
- Q_QUICK_SG_PROFILE(QQuickProfiler::SceneGraphPolishFrame, (time_polished - time_start));
+ QSG_LOG_TIME_SAMPLE(time_polished);
+ Q_QUICK_SG_PROFILE_SWITCH(QQuickProfiler::SceneGraphPolishFrame,
+ QQuickProfiler::SceneGraphRenderLoopFrame);
emit window->afterAnimating();
RLDEBUG(" - syncing");
d->syncSceneGraph();
- QSG_RENDER_TIMING_SAMPLE(time_synced);
+ QSG_RENDER_TIMING_SAMPLE(QQuickProfiler::SceneGraphRenderLoopFrame, time_synced);
RLDEBUG(" - rendering");
d->renderSceneGraph(window->size());
- QSG_RENDER_TIMING_SAMPLE(time_rendered);
+ QSG_RENDER_TIMING_SAMPLE(QQuickProfiler::SceneGraphRenderLoopFrame, time_rendered);
RLDEBUG(" - swapping");
- m_gl->swapBuffers(window);
- QSG_RENDER_TIMING_SAMPLE(time_swapped);
+ if (!d->customRenderStage || !d->customRenderStage->swap())
+ m_gl->swapBuffers(window);
+ QSG_RENDER_TIMING_SAMPLE(QQuickProfiler::SceneGraphRenderLoopFrame, time_swapped);
RLDEBUG(" - frameDone");
d->fireFrameSwapped();
@@ -437,10 +467,7 @@ void QSGWindowsRenderLoop::renderWindow(QQuickWindow *window)
<< ", swap=" << (time_swapped - time_rendered) / 1000000
<< " - " << window;
- Q_QUICK_SG_PROFILE(QQuickProfiler::SceneGraphRenderLoopFrame, (
- time_synced - time_polished,
- time_rendered - time_synced,
- time_swapped - time_rendered));
+ Q_QUICK_SG_PROFILE_REPORT(QQuickProfiler::SceneGraphRenderLoopFrame);
}
QT_END_NAMESPACE
diff --git a/src/quick/scenegraph/qsgwindowsrenderloop_p.h b/src/quick/scenegraph/qsgwindowsrenderloop_p.h
index 42fc29571f..fd2dde6f2f 100644
--- a/src/quick/scenegraph/qsgwindowsrenderloop_p.h
+++ b/src/quick/scenegraph/qsgwindowsrenderloop_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/scenegraph.qrc b/src/quick/scenegraph/scenegraph.qrc
index e6a90c9120..5db242e46b 100644
--- a/src/quick/scenegraph/scenegraph.qrc
+++ b/src/quick/scenegraph/scenegraph.qrc
@@ -4,6 +4,7 @@
<file>shaders/flatcolor.vert</file>
<file>shaders/8bittextmask.frag</file>
<file>shaders/24bittextmask.frag</file>
+ <file>shaders/32bitcolortext.frag</file>
<file>shaders/opaquetexture.frag</file>
<file>shaders/opaquetexture.vert</file>
<file>shaders/outlinedtext.frag</file>
@@ -34,6 +35,7 @@
<file>shaders/stencilclip.vert</file>
<file>shaders/8bittextmask_core.frag</file>
<file>shaders/24bittextmask_core.frag</file>
+ <file>shaders/32bitcolortext_core.frag</file>
<file>shaders/distancefieldoutlinetext_core.frag</file>
<file>shaders/distancefieldshiftedtext_core.frag</file>
<file>shaders/distancefieldshiftedtext_core.vert</file>
diff --git a/src/quick/scenegraph/shaders/32bitcolortext.frag b/src/quick/scenegraph/shaders/32bitcolortext.frag
new file mode 100644
index 0000000000..6fdb6e6aeb
--- /dev/null
+++ b/src/quick/scenegraph/shaders/32bitcolortext.frag
@@ -0,0 +1,9 @@
+varying highp vec2 sampleCoord;
+
+uniform sampler2D _qt_texture;
+uniform lowp float color; // just the alpha, really...
+
+void main()
+{
+ gl_FragColor = texture2D(_qt_texture, sampleCoord) * color;
+}
diff --git a/src/quick/scenegraph/shaders/32bitcolortext_core.frag b/src/quick/scenegraph/shaders/32bitcolortext_core.frag
new file mode 100644
index 0000000000..010aca97b4
--- /dev/null
+++ b/src/quick/scenegraph/shaders/32bitcolortext_core.frag
@@ -0,0 +1,13 @@
+#version 150 core
+
+in vec2 sampleCoord;
+
+out vec4 fragColor;
+
+uniform sampler2D _qt_texture;
+uniform float color; // just the alpha, really...
+
+void main()
+{
+ fragColor = texture(_qt_texture, sampleCoord) * color;
+}
diff --git a/src/quick/scenegraph/shaders/smoothtexture.vert b/src/quick/scenegraph/shaders/smoothtexture.vert
index 1ce824a68f..900fbc6a72 100644
--- a/src/quick/scenegraph/shaders/smoothtexture.vert
+++ b/src/quick/scenegraph/shaders/smoothtexture.vert
@@ -48,5 +48,8 @@ void main()
bool onEdge = any(notEqual(vertexOffset, vec2(0.)));
bool outerEdge = all(equal(texCoordOffset, vec2(0.)));
- vertexOpacity = onEdge && outerEdge ? 0. : opacity;
+ if (onEdge && outerEdge)
+ vertexOpacity = 0.;
+ else
+ vertexOpacity = opacity;
} \ No newline at end of file
diff --git a/src/quick/scenegraph/shaders/smoothtexture_core.vert b/src/quick/scenegraph/shaders/smoothtexture_core.vert
index a2489a39c5..6821398e57 100644
--- a/src/quick/scenegraph/shaders/smoothtexture_core.vert
+++ b/src/quick/scenegraph/shaders/smoothtexture_core.vert
@@ -50,5 +50,8 @@ void main()
bool onEdge = any(notEqual(vertexOffset, vec2(0.)));
bool outerEdge = all(equal(texCoordOffset, vec2(0.)));
- vertexOpacity = onEdge && outerEdge ? 0. : opacity;
-} \ No newline at end of file
+ if (onEdge && outerEdge)
+ vertexOpacity = 0.;
+ else
+ vertexOpacity = opacity;
+}
diff --git a/src/quick/scenegraph/shaders/visualization.frag b/src/quick/scenegraph/shaders/visualization.frag
index 15c81f2447..458d9dde14 100644
--- a/src/quick/scenegraph/shaders/visualization.frag
+++ b/src/quick/scenegraph/shaders/visualization.frag
@@ -1,11 +1,11 @@
uniform lowp vec4 color;
-uniform mediump vec4 tweak; // x,y -> width, height; z -> intensity of ;
+uniform lowp float pattern;
varying mediump vec2 pos;
void main(void)
{
lowp vec4 c = color;
- c.xyz += pow(max(sin(pos.x + pos.y), 0.0), 2.0) * tweak.z * 0.25;
+ c.xyz += pow(max(sin(pos.x + pos.y), 0.0), 2.0) * pattern * 0.25;
gl_FragColor = c;
}
diff --git a/src/quick/scenegraph/shaders/visualization.vert b/src/quick/scenegraph/shaders/visualization.vert
index 591eb12ed6..e110f51c99 100644
--- a/src/quick/scenegraph/shaders/visualization.vert
+++ b/src/quick/scenegraph/shaders/visualization.vert
@@ -2,8 +2,8 @@ attribute highp vec4 v;
uniform highp mat4 matrix;
uniform highp mat4 rotation;
-// w -> apply 3d rotation and projection
-uniform mediump vec4 tweak;
+// set to 1 if projection is enabled
+uniform bool projection;
varying mediump vec2 pos;
@@ -11,7 +11,7 @@ void main()
{
vec4 p = matrix * v;
- if (tweak.w > 0.0) {
+ if (projection) {
vec4 proj = rotation * p;
gl_Position = vec4(proj.x, proj.y, 0, proj.z);
} else {
diff --git a/src/quick/scenegraph/util/qsgareaallocator.cpp b/src/quick/scenegraph/util/qsgareaallocator.cpp
index df050c5050..335b8f71d5 100644
--- a/src/quick/scenegraph/util/qsgareaallocator.cpp
+++ b/src/quick/scenegraph/util/qsgareaallocator.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/util/qsgareaallocator_p.h b/src/quick/scenegraph/util/qsgareaallocator_p.h
index 36b5963ccd..d2823ce3ac 100644
--- a/src/quick/scenegraph/util/qsgareaallocator_p.h
+++ b/src/quick/scenegraph/util/qsgareaallocator_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/util/qsgatlastexture.cpp b/src/quick/scenegraph/util/qsgatlastexture.cpp
index 5edcb5d67a..b862fa6a2b 100644
--- a/src/quick/scenegraph/util/qsgatlastexture.cpp
+++ b/src/quick/scenegraph/util/qsgatlastexture.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -146,8 +146,15 @@ Atlas::Atlas(const QSize &size)
|| deviceName->compare(QStringLiteral("samsung SM-T215"), Qt::CaseInsensitive) == 0);
#else
static bool wrongfullyReportsBgra8888Support = false;
+ // The Raspberry Pi (both 1 and 2) GPU refuses framebuffers with BGRA color attachments.
+ const GLubyte *renderer = QOpenGLContext::currentContext()->functions()->glGetString(GL_RENDERER);
+ if (renderer && strstr((const char *) renderer, "VideoCore IV"))
+ wrongfullyReportsBgra8888Support = true;
#endif // ANDROID
+ if (qEnvironmentVariableIsSet("QSG_ATLAS_NO_BGRA_WORKAROUNDS"))
+ wrongfullyReportsBgra8888Support = false;
+
const char *ext = (const char *) QOpenGLContext::currentContext()->functions()->glGetString(GL_EXTENSIONS);
if (!wrongfullyReportsBgra8888Support
&& (strstr(ext, "GL_EXT_bgra")
@@ -377,28 +384,30 @@ void Atlas::bind(QSGTexture::Filtering filtering)
// Upload all pending images..
for (int i=0; i<m_pending_uploads.size(); ++i) {
- bool profileFrames = QSG_LOG_TIME_TEXTURE().isDebugEnabled() ||
- QQuickProfiler::profilingSceneGraph();
+ bool profileFrames = QSG_LOG_TIME_TEXTURE().isDebugEnabled();
if (profileFrames)
qsg_renderer_timer.start();
+ // Skip bind, convert, swizzle; they're irrelevant
+ Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphTexturePrepare);
+ Q_QUICK_SG_PROFILE_SKIP(QQuickProfiler::SceneGraphTexturePrepare, 3);
+ Texture *t = m_pending_uploads.at(i);
if (m_externalFormat == GL_BGRA &&
!m_use_bgra_fallback) {
- uploadBgra(m_pending_uploads.at(i));
+ uploadBgra(t);
} else {
- upload(m_pending_uploads.at(i));
+ upload(t);
}
+ t->releaseImage();
qCDebug(QSG_LOG_TIME_TEXTURE).nospace() << "atlastexture uploaded in: " << qsg_renderer_timer.elapsed()
- << "ms (" << m_pending_uploads.at(i)->image().width() << "x"
- << m_pending_uploads.at(i)->image().height() << ")";
-
- Q_QUICK_SG_PROFILE(QQuickProfiler::SceneGraphTexturePrepare, (
- 0, // bind (not relevant)
- 0, // convert (not relevant)
- 0, // swizzle (not relevant)
- qsg_renderer_timer.nsecsElapsed(), // (upload all of the above)
- 0)); // mipmap (not used ever...)
+ << "ms (" << t->textureSize().width() << "x"
+ << t->textureSize().height() << ")";
+
+ // Skip mipmap; unused
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare);
+ Q_QUICK_SG_PROFILE_SKIP(QQuickProfiler::SceneGraphTexturePrepare, 1);
+ Q_QUICK_SG_PROFILE_REPORT(QQuickProfiler::SceneGraphTexturePrepare);
}
GLenum f = filtering == QSGTexture::Nearest ? GL_NEAREST : GL_LINEAR;
@@ -423,15 +432,15 @@ Texture::Texture(Atlas *atlas, const QRect &textureRect, const QImage &image)
, m_image(image)
, m_atlas(atlas)
, m_nonatlas_texture(0)
+ , m_has_alpha(image.hasAlphaChannel())
{
- m_allocated_rect_without_padding = m_allocated_rect.adjusted(1, 1, -1, -1);
float w = atlas->size().width();
float h = atlas->size().height();
-
- m_texture_coords_rect = QRectF(m_allocated_rect_without_padding.x() / w,
- m_allocated_rect_without_padding.y() / h,
- m_allocated_rect_without_padding.width() / w,
- m_allocated_rect_without_padding.height() / h);
+ QRect nopad = atlasSubRectWithoutPadding();
+ m_texture_coords_rect = QRectF(nopad.x() / w,
+ nopad.y() / h,
+ nopad.width() / w,
+ nopad.height() / h);
}
Texture::~Texture()
@@ -448,12 +457,58 @@ void Texture::bind()
QSGTexture *Texture::removedFromAtlas() const
{
- if (!m_nonatlas_texture) {
+ if (m_nonatlas_texture) {
+ m_nonatlas_texture->setMipmapFiltering(mipmapFiltering());
+ m_nonatlas_texture->setFiltering(filtering());
+ return m_nonatlas_texture;
+ }
+
+ if (!m_image.isNull()) {
m_nonatlas_texture = new QSGPlainTexture();
m_nonatlas_texture->setImage(m_image);
m_nonatlas_texture->setFiltering(filtering());
- m_nonatlas_texture->setMipmapFiltering(mipmapFiltering());
+
+ } else {
+ QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
+ // bind the atlas texture as an fbo and extract the texture..
+
+ // First extract the currently bound fbo so we can restore it later.
+ GLint currentFbo;
+ f->glGetIntegerv(GL_FRAMEBUFFER_BINDING, &currentFbo);
+
+ // Create an FBO and bind the atlas texture into it.
+ GLuint fbo;
+ f->glGenFramebuffers(1, &fbo);
+ f->glBindFramebuffer(GL_FRAMEBUFFER, fbo);
+ f->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_atlas->textureId(), 0);
+
+ // Create the target texture, QSGPlainTexture below will deal with the texparams, so we don't
+ // need to worry about those here.
+ GLuint texture;
+ f->glGenTextures(1, &texture);
+ f->glBindTexture(GL_TEXTURE_2D, texture);
+ QRect r = atlasSubRectWithoutPadding();
+ // and copy atlas into our texture.
+ while (f->glGetError() != GL_NO_ERROR) ;
+ f->glCopyTexImage2D(GL_TEXTURE_2D, 0, m_atlas->internalFormat(), r.x(), r.y(), r.width(), r.height(), 0);
+ // BGRA may have been rejected by some GLES implementations
+ if (f->glGetError() != GL_NO_ERROR)
+ f->glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, r.x(), r.y(), r.width(), r.height(), 0);
+
+ m_nonatlas_texture = new QSGPlainTexture();
+ m_nonatlas_texture->setTextureId(texture);
+ m_nonatlas_texture->setOwnsTexture(true);
+ m_nonatlas_texture->setHasAlphaChannel(m_has_alpha);
+ m_nonatlas_texture->setTextureSize(r.size());
+
+ // cleanup: unbind our atlas from the fbo, rebind the old default and delete the fbo.
+ f->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0);
+ f->glBindFramebuffer(GL_FRAMEBUFFER, (GLuint) currentFbo);
+ f->glDeleteFramebuffers(1, &fbo);
}
+
+ m_nonatlas_texture->setMipmapFiltering(mipmapFiltering());
+ m_nonatlas_texture->setFiltering(filtering());
return m_nonatlas_texture;
}
diff --git a/src/quick/scenegraph/util/qsgatlastexture_p.h b/src/quick/scenegraph/util/qsgatlastexture_p.h
index 639bdc291e..399d5fd669 100644
--- a/src/quick/scenegraph/util/qsgatlastexture_p.h
+++ b/src/quick/scenegraph/util/qsgatlastexture_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -87,6 +87,9 @@ public:
QSize size() const { return m_size; }
+ GLuint internalFormat() const { return m_internalFormat; }
+ GLuint externalFormat() const { return m_externalFormat; }
+
private:
QSGAreaAllocator m_allocator;
GLuint m_texture_id;
@@ -110,26 +113,26 @@ public:
~Texture();
int textureId() const { return m_atlas->textureId(); }
- QSize textureSize() const { return m_allocated_rect_without_padding.size(); }
- bool hasAlphaChannel() const { return m_image.hasAlphaChannel(); }
+ QSize textureSize() const { return atlasSubRectWithoutPadding().size(); }
+ bool hasAlphaChannel() const { return m_has_alpha; }
bool hasMipmaps() const { return false; }
bool isAtlasTexture() const { return true; }
QRectF normalizedTextureSubRect() const { return m_texture_coords_rect; }
QRect atlasSubRect() const { return m_allocated_rect; }
- QRect atlasSubRectWithoutPadding() const { return m_allocated_rect_without_padding; }
+ QRect atlasSubRectWithoutPadding() const { return m_allocated_rect.adjusted(1, 1, -1, -1); }
bool isTexture() const { return true; }
QSGTexture *removedFromAtlas() const;
+ void releaseImage() { m_image = QImage(); }
const QImage &image() const { return m_image; }
void bind();
private:
- QRect m_allocated_rect_without_padding;
QRect m_allocated_rect;
QRectF m_texture_coords_rect;
@@ -139,6 +142,7 @@ private:
mutable QSGPlainTexture *m_nonatlas_texture;
+ uint m_has_alpha : 1;
};
}
diff --git a/src/quick/scenegraph/util/qsgdefaultpainternode.cpp b/src/quick/scenegraph/util/qsgdefaultpainternode.cpp
index 6135d958d5..be8deb2aa3 100644
--- a/src/quick/scenegraph/util/qsgdefaultpainternode.cpp
+++ b/src/quick/scenegraph/util/qsgdefaultpainternode.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/util/qsgdefaultpainternode_p.h b/src/quick/scenegraph/util/qsgdefaultpainternode_p.h
index a87aeb5b44..62daa54432 100644
--- a/src/quick/scenegraph/util/qsgdefaultpainternode_p.h
+++ b/src/quick/scenegraph/util/qsgdefaultpainternode_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp b/src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp
index 54f50b3fd3..5d2260923b 100644
--- a/src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp
+++ b/src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Quick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -151,7 +151,7 @@ void QSGDefaultDepthStencilBuffer::free()
QSGDepthStencilBufferManager::~QSGDepthStencilBufferManager()
{
- for (Hash::const_iterator it = m_buffers.constBegin(); it != m_buffers.constEnd(); ++it) {
+ for (Hash::const_iterator it = m_buffers.constBegin(), cend = m_buffers.constEnd(); it != cend; ++it) {
QSGDepthStencilBuffer *buffer = it.value().data();
buffer->free();
buffer->m_manager = 0;
diff --git a/src/quick/scenegraph/util/qsgdepthstencilbuffer_p.h b/src/quick/scenegraph/util/qsgdepthstencilbuffer_p.h
index ba2311a79a..e9d07ae605 100644
--- a/src/quick/scenegraph/util/qsgdepthstencilbuffer_p.h
+++ b/src/quick/scenegraph/util/qsgdepthstencilbuffer_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Quick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/util/qsgdistancefieldutil.cpp b/src/quick/scenegraph/util/qsgdistancefieldutil.cpp
index 75b0e03576..8e02681703 100644
--- a/src/quick/scenegraph/util/qsgdistancefieldutil.cpp
+++ b/src/quick/scenegraph/util/qsgdistancefieldutil.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/util/qsgdistancefieldutil_p.h b/src/quick/scenegraph/util/qsgdistancefieldutil_p.h
index 45f8238ead..7ed4b44a6d 100644
--- a/src/quick/scenegraph/util/qsgdistancefieldutil_p.h
+++ b/src/quick/scenegraph/util/qsgdistancefieldutil_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/util/qsgengine.cpp b/src/quick/scenegraph/util/qsgengine.cpp
index edf813ac24..c0ddf25765 100644
--- a/src/quick/scenegraph/util/qsgengine.cpp
+++ b/src/quick/scenegraph/util/qsgengine.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/util/qsgengine.h b/src/quick/scenegraph/util/qsgengine.h
index e8c466fabb..9a74a02aa1 100644
--- a/src/quick/scenegraph/util/qsgengine.h
+++ b/src/quick/scenegraph/util/qsgengine.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/util/qsgengine_p.h b/src/quick/scenegraph/util/qsgengine_p.h
index 1275ca161e..770c4a536c 100644
--- a/src/quick/scenegraph/util/qsgengine_p.h
+++ b/src/quick/scenegraph/util/qsgengine_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -45,8 +45,8 @@ class QSGRenderContext;
class QSGEnginePrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QSGEngine)
-
public:
+ static QSGEnginePrivate *get(QSGEngine *engine) { return engine->d_func(); }
QSGEnginePrivate();
QScopedPointer<QSGContext> sgContext;
diff --git a/src/quick/scenegraph/util/qsgflatcolormaterial.cpp b/src/quick/scenegraph/util/qsgflatcolormaterial.cpp
index 8e4ca68d49..754d2fb33a 100644
--- a/src/quick/scenegraph/util/qsgflatcolormaterial.cpp
+++ b/src/quick/scenegraph/util/qsgflatcolormaterial.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/util/qsgflatcolormaterial.h b/src/quick/scenegraph/util/qsgflatcolormaterial.h
index cfaa1828c9..e914cac705 100644
--- a/src/quick/scenegraph/util/qsgflatcolormaterial.h
+++ b/src/quick/scenegraph/util/qsgflatcolormaterial.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/util/qsgshadersourcebuilder.cpp b/src/quick/scenegraph/util/qsgshadersourcebuilder.cpp
index ebfe86e8a7..93a9c98ffb 100644
--- a/src/quick/scenegraph/util/qsgshadersourcebuilder.cpp
+++ b/src/quick/scenegraph/util/qsgshadersourcebuilder.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/util/qsgshadersourcebuilder_p.h b/src/quick/scenegraph/util/qsgshadersourcebuilder_p.h
index a1162de2b3..a270acb6ab 100644
--- a/src/quick/scenegraph/util/qsgshadersourcebuilder_p.h
+++ b/src/quick/scenegraph/util/qsgshadersourcebuilder_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/util/qsgsimplematerial.cpp b/src/quick/scenegraph/util/qsgsimplematerial.cpp
index 8ae10f85ec..92d24e4950 100644
--- a/src/quick/scenegraph/util/qsgsimplematerial.cpp
+++ b/src/quick/scenegraph/util/qsgsimplematerial.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/util/qsgsimplematerial.h b/src/quick/scenegraph/util/qsgsimplematerial.h
index 2829fd14f4..b017717bb8 100644
--- a/src/quick/scenegraph/util/qsgsimplematerial.h
+++ b/src/quick/scenegraph/util/qsgsimplematerial.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/util/qsgsimplerectnode.cpp b/src/quick/scenegraph/util/qsgsimplerectnode.cpp
index 17fae215f9..17aeb515a1 100644
--- a/src/quick/scenegraph/util/qsgsimplerectnode.cpp
+++ b/src/quick/scenegraph/util/qsgsimplerectnode.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -41,6 +41,7 @@ QT_BEGIN_NAMESPACE
\brief The QSGSimpleRectNode class is a convenience class for drawing
solid filled rectangles using scenegraph.
+ \inmodule QtQuick
*/
diff --git a/src/quick/scenegraph/util/qsgsimplerectnode.h b/src/quick/scenegraph/util/qsgsimplerectnode.h
index fc7fa3a279..c6831ee25c 100644
--- a/src/quick/scenegraph/util/qsgsimplerectnode.h
+++ b/src/quick/scenegraph/util/qsgsimplerectnode.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/util/qsgsimpletexturenode.cpp b/src/quick/scenegraph/util/qsgsimpletexturenode.cpp
index 1fbeba83bc..d9f3c44374 100644
--- a/src/quick/scenegraph/util/qsgsimpletexturenode.cpp
+++ b/src/quick/scenegraph/util/qsgsimpletexturenode.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -42,12 +42,13 @@ class QSGSimpleTextureNodePrivate : public QSGGeometryNodePrivate
public:
QSGSimpleTextureNodePrivate()
: QSGGeometryNodePrivate()
- , m_texCoordMode(QSGSimpleTextureNode::NoTransform)
+ , texCoordMode(QSGSimpleTextureNode::NoTransform)
, isAtlasTexture(false)
, ownsTexture(false)
{}
- QSGSimpleTextureNode::TextureCoordinatesTransformMode m_texCoordMode;
+ QRectF sourceRect;
+ QSGSimpleTextureNode::TextureCoordinatesTransformMode texCoordMode;
uint isAtlasTexture : 1;
uint ownsTexture : 1;
};
@@ -55,13 +56,16 @@ public:
static void qsgsimpletexturenode_update(QSGGeometry *g,
QSGTexture *texture,
const QRectF &rect,
+ QRectF sourceRect,
QSGSimpleTextureNode::TextureCoordinatesTransformMode texCoordMode)
{
if (!texture)
return;
- QSize ts = texture->textureSize();
- QRectF sourceRect(0, 0, ts.width(), ts.height());
+ if (!sourceRect.width() || !sourceRect.height()) {
+ QSize ts = texture->textureSize();
+ sourceRect = QRectF(0, 0, ts.width(), ts.height());
+ }
// Maybe transform the texture coordinates
if (texCoordMode.testFlag(QSGSimpleTextureNode::MirrorHorizontally)) {
@@ -151,7 +155,7 @@ void QSGSimpleTextureNode::setRect(const QRectF &r)
return;
m_rect = r;
Q_D(QSGSimpleTextureNode);
- qsgsimpletexturenode_update(&m_geometry, texture(), m_rect, d->m_texCoordMode);
+ qsgsimpletexturenode_update(&m_geometry, texture(), m_rect, d->sourceRect, d->texCoordMode);
markDirty(DirtyGeometry);
}
@@ -172,6 +176,41 @@ QRectF QSGSimpleTextureNode::rect() const
}
/*!
+ Sets the source rect of this texture node to \a r.
+
+ \since 5.5
+ */
+void QSGSimpleTextureNode::setSourceRect(const QRectF &r)
+{
+ Q_D(QSGSimpleTextureNode);
+ if (d->sourceRect == r)
+ return;
+ d->sourceRect = r;
+ qsgsimpletexturenode_update(&m_geometry, texture(), m_rect, d->sourceRect, d->texCoordMode);
+ markDirty(DirtyGeometry);
+}
+
+/*!
+ \fn void QSGSimpleTextureNode::setSourceRect(qreal x, qreal y, qreal w, qreal h)
+ \overload
+ \since 5.5
+
+ Sets the rectangle of this texture node to show its texture from (\a x, \a y) and
+ have width \a w and height \a h relatively to the QSGTexture::textureSize.
+ */
+
+/*!
+ Returns the source rect of this texture node.
+
+ \since 5.5
+ */
+QRectF QSGSimpleTextureNode::sourceRect() const
+{
+ Q_D(const QSGSimpleTextureNode);
+ return d->sourceRect;
+}
+
+/*!
Sets the texture of this texture node to \a texture.
Use setOwnsTexture() to set whether the node should take
@@ -184,10 +223,12 @@ QRectF QSGSimpleTextureNode::rect() const
void QSGSimpleTextureNode::setTexture(QSGTexture *texture)
{
Q_ASSERT(texture);
+ Q_D(QSGSimpleTextureNode);
+ if (d->ownsTexture)
+ delete m_material.texture();
m_material.setTexture(texture);
m_opaque_material.setTexture(texture);
- Q_D(QSGSimpleTextureNode);
- qsgsimpletexturenode_update(&m_geometry, texture, m_rect, d->m_texCoordMode);
+ qsgsimpletexturenode_update(&m_geometry, texture, m_rect, d->sourceRect, d->texCoordMode);
DirtyState dirty = DirtyMaterial;
// It would be tempting to skip the extra bit here and instead use
@@ -236,10 +277,10 @@ QSGTexture *QSGSimpleTextureNode::texture() const
void QSGSimpleTextureNode::setTextureCoordinatesTransform(QSGSimpleTextureNode::TextureCoordinatesTransformMode mode)
{
Q_D(QSGSimpleTextureNode);
- if (d->m_texCoordMode == mode)
+ if (d->texCoordMode == mode)
return;
- d->m_texCoordMode = mode;
- qsgsimpletexturenode_update(&m_geometry, texture(), m_rect, d->m_texCoordMode);
+ d->texCoordMode = mode;
+ qsgsimpletexturenode_update(&m_geometry, texture(), m_rect, d->sourceRect, d->texCoordMode);
markDirty(DirtyMaterial);
}
@@ -251,7 +292,7 @@ void QSGSimpleTextureNode::setTextureCoordinatesTransform(QSGSimpleTextureNode::
QSGSimpleTextureNode::TextureCoordinatesTransformMode QSGSimpleTextureNode::textureCoordinatesTransform() const
{
Q_D(const QSGSimpleTextureNode);
- return d->m_texCoordMode;
+ return d->texCoordMode;
}
/*!
diff --git a/src/quick/scenegraph/util/qsgsimpletexturenode.h b/src/quick/scenegraph/util/qsgsimpletexturenode.h
index 56f5c5a0df..03a7f821ae 100644
--- a/src/quick/scenegraph/util/qsgsimpletexturenode.h
+++ b/src/quick/scenegraph/util/qsgsimpletexturenode.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -52,6 +52,10 @@ public:
inline void setRect(qreal x, qreal y, qreal w, qreal h) { setRect(QRectF(x, y, w, h)); }
QRectF rect() const;
+ void setSourceRect(const QRectF &r);
+ inline void setSourceRect(qreal x, qreal y, qreal w, qreal h) { setSourceRect(QRectF(x, y, w, h)); }
+ QRectF sourceRect() const;
+
void setTexture(QSGTexture *texture);
QSGTexture *texture() const;
diff --git a/src/quick/scenegraph/util/qsgtexture.cpp b/src/quick/scenegraph/util/qsgtexture.cpp
index bfc9212138..c89ad7a608 100644
--- a/src/quick/scenegraph/util/qsgtexture.cpp
+++ b/src/quick/scenegraph/util/qsgtexture.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -632,10 +632,12 @@ void QSGPlainTexture::bind()
m_dirty_texture = false;
- bool profileFrames = QSG_LOG_TIME_TEXTURE().isDebugEnabled() ||
- QQuickProfiler::profilingSceneGraph();
+ bool profileFrames = QSG_LOG_TIME_TEXTURE().isDebugEnabled();
if (profileFrames)
qsg_renderer_timer.start();
+ Q_QUICK_SG_PROFILE_START_SYNCHRONIZED(QQuickProfiler::SceneGraphTexturePrepare,
+ QQuickProfiler::SceneGraphTextureDeletion);
+
if (m_image.isNull()) {
if (m_texture_id && m_owns_texture) {
@@ -644,8 +646,7 @@ void QSGPlainTexture::bind()
(int) qsg_renderer_timer.elapsed(),
m_texture_size.width(),
m_texture_size.height());
- Q_QUICK_SG_PROFILE(QQuickProfiler::SceneGraphTextureDeletion, (
- qsg_renderer_timer.nsecsElapsed()));
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphTextureDeletion);
}
m_texture_id = 0;
m_texture_size = QSize();
@@ -661,6 +662,7 @@ void QSGPlainTexture::bind()
qint64 bindTime = 0;
if (profileFrames)
bindTime = qsg_renderer_timer.nsecsElapsed();
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare);
// ### TODO: check for out-of-memory situations...
@@ -701,6 +703,7 @@ void QSGPlainTexture::bind()
qint64 convertTime = 0;
if (profileFrames)
convertTime = qsg_renderer_timer.nsecsElapsed();
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare);
updateBindOptions(m_dirty_bind_options);
@@ -743,12 +746,14 @@ void QSGPlainTexture::bind()
qint64 swizzleTime = 0;
if (profileFrames)
swizzleTime = qsg_renderer_timer.nsecsElapsed();
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare);
funcs->glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, m_texture_size.width(), m_texture_size.height(), 0, externalFormat, GL_UNSIGNED_BYTE, tmp.constBits());
qint64 uploadTime = 0;
if (profileFrames)
uploadTime = qsg_renderer_timer.nsecsElapsed();
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphTexturePrepare);
if (mipmapFiltering() != QSGTexture::None) {
funcs->glGenerateMipmap(GL_TEXTURE_2D);
@@ -771,13 +776,7 @@ void QSGPlainTexture::bind()
int((mipmapTime - uploadTime)/1000000),
m_texture_size != m_image.size() ? " (scaled to GL_MAX_TEXTURE_SIZE)" : "");
}
-
- Q_QUICK_SG_PROFILE(QQuickProfiler::SceneGraphTexturePrepare, (
- bindTime,
- convertTime - bindTime,
- swizzleTime - convertTime,
- uploadTime - swizzleTime,
- qsg_renderer_timer.nsecsElapsed() - uploadTime));
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphTexturePrepare);
m_texture_rect = QRectF(0, 0, 1, 1);
diff --git a/src/quick/scenegraph/util/qsgtexture.h b/src/quick/scenegraph/util/qsgtexture.h
index bdfb0b0ee8..f53c9cf51b 100644
--- a/src/quick/scenegraph/util/qsgtexture.h
+++ b/src/quick/scenegraph/util/qsgtexture.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/util/qsgtexture_p.h b/src/quick/scenegraph/util/qsgtexture_p.h
index bd76b9850c..c4edee6d29 100644
--- a/src/quick/scenegraph/util/qsgtexture_p.h
+++ b/src/quick/scenegraph/util/qsgtexture_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/util/qsgtexturematerial.cpp b/src/quick/scenegraph/util/qsgtexturematerial.cpp
index 015296f241..6bfaaf0080 100644
--- a/src/quick/scenegraph/util/qsgtexturematerial.cpp
+++ b/src/quick/scenegraph/util/qsgtexturematerial.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/util/qsgtexturematerial.h b/src/quick/scenegraph/util/qsgtexturematerial.h
index 05a682401b..43f0b323a3 100644
--- a/src/quick/scenegraph/util/qsgtexturematerial.h
+++ b/src/quick/scenegraph/util/qsgtexturematerial.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/util/qsgtexturematerial_p.h b/src/quick/scenegraph/util/qsgtexturematerial_p.h
index 0007c3f1dc..7146ea95ec 100644
--- a/src/quick/scenegraph/util/qsgtexturematerial_p.h
+++ b/src/quick/scenegraph/util/qsgtexturematerial_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/util/qsgtextureprovider.cpp b/src/quick/scenegraph/util/qsgtextureprovider.cpp
index 4a43f7149f..b9f9bde476 100644
--- a/src/quick/scenegraph/util/qsgtextureprovider.cpp
+++ b/src/quick/scenegraph/util/qsgtextureprovider.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -38,6 +38,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QSGTextureProvider
\brief The QSGTextureProvider class encapsulates texture based entities in QML.
+ \inmodule QtQuick
The QSGTextureProvider lives primarily in the scene graph rendering thread.
diff --git a/src/quick/scenegraph/util/qsgtextureprovider.h b/src/quick/scenegraph/util/qsgtextureprovider.h
index 97f827b511..7386eee814 100644
--- a/src/quick/scenegraph/util/qsgtextureprovider.h
+++ b/src/quick/scenegraph/util/qsgtextureprovider.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp b/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp
index 3a84bf6219..1c83d10de0 100644
--- a/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp
+++ b/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -99,9 +99,12 @@ void QSGVertexColorMaterialShader::initialize()
The geometry to be rendered with vertex color must have the following layout. Attribute
position 0 must contain vertices. Attribute position 1 must contain colors, a tuple of
4 values with RGBA layout. Both floats in the range of 0 to 1 and unsigned bytes in
- the range 0 to 255 are valid for the color values. The
- QSGGeometry::defaultAttributes_ColoredPoint2D() constructs an attribute set
- compatible with this material.
+ the range 0 to 255 are valid for the color values.
+
+ \note The rendering pipeline expects pixels with premultiplied alpha.
+
+ QSGGeometry::defaultAttributes_ColoredPoint2D() can be used to construct an attribute
+ set that is compatible with this material.
The vertex color material respects both current opacity and current matrix when
updating it's rendering state.
diff --git a/src/quick/scenegraph/util/qsgvertexcolormaterial.h b/src/quick/scenegraph/util/qsgvertexcolormaterial.h
index 4dbfa4f436..fb511b3b78 100644
--- a/src/quick/scenegraph/util/qsgvertexcolormaterial.h
+++ b/src/quick/scenegraph/util/qsgvertexcolormaterial.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickanimation.cpp b/src/quick/util/qquickanimation.cpp
index b65f817af5..ec3abf7090 100644
--- a/src/quick/util/qquickanimation.cpp
+++ b/src/quick/util/qquickanimation.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -867,7 +867,7 @@ void QActionAnimation::updateState(State newState, State oldState)
void QActionAnimation::debugAnimation(QDebug d) const
{
- d << "ActionAnimation(" << hex << (void *) this << dec << ")";
+ d << "ActionAnimation(" << hex << (const void *) this << dec << ")";
if (animAction) {
int indentLevel = 1;
@@ -1960,7 +1960,7 @@ void QQuickBulkValueAnimator::topLevelAnimationLoopChanged()
void QQuickBulkValueAnimator::debugAnimation(QDebug d) const
{
- d << "BulkValueAnimation(" << hex << (void *) this << dec << ")" << "duration:" << duration();
+ d << "BulkValueAnimation(" << hex << (const void *) this << dec << ")" << "duration:" << duration();
if (animValue) {
int indentLevel = 1;
@@ -2144,7 +2144,10 @@ void QQuickPropertyAnimation::setTo(const QVariant &t)
\c Easing.Linear.
\qml
- PropertyAnimation { properties: "y"; easing.type: Easing.InOutElastic; easing.amplitude: 2.0; easing.period: 1.5 }
+ PropertyAnimation { properties: "y";
+ easing.type: Easing.InOutElastic;
+ easing.amplitude: 2.0;
+ easing.period: 1.5 }
\endqml
Available types are:
diff --git a/src/quick/util/qquickanimation_p.h b/src/quick/util/qquickanimation_p.h
index 35890897c6..0f6224a831 100644
--- a/src/quick/util/qquickanimation_p.h
+++ b/src/quick/util/qquickanimation_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickanimation_p_p.h b/src/quick/util/qquickanimation_p_p.h
index cf298785bf..4224c6d9ed 100644
--- a/src/quick/util/qquickanimation_p_p.h
+++ b/src/quick/util/qquickanimation_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -47,7 +47,7 @@
#include "qquickanimation_p.h"
-#include <private/qqmlnullablevalue_p_p.h>
+#include <private/qqmlnullablevalue_p.h>
#include <qqml.h>
#include <qqmlcontext.h>
diff --git a/src/quick/util/qquickanimationcontroller.cpp b/src/quick/util/qquickanimationcontroller.cpp
index af1d532131..47981508c0 100644
--- a/src/quick/util/qquickanimationcontroller.cpp
+++ b/src/quick/util/qquickanimationcontroller.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickanimationcontroller_p.h b/src/quick/util/qquickanimationcontroller_p.h
index 4969be69a0..171090b6a7 100644
--- a/src/quick/util/qquickanimationcontroller_p.h
+++ b/src/quick/util/qquickanimationcontroller_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickanimator.cpp b/src/quick/util/qquickanimator.cpp
index 987539af14..61fb7481d9 100644
--- a/src/quick/util/qquickanimator.cpp
+++ b/src/quick/util/qquickanimator.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -293,6 +293,7 @@ QAbstractAnimationJob *QQuickAnimator::transition(QQuickStateActions &actions,
\inqmlmodule QtQuick
\since 5.2
\ingroup qtquick-transitions-animations
+ \inherits Animator
\brief The XAnimator type animates the x position of an Item.
\l{Animator} types are different from normal Animation types. When
@@ -325,6 +326,7 @@ QQuickAnimatorJob *QQuickXAnimator::createJob() const { return new QQuickXAnimat
\inqmlmodule QtQuick
\since 5.2
\ingroup qtquick-transitions-animations
+ \inherits Animator
\brief The YAnimator type animates the y position of an Item.
\l{Animator} types are different from normal Animation types. When
@@ -357,6 +359,7 @@ QQuickAnimatorJob *QQuickYAnimator::createJob() const { return new QQuickYAnimat
\inqmlmodule QtQuick
\since 5.2
\ingroup qtquick-transitions-animations
+ \inherits Animator
\brief The ScaleAnimator type animates the scale factor of an Item.
\l{Animator} types are different from normal Animation types. When
@@ -389,6 +392,7 @@ QQuickAnimatorJob *QQuickScaleAnimator::createJob() const { return new QQuickSca
\inqmlmodule QtQuick
\since 5.2
\ingroup qtquick-transitions-animations
+ \inherits Animator
\brief The OpacityAnimator type animates the opacity of an Item.
\l{Animator} types are different from normal Animation types. When
@@ -420,6 +424,7 @@ QQuickAnimatorJob *QQuickOpacityAnimator::createJob() const { return new QQuickO
\inqmlmodule QtQuick
\since 5.2
\ingroup qtquick-transitions-animations
+ \inherits Animator
\brief The RotationAnimator type animates the rotation of an Item.
\l{Animator} types are different from normal Animation types. When
@@ -491,6 +496,7 @@ QQuickRotationAnimator::RotationDirection QQuickRotationAnimator::direction() co
\inqmlmodule QtQuick
\since 5.2
\ingroup qtquick-transitions-animations
+ \inherits Animator
\brief The UniformAnimator type animates a uniform of a ShaderEffect.
\l{Animator} types are different from normal Animation types. When
diff --git a/src/quick/util/qquickanimator_p.h b/src/quick/util/qquickanimator_p.h
index b018931e0a..4d3a8e9e4f 100644
--- a/src/quick/util/qquickanimator_p.h
+++ b/src/quick/util/qquickanimator_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickanimator_p_p.h b/src/quick/util/qquickanimator_p_p.h
index e4a49f0250..ad16b1c361 100644
--- a/src/quick/util/qquickanimator_p_p.h
+++ b/src/quick/util/qquickanimator_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickanimatorcontroller.cpp b/src/quick/util/qquickanimatorcontroller.cpp
index cfaa439072..c875e18978 100644
--- a/src/quick/util/qquickanimatorcontroller.cpp
+++ b/src/quick/util/qquickanimatorcontroller.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickanimatorcontroller_p.h b/src/quick/util/qquickanimatorcontroller_p.h
index b13c174606..4de485c37c 100644
--- a/src/quick/util/qquickanimatorcontroller_p.h
+++ b/src/quick/util/qquickanimatorcontroller_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickanimatorjob.cpp b/src/quick/util/qquickanimatorjob.cpp
index f29ec49b9f..2a8e3c281c 100644
--- a/src/quick/util/qquickanimatorjob.cpp
+++ b/src/quick/util/qquickanimatorjob.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -42,6 +42,7 @@
#include <private/qanimationgroupjob_p.h>
#include <qcoreapplication.h>
+#include <qdebug.h>
QT_BEGIN_NAMESPACE
@@ -133,6 +134,13 @@ void QQuickAnimatorProxyJob::updateState(QAbstractAnimationJob::State newState,
}
}
+void QQuickAnimatorProxyJob::debugAnimation(QDebug d) const
+{
+ d << "QuickAnimatorProxyJob("<< hex << (const void *) this << dec
+ << "state:" << state() << "duration:" << duration()
+ << "proxying: (" << job() << ')';
+}
+
void QQuickAnimatorProxyJob::windowChanged(QQuickWindow *window)
{
setWindow(window);
@@ -215,6 +223,13 @@ QQuickAnimatorJob::QQuickAnimatorJob()
m_isRenderThreadJob = true;
}
+void QQuickAnimatorJob::debugAnimation(QDebug d) const
+{
+ d << "QuickAnimatorJob(" << hex << (const void *) this << dec
+ << ") state:" << state() << "duration:" << duration()
+ << "target:" << m_target << "value:" << m_value;
+}
+
qreal QQuickAnimatorJob::value() const
{
qreal v;
@@ -405,21 +420,33 @@ void QQuickOpacityAnimatorJob::initialize(QQuickAnimatorController *controller)
m_opacityNode = d->opacityNode();
if (!m_opacityNode) {
m_opacityNode = new QSGOpacityNode();
- d->extra.value().opacityNode = m_opacityNode;
-
- QSGNode *child = d->clipNode();
- if (!child)
- child = d->rootNode();
- if (!child)
- child = d->groupNode;
- if (child) {
+ /* The item node subtree is like this
+ *
+ * itemNode
+ * (opacityNode) optional
+ * (clipNode) optional
+ * (rootNode) optional
+ * children / paintNode
+ *
+ * If the opacity node doesn't exist, we need to insert it into
+ * the hierarchy between itemNode and clipNode or rootNode. If
+ * neither clip or root exists, we need to reparent all children
+ * from itemNode to opacityNode.
+ */
+ QSGNode *iNode = d->itemNode();
+ QSGNode *child = d->childContainerNode();
+ if (child != iNode) {
if (child->parent())
child->parent()->removeChildNode(child);
m_opacityNode->appendChildNode(child);
+ iNode->appendChildNode(m_opacityNode);
+ } else {
+ iNode->reparentChildNodesTo(m_opacityNode);
+ iNode->appendChildNode(m_opacityNode);
}
- d->itemNode()->appendChildNode(m_opacityNode);
+ d->extra.value().opacityNode = m_opacityNode;
}
}
diff --git a/src/quick/util/qquickanimatorjob_p.h b/src/quick/util/qquickanimatorjob_p.h
index d87c9072a2..1cffae17db 100644
--- a/src/quick/util/qquickanimatorjob_p.h
+++ b/src/quick/util/qquickanimatorjob_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -74,6 +74,7 @@ public:
protected:
void updateCurrentTime(int);
void updateState(QAbstractAnimationJob::State newState, QAbstractAnimationJob::State oldState);
+ void debugAnimation(QDebug d) const Q_DECL_OVERRIDE;
public Q_SLOTS:
void windowChanged(QQuickWindow *window);
@@ -137,6 +138,7 @@ public:
protected:
QQuickAnimatorJob();
+ void debugAnimation(QDebug d) const Q_DECL_OVERRIDE;
QQuickItem *m_target;
QQuickAnimatorController *m_controller;
@@ -200,8 +202,8 @@ public:
protected:
QQuickTransformAnimatorJob();
- void initialize(QQuickAnimatorController *controller);
- void nodeWasDestroyed();
+ void initialize(QQuickAnimatorController *controller) Q_DECL_OVERRIDE;
+ void nodeWasDestroyed() Q_DECL_OVERRIDE;
void targetWasDeleted() Q_DECL_OVERRIDE;
Helper *m_helper;
diff --git a/src/quick/util/qquickapplication.cpp b/src/quick/util/qquickapplication.cpp
index 66676e27ba..aac5caff4c 100644
--- a/src/quick/util/qquickapplication.cpp
+++ b/src/quick/util/qquickapplication.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickapplication_p.h b/src/quick/util/qquickapplication_p.h
index e0b3c8e242..c22d8cfe6b 100644
--- a/src/quick/util/qquickapplication_p.h
+++ b/src/quick/util/qquickapplication_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickbehavior.cpp b/src/quick/util/qquickbehavior.cpp
index ef30d91b4a..82ecf8588e 100644
--- a/src/quick/util/qquickbehavior.cpp
+++ b/src/quick/util/qquickbehavior.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickbehavior_p.h b/src/quick/util/qquickbehavior_p.h
index 8305642460..d566ca8ba1 100644
--- a/src/quick/util/qquickbehavior_p.h
+++ b/src/quick/util/qquickbehavior_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickfontloader.cpp b/src/quick/util/qquickfontloader.cpp
index 714ee5c7f8..67df47fb37 100644
--- a/src/quick/util/qquickfontloader.cpp
+++ b/src/quick/util/qquickfontloader.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickfontloader_p.h b/src/quick/util/qquickfontloader_p.h
index 1599282d0a..b6ca0b3c94 100644
--- a/src/quick/util/qquickfontloader_p.h
+++ b/src/quick/util/qquickfontloader_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickfontmetrics.cpp b/src/quick/util/qquickfontmetrics.cpp
index 0cb2c29c53..a87ec7d60a 100644
--- a/src/quick/util/qquickfontmetrics.cpp
+++ b/src/quick/util/qquickfontmetrics.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickfontmetrics_p.h b/src/quick/util/qquickfontmetrics_p.h
index 352fb47e14..88880a2be8 100644
--- a/src/quick/util/qquickfontmetrics_p.h
+++ b/src/quick/util/qquickfontmetrics_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickglobal.cpp b/src/quick/util/qquickglobal.cpp
index 139bae4038..6aa7bedc5b 100644
--- a/src/quick/util/qquickglobal.cpp
+++ b/src/quick/util/qquickglobal.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -39,6 +39,7 @@
#include <QtGui/QGuiApplication>
#include <QtGui/qdesktopservices.h>
#include <QtGui/qfontdatabase.h>
+#include <QtGui/qstylehints.h>
#include <private/qv4engine_p.h>
#include <private/qv4object_p.h>
@@ -97,6 +98,11 @@ public:
return QVariant(QColor::fromHslF(h, s, l, a));
}
+ QVariant fromHsvF(double h, double s, double v, double a)
+ {
+ return QVariant(QColor::fromHsvF(h, s, v, a));
+ }
+
QVariant lighter(const QVariant &var, qreal factor)
{
QColor color = var.value<QColor>();
@@ -261,13 +267,11 @@ public:
return QMatrix4x4();
}
- static QFont fontFromObject(QQmlV4Handle object, QV8Engine *e, bool *ok)
+ static QFont fontFromObject(QQmlV4Handle object, QV4::ExecutionEngine *v4, bool *ok)
{
- Q_UNUSED(e);
-
- if (ok) *ok = false;
+ if (ok)
+ *ok = false;
QFont retn;
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(e);
QV4::Scope scope(v4);
QV4::ScopedObject obj(scope, object);
if (!obj) {
@@ -278,17 +282,17 @@ public:
QV4::ScopedString s(scope);
- QV4::ScopedValue vbold(scope, obj->get((s = v4->newString(QStringLiteral("bold"))).getPointer()));
- QV4::ScopedValue vcap(scope, obj->get((s = v4->newString(QStringLiteral("capitalization"))).getPointer()));
- QV4::ScopedValue vfam(scope, obj->get((s = v4->newString(QStringLiteral("family"))).getPointer()));
- QV4::ScopedValue vital(scope, obj->get((s = v4->newString(QStringLiteral("italic"))).getPointer()));
- QV4::ScopedValue vlspac(scope, obj->get((s = v4->newString(QStringLiteral("letterSpacing"))).getPointer()));
- QV4::ScopedValue vpixsz(scope, obj->get((s = v4->newString(QStringLiteral("pixelSize"))).getPointer()));
- QV4::ScopedValue vpntsz(scope, obj->get((s = v4->newString(QStringLiteral("pointSize"))).getPointer()));
- QV4::ScopedValue vstrk(scope, obj->get((s = v4->newString(QStringLiteral("strikeout"))).getPointer()));
- QV4::ScopedValue vundl(scope, obj->get((s = v4->newString(QStringLiteral("underline"))).getPointer()));
- QV4::ScopedValue vweight(scope, obj->get((s = v4->newString(QStringLiteral("weight"))).getPointer()));
- QV4::ScopedValue vwspac(scope, obj->get((s = v4->newString(QStringLiteral("wordSpacing"))).getPointer()));
+ QV4::ScopedValue vbold(scope, obj->get((s = v4->newString(QStringLiteral("bold")))));
+ QV4::ScopedValue vcap(scope, obj->get((s = v4->newString(QStringLiteral("capitalization")))));
+ QV4::ScopedValue vfam(scope, obj->get((s = v4->newString(QStringLiteral("family")))));
+ QV4::ScopedValue vital(scope, obj->get((s = v4->newString(QStringLiteral("italic")))));
+ QV4::ScopedValue vlspac(scope, obj->get((s = v4->newString(QStringLiteral("letterSpacing")))));
+ QV4::ScopedValue vpixsz(scope, obj->get((s = v4->newString(QStringLiteral("pixelSize")))));
+ QV4::ScopedValue vpntsz(scope, obj->get((s = v4->newString(QStringLiteral("pointSize")))));
+ QV4::ScopedValue vstrk(scope, obj->get((s = v4->newString(QStringLiteral("strikeout")))));
+ QV4::ScopedValue vundl(scope, obj->get((s = v4->newString(QStringLiteral("underline")))));
+ QV4::ScopedValue vweight(scope, obj->get((s = v4->newString(QStringLiteral("weight")))));
+ QV4::ScopedValue vwspac(scope, obj->get((s = v4->newString(QStringLiteral("wordSpacing")))));
// pull out the values, set ok to true if at least one valid field is given.
if (vbold->isBoolean()) {
@@ -339,10 +343,10 @@ public:
return retn;
}
- static QMatrix4x4 matrix4x4FromObject(QQmlV4Handle object, QV8Engine *e, bool *ok)
+ static QMatrix4x4 matrix4x4FromObject(QQmlV4Handle object, QV4::ExecutionEngine *v4, bool *ok)
{
- if (ok) *ok = false;
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(e);
+ if (ok)
+ *ok = false;
QV4::Scope scope(v4);
QV4::ScopedArrayObject array(scope, object);
if (!array)
@@ -364,35 +368,28 @@ public:
return QMatrix4x4(matVals);
}
- template<typename T>
- bool typedCreate(QQmlValueType *&v)
- {
- v = new T;
- return true;
- }
-
- bool create(int type, QQmlValueType *&v)
+ const QMetaObject *getMetaObjectForMetaType(int type)
{
switch (type) {
case QMetaType::QColor:
- return typedCreate<QQuickColorValueType>(v);
+ return &QQuickColorValueType::staticMetaObject;
case QMetaType::QFont:
- return typedCreate<QQuickFontValueType>(v);
+ return &QQuickFontValueType::staticMetaObject;
case QMetaType::QVector2D:
- return typedCreate<QQuickVector2DValueType>(v);
+ return &QQuickVector2DValueType::staticMetaObject;
case QMetaType::QVector3D:
- return typedCreate<QQuickVector3DValueType>(v);
+ return &QQuickVector3DValueType::staticMetaObject;
case QMetaType::QVector4D:
- return typedCreate<QQuickVector4DValueType>(v);
+ return &QQuickVector4DValueType::staticMetaObject;
case QMetaType::QQuaternion:
- return typedCreate<QQuickQuaternionValueType>(v);
+ return &QQuickQuaternionValueType::staticMetaObject;
case QMetaType::QMatrix4x4:
- return typedCreate<QQuickMatrix4x4ValueType>(v);
+ return &QQuickMatrix4x4ValueType::staticMetaObject;
default:
break;
}
- return false;
+ return 0;
}
template<typename T>
@@ -711,9 +708,8 @@ public:
return false;
}
- bool variantFromJsObject(int type, QQmlV4Handle object, QV8Engine *e, QVariant *v)
+ bool variantFromJsObject(int type, QQmlV4Handle object, QV4::ExecutionEngine *v4, QVariant *v)
{
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(e);
QV4::Scope scope(v4);
#ifndef QT_NO_DEBUG
QV4::ScopedObject obj(scope, object);
@@ -722,10 +718,10 @@ public:
bool ok = false;
switch (type) {
case QMetaType::QFont:
- *v = QVariant::fromValue(fontFromObject(object, e, &ok));
+ *v = QVariant::fromValue(fontFromObject(object, v4, &ok));
break;
case QMetaType::QMatrix4x4:
- *v = QVariant::fromValue(matrix4x4FromObject(object, e, &ok));
+ *v = QVariant::fromValue(matrix4x4FromObject(object, v4, &ok));
default: break;
}
@@ -936,10 +932,19 @@ public:
#ifndef QT_NO_IM
QInputMethod *inputMethod()
{
- return qGuiApp->inputMethod();
+ QInputMethod *im = qGuiApp->inputMethod();
+ QQmlEngine::setObjectOwnership(im, QQmlEngine::CppOwnership);
+ return im;
}
#endif
+ QStyleHints *styleHints()
+ {
+ QStyleHints *sh = qGuiApp->styleHints();
+ QQmlEngine::setObjectOwnership(sh, QQmlEngine::CppOwnership);
+ return sh;
+ }
+
QStringList fontFamilies()
{
QFontDatabase database;
diff --git a/src/quick/util/qquickimageprovider.cpp b/src/quick/util/qquickimageprovider.cpp
index d775aa03b9..a231209cd0 100644
--- a/src/quick/util/qquickimageprovider.cpp
+++ b/src/quick/util/qquickimageprovider.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickimageprovider.h b/src/quick/util/qquickimageprovider.h
index 915bf72fb4..a2b510f606 100644
--- a/src/quick/util/qquickimageprovider.h
+++ b/src/quick/util/qquickimageprovider.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -67,9 +67,15 @@ public:
ImageType imageType() const;
Flags flags() const;
+#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
+ virtual QImage requestImage(const QString &id, QSize *size, const QSize& requestedSize, bool requestedAutoTransform);
+ virtual QPixmap requestPixmap(const QString &id, QSize *size, const QSize& requestedSize, bool requestedAutoTransform);
+ virtual QQuickTextureFactory *requestTexture(const QString &id, QSize *size, const QSize &requestedSize, bool requestedAutoTransform);
+#else
virtual QImage requestImage(const QString &id, QSize *size, const QSize& requestedSize);
virtual QPixmap requestPixmap(const QString &id, QSize *size, const QSize& requestedSize);
virtual QQuickTextureFactory *requestTexture(const QString &id, QSize *size, const QSize &requestedSize);
+#endif
private:
QQuickImageProviderPrivate *d;
diff --git a/src/quick/util/qquickpath.cpp b/src/quick/util/qquickpath.cpp
index 6db5034d49..a7881b31c7 100644
--- a/src/quick/util/qquickpath.cpp
+++ b/src/quick/util/qquickpath.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickpath_p.h b/src/quick/util/qquickpath_p.h
index f6a64fa89c..eea313eeb1 100644
--- a/src/quick/util/qquickpath_p.h
+++ b/src/quick/util/qquickpath_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -36,7 +36,7 @@
#include <qqml.h>
-#include <private/qqmlnullablevalue_p_p.h>
+#include <private/qqmlnullablevalue_p.h>
#include <private/qbezier_p.h>
#include <QtCore/QObject>
diff --git a/src/quick/util/qquickpath_p_p.h b/src/quick/util/qquickpath_p_p.h
index 65d9a06414..4716f94a19 100644
--- a/src/quick/util/qquickpath_p_p.h
+++ b/src/quick/util/qquickpath_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickpathinterpolator.cpp b/src/quick/util/qquickpathinterpolator.cpp
index 68d06c24a8..2a916efcdd 100644
--- a/src/quick/util/qquickpathinterpolator.cpp
+++ b/src/quick/util/qquickpathinterpolator.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickpathinterpolator_p.h b/src/quick/util/qquickpathinterpolator_p.h
index e83c396ac6..895aa56078 100644
--- a/src/quick/util/qquickpathinterpolator_p.h
+++ b/src/quick/util/qquickpathinterpolator_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp
index 42e6b818fb..ddf2ae2393 100644
--- a/src/quick/util/qquickpixmapcache.cpp
+++ b/src/quick/util/qquickpixmapcache.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -46,6 +46,7 @@
#include <QtQuick/private/qsgtexture_p.h>
#include <QtQuick/private/qsgcontext_p.h>
+#include <QQuickWindow>
#include <QCoreApplication>
#include <QImageReader>
#include <QHash>
@@ -101,13 +102,16 @@ QQuickDefaultTextureFactory::QQuickDefaultTextureFactory(const QImage &image)
} else {
im = image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
}
+ size = im.size();
}
-QSGTexture *QQuickDefaultTextureFactory::createTexture(QQuickWindow *) const
+QSGTexture *QQuickDefaultTextureFactory::createTexture(QQuickWindow *window) const
{
- QSGPlainTexture *t = new QSGPlainTexture();
- t->setImage(im);
+ QSGTexture *t = window->createTextureFromImage(im, QQuickWindow::TextureCanUseAtlas);
+ static bool transient = qEnvironmentVariableIsSet("QSG_TRANSIENT_IMAGES");
+ if (transient)
+ const_cast<QQuickDefaultTextureFactory *>(this)->im = QImage();
return t;
}
@@ -138,15 +142,17 @@ public:
QUrl url;
bool loading;
+ AutoTransform autoTransform;
int redirectCount;
class Event : public QEvent {
public:
- Event(ReadError, const QString &, const QSize &, QQuickTextureFactory *factory);
+ Event(ReadError, const QString &, const QSize &, AutoTransform, QQuickTextureFactory *factory);
ReadError error;
QString errorString;
QSize implicitSize;
+ AutoTransform autoTransform;
QQuickTextureFactory *textureFactory;
};
void postReply(ReadError, const QString &, const QSize &, QQuickTextureFactory *factory);
@@ -199,7 +205,7 @@ protected:
private:
friend class QQuickPixmapReaderThreadObject;
void processJobs();
- void processJob(QQuickPixmapReply *, const QUrl &, const QSize &);
+ void processJob(QQuickPixmapReply *, const QUrl &, const QSize &, AutoTransform);
void networkRequestDone(QNetworkReply *);
QList<QQuickPixmapReply*> jobs;
@@ -228,25 +234,32 @@ public:
class QQuickPixmapData
{
public:
- QQuickPixmapData(QQuickPixmap *pixmap, const QUrl &u, const QSize &s, const QString &e)
+ QQuickPixmapData(QQuickPixmap *pixmap, const QUrl &u, const QSize &s, AutoTransform transform, const QString &e)
: refCount(1), inCache(false), pixmapStatus(QQuickPixmap::Error),
- url(u), errorString(e), requestSize(s), textureFactory(0), reply(0), prevUnreferenced(0),
+ url(u), errorString(e), requestSize(s),
+ requestedTransform(transform), appliedTransform(UsePluginDefault),
+ textureFactory(0), reply(0), prevUnreferenced(0),
prevUnreferencedPtr(0), nextUnreferenced(0)
{
declarativePixmaps.insert(pixmap);
}
- QQuickPixmapData(QQuickPixmap *pixmap, const QUrl &u, const QSize &r)
+ QQuickPixmapData(QQuickPixmap *pixmap, const QUrl &u, const QSize &r, AutoTransform rTransform, AutoTransform aTransform)
: refCount(1), inCache(false), pixmapStatus(QQuickPixmap::Loading),
- url(u), requestSize(r), textureFactory(0), reply(0), prevUnreferenced(0), prevUnreferencedPtr(0),
+ url(u), requestSize(r),
+ requestedTransform(rTransform), appliedTransform(aTransform),
+ textureFactory(0), reply(0), prevUnreferenced(0), prevUnreferencedPtr(0),
nextUnreferenced(0)
{
declarativePixmaps.insert(pixmap);
}
- QQuickPixmapData(QQuickPixmap *pixmap, const QUrl &u, QQuickTextureFactory *texture, const QSize &s, const QSize &r)
+ QQuickPixmapData(QQuickPixmap *pixmap, const QUrl &u, QQuickTextureFactory *texture,
+ const QSize &s, const QSize &r, AutoTransform rTransform, AutoTransform aTransform)
: refCount(1), inCache(false), pixmapStatus(QQuickPixmap::Ready),
- url(u), implicitSize(s), requestSize(r), textureFactory(texture), reply(0), prevUnreferenced(0),
+ url(u), implicitSize(s), requestSize(r),
+ requestedTransform(rTransform), appliedTransform(aTransform),
+ textureFactory(texture), reply(0), prevUnreferenced(0),
prevUnreferencedPtr(0), nextUnreferenced(0)
{
declarativePixmaps.insert(pixmap);
@@ -254,6 +267,7 @@ public:
QQuickPixmapData(QQuickPixmap *pixmap, QQuickTextureFactory *texture)
: refCount(1), inCache(false), pixmapStatus(QQuickPixmap::Ready),
+ requestedTransform(UsePluginDefault), appliedTransform(UsePluginDefault),
textureFactory(texture), reply(0), prevUnreferenced(0),
prevUnreferencedPtr(0), nextUnreferenced(0)
{
@@ -287,6 +301,8 @@ public:
QString errorString;
QSize implicitSize;
QSize requestSize;
+ AutoTransform requestedTransform;
+ AutoTransform appliedTransform;
QQuickTextureFactory *textureFactory;
@@ -315,11 +331,11 @@ void QQuickPixmapReply::postReply(ReadError error, const QString &errorString,
const QSize &implicitSize, QQuickTextureFactory *factory)
{
loading = false;
- QCoreApplication::postEvent(this, new Event(error, errorString, implicitSize, factory));
+ QCoreApplication::postEvent(this, new Event(error, errorString, implicitSize, autoTransform, factory));
}
-QQuickPixmapReply::Event::Event(ReadError e, const QString &s, const QSize &iSize, QQuickTextureFactory *factory)
- : QEvent(QEvent::User), error(e), errorString(s), implicitSize(iSize), textureFactory(factory)
+QQuickPixmapReply::Event::Event(ReadError e, const QString &s, const QSize &iSize, AutoTransform iTransformed, QQuickTextureFactory *factory)
+ : QEvent(QEvent::User), error(e), errorString(s), implicitSize(iSize), autoTransform(iTransformed), textureFactory(factory)
{
}
@@ -356,9 +372,13 @@ static void maybeRemoveAlpha(QImage *image)
}
static bool readImage(const QUrl& url, QIODevice *dev, QImage *image, QString *errorString, QSize *impsize,
- const QSize &requestSize)
+ const QSize &requestSize, AutoTransform &autoTransform)
{
QImageReader imgio(dev);
+ if (autoTransform != UsePluginDefault)
+ imgio.setAutoTransform(autoTransform == ApplyTransform);
+ else
+ autoTransform = imgio.autoTransform() ? ApplyTransform : DoNotApplyTransform;
const bool force_scale = imgio.format() == "svg" || imgio.format() == "svgz";
@@ -468,7 +488,7 @@ void QQuickPixmapReader::networkRequestDone(QNetworkReply *reply)
QByteArray all = reply->readAll();
QBuffer buff(&all);
buff.open(QIODevice::ReadOnly);
- if (!readImage(reply->url(), &buff, &image, &errorString, &readSize, job->requestSize))
+ if (!readImage(reply->url(), &buff, &image, &errorString, &readSize, job->requestSize, job->autoTransform))
error = QQuickPixmapReply::Decoding;
}
// send completion event to the QQuickPixmapReply
@@ -514,7 +534,7 @@ void QQuickPixmapReader::processJobs()
QMutexLocker locker(&mutex);
while (true) {
- if (cancelled.isEmpty() && (jobs.isEmpty() || replies.count() >= IMAGEREQUEST_MAX_REQUEST_COUNT))
+ if (cancelled.isEmpty() && jobs.isEmpty())
return; // Nothing else to do
// Clean cancelled jobs
@@ -536,23 +556,43 @@ void QQuickPixmapReader::processJobs()
cancelled.clear();
}
- if (!jobs.isEmpty() && replies.count() < IMAGEREQUEST_MAX_REQUEST_COUNT) {
- QQuickPixmapReply *runningJob = jobs.takeLast();
- runningJob->loading = true;
+ if (!jobs.isEmpty()) {
+ // Find a job we can use
+ bool usableJob = false;
+ for (int i = jobs.count() - 1; !usableJob && i >= 0; i--) {
+ QQuickPixmapReply *runningJob = jobs[i];
+ const QUrl url = runningJob->url;
+
+ if (url.scheme() == QLatin1String("image")) {
+ usableJob = true;
+ } else {
+ const QString localFile = QQmlFile::urlToLocalFileOrQrc(url);
+ usableJob = !localFile.isEmpty() || replies.count() < IMAGEREQUEST_MAX_REQUEST_COUNT;
+ }
- QUrl url = runningJob->url;
- PIXMAP_PROFILE(pixmapStateChanged<QQuickProfiler::PixmapLoadingStarted>(url));
+ if (usableJob) {
+ jobs.removeAt(i);
+
+ runningJob->loading = true;
- QSize requestSize = runningJob->requestSize;
- locker.unlock();
- processJob(runningJob, url, requestSize);
- locker.relock();
+ PIXMAP_PROFILE(pixmapStateChanged<QQuickProfiler::PixmapLoadingStarted>(url));
+
+ QSize requestSize = runningJob->requestSize;
+ AutoTransform autoTransform = runningJob->autoTransform;
+ locker.unlock();
+ processJob(runningJob, url, requestSize, autoTransform);
+ locker.relock();
+ }
+ }
+
+ if (!usableJob)
+ return;
}
}
}
void QQuickPixmapReader::processJob(QQuickPixmapReply *runningJob, const QUrl &url,
- const QSize &requestSize)
+ const QSize &requestSize, AutoTransform autoTransform)
{
// fetch
if (url.scheme() == QLatin1String("image")) {
@@ -623,7 +663,7 @@ void QQuickPixmapReader::processJob(QQuickPixmapReply *runningJob, const QUrl &u
QFile f(lf);
QSize readSize;
if (f.open(QIODevice::ReadOnly)) {
- if (!readImage(url, &f, &image, &errorStr, &readSize, requestSize))
+ if (!readImage(url, &f, &image, &errorStr, &readSize, requestSize, autoTransform))
errorCode = QQuickPixmapReply::Loading;
} else {
errorStr = QQuickPixmap::tr("Cannot open: %1").arg(url.toString());
@@ -722,16 +762,17 @@ class QQuickPixmapKey
public:
const QUrl *url;
const QSize *size;
+ AutoTransform autoTransform;
};
inline bool operator==(const QQuickPixmapKey &lhs, const QQuickPixmapKey &rhs)
{
- return *lhs.size == *rhs.size && *lhs.url == *rhs.url;
+ return *lhs.size == *rhs.size && *lhs.url == *rhs.url && lhs.autoTransform == rhs.autoTransform;
}
inline uint qHash(const QQuickPixmapKey &key)
{
- return qHash(*key.url) ^ key.size->width() ^ key.size->height();
+ return qHash(*key.url) ^ (key.size->width()*7) ^ (key.size->height()*17) ^ (key.autoTransform * 0x5c5c5c5c);
}
class QSGContext;
@@ -833,8 +874,10 @@ void QQuickPixmapStore::unreferencePixmap(QQuickPixmapData *data)
shrinkCache(-1); // Shrink the cache in case it has become larger than cache_limit
- if (m_timerId == -1 && m_unreferencedPixmaps && !m_destroying)
+ if (m_timerId == -1 && m_unreferencedPixmaps
+ && !m_destroying && !QCoreApplication::closingDown()) {
m_timerId = startTimer(CACHE_EXPIRE_TIME * 1000);
+ }
}
void QQuickPixmapStore::referencePixmap(QQuickPixmapData *data)
@@ -899,7 +942,7 @@ void QQuickPixmap::purgeCache()
}
QQuickPixmapReply::QQuickPixmapReply(QQuickPixmapData *d)
-: data(d), engineForReader(0), requestSize(d->requestSize), url(d->url), loading(false), redirectCount(0)
+: data(d), engineForReader(0), requestSize(d->requestSize), url(d->url), loading(false), autoTransform(d->appliedTransform), redirectCount(0)
{
if (finishedIndex == -1) {
finishedIndex = QMetaMethod::fromSignal(&QQuickPixmapReply::finished).methodIndex();
@@ -923,6 +966,7 @@ bool QQuickPixmapReply::event(QEvent *event)
if (data->pixmapStatus == QQuickPixmap::Ready) {
data->textureFactory = de->textureFactory;
data->implicitSize = de->implicitSize;
+ data->appliedTransform = de->autoTransform;
PIXMAP_PROFILE(pixmapLoadingFinished(data->url,
data->textureFactory != 0 && data->textureFactory->textureSize().isValid() ?
data->textureFactory->textureSize() :
@@ -993,7 +1037,7 @@ void QQuickPixmapData::release()
void QQuickPixmapData::addToCache()
{
if (!inCache) {
- QQuickPixmapKey key = { &url, &requestSize };
+ QQuickPixmapKey key = { &url, &requestSize, requestedTransform };
pixmapStore()->m_cache.insert(key, this);
inCache = true;
PIXMAP_PROFILE(pixmapCountChanged<QQuickProfiler::PixmapCacheCountChanged>(
@@ -1004,7 +1048,7 @@ void QQuickPixmapData::addToCache()
void QQuickPixmapData::removeFromCache()
{
if (inCache) {
- QQuickPixmapKey key = { &url, &requestSize };
+ QQuickPixmapKey key = { &url, &requestSize, requestedTransform };
pixmapStore()->m_cache.remove(key);
inCache = false;
PIXMAP_PROFILE(pixmapCountChanged<QQuickProfiler::PixmapCacheCountChanged>(
@@ -1012,7 +1056,7 @@ void QQuickPixmapData::removeFromCache()
}
}
-static QQuickPixmapData* createPixmapDataSync(QQuickPixmap *declarativePixmap, QQmlEngine *engine, const QUrl &url, const QSize &requestSize, bool *ok)
+static QQuickPixmapData* createPixmapDataSync(QQuickPixmap *declarativePixmap, QQmlEngine *engine, const QUrl &url, const QSize &requestSize, AutoTransform autoTransform, bool *ok)
{
if (url.scheme() == QLatin1String("image")) {
QSize readSize;
@@ -1024,14 +1068,14 @@ static QQuickPixmapData* createPixmapDataSync(QQuickPixmap *declarativePixmap, Q
switch (imageType) {
case QQuickImageProvider::Invalid:
- return new QQuickPixmapData(declarativePixmap, url, requestSize,
+ return new QQuickPixmapData(declarativePixmap, url, requestSize, autoTransform,
QQuickPixmap::tr("Invalid image provider: %1").arg(url.toString()));
case QQuickImageProvider::Texture:
{
QQuickTextureFactory *texture = provider->requestTexture(imageId(url), &readSize, requestSize);
if (texture) {
*ok = true;
- return new QQuickPixmapData(declarativePixmap, url, texture, readSize, requestSize);
+ return new QQuickPixmapData(declarativePixmap, url, texture, readSize, requestSize, autoTransform, UsePluginDefault);
}
}
@@ -1040,7 +1084,7 @@ static QQuickPixmapData* createPixmapDataSync(QQuickPixmap *declarativePixmap, Q
QImage image = provider->requestImage(imageId(url), &readSize, requestSize);
if (!image.isNull()) {
*ok = true;
- return new QQuickPixmapData(declarativePixmap, url, textureFactoryForImage(image), readSize, requestSize);
+ return new QQuickPixmapData(declarativePixmap, url, textureFactoryForImage(image), readSize, requestSize, autoTransform, UsePluginDefault);
}
}
case QQuickImageProvider::Pixmap:
@@ -1048,13 +1092,13 @@ static QQuickPixmapData* createPixmapDataSync(QQuickPixmap *declarativePixmap, Q
QPixmap pixmap = provider->requestPixmap(imageId(url), &readSize, requestSize);
if (!pixmap.isNull()) {
*ok = true;
- return new QQuickPixmapData(declarativePixmap, url, textureFactoryForImage(pixmap.toImage()), readSize, requestSize);
+ return new QQuickPixmapData(declarativePixmap, url, textureFactoryForImage(pixmap.toImage()), readSize, requestSize, autoTransform, UsePluginDefault);
}
}
}
// provider has bad image type, or provider returned null image
- return new QQuickPixmapData(declarativePixmap, url, requestSize,
+ return new QQuickPixmapData(declarativePixmap, url, requestSize, autoTransform,
QQuickPixmap::tr("Failed to get image from provider: %1").arg(url.toString()));
}
@@ -1068,17 +1112,17 @@ static QQuickPixmapData* createPixmapDataSync(QQuickPixmap *declarativePixmap, Q
if (f.open(QIODevice::ReadOnly)) {
QImage image;
-
- if (readImage(url, &f, &image, &errorString, &readSize, requestSize)) {
+ AutoTransform appliedTransform = autoTransform;
+ if (readImage(url, &f, &image, &errorString, &readSize, requestSize, appliedTransform)) {
*ok = true;
- return new QQuickPixmapData(declarativePixmap, url, textureFactoryForImage(image), readSize, requestSize);
+ return new QQuickPixmapData(declarativePixmap, url, textureFactoryForImage(image), readSize, requestSize, autoTransform, appliedTransform);
}
errorString = QQuickPixmap::tr("Invalid image data: %1").arg(url.toString());
} else {
errorString = QQuickPixmap::tr("Cannot open: %1").arg(url.toString());
}
- return new QQuickPixmapData(declarativePixmap, url, requestSize, errorString);
+ return new QQuickPixmapData(declarativePixmap, url, requestSize, autoTransform, errorString);
}
@@ -1107,7 +1151,7 @@ QQuickPixmap::QQuickPixmap(QQmlEngine *engine, const QUrl &url, const QSize &siz
QQuickPixmap::QQuickPixmap(const QUrl &url, const QImage &image)
{
- d = new QQuickPixmapData(this, url, new QQuickDefaultTextureFactory(image), image.size(), QSize());
+ d = new QQuickPixmapData(this, url, new QQuickDefaultTextureFactory(image), image.size(), QSize(), UsePluginDefault, UsePluginDefault);
d->addToCache();
}
@@ -1180,6 +1224,14 @@ const QSize &QQuickPixmap::requestSize() const
return nullPixmap()->size;
}
+AutoTransform QQuickPixmap::autoTransform() const
+{
+ if (d)
+ return d->appliedTransform;
+ else
+ return UsePluginDefault;
+}
+
QQuickTextureFactory *QQuickPixmap::textureFactory() const
{
if (d)
@@ -1255,13 +1307,18 @@ void QQuickPixmap::load(QQmlEngine *engine, const QUrl &url, const QSize &size)
void QQuickPixmap::load(QQmlEngine *engine, const QUrl &url, const QSize &requestSize, QQuickPixmap::Options options)
{
+ load(engine, url, requestSize, options, UsePluginDefault);
+}
+
+void QQuickPixmap::load(QQmlEngine *engine, const QUrl &url, const QSize &requestSize, QQuickPixmap::Options options, AutoTransform requestAutoTransform)
+{
if (d) {
d->declarativePixmaps.remove(this);
d->release();
d = 0;
}
- QQuickPixmapKey key = { &url, &requestSize };
+ QQuickPixmapKey key = { &url, &requestSize, requestAutoTransform };
QQuickPixmapStore *store = pixmapStore();
QHash<QQuickPixmapKey, QQuickPixmapData *>::Iterator iter = store->m_cache.end();
@@ -1287,7 +1344,7 @@ void QQuickPixmap::load(QQmlEngine *engine, const QUrl &url, const QSize &reques
if (!(options & QQuickPixmap::Asynchronous)) {
bool ok = false;
PIXMAP_PROFILE(pixmapStateChanged<QQuickProfiler::PixmapLoadingStarted>(url));
- d = createPixmapDataSync(this, engine, url, requestSize, &ok);
+ d = createPixmapDataSync(this, engine, url, requestSize, requestAutoTransform, &ok);
if (ok) {
PIXMAP_PROFILE(pixmapLoadingFinished(url, QSize(width(), height())));
if (options & QQuickPixmap::Cache)
@@ -1303,7 +1360,7 @@ void QQuickPixmap::load(QQmlEngine *engine, const QUrl &url, const QSize &reques
if (!engine)
return;
- d = new QQuickPixmapData(this, url, requestSize);
+ d = new QQuickPixmapData(this, url, requestSize, requestAutoTransform, requestAutoTransform);
if (options & QQuickPixmap::Cache)
d->addToCache();
@@ -1339,7 +1396,7 @@ void QQuickPixmap::clear(QObject *obj)
bool QQuickPixmap::isCached(const QUrl &url, const QSize &requestSize)
{
- QQuickPixmapKey key = { &url, &requestSize };
+ QQuickPixmapKey key = { &url, &requestSize, UsePluginDefault };
QQuickPixmapStore *store = pixmapStore();
return store->m_cache.contains(key);
diff --git a/src/quick/util/qquickpixmapcache_p.h b/src/quick/util/qquickpixmapcache_p.h
index df56ee3a10..482a2e5653 100644
--- a/src/quick/util/qquickpixmapcache_p.h
+++ b/src/quick/util/qquickpixmapcache_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -49,18 +49,25 @@ class QQmlEngine;
class QQuickPixmapData;
class QQuickTextureFactory;
+enum AutoTransform {
+ UsePluginDefault = -1,
+ ApplyTransform = 0,
+ DoNotApplyTransform = 1
+};
+
class QQuickDefaultTextureFactory : public QQuickTextureFactory
{
Q_OBJECT
public:
QQuickDefaultTextureFactory(const QImage &i);
QSGTexture *createTexture(QQuickWindow *window) const;
- QSize textureSize() const { return im.size(); }
- int textureByteCount() const { return im.byteCount(); }
+ QSize textureSize() const { return size; }
+ int textureByteCount() const { return size.width() * size.height() * 4; }
QImage image() const { return im; }
private:
QImage im;
+ QSize size;
};
class Q_QUICK_PRIVATE_EXPORT QQuickPixmap
@@ -91,6 +98,7 @@ public:
const QUrl &url() const;
const QSize &implicitSize() const;
const QSize &requestSize() const;
+ AutoTransform autoTransform() const;
QImage image() const;
void setImage(const QImage &);
void setPixmap(const QQuickPixmap &other);
@@ -105,6 +113,7 @@ public:
void load(QQmlEngine *, const QUrl &, QQuickPixmap::Options options);
void load(QQmlEngine *, const QUrl &, const QSize &);
void load(QQmlEngine *, const QUrl &, const QSize &, QQuickPixmap::Options options);
+ void load(QQmlEngine *, const QUrl &, const QSize &, QQuickPixmap::Options options, AutoTransform autoTransform);
void clear();
void clear(QObject *);
diff --git a/src/quick/util/qquickprofiler.cpp b/src/quick/util/qquickprofiler.cpp
index 3b34b7550b..d9132a9cb2 100644
--- a/src/quick/util/qquickprofiler.cpp
+++ b/src/quick/util/qquickprofiler.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -80,7 +80,7 @@ void QQuickProfilerData::toByteArrays(QList<QByteArray> &messages) const
// RendererFrame: preprocessTime, updateTime, bindingTime, renderTime
case QQuickProfiler::SceneGraphRendererFrame: ds << subtime_1 << subtime_2 << subtime_3 << subtime_4; break;
// AdaptationLayerFrame: glyphCount (which is an integer), glyphRenderTime, glyphStoreTime
- case QQuickProfiler::SceneGraphAdaptationLayerFrame: ds << subtime_1 << subtime_2 << subtime_3; break;
+ case QQuickProfiler::SceneGraphAdaptationLayerFrame: ds << subtime_3 << subtime_1 << subtime_2; break;
// ContextFrame: compiling material time
case QQuickProfiler::SceneGraphContextFrame: ds << subtime_1; break;
// RenderLoop: syncTime, renderTime, swapTime
diff --git a/src/quick/util/qquickprofiler_p.h b/src/quick/util/qquickprofiler_p.h
index 62e23cd393..aaed4bd60e 100644
--- a/src/quick/util/qquickprofiler_p.h
+++ b/src/quick/util/qquickprofiler_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -51,6 +51,7 @@
#include <QUrl>
#include <QSize>
#include <QMutex>
+#include <QThreadStorage>
QT_BEGIN_NAMESPACE
@@ -63,9 +64,38 @@ QT_BEGIN_NAMESPACE
#define Q_QUICK_PROFILE(feature, Method)\
Q_QUICK_PROFILE_IF_ENABLED(feature, QQuickProfiler::Method)
-#define Q_QUICK_SG_PROFILE(Type, Params)\
+#define Q_QUICK_SG_PROFILE_START(Type)\
Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\
- (QQuickProfiler::sceneGraphFrame<Type> Params))
+ (QQuickProfiler::startSceneGraphFrame<Type>()))
+
+#define Q_QUICK_SG_PROFILE_RECORD(Type)\
+ Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\
+ (QQuickProfiler::recordSceneGraphTimestamp<Type>()))
+
+#define Q_QUICK_SG_PROFILE_SKIP(Type, Skip)\
+ Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\
+ (QQuickProfiler::skipSceneGraphTimestamps<Type, Skip>()))
+
+#define Q_QUICK_SG_PROFILE_START_SYNCHRONIZED(Type1, Type2)\
+ Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\
+ (QQuickProfiler::startSceneGraphFrame<Type1, Type2>()))
+
+#define Q_QUICK_SG_PROFILE_SWITCH(Type1, Type2) \
+ Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\
+ (QQuickProfiler::reportSceneGraphFrame<Type1, true, Type2>()))
+
+#define Q_QUICK_SG_PROFILE_REPORT(Type)\
+ Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\
+ (QQuickProfiler::reportSceneGraphFrame<Type, false>()))
+
+#define Q_QUICK_SG_PROFILE_END(Type)\
+ Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\
+ (QQuickProfiler::reportSceneGraphFrame<Type, true>()))
+
+#define Q_QUICK_SG_PROFILE_END_WITH_PAYLOAD(Type, Payload)\
+ Q_QUICK_PROFILE_IF_ENABLED(QQuickProfiler::ProfileSceneGraph,\
+ (QQuickProfiler::reportSceneGraphFrame<Type, true>(Payload)))
+
#define Q_QUICK_INPUT_PROFILE(Method)\
Q_QUICK_PROFILE(QQuickProfiler::ProfileInputEvents, Method)
@@ -136,6 +166,39 @@ struct Q_AUTOTEST_EXPORT QQuickProfilerData
Q_DECLARE_TYPEINFO(QQuickProfilerData, Q_MOVABLE_TYPE);
+class QQuickProfilerSceneGraphData : public QQmlProfilerDefinitions {
+private:
+ static const uint s_numSceneGraphTimings = 5;
+
+ template<uint size>
+ struct TimingData {
+ qint64 values[size][s_numSceneGraphTimings + 1];
+ int offsets[size];
+ };
+
+ QThreadStorage<TimingData<NumRenderThreadFrameTypes> > renderThreadTimings;
+ TimingData<NumGUIThreadFrameTypes> guiThreadTimings;
+
+public:
+ template<SceneGraphFrameType type>
+ qint64 *timings()
+ {
+ if (type < NumRenderThreadFrameTypes)
+ return renderThreadTimings.localData().values[type];
+ else
+ return guiThreadTimings.values[type - NumRenderThreadFrameTypes];
+ }
+
+ template<SceneGraphFrameType type>
+ int &offset()
+ {
+ if (type < NumRenderThreadFrameTypes)
+ return renderThreadTimings.localData().offsets[type];
+ else
+ return guiThreadTimings.offsets[type - NumRenderThreadFrameTypes];
+ }
+};
+
class Q_QUICK_PRIVATE_EXPORT QQuickProfiler : public QQmlAbstractProfilerAdapter {
Q_OBJECT
public:
@@ -163,12 +226,62 @@ public:
}
}
+ template<SceneGraphFrameType FrameType1, SceneGraphFrameType FrameType2>
+ static void startSceneGraphFrame()
+ {
+ startSceneGraphFrame<FrameType1>();
+ s_instance->m_sceneGraphData.offset<FrameType2>() = 0;
+ s_instance->m_sceneGraphData.timings<FrameType2>()[0] =
+ s_instance->m_sceneGraphData.timings<FrameType1>()[0];
+ }
+
template<SceneGraphFrameType FrameType>
- static void sceneGraphFrame(qint64 value1, qint64 value2 = -1, qint64 value3 = -1,
- qint64 value4 = -1, qint64 value5 = -1)
+ static void startSceneGraphFrame()
+ {
+ s_instance->m_sceneGraphData.offset<FrameType>() = 0;
+ s_instance->m_sceneGraphData.timings<FrameType>()[0] = s_instance->timestamp();
+ }
+
+ template<SceneGraphFrameType FrameType>
+ static void recordSceneGraphTimestamp()
+ {
+ s_instance->m_sceneGraphData.timings<FrameType>()
+ [++s_instance->m_sceneGraphData.offset<FrameType>()] = s_instance->timestamp();
+ }
+
+ template<SceneGraphFrameType FrameType, uint Skip>
+ static void skipSceneGraphTimestamps()
+ {
+ qint64 *timings = s_instance->m_sceneGraphData.timings<FrameType>();
+ const qint64 last = timings[s_instance->m_sceneGraphData.offset<FrameType>()];
+ for (uint i = 0; i < Skip; ++i)
+ timings[++s_instance->m_sceneGraphData.offset<FrameType>()] = last;
+ }
+
+ template<SceneGraphFrameType FrameType, bool Record>
+ static void reportSceneGraphFrame(quint64 payload = ~0)
+ {
+ qint64 *timings = s_instance->m_sceneGraphData.timings<FrameType>();
+ int &offset = s_instance->m_sceneGraphData.offset<FrameType>();
+ if (Record)
+ timings[++offset] = s_instance->timestamp();
+ s_instance->processMessage(QQuickProfilerData(
+ timings[offset], 1 << SceneGraphFrame, 1 << FrameType,
+ offset > 0 ? timings[1] - timings[0] : payload,
+ offset > 1 ? timings[2] - timings[1] : payload,
+ offset > 2 ? timings[3] - timings[2] : payload,
+ offset > 3 ? timings[4] - timings[3] : payload,
+ offset > 4 ? timings[5] - timings[4] : payload));
+ }
+
+ template<SceneGraphFrameType FrameType, bool Record, SceneGraphFrameType SwitchTo>
+ static void reportSceneGraphFrame(quint64 payload = ~0)
{
- s_instance->processMessage(QQuickProfilerData(s_instance->timestamp(), 1 << SceneGraphFrame,
- 1 << FrameType, value1, value2, value3, value4, value5));
+ reportSceneGraphFrame<FrameType, Record>(payload);
+ s_instance->m_sceneGraphData.offset<SwitchTo>() = 0;
+ s_instance->m_sceneGraphData.timings<SwitchTo>()[0] =
+ s_instance->m_sceneGraphData.timings<FrameType>()
+ [s_instance->m_sceneGraphData.offset<FrameType>()];
}
template<PixmapEventType PixmapState>
@@ -215,6 +328,7 @@ protected:
QMutex m_dataMutex;
QElapsedTimer m_timer;
QVarLengthArray<QQuickProfilerData> m_data;
+ QQuickProfilerSceneGraphData m_sceneGraphData;
QQuickProfiler(QQmlProfilerService *service);
diff --git a/src/quick/util/qquickpropertychanges.cpp b/src/quick/util/qquickpropertychanges.cpp
index 03a55ebac1..6c333c6b13 100644
--- a/src/quick/util/qquickpropertychanges.cpp
+++ b/src/quick/util/qquickpropertychanges.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -295,8 +295,8 @@ void QQuickPropertyChangesPrivate::decodeBinding(const QString &propertyPrefix,
int column = -1;
QQmlData *ddata = QQmlData::get(q);
- if (ddata && ddata->outerContext && !ddata->outerContext->url.isEmpty()) {
- url = ddata->outerContext->url;
+ if (ddata && ddata->outerContext && !ddata->outerContext->url().isEmpty()) {
+ url = ddata->outerContext->url();
line = ddata->lineNumber;
column = ddata->columnNumber;
}
diff --git a/src/quick/util/qquickpropertychanges_p.h b/src/quick/util/qquickpropertychanges_p.h
index 7d5dcf213d..15e5ec2936 100644
--- a/src/quick/util/qquickpropertychanges_p.h
+++ b/src/quick/util/qquickpropertychanges_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickshortcut.cpp b/src/quick/util/qquickshortcut.cpp
new file mode 100644
index 0000000000..36c6933af4
--- /dev/null
+++ b/src/quick/util/qquickshortcut.cpp
@@ -0,0 +1,283 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtQuick module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickshortcut_p.h"
+
+#include <QtQuick/qquickitem.h>
+#include <QtQuick/qquickwindow.h>
+#include <QtGui/private/qguiapplication_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype Shortcut
+ \instantiates QQuickShortcut
+ \inqmlmodule QtQuick
+ \since 5.5
+ \ingroup qtquick-input
+ \brief Provides keyboard shortcuts
+
+ The Shortcut type provides a way of handling keyboard shortcuts. The shortcut can
+ be set to one of the \l{QKeySequence::StandardKey}{standard keyboard shortcuts},
+ or it can be described with a string containing a sequence of up to four key
+ presses that are needed to \l{Shortcut::activated}{activate} the shortcut.
+
+ \qml
+ Item {
+ id: view
+
+ property int currentIndex
+
+ Shortcut {
+ sequence: StandardKey.NextChild
+ onActivated: view.currentIndex++
+ }
+ }
+ \endqml
+
+ \sa Keys
+*/
+
+/*! \qmlsignal QtQuick::Shortcut::activated()
+
+ This signal is emitted when the shortcut is activated.
+
+ The corresponding handler is \c onActivated.
+*/
+
+/*! \qmlsignal QtQuick::Shortcut::activatedAmbiguously()
+
+ This signal is emitted when the shortcut is activated ambigously,
+ meaning that it matches the start of more than one shortcut.
+
+ The corresponding handler is \c onActivatedAmbiguously.
+*/
+
+QQuickShortcut::QQuickShortcut(QObject *parent) : QObject(parent), m_id(0),
+ m_enabled(true), m_completed(false), m_autorepeat(true), m_context(Qt::WindowShortcut)
+{
+}
+
+QQuickShortcut::~QQuickShortcut()
+{
+ ungrabShortcut();
+}
+
+/*!
+ \qmlproperty keysequence QtQuick::Shortcut::sequence
+
+ This property holds the shortcut's key sequence. The key sequence can be set
+ to one of the \l{QKeySequence::StandardKey}{standard keyboard shortcuts}, or
+ it can be described with a string containing a sequence of up to four key
+ presses that are needed to \l{Shortcut::activated}{activate} the shortcut.
+
+ The default value is an empty key sequence.
+
+ \qml
+ Shortcut {
+ sequence: "Ctrl+E,Ctrl+W"
+ onActivated: edit.wrapMode = TextEdit.Wrap
+ }
+ \endqml
+*/
+QVariant QQuickShortcut::sequence() const
+{
+ return m_sequence;
+}
+
+void QQuickShortcut::setSequence(const QVariant &sequence)
+{
+ if (sequence == m_sequence)
+ return;
+
+ QKeySequence shortcut;
+ if (sequence.type() == QVariant::Int)
+ shortcut = QKeySequence(static_cast<QKeySequence::StandardKey>(sequence.toInt()));
+ else
+ shortcut = QKeySequence::fromString(sequence.toString());
+
+ grabShortcut(shortcut, m_context);
+
+ m_sequence = sequence;
+ m_shortcut = shortcut;
+ emit sequenceChanged();
+}
+
+/*!
+ \qmlproperty bool QtQuick::Shortcut::enabled
+
+ This property holds whether the shortcut is enabled.
+
+ The default value is \c true.
+*/
+bool QQuickShortcut::isEnabled() const
+{
+ return m_enabled;
+}
+
+void QQuickShortcut::setEnabled(bool enabled)
+{
+ if (enabled == m_enabled)
+ return;
+
+ if (m_id)
+ QGuiApplicationPrivate::instance()->shortcutMap.setShortcutEnabled(enabled, m_id, this);
+
+ m_enabled = enabled;
+ emit enabledChanged();
+}
+
+/*!
+ \qmlproperty bool QtQuick::Shortcut::autoRepeat
+
+ This property holds whether the shortcut can auto repeat.
+
+ The default value is \c true.
+*/
+bool QQuickShortcut::autoRepeat() const
+{
+ return m_autorepeat;
+}
+
+void QQuickShortcut::setAutoRepeat(bool repeat)
+{
+ if (repeat == m_autorepeat)
+ return;
+
+ if (m_id)
+ QGuiApplicationPrivate::instance()->shortcutMap.setShortcutAutoRepeat(repeat, m_id, this);
+
+ m_autorepeat = repeat;
+ emit autoRepeatChanged();
+}
+
+/*!
+ \qmlproperty enumeration QtQuick::Shortcut::context
+
+ This property holds the \l{Qt::ShortcutContext}{shortcut context}.
+
+ Supported values are:
+ \list
+ \li \c Qt.WindowShortcut (default) - The shortcut is active when its parent item is in an active top-level window.
+ \li \c Qt.ApplicationShortcut - The shortcut is active when one of the application's windows are active.
+ \endlist
+
+ \qml
+ Shortcut {
+ sequence: StandardKey.Quit
+ context: Qt.ApplicationShortcut
+ onActivated: Qt.quit()
+ }
+ \endqml
+*/
+Qt::ShortcutContext QQuickShortcut::context() const
+{
+ return m_context;
+}
+
+void QQuickShortcut::setContext(Qt::ShortcutContext context)
+{
+ if (context == m_context)
+ return;
+
+ grabShortcut(m_shortcut, context);
+
+ m_context = context;
+ emit contextChanged();
+}
+
+void QQuickShortcut::classBegin()
+{
+}
+
+void QQuickShortcut::componentComplete()
+{
+ m_completed = true;
+ grabShortcut(m_shortcut, m_context);
+}
+
+bool QQuickShortcut::event(QEvent *event)
+{
+ if (m_enabled && event->type() == QEvent::Shortcut) {
+ QShortcutEvent *se = static_cast<QShortcutEvent *>(event);
+ if (se->shortcutId() == m_id && se->key() == m_shortcut){
+ if (se->isAmbiguous())
+ emit activatedAmbiguously();
+ else
+ emit activated();
+ return true;
+ }
+ }
+ return false;
+}
+
+static bool qQuickShortcutContextMatcher(QObject *obj, Qt::ShortcutContext context)
+{
+ switch (context) {
+ case Qt::ApplicationShortcut:
+ return true;
+ case Qt::WindowShortcut:
+ while (obj && !obj->isWindowType()) {
+ obj = obj->parent();
+ if (QQuickItem *item = qobject_cast<QQuickItem *>(obj))
+ obj = item->window();
+ }
+ return obj && obj == QGuiApplication::focusWindow();
+ default:
+ return false;
+ }
+}
+
+void QQuickShortcut::grabShortcut(const QKeySequence &sequence, Qt::ShortcutContext context)
+{
+ ungrabShortcut();
+
+ if (m_completed && !sequence.isEmpty()) {
+ QGuiApplicationPrivate *pApp = QGuiApplicationPrivate::instance();
+ m_id = pApp->shortcutMap.addShortcut(this, sequence, context, qQuickShortcutContextMatcher);
+ if (!m_enabled)
+ pApp->shortcutMap.setShortcutEnabled(false, m_id, this);
+ if (!m_autorepeat)
+ pApp->shortcutMap.setShortcutAutoRepeat(false, m_id, this);
+ }
+}
+
+void QQuickShortcut::ungrabShortcut()
+{
+ if (m_id) {
+ QGuiApplicationPrivate::instance()->shortcutMap.removeShortcut(m_id, this);
+ m_id = 0;
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/quick/util/qquickshortcut_p.h b/src/quick/util/qquickshortcut_p.h
new file mode 100644
index 0000000000..e16ac9df20
--- /dev/null
+++ b/src/quick/util/qquickshortcut_p.h
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtQuick module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://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 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKSHORTCUT_P_H
+#define QQUICKSHORTCUT_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qobject.h>
+#include <QtCore/qvariant.h>
+#include <QtGui/qkeysequence.h>
+#include <QtQml/qqmlparserstatus.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickShortcut : public QObject, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+ Q_PROPERTY(QVariant sequence READ sequence WRITE setSequence NOTIFY sequenceChanged FINAL)
+ Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged FINAL)
+ Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat NOTIFY autoRepeatChanged FINAL)
+ Q_PROPERTY(Qt::ShortcutContext context READ context WRITE setContext NOTIFY contextChanged FINAL)
+
+public:
+ explicit QQuickShortcut(QObject *parent = Q_NULLPTR);
+ ~QQuickShortcut();
+
+ QVariant sequence() const;
+ void setSequence(const QVariant &sequence);
+
+ bool isEnabled() const;
+ void setEnabled(bool enabled);
+
+ bool autoRepeat() const;
+ void setAutoRepeat(bool repeat);
+
+ Qt::ShortcutContext context() const;
+ void setContext(Qt::ShortcutContext context);
+
+Q_SIGNALS:
+ void sequenceChanged();
+ void enabledChanged();
+ void autoRepeatChanged();
+ void contextChanged();
+
+ void activated();
+ void activatedAmbiguously();
+
+protected:
+ void classBegin() Q_DECL_OVERRIDE;
+ void componentComplete() Q_DECL_OVERRIDE;
+ bool event(QEvent *event) Q_DECL_OVERRIDE;
+
+ void grabShortcut(const QKeySequence &sequence, Qt::ShortcutContext context);
+ void ungrabShortcut();
+
+private:
+ int m_id;
+ bool m_enabled;
+ bool m_completed;
+ bool m_autorepeat;
+ QKeySequence m_shortcut;
+ Qt::ShortcutContext m_context;
+ QVariant m_sequence;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKSHORTCUT_P_H
diff --git a/src/quick/util/qquicksmoothedanimation.cpp b/src/quick/util/qquicksmoothedanimation.cpp
index 48fd03853e..6d585d38a7 100644
--- a/src/quick/util/qquicksmoothedanimation.cpp
+++ b/src/quick/util/qquicksmoothedanimation.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -37,6 +37,7 @@
#include "qquickanimation_p_p.h"
#include "private/qcontinuinganimationgroupjob_p.h"
+#include <qmath.h>
#include <qqmlproperty.h>
#include <private/qqmlproperty_p.h>
@@ -44,7 +45,6 @@
#include <QtCore/qdebug.h>
-#include <math.h>
#define DELAY_STOP_TIMER_INTERVAL 32
@@ -157,7 +157,7 @@ bool QSmoothedAnimation::recalc()
return false;
}
- finalDuration = ceil(tf * 1000.0);
+ finalDuration = qCeil(tf * 1000.0);
if (maximumEasingTime == 0) {
a = 0;
@@ -191,7 +191,7 @@ bool QSmoothedAnimation::recalc()
qreal c2 = 0.5 * vi * tf - s;
qreal c3 = -0.25 * vi * vi;
- qreal a1 = (-c2 + sqrt(c2 * c2 - 4 * c1 * c3)) / (2. * c1);
+ qreal a1 = (-c2 + qSqrt(c2 * c2 - 4 * c1 * c3)) / (2. * c1);
qreal tp1 = 0.5 * tf - 0.5 * vi / a1;
qreal vp1 = a1 * tp1 + vi;
@@ -307,7 +307,7 @@ void QSmoothedAnimation::init()
void QSmoothedAnimation::debugAnimation(QDebug d) const
{
- d << "SmoothedAnimationJob(" << hex << (void *) this << dec << ")" << "duration:" << userDuration
+ d << "SmoothedAnimationJob(" << hex << (const void *) this << dec << ")" << "duration:" << userDuration
<< "velocity:" << velocity << "target:" << target.object() << "property:" << target.name()
<< "to:" << to << "current velocity:" << trackVelocity;
}
@@ -378,11 +378,11 @@ QQuickSmoothedAnimationPrivate::QQuickSmoothedAnimationPrivate()
QQuickSmoothedAnimationPrivate::~QQuickSmoothedAnimationPrivate()
{
+ typedef QHash<QQmlProperty, QSmoothedAnimation* >::iterator ActiveAnimationsHashIt;
+
delete anim;
- QHash<QQmlProperty, QSmoothedAnimation* >::iterator it;
- for (it = activeAnimations.begin(); it != activeAnimations.end(); ++it) {
+ for (ActiveAnimationsHashIt it = activeAnimations.begin(), end = activeAnimations.end(); it != end; ++it)
it.value()->clearTemplate();
- }
}
void QQuickSmoothedAnimationPrivate::updateRunningAnimations()
diff --git a/src/quick/util/qquicksmoothedanimation_p.h b/src/quick/util/qquicksmoothedanimation_p.h
index d95fb9a607..68479aa629 100644
--- a/src/quick/util/qquicksmoothedanimation_p.h
+++ b/src/quick/util/qquicksmoothedanimation_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquicksmoothedanimation_p_p.h b/src/quick/util/qquicksmoothedanimation_p_p.h
index fe1abcd19d..868bbd7edd 100644
--- a/src/quick/util/qquicksmoothedanimation_p_p.h
+++ b/src/quick/util/qquicksmoothedanimation_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickspringanimation.cpp b/src/quick/util/qquickspringanimation.cpp
index 5bfdbf2600..125d6f5ef6 100644
--- a/src/quick/util/qquickspringanimation.cpp
+++ b/src/quick/util/qquickspringanimation.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -41,8 +41,7 @@
#include <private/qobject_p.h>
-#include <limits.h>
-#include <math.h>
+#include <cmath>
#define DELAY_STOP_TIMER_INTERVAL 32
@@ -87,6 +86,7 @@ public:
bool haveModulus : 1;
bool skipUpdate : 1;
typedef QHash<QQmlProperty, QSpringAnimation*> ActiveAnimationHash;
+ typedef ActiveAnimationHash::Iterator ActiveAnimationHashIt;
void clearTemplate() { animationTemplate = 0; }
@@ -162,14 +162,12 @@ QSpringAnimation::~QSpringAnimation()
{
if (animationTemplate) {
if (target.object()) {
- QSpringAnimation::ActiveAnimationHash::iterator it =
- animationTemplate->activeAnimations.find(target);
+ ActiveAnimationHashIt it = animationTemplate->activeAnimations.find(target);
if (it != animationTemplate->activeAnimations.end() && it.value() == this)
animationTemplate->activeAnimations.erase(it);
} else {
//target is no longer valid, need to search linearly
- QSpringAnimation::ActiveAnimationHash::iterator it;
- for (it = animationTemplate->activeAnimations.begin(); it != animationTemplate->activeAnimations.end(); ++it) {
+ for (ActiveAnimationHashIt it = animationTemplate->activeAnimations.begin(); it != animationTemplate->activeAnimations.end(); ++it) {
if (it.value() == this) {
animationTemplate->activeAnimations.erase(it);
break;
@@ -282,11 +280,11 @@ void QSpringAnimation::updateCurrentTime(int time)
if (diff > 0) {
currentValue += moveBy;
if (haveModulus)
- currentValue = fmod(currentValue, modulus);
+ currentValue = std::fmod(currentValue, modulus);
} else {
currentValue -= moveBy;
if (haveModulus && currentValue < 0.0)
- currentValue = fmod(currentValue, modulus) + modulus;
+ currentValue = std::fmod(currentValue, modulus) + modulus;
}
if (lastTime - startTime >= dura) {
currentValue = to;
@@ -315,7 +313,7 @@ void QSpringAnimation::updateState(QAbstractAnimationJob::State newState, QAbstr
void QSpringAnimation::debugAnimation(QDebug d) const
{
- d << "SpringAnimationJob(" << hex << (void *) this << dec << ")" << "velocity:" << maxVelocity
+ d << "SpringAnimationJob(" << hex << (const void *) this << dec << ")" << "velocity:" << maxVelocity
<< "spring:" << spring << "damping:" << damping << "epsilon:" << epsilon << "modulus:" << modulus
<< "mass:" << mass << "target:" << target.object() << "property:" << target.name()
<< "to:" << to << "current velocity:" << velocity;
@@ -330,8 +328,7 @@ void QQuickSpringAnimationPrivate::updateMode()
mode = QSpringAnimation::Spring;
else {
mode = QSpringAnimation::Velocity;
- QSpringAnimation::ActiveAnimationHash::iterator it;
- for (it = activeAnimations.begin(); it != activeAnimations.end(); ++it) {
+ for (QSpringAnimation::ActiveAnimationHashIt it = activeAnimations.begin(), end = activeAnimations.end(); it != end; ++it) {
QSpringAnimation *animation = *it;
animation->startTime = animation->lastTime;
qreal dist = qAbs(animation->currentValue - animation->to);
@@ -379,10 +376,8 @@ QQuickSpringAnimation::QQuickSpringAnimation(QObject *parent)
QQuickSpringAnimation::~QQuickSpringAnimation()
{
Q_D(QQuickSpringAnimation);
- QSpringAnimation::ActiveAnimationHash::iterator it;
- for (it = d->activeAnimations.begin(); it != d->activeAnimations.end(); ++it) {
+ for (QSpringAnimation::ActiveAnimationHashIt it = d->activeAnimations.begin(), end = d->activeAnimations.end(); it != end; ++it)
it.value()->clearTemplate();
- }
}
/*!
diff --git a/src/quick/util/qquickspringanimation_p.h b/src/quick/util/qquickspringanimation_p.h
index 6f814a7b5e..082fd341f7 100644
--- a/src/quick/util/qquickspringanimation_p.h
+++ b/src/quick/util/qquickspringanimation_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickstate.cpp b/src/quick/util/qquickstate.cpp
index 2da487dd2d..98d7a76c7e 100644
--- a/src/quick/util/qquickstate.cpp
+++ b/src/quick/util/qquickstate.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -157,6 +157,11 @@ QQuickState::~QQuickState()
Q_D(QQuickState);
if (d->group)
d->group->removeState(this);
+
+ foreach (const QQuickSimpleAction &action, d->revertList) {
+ if (action.binding())
+ action.binding()->destroy();
+ }
}
/*!
diff --git a/src/quick/util/qquickstate_p.h b/src/quick/util/qquickstate_p.h
index def89a598e..0c774635d8 100644
--- a/src/quick/util/qquickstate_p.h
+++ b/src/quick/util/qquickstate_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickstate_p_p.h b/src/quick/util/qquickstate_p_p.h
index f27c068966..fc589f0d2d 100644
--- a/src/quick/util/qquickstate_p_p.h
+++ b/src/quick/util/qquickstate_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickstatechangescript.cpp b/src/quick/util/qquickstatechangescript.cpp
index 02a9507ce9..6d25b9791d 100644
--- a/src/quick/util/qquickstatechangescript.cpp
+++ b/src/quick/util/qquickstatechangescript.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickstatechangescript_p.h b/src/quick/util/qquickstatechangescript_p.h
index 18427318a3..4ff6f0db3e 100644
--- a/src/quick/util/qquickstatechangescript_p.h
+++ b/src/quick/util/qquickstatechangescript_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickstategroup.cpp b/src/quick/util/qquickstategroup.cpp
index f5699509cd..c44f00a76e 100644
--- a/src/quick/util/qquickstategroup.cpp
+++ b/src/quick/util/qquickstategroup.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickstategroup_p.h b/src/quick/util/qquickstategroup_p.h
index 12e0aa7c1e..8ea2dbc4b3 100644
--- a/src/quick/util/qquickstategroup_p.h
+++ b/src/quick/util/qquickstategroup_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickstyledtext.cpp b/src/quick/util/qquickstyledtext.cpp
index 48d9cf4640..6ed32c10e2 100644
--- a/src/quick/util/qquickstyledtext.cpp
+++ b/src/quick/util/qquickstyledtext.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -542,6 +542,12 @@ void QQuickStyledTextPrivate::parseEntity(const QChar *&ch, const QString &textI
textOut += QChar(38);
else if (entity == QLatin1String("quot"))
textOut += QChar(34);
+ else if (entity == QLatin1String("nbsp"))
+ textOut += QChar(QChar::Nbsp);
+ return;
+ } else if (*ch == QLatin1Char(' ')) {
+ QStringRef entity(&textIn, entityStart - 1, entityLength + 1);
+ textOut += entity + *ch;
return;
}
++entityLength;
diff --git a/src/quick/util/qquickstyledtext_p.h b/src/quick/util/qquickstyledtext_p.h
index e46ca14a26..2f07a740e5 100644
--- a/src/quick/util/qquickstyledtext_p.h
+++ b/src/quick/util/qquickstyledtext_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquicksvgparser.cpp b/src/quick/util/qquicksvgparser.cpp
index 394cd2a428..587f4ac972 100644
--- a/src/quick/util/qquicksvgparser.cpp
+++ b/src/quick/util/qquicksvgparser.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Quick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -159,8 +159,8 @@ static void pathArcSegment(QPainterPath &path,
qreal t;
qreal thHalf;
- sinTh = qSin(xAxisRotation * (Q_PI / 180.0));
- cosTh = qCos(xAxisRotation * (Q_PI / 180.0));
+ sinTh = qSin(qDegreesToRadians(xAxisRotation));
+ cosTh = qCos(qDegreesToRadians(xAxisRotation));
a00 = cosTh * rx;
a01 = -sinTh * ry;
@@ -202,8 +202,8 @@ void QQuickSvgParser::pathArc(QPainterPath &path,
rx = qAbs(rx);
ry = qAbs(ry);
- sin_th = qSin(x_axis_rotation * (Q_PI / 180.0));
- cos_th = qCos(x_axis_rotation * (Q_PI / 180.0));
+ sin_th = qSin(qDegreesToRadians(x_axis_rotation));
+ cos_th = qCos(qDegreesToRadians(x_axis_rotation));
dx = (curx - x) / 2.0;
dy = (cury - y) / 2.0;
diff --git a/src/quick/util/qquicksvgparser_p.h b/src/quick/util/qquicksvgparser_p.h
index c6ddda4c60..ed9a7558d0 100644
--- a/src/quick/util/qquicksvgparser_p.h
+++ b/src/quick/util/qquicksvgparser_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Quick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquicksystempalette.cpp b/src/quick/util/qquicksystempalette.cpp
index 18548aef00..af036d93b6 100644
--- a/src/quick/util/qquicksystempalette.cpp
+++ b/src/quick/util/qquicksystempalette.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquicksystempalette_p.h b/src/quick/util/qquicksystempalette_p.h
index 49eedb0fec..143efa1c12 100644
--- a/src/quick/util/qquicksystempalette_p.h
+++ b/src/quick/util/qquicksystempalette_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquicktextmetrics.cpp b/src/quick/util/qquicktextmetrics.cpp
index 666546b4ae..1dd787f4a5 100644
--- a/src/quick/util/qquicktextmetrics.cpp
+++ b/src/quick/util/qquicktextmetrics.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquicktextmetrics_p.h b/src/quick/util/qquicktextmetrics_p.h
index 6fee1d70f5..c0265d9507 100644
--- a/src/quick/util/qquicktextmetrics_p.h
+++ b/src/quick/util/qquicktextmetrics_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquicktimeline.cpp b/src/quick/util/qquicktimeline.cpp
index 3e888ca987..74754a0bfb 100644
--- a/src/quick/util/qquicktimeline.cpp
+++ b/src/quick/util/qquicktimeline.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -659,7 +659,7 @@ void QQuickTimeLine::complete()
*/
void QQuickTimeLine::clear()
{
- for (QQuickTimeLinePrivate::Ops::ConstIterator iter = d->ops.begin(); iter != d->ops.end(); ++iter)
+ for (QQuickTimeLinePrivate::Ops::const_iterator iter = d->ops.begin(), cend = d->ops.end(); iter != cend; ++iter)
iter.key()->_t = 0;
d->ops.clear();
d->length = 0;
@@ -717,7 +717,7 @@ void QQuickTimeLine::updateCurrentTime(int v)
void QQuickTimeLine::debugAnimation(QDebug d) const
{
- d << "QuickTimeLine(" << hex << (void *) this << dec << ")";
+ d << "QuickTimeLine(" << hex << (const void *) this << dec << ")";
}
bool operator<(const QPair<int, Update> &lhs,
@@ -735,9 +735,9 @@ int QQuickTimeLinePrivate::advance(int t)
pauseTime = -1;
// Minimal advance time
int advanceTime = t;
- for (Ops::Iterator iter = ops.begin(); iter != ops.end(); ++iter) {
- TimeLine &tl = *iter;
- Op &op = tl.ops.first();
+ for (Ops::const_iterator iter = ops.constBegin(), cend = ops.constEnd(); iter != cend; ++iter) {
+ const TimeLine &tl = *iter;
+ const Op &op = tl.ops.first();
int length = op.length - tl.consumedOpLength;
if (length < advanceTime) {
diff --git a/src/quick/util/qquicktimeline_p_p.h b/src/quick/util/qquicktimeline_p_p.h
index 242c955d67..6c4056ae4b 100644
--- a/src/quick/util/qquicktimeline_p_p.h
+++ b/src/quick/util/qquicktimeline_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquicktransition.cpp b/src/quick/util/qquicktransition.cpp
index bb55b5b713..5c1c34b62f 100644
--- a/src/quick/util/qquicktransition.cpp
+++ b/src/quick/util/qquicktransition.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquicktransition_p.h b/src/quick/util/qquicktransition_p.h
index 9952a0cdd1..826df6794b 100644
--- a/src/quick/util/qquicktransition_p.h
+++ b/src/quick/util/qquicktransition_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquicktransitionmanager.cpp b/src/quick/util/qquicktransitionmanager.cpp
index 171c40db97..832596d9a2 100644
--- a/src/quick/util/qquicktransitionmanager.cpp
+++ b/src/quick/util/qquicktransitionmanager.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquicktransitionmanager_p_p.h b/src/quick/util/qquicktransitionmanager_p_p.h
index e312b279fb..a6d91d7efd 100644
--- a/src/quick/util/qquicktransitionmanager_p_p.h
+++ b/src/quick/util/qquicktransitionmanager_p_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickutilmodule.cpp b/src/quick/util/qquickutilmodule.cpp
index 0b42c21e8b..4d156a2d9a 100644
--- a/src/quick/util/qquickutilmodule.cpp
+++ b/src/quick/util/qquickutilmodule.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -48,6 +48,7 @@
#include "qquicktextmetrics_p.h"
#include "qquicktransition_p.h"
#include "qquickanimator_p.h"
+#include "qquickshortcut_p.h"
#include <qqmlinfo.h>
#include <private/qqmltypenotavailable_p.h>
#include <private/qquickanimationcontroller_p.h>
@@ -103,4 +104,6 @@ void QQuickUtilModule::defineModule()
qmlRegisterType<QQuickFontMetrics>("QtQuick", 2, 4, "FontMetrics");
qmlRegisterType<QQuickTextMetrics>("QtQuick", 2, 4, "TextMetrics");
+
+ qmlRegisterType<QQuickShortcut>("QtQuick", 2, 5, "Shortcut");
}
diff --git a/src/quick/util/qquickutilmodule_p.h b/src/quick/util/qquickutilmodule_p.h
index 06971147e6..77d0e7dd3b 100644
--- a/src/quick/util/qquickutilmodule_p.h
+++ b/src/quick/util/qquickutilmodule_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/quick/util/qquickvaluetypes.cpp b/src/quick/util/qquickvaluetypes.cpp
index 862e5cee55..fef6dfd1d0 100644
--- a/src/quick/util/qquickvaluetypes.cpp
+++ b/src/quick/util/qquickvaluetypes.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -48,11 +48,6 @@ namespace QQuickValueTypes {
}
}
-QQuickColorValueType::QQuickColorValueType(QObject *parent)
- : QQmlValueTypeBase<QColor>(QMetaType::QColor, parent)
-{
-}
-
QString QQuickColorValueType::toString() const
{
// to maintain behaviour with QtQuick 1.0, we just output normal toString() value.
@@ -99,26 +94,11 @@ void QQuickColorValueType::setA(qreal a)
v.setAlphaF(a);
}
-
-QQuickVector2DValueType::QQuickVector2DValueType(QObject *parent)
- : QQmlValueTypeBase<QVector2D>(QMetaType::QVector2D, parent)
-{
-}
-
QString QQuickVector2DValueType::toString() const
{
return QString(QLatin1String("QVector2D(%1, %2)")).arg(v.x()).arg(v.y());
}
-bool QQuickVector2DValueType::isEqual(const QVariant &other) const
-{
- if (other.userType() != QMetaType::QVector2D)
- return false;
-
- QVector2D otherVector = other.value<QVector2D>();
- return (v == otherVector);
-}
-
qreal QQuickVector2DValueType::x() const
{
return v.x();
@@ -199,26 +179,11 @@ bool QQuickVector2DValueType::fuzzyEquals(const QVector2D &vec) const
return qFuzzyCompare(v, vec);
}
-
-QQuickVector3DValueType::QQuickVector3DValueType(QObject *parent)
- : QQmlValueTypeBase<QVector3D>(QMetaType::QVector3D, parent)
-{
-}
-
QString QQuickVector3DValueType::toString() const
{
return QString(QLatin1String("QVector3D(%1, %2, %3)")).arg(v.x()).arg(v.y()).arg(v.z());
}
-bool QQuickVector3DValueType::isEqual(const QVariant &other) const
-{
- if (other.userType() != QMetaType::QVector3D)
- return false;
-
- QVector3D otherVector = other.value<QVector3D>();
- return (v == otherVector);
-}
-
qreal QQuickVector3DValueType::x() const
{
return v.x();
@@ -321,26 +286,11 @@ bool QQuickVector3DValueType::fuzzyEquals(const QVector3D &vec) const
return qFuzzyCompare(v, vec);
}
-
-QQuickVector4DValueType::QQuickVector4DValueType(QObject *parent)
- : QQmlValueTypeBase<QVector4D>(QMetaType::QVector4D, parent)
-{
-}
-
QString QQuickVector4DValueType::toString() const
{
return QString(QLatin1String("QVector4D(%1, %2, %3, %4)")).arg(v.x()).arg(v.y()).arg(v.z()).arg(v.w());
}
-bool QQuickVector4DValueType::isEqual(const QVariant &other) const
-{
- if (other.userType() != QMetaType::QVector4D)
- return false;
-
- QVector4D otherVector = other.value<QVector4D>();
- return (v == otherVector);
-}
-
qreal QQuickVector4DValueType::x() const
{
return v.x();
@@ -450,11 +400,6 @@ bool QQuickVector4DValueType::fuzzyEquals(const QVector4D &vec) const
return qFuzzyCompare(v, vec);
}
-QQuickQuaternionValueType::QQuickQuaternionValueType(QObject *parent)
- : QQmlValueTypeBase<QQuaternion>(QMetaType::QQuaternion, parent)
-{
-}
-
QString QQuickQuaternionValueType::toString() const
{
return QString(QLatin1String("QQuaternion(%1, %2, %3, %4)")).arg(v.scalar()).arg(v.x()).arg(v.y()).arg(v.z());
@@ -500,12 +445,6 @@ void QQuickQuaternionValueType::setZ(qreal z)
v.setZ(z);
}
-
-QQuickMatrix4x4ValueType::QQuickMatrix4x4ValueType(QObject *parent)
- : QQmlValueTypeBase<QMatrix4x4>(QMetaType::QMatrix4x4, parent)
-{
-}
-
QMatrix4x4 QQuickMatrix4x4ValueType::times(const QMatrix4x4 &m) const
{
return v * m;
@@ -579,38 +518,6 @@ bool QQuickMatrix4x4ValueType::fuzzyEquals(const QMatrix4x4 &m) const
return qFuzzyCompare(v, m);
}
-QString QQuickMatrix4x4ValueType::toString() const
-{
- return QString(QLatin1String("QMatrix4x4(%1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16)"))
- .arg(v(0, 0)).arg(v(0, 1)).arg(v(0, 2)).arg(v(0, 3))
- .arg(v(1, 0)).arg(v(1, 1)).arg(v(1, 2)).arg(v(1, 3))
- .arg(v(2, 0)).arg(v(2, 1)).arg(v(2, 2)).arg(v(2, 3))
- .arg(v(3, 0)).arg(v(3, 1)).arg(v(3, 2)).arg(v(3, 3));
-}
-
-bool QQuickMatrix4x4ValueType::isEqual(const QVariant &other) const
-{
- if (other.userType() != qMetaTypeId<QMatrix4x4>())
- return false;
-
- QMatrix4x4 otherMatrix = other.value<QMatrix4x4>();
- return (v == otherMatrix);
-
-}
-
-QQuickFontValueType::QQuickFontValueType(QObject *parent)
- : QQmlValueTypeBase<QFont>(QMetaType::QFont, parent),
- pixelSizeSet(false),
- pointSizeSet(false)
-{
-}
-
-void QQuickFontValueType::onLoad()
-{
- pixelSizeSet = false;
- pointSizeSet = false;
-}
-
QString QQuickFontValueType::toString() const
{
return QString(QLatin1String("QFont(%1)")).arg(v.toString());
@@ -689,34 +596,27 @@ void QQuickFontValueType::setStrikeout(bool b)
qreal QQuickFontValueType::pointSize() const
{
if (v.pointSizeF() == -1) {
- if (dpi.isNull)
- dpi = qt_defaultDpi();
- return v.pixelSize() * qreal(72.) / qreal(dpi);
+ return v.pixelSize() * qreal(72.) / qreal(qt_defaultDpi());
}
return v.pointSizeF();
}
void QQuickFontValueType::setPointSize(qreal size)
{
- if (pixelSizeSet) {
+ if ((v.resolve() & QFont::SizeResolved) && v.pixelSize() != -1) {
qWarning() << "Both point size and pixel size set. Using pixel size.";
return;
}
if (size >= 0.0) {
- pointSizeSet = true;
v.setPointSizeF(size);
- } else {
- pointSizeSet = false;
}
}
int QQuickFontValueType::pixelSize() const
{
if (v.pixelSize() == -1) {
- if (dpi.isNull)
- dpi = qt_defaultDpi();
- return (v.pointSizeF() * dpi) / qreal(72.);
+ return (v.pointSizeF() * qt_defaultDpi()) / qreal(72.);
}
return v.pixelSize();
}
@@ -724,12 +624,9 @@ int QQuickFontValueType::pixelSize() const
void QQuickFontValueType::setPixelSize(int size)
{
if (size >0) {
- if (pointSizeSet)
+ if ((v.resolve() & QFont::SizeResolved) && v.pointSizeF() != -1)
qWarning() << "Both point size and pixel size set. Using pixel size.";
v.setPixelSize(size);
- pixelSizeSet = true;
- } else {
- pixelSizeSet = false;
}
}
diff --git a/src/quick/util/qquickvaluetypes_p.h b/src/quick/util/qquickvaluetypes_p.h
index d6546fba36..f62306ed01 100644
--- a/src/quick/util/qquickvaluetypes_p.h
+++ b/src/quick/util/qquickvaluetypes_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -54,17 +54,16 @@ void registerValueTypes();
}
-class Q_AUTOTEST_EXPORT QQuickColorValueType : public QQmlValueTypeBase<QColor>
+class QQuickColorValueType
{
+ QColor v;
Q_PROPERTY(qreal r READ r WRITE setR FINAL)
Q_PROPERTY(qreal g READ g WRITE setG FINAL)
Q_PROPERTY(qreal b READ b WRITE setB FINAL)
Q_PROPERTY(qreal a READ a WRITE setA FINAL)
- Q_OBJECT
+ Q_GADGET
public:
- QQuickColorValueType(QObject *parent = 0);
-
- virtual QString toString() const;
+ Q_INVOKABLE QString toString() const;
qreal r() const;
qreal g() const;
@@ -76,16 +75,14 @@ public:
void setA(qreal);
};
-class Q_AUTOTEST_EXPORT QQuickVector2DValueType : public QQmlValueTypeBase<QVector2D>
+class QQuickVector2DValueType
{
+ QVector2D v;
Q_PROPERTY(qreal x READ x WRITE setX FINAL)
Q_PROPERTY(qreal y READ y WRITE setY FINAL)
- Q_OBJECT
+ Q_GADGET
public:
- QQuickVector2DValueType(QObject *parent = 0);
-
- virtual QString toString() const;
- virtual bool isEqual(const QVariant &other) const;
+ Q_INVOKABLE QString toString() const;
qreal x() const;
qreal y() const;
@@ -105,17 +102,15 @@ public:
Q_INVOKABLE bool fuzzyEquals(const QVector2D &vec) const;
};
-class Q_AUTOTEST_EXPORT QQuickVector3DValueType : public QQmlValueTypeBase<QVector3D>
+class QQuickVector3DValueType
{
+ QVector3D v;
Q_PROPERTY(qreal x READ x WRITE setX FINAL)
Q_PROPERTY(qreal y READ y WRITE setY FINAL)
Q_PROPERTY(qreal z READ z WRITE setZ FINAL)
- Q_OBJECT
+ Q_GADGET
public:
- QQuickVector3DValueType(QObject *parent = 0);
-
- virtual QString toString() const;
- virtual bool isEqual(const QVariant &other) const;
+ Q_INVOKABLE QString toString() const;
qreal x() const;
qreal y() const;
@@ -139,18 +134,16 @@ public:
Q_INVOKABLE bool fuzzyEquals(const QVector3D &vec) const;
};
-class Q_AUTOTEST_EXPORT QQuickVector4DValueType : public QQmlValueTypeBase<QVector4D>
+class QQuickVector4DValueType
{
+ QVector4D v;
Q_PROPERTY(qreal x READ x WRITE setX FINAL)
Q_PROPERTY(qreal y READ y WRITE setY FINAL)
Q_PROPERTY(qreal z READ z WRITE setZ FINAL)
Q_PROPERTY(qreal w READ w WRITE setW FINAL)
- Q_OBJECT
+ Q_GADGET
public:
- QQuickVector4DValueType(QObject *parent = 0);
-
- virtual QString toString() const;
- virtual bool isEqual(const QVariant &other) const;
+ Q_INVOKABLE QString toString() const;
qreal x() const;
qreal y() const;
@@ -175,17 +168,16 @@ public:
Q_INVOKABLE bool fuzzyEquals(const QVector4D &vec) const;
};
-class Q_AUTOTEST_EXPORT QQuickQuaternionValueType : public QQmlValueTypeBase<QQuaternion>
+class QQuickQuaternionValueType
{
+ QQuaternion v;
Q_PROPERTY(qreal scalar READ scalar WRITE setScalar)
Q_PROPERTY(qreal x READ x WRITE setX)
Q_PROPERTY(qreal y READ y WRITE setY)
Q_PROPERTY(qreal z READ z WRITE setZ)
- Q_OBJECT
+ Q_GADGET
public:
- QQuickQuaternionValueType(QObject *parent = 0);
-
- virtual QString toString() const;
+ Q_INVOKABLE QString toString() const;
qreal scalar() const;
qreal x() const;
@@ -197,8 +189,9 @@ public:
void setZ(qreal);
};
-class Q_AUTOTEST_EXPORT QQuickMatrix4x4ValueType : public QQmlValueTypeBase<QMatrix4x4>
+class QQuickMatrix4x4ValueType
{
+ QMatrix4x4 v;
Q_PROPERTY(qreal m11 READ m11 WRITE setM11 FINAL)
Q_PROPERTY(qreal m12 READ m12 WRITE setM12 FINAL)
Q_PROPERTY(qreal m13 READ m13 WRITE setM13 FINAL)
@@ -215,13 +208,8 @@ class Q_AUTOTEST_EXPORT QQuickMatrix4x4ValueType : public QQmlValueTypeBase<QMat
Q_PROPERTY(qreal m42 READ m42 WRITE setM42 FINAL)
Q_PROPERTY(qreal m43 READ m43 WRITE setM43 FINAL)
Q_PROPERTY(qreal m44 READ m44 WRITE setM44 FINAL)
- Q_OBJECT
+ Q_GADGET
public:
- QQuickMatrix4x4ValueType(QObject *parent = 0);
-
- virtual QString toString() const;
- virtual bool isEqual(const QVariant &other) const;
-
qreal m11() const { return v(0, 0); }
qreal m12() const { return v(0, 1); }
qreal m13() const { return v(0, 2); }
@@ -274,9 +262,10 @@ public:
Q_INVOKABLE bool fuzzyEquals(const QMatrix4x4 &m) const;
};
-class Q_AUTOTEST_EXPORT QQuickFontValueType : public QQmlValueTypeBase<QFont>
+class QQuickFontValueType
{
- Q_OBJECT
+ QFont v;
+ Q_GADGET
Q_ENUMS(FontWeight)
Q_ENUMS(Capitalization)
@@ -294,20 +283,22 @@ class Q_AUTOTEST_EXPORT QQuickFontValueType : public QQmlValueTypeBase<QFont>
Q_PROPERTY(qreal wordSpacing READ wordSpacing WRITE setWordSpacing FINAL)
public:
- enum FontWeight { Light = QFont::Light,
- Normal = QFont::Normal,
- DemiBold = QFont::DemiBold,
- Bold = QFont::Bold,
- Black = QFont::Black };
+ enum FontWeight { Thin = QFont::Thin,
+ ExtraLight = QFont::ExtraLight,
+ Light = QFont::Light,
+ Normal = QFont::Normal,
+ Medium = QFont::Medium,
+ DemiBold = QFont::DemiBold,
+ Bold = QFont::Bold,
+ ExtraBold = QFont::ExtraBold,
+ Black = QFont::Black };
enum Capitalization { MixedCase = QFont::MixedCase,
AllUppercase = QFont::AllUppercase,
AllLowercase = QFont::AllLowercase,
SmallCaps = QFont::SmallCaps,
Capitalize = QFont::Capitalize };
- QQuickFontValueType(QObject *parent = 0);
-
- virtual QString toString() const;
+ Q_INVOKABLE QString toString() const;
QString family() const;
void setFamily(const QString &);
@@ -344,13 +335,6 @@ public:
qreal wordSpacing() const;
void setWordSpacing(qreal spacing);
-
- void onLoad();
-
-private:
- bool pixelSizeSet;
- bool pointSizeSet;
- mutable QQmlNullableValue<int> dpi;
};
QT_END_NAMESPACE
diff --git a/src/quick/util/util.pri b/src/quick/util/util.pri
index 76cf1996bc..0e0df4e751 100644
--- a/src/quick/util/util.pri
+++ b/src/quick/util/util.pri
@@ -28,7 +28,8 @@ SOURCES += \
$$PWD/qquickanimatorcontroller.cpp \
$$PWD/qquickprofiler.cpp \
$$PWD/qquickfontmetrics.cpp \
- $$PWD/qquicktextmetrics.cpp
+ $$PWD/qquicktextmetrics.cpp \
+ $$PWD/qquickshortcut.cpp
HEADERS += \
$$PWD/qquickapplication_p.h\
@@ -64,4 +65,5 @@ HEADERS += \
$$PWD/qquickanimatorcontroller_p.h \
$$PWD/qquickprofiler_p.h \
$$PWD/qquickfontmetrics_p.h \
- $$PWD/qquicktextmetrics_p.h
+ $$PWD/qquicktextmetrics_p.h \
+ $$PWD/qquickshortcut_p.h
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp
index 6143e4ef0d..a848774ae9 100644
--- a/src/quickwidgets/qquickwidget.cpp
+++ b/src/quickwidgets/qquickwidget.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -202,7 +202,12 @@ void QQuickWidgetPrivate::itemGeometryChanged(QQuickItem *resizeItem, const QRec
void QQuickWidgetPrivate::render(bool needsSync)
{
- context->makeCurrent(offscreenSurface);
+ if (!context->makeCurrent(offscreenSurface)) {
+ qWarning("QQuickWidget: Cannot render due to failing makeCurrent()");
+ return;
+ }
+
+ QOpenGLContextPrivate::get(context)->defaultFboRedirect = fbo->handle();
if (needsSync) {
renderControl->polishItems();
@@ -210,12 +215,15 @@ void QQuickWidgetPrivate::render(bool needsSync)
}
renderControl->render();
- context->functions()->glFlush();
if (resolvedFbo) {
QRect rect(QPoint(0, 0), fbo->size());
QOpenGLFramebufferObject::blitFramebuffer(resolvedFbo, rect, fbo, rect);
}
+
+ static_cast<QOpenGLExtensions *>(context->functions())->flushShared();
+
+ QOpenGLContextPrivate::get(context)->defaultFboRedirect = 0;
}
void QQuickWidgetPrivate::renderSceneGraph()
@@ -622,6 +630,22 @@ void QQuickWidgetPrivate::updateSize()
}
}
+/*!
+ \internal
+
+ Update the position of the offscreen window, so it matches the position of the QQuickWidget.
+ */
+void QQuickWidgetPrivate::updatePosition()
+{
+ Q_Q(QQuickWidget);
+ if (offscreenWindow == 0)
+ return;
+
+ const QPoint &pos = q->mapToGlobal(QPoint(0, 0));
+ if (offscreenWindow->position() != pos)
+ offscreenWindow->setPosition(pos);
+}
+
QSize QQuickWidgetPrivate::rootObjectSize() const
{
QSize rootObjectSize(0,0);
@@ -674,8 +698,10 @@ void QQuickWidgetPrivate::createContext()
context = new QOpenGLContext;
context->setFormat(offscreenWindow->requestedFormat());
- if (qt_gl_global_share_context())
+ if (qt_gl_global_share_context()) {
context->setShareContext(qt_gl_global_share_context());
+ context->setScreen(context->shareContext()->screen());
+ }
if (!context->create()) {
const bool isEs = context->isOpenGLES();
@@ -690,6 +716,7 @@ void QQuickWidgetPrivate::createContext()
// contains a QSurfaceFormat representing the _actual_ format of the underlying
// configuration. This is essential to get a surface that is compatible with the context.
offscreenSurface->setFormat(context->format());
+ offscreenSurface->setScreen(context->screen());
offscreenSurface->create();
}
@@ -725,7 +752,14 @@ void QQuickWidget::createFramebufferObject()
if (context->shareContext() != QWidgetPrivate::get(window())->shareContext()) {
context->setShareContext(QWidgetPrivate::get(window())->shareContext());
- context->create();
+ context->setScreen(context->shareContext()->screen());
+ if (!context->create())
+ qWarning("QQuickWidget: Failed to recreate context");
+ // The screen may be different so we must recreate the offscreen surface too.
+ // Unlike QOpenGLContext, QOffscreenSurface's create() does not recreate so have to destroy() first.
+ d->offscreenSurface->destroy();
+ d->offscreenSurface->setScreen(context->screen());
+ d->offscreenSurface->create();
}
context->makeCurrent(d->offscreenSurface);
@@ -738,6 +772,16 @@ void QQuickWidget::createFramebufferObject()
format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
format.setSamples(samples);
+ // The default framebuffer for normal windows have sRGB support on OS X which leads to the Qt Quick text item
+ // utilizing sRGB blending. To get identical results with QQuickWidget we have to have our framebuffer backed
+ // by an sRGB texture.
+#ifdef Q_OS_OSX
+ if (context->hasExtension("GL_ARB_framebuffer_sRGB")
+ && context->hasExtension("GL_EXT_texture_sRGB")
+ && context->hasExtension("GL_EXT_texture_sRGB_decode"))
+ format.setInternalTextureFormat(GL_SRGB8_ALPHA8_EXT);
+#endif
+
const QSize fboSize = size() * devicePixelRatio();
// Could be a simple hide - show, in which case the previous fbo is just fine.
@@ -746,7 +790,22 @@ void QQuickWidget::createFramebufferObject()
d->fbo = new QOpenGLFramebufferObject(fboSize, format);
}
- d->offscreenWindow->setGeometry(0, 0, width(), height());
+ // When compositing in the backingstore, sampling the sRGB texture would perform an
+ // sRGB-linear conversion which is not what we want when the final framebuffer (the window's)
+ // is sRGB too. Disable the conversion.
+#ifdef Q_OS_OSX
+ if (format.internalTextureFormat() == GL_SRGB8_ALPHA8_EXT) {
+ QOpenGLFunctions *funcs = context->functions();
+ funcs->glBindTexture(GL_TEXTURE_2D, d->fbo->texture());
+ funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT);
+ }
+#endif
+
+ // Even though this is just an offscreen window we should set the position on it, as it might be
+ // useful for an item to know the actual position of the scene.
+ // Note: The position will be update when we get a move event (see: updatePosition()).
+ const QPoint &globalPos = mapToGlobal(QPoint(0, 0));
+ d->offscreenWindow->setGeometry(globalPos.x(), globalPos.y(), width(), height());
d->offscreenWindow->setRenderTarget(d->fbo);
if (samples > 0)
@@ -1013,7 +1072,7 @@ void QQuickWidget::showEvent(QShowEvent *)
Q_D(QQuickWidget);
d->updatePending = false;
d->createContext();
- triggerUpdate();
+ d->render(true);
}
/*! \reimp */
@@ -1076,21 +1135,6 @@ bool QQuickWidget::event(QEvent *e)
Q_D(QQuickWidget);
switch (e->type()) {
-#ifndef QT_NO_DRAGANDDROP
- case QEvent::Drop:
- case QEvent::DragMove:
- case QEvent::DragLeave:
- // Drag/drop events only have local pos, so no need to map,
- // but QQuickWindow::event() does not return true
- d->offscreenWindow->event(e);
- return e->isAccepted();
- case QEvent::DragEnter:
- // Don't reject drag events for the entire widget when one
- // item rejects the drag enter
- d->offscreenWindow->event(e);
- e->accept();
- return true;
-#endif
case QEvent::InputMethod:
case QEvent::InputMethodQuery:
@@ -1114,6 +1158,10 @@ bool QQuickWidget::event(QEvent *e)
}
break;
+ case QEvent::Move:
+ d->updatePosition();
+ break;
+
default:
break;
}
@@ -1121,6 +1169,42 @@ bool QQuickWidget::event(QEvent *e)
return QWidget::event(e);
}
+#ifndef QT_NO_DRAGANDDROP
+
+/*! \reimp */
+void QQuickWidget::dragEnterEvent(QDragEnterEvent *e)
+{
+ Q_D(QQuickWidget);
+ // Don't reject drag events for the entire widget when one
+ // item rejects the drag enter
+ d->offscreenWindow->event(e);
+ e->accept();
+}
+
+/*! \reimp */
+void QQuickWidget::dragMoveEvent(QDragMoveEvent *e)
+{
+ Q_D(QQuickWidget);
+ // Drag/drop events only have local pos, so no need to map,
+ // but QQuickWindow::event() does not return true
+ d->offscreenWindow->event(e);
+}
+
+/*! \reimp */
+void QQuickWidget::dragLeaveEvent(QDragLeaveEvent *e)
+{
+ Q_D(QQuickWidget);
+ d->offscreenWindow->event(e);
+}
+
+/*! \reimp */
+void QQuickWidget::dropEvent(QDropEvent *e)
+{
+ Q_D(QQuickWidget);
+ d->offscreenWindow->event(e);
+}
+
+#endif // QT_NO_DRAGANDDROP
// TODO: try to separate the two cases of
// 1. render() unconditionally without sync
@@ -1196,4 +1280,23 @@ void QQuickWidget::setClearColor(const QColor &color)
d->offscreenWindow->setColor(color);
}
+/*!
+ \since 5.5
+
+ Returns the offscreen QQuickWindow which is used by this widget to drive
+ the Qt Quick rendering. This is useful if you want to use QQuickWindow
+ APIs that are not currently exposed by QQuickWidget, for instance
+ connecting to the QQuickWindow::beforeRendering() signal in order
+ to draw native OpenGL content below Qt Quick's own rendering.
+
+ \warning Use the return value of this function with caution. In
+ particular, do not ever attempt to show the QQuickWindow, and be
+ very careful when using other QWindow-only APIs.
+*/
+QQuickWindow *QQuickWidget::quickWindow() const
+{
+ Q_D(const QQuickWidget);
+ return d->offscreenWindow;
+}
+
QT_END_NAMESPACE
diff --git a/src/quickwidgets/qquickwidget.h b/src/quickwidgets/qquickwidget.h
index 530a523470..a8bf03edfb 100644
--- a/src/quickwidgets/qquickwidget.h
+++ b/src/quickwidgets/qquickwidget.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -90,6 +90,8 @@ public:
void setClearColor(const QColor &color);
+ QQuickWindow *quickWindow() const;
+
public Q_SLOTS:
void setSource(const QUrl&);
void setContent(const QUrl& url, QQmlComponent *component, QObject *item);
@@ -99,6 +101,7 @@ Q_SIGNALS:
void sceneGraphError(QQuickWindow::SceneGraphError error, const QString &message);
private Q_SLOTS:
+ // ### Qt 6: make these truly private slots through Q_PRIVATE_SLOT
void continueExecute();
void createFramebufferObject();
void destroyFramebufferObject();
@@ -125,6 +128,13 @@ protected:
virtual void wheelEvent(QWheelEvent *);
#endif
+#ifndef QT_NO_DRAGANDDROP
+ virtual void dragEnterEvent(QDragEnterEvent *);
+ virtual void dragMoveEvent(QDragMoveEvent *);
+ virtual void dragLeaveEvent(QDragLeaveEvent *);
+ virtual void dropEvent(QDropEvent *);
+#endif
+
bool event(QEvent *);
private:
diff --git a/src/quickwidgets/qquickwidget_p.h b/src/quickwidgets/qquickwidget_p.h
index c058a08b1d..dd0da96c3d 100644
--- a/src/quickwidgets/qquickwidget_p.h
+++ b/src/quickwidgets/qquickwidget_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -73,6 +73,7 @@ public:
void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry);
void initResize();
void updateSize();
+ void updatePosition();
void updateFrambufferObjectSize();
void setRootObject(QObject *);
void render(bool needsSync);
diff --git a/src/quickwidgets/qtquickwidgetsglobal.h b/src/quickwidgets/qtquickwidgetsglobal.h
index f0b1caeb1b..60e5105ab8 100644
--- a/src/quickwidgets/qtquickwidgetsglobal.h
+++ b/src/quickwidgets/qtquickwidgetsglobal.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$