From b828609440a4771838c242b3ad9962ecd7a2fe99 Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Fri, 20 Dec 2019 12:41:04 +0100 Subject: Remove deprecated classes and functions Mostly old messaging API Change-Id: I17eb2206b2ede56d2f7d36375d5e711d6149019f Reviewed-by: Paul Lemire --- src/animation/backend/animationutils_p.h | 1 - src/animation/backend/backendnode_p.h | 1 + src/animation/backend/channelmapping.cpp | 1 - src/animation/backend/clipblendnode.cpp | 6 - src/animation/backend/clipblendnode_p.h | 9 +- src/animation/backend/clipblendvalue.cpp | 1 - src/animation/backend/nodefunctor_p.h | 4 +- src/animation/frontend/frontend.pri | 8 - src/animation/frontend/qabstractanimationclip.cpp | 5 - src/animation/frontend/qabstractanimationclip.h | 3 +- src/animation/frontend/qabstractchannelmapping.cpp | 2 +- src/animation/frontend/qabstractchannelmapping_p.h | 9 +- src/animation/frontend/qabstractclipanimator.cpp | 5 - src/animation/frontend/qabstractclipanimator.h | 2 - src/animation/frontend/qadditiveclipblend.cpp | 12 - src/animation/frontend/qadditiveclipblend.h | 1 - src/animation/frontend/qanimationaspect.cpp | 20 +- .../frontend/qanimationcallbacktrigger.cpp | 54 -- .../frontend/qanimationcallbacktrigger_p.h | 85 --- src/animation/frontend/qanimationclip.cpp | 9 - src/animation/frontend/qanimationclip.h | 1 - src/animation/frontend/qanimationcliploader.cpp | 14 - src/animation/frontend/qanimationcliploader.h | 3 - src/animation/frontend/qblendedclipanimator.cpp | 15 - src/animation/frontend/qblendedclipanimator.h | 1 - src/animation/frontend/qcallbackmapping.cpp | 16 +- src/animation/frontend/qcallbackmapping.h | 1 - src/animation/frontend/qchannelmapper.cpp | 14 +- src/animation/frontend/qchannelmapper.h | 1 - src/animation/frontend/qchannelmapping.cpp | 17 +- src/animation/frontend/qchannelmapping.h | 1 - .../frontend/qchannelmappingcreatedchange.cpp | 75 -- .../frontend/qchannelmappingcreatedchange_p.h | 101 --- .../frontend/qchannelmappingcreatedchange_p_p.h | 72 -- src/animation/frontend/qclipanimator.cpp | 15 - src/animation/frontend/qclipanimator.h | 1 - .../frontend/qclipblendnodecreatedchange.cpp | 73 -- .../frontend/qclipblendnodecreatedchange.h | 83 --- .../frontend/qclipblendnodecreatedchange_p.h | 69 -- src/animation/frontend/qclipblendvalue.cpp | 10 - src/animation/frontend/qclipblendvalue.h | 1 - src/animation/frontend/qclock.cpp | 9 - src/animation/frontend/qclock.h | 1 - src/animation/frontend/qlerpclipblend.cpp | 12 - src/animation/frontend/qlerpclipblend.h | 1 - src/animation/frontend/qskeletonmapping.cpp | 13 +- src/animation/frontend/qskeletonmapping.h | 1 - src/core/aspects/qabstractaspect.cpp | 238 +----- src/core/aspects/qabstractaspect.h | 11 - src/core/aspects/qabstractaspect_p.h | 15 +- src/core/aspects/qaspectengine.cpp | 16 - src/core/aspects/qaspectengine_p.h | 3 - src/core/aspects/qaspectfactory.cpp | 9 - src/core/aspects/qaspectmanager.cpp | 13 +- src/core/aspects/qaspectmanager_p.h | 2 +- src/core/changes/changes.pri | 63 -- src/core/changes/qcomponentaddedchange.cpp | 131 ---- src/core/changes/qcomponentaddedchange.h | 76 -- src/core/changes/qcomponentaddedchange_p.h | 83 --- src/core/changes/qcomponentremovedchange.cpp | 132 ---- src/core/changes/qcomponentremovedchange.h | 76 -- src/core/changes/qcomponentremovedchange_p.h | 83 --- src/core/changes/qdynamicpropertyupdatedchange.cpp | 128 ---- src/core/changes/qdynamicpropertyupdatedchange.h | 74 -- src/core/changes/qdynamicpropertyupdatedchange_p.h | 83 --- src/core/changes/qnodecommand.cpp | 162 ----- src/core/changes/qnodecommand.h | 85 --- src/core/changes/qnodecommand_p.h | 76 -- src/core/changes/qnodecreatedchange.cpp | 133 ---- src/core/changes/qnodecreatedchange.h | 93 --- src/core/changes/qnodecreatedchange_p.h | 78 -- src/core/changes/qnodedestroyedchange.cpp | 85 --- src/core/changes/qnodedestroyedchange.h | 68 -- src/core/changes/qnodedestroyedchange_p.h | 71 -- src/core/changes/qpropertynodeaddedchange.cpp | 116 --- src/core/changes/qpropertynodeaddedchange.h | 72 -- src/core/changes/qpropertynodeaddedchange_p.h | 78 -- src/core/changes/qpropertynoderemovedchange.cpp | 108 --- src/core/changes/qpropertynoderemovedchange.h | 72 -- src/core/changes/qpropertynoderemovedchange_p.h | 79 -- src/core/changes/qpropertyupdatedchange.cpp | 113 --- src/core/changes/qpropertyupdatedchange.h | 71 -- src/core/changes/qpropertyupdatedchange_p.h | 79 -- src/core/changes/qpropertyupdatedchangebase.cpp | 103 --- src/core/changes/qpropertyupdatedchangebase.h | 70 -- src/core/changes/qpropertyupdatedchangebase_p.h | 85 --- src/core/changes/qpropertyvalueaddedchange.cpp | 101 --- src/core/changes/qpropertyvalueaddedchange.h | 72 -- src/core/changes/qpropertyvalueaddedchange_p.h | 80 -- src/core/changes/qpropertyvalueaddedchangebase.cpp | 99 --- src/core/changes/qpropertyvalueaddedchangebase.h | 70 -- src/core/changes/qpropertyvalueaddedchangebase_p.h | 77 -- src/core/changes/qpropertyvalueremovedchange.cpp | 102 --- src/core/changes/qpropertyvalueremovedchange.h | 72 -- src/core/changes/qpropertyvalueremovedchange_p.h | 80 -- .../changes/qpropertyvalueremovedchangebase.cpp | 99 --- src/core/changes/qpropertyvalueremovedchangebase.h | 70 -- .../changes/qpropertyvalueremovedchangebase_p.h | 77 -- src/core/changes/qscenechange.cpp | 169 ----- src/core/changes/qscenechange.h | 117 --- src/core/changes/qscenechange_p.h | 98 --- src/core/changes/qskeletoncreatedchange.cpp | 77 -- src/core/changes/qskeletoncreatedchange_p.h | 102 --- src/core/changes/qskeletoncreatedchange_p_p.h | 72 -- .../changes/qstaticpropertyupdatedchangebase.cpp | 114 --- .../changes/qstaticpropertyupdatedchangebase.h | 71 -- .../changes/qstaticpropertyupdatedchangebase_p.h | 80 -- .../qstaticpropertyvalueaddedchangebase.cpp | 101 --- .../changes/qstaticpropertyvalueaddedchangebase.h | 71 -- .../qstaticpropertyvalueaddedchangebase_p.h | 78 -- .../qstaticpropertyvalueremovedchangebase.cpp | 100 --- .../qstaticpropertyvalueremovedchangebase.h | 71 -- .../qstaticpropertyvalueremovedchangebase_p.h | 78 -- src/core/changes/qtypedpropertyupdatechange_p.h | 84 --- src/core/core.pri | 11 +- src/core/core.pro | 1 - src/core/nodes/nodes.pri | 4 +- src/core/nodes/qbackendnode.cpp | 94 +-- src/core/nodes/qbackendnode.h | 12 +- src/core/nodes/qbackendnode_p.h | 10 - src/core/nodes/qentity.cpp | 43 +- src/core/nodes/qentity.h | 2 - src/core/nodes/qentity_p.h | 2 + src/core/nodes/qnode.cpp | 169 +---- src/core/nodes/qnode.h | 12 - src/core/nodes/qnode_p.h | 12 +- src/core/nodes/qnodecreatedchangegenerator.cpp | 53 -- src/core/nodes/qnodecreatedchangegenerator_p.h | 97 --- src/core/qchangearbiter.cpp | 251 +------ src/core/qchangearbiter_p.h | 96 +-- src/core/qlockableobserverinterface.cpp | 52 -- src/core/qlockableobserverinterface_p.h | 77 -- src/core/qobservableinterface.cpp | 52 -- src/core/qobservableinterface_p.h | 79 -- src/core/qobserverinterface.cpp | 52 -- src/core/qobserverinterface_p.h | 73 -- src/core/qpostman.cpp | 173 ----- src/core/qpostman_p.h | 101 --- src/core/qpostman_p_p.h | 85 --- src/core/qscene.cpp | 55 +- src/core/qscene_p.h | 13 +- src/core/transforms/qabstractskeleton.cpp | 9 +- src/core/transforms/qabstractskeleton.h | 2 - src/core/transforms/qabstractskeleton_p.h | 9 +- src/core/transforms/qarmature.cpp | 10 - src/core/transforms/qarmature.h | 1 - src/core/transforms/qjoint.cpp | 21 +- src/core/transforms/qjoint.h | 1 - src/core/transforms/qskeleton.cpp | 13 +- src/core/transforms/qskeleton.h | 1 - src/core/transforms/qskeletonloader.cpp | 21 +- src/core/transforms/qskeletonloader.h | 2 - src/core/transforms/qskeletonloader_p.h | 4 - src/core/transforms/qtransform.cpp | 39 +- src/core/transforms/qtransform.h | 3 - src/input/backend/backendnode_p.h | 1 + src/input/backend/genericdevicebackendnode.cpp | 6 +- src/input/backend/genericdevicebackendnode_p.h | 2 +- src/input/backend/inputbackendnodefunctor_p.h | 4 +- src/input/backend/inputsettings.cpp | 4 +- src/input/backend/inputsettings_p.h | 2 +- src/input/backend/keyboarddevice.cpp | 6 +- src/input/backend/keyboarddevice_p.h | 2 +- src/input/backend/keyboardhandler.cpp | 4 +- src/input/backend/keyboardhandler_p.h | 2 +- src/input/backend/logicaldevice.cpp | 4 +- src/input/backend/logicaldevice_p.h | 2 +- src/input/backend/mousedevice.cpp | 6 +- src/input/backend/mousedevice_p.h | 2 +- src/input/backend/mousehandler.cpp | 4 +- src/input/backend/mousehandler_p.h | 2 +- src/input/backend/physicaldeviceproxy.cpp | 4 +- src/input/backend/physicaldeviceproxy_p.h | 2 +- .../backend/qabstractphysicaldevicebackendnode.cpp | 1 - src/input/frontend/frontend.pri | 3 - src/input/frontend/qabstractaxisinput.cpp | 1 - src/input/frontend/qabstractphysicaldevice.cpp | 14 +- src/input/frontend/qabstractphysicaldevice.h | 1 - .../frontend/qabstractphysicaldeviceproxy.cpp | 16 - .../frontend/qabstractphysicaldeviceproxy_p.h | 1 - src/input/frontend/qaction.cpp | 18 +- src/input/frontend/qaction.h | 5 - src/input/frontend/qactioninput.cpp | 13 - src/input/frontend/qactioninput.h | 1 - src/input/frontend/qanalogaxisinput.cpp | 12 - src/input/frontend/qanalogaxisinput.h | 1 - src/input/frontend/qaxis.cpp | 18 +- src/input/frontend/qaxis.h | 5 - src/input/frontend/qaxisaccumulator.cpp | 18 - src/input/frontend/qaxisaccumulator.h | 5 - src/input/frontend/qaxissetting.cpp | 15 - src/input/frontend/qaxissetting.h | 1 - src/input/frontend/qbuttonaxisinput.cpp | 15 - src/input/frontend/qbuttonaxisinput.h | 1 - src/input/frontend/qinputaspect.cpp | 36 +- src/input/frontend/qinputchord.cpp | 17 +- src/input/frontend/qinputchord.h | 1 - src/input/frontend/qinputsequence.cpp | 18 +- src/input/frontend/qinputsequence.h | 1 - src/input/frontend/qinputsettings.cpp | 13 - src/input/frontend/qinputsettings.h | 1 - src/input/frontend/qkeyboarddevice.cpp | 5 - src/input/frontend/qkeyboarddevice.h | 2 - src/input/frontend/qkeyboardhandler.cpp | 17 - src/input/frontend/qkeyboardhandler.h | 5 - src/input/frontend/qlogicaldevice.cpp | 18 +- src/input/frontend/qlogicaldevice.h | 1 - src/input/frontend/qmousedevice.cpp | 19 - src/input/frontend/qmousedevice.h | 4 - src/input/frontend/qmousehandler.cpp | 15 - src/input/frontend/qmousehandler.h | 3 - .../frontend/qphysicaldevicecreatedchange.cpp | 82 --- src/input/frontend/qphysicaldevicecreatedchange.h | 84 --- .../frontend/qphysicaldevicecreatedchange_p.h | 71 -- src/logic/handler.cpp | 16 +- src/logic/handler_p.h | 11 +- src/logic/manager.cpp | 6 +- src/logic/qlogicaspect.cpp | 8 +- src/logic/qlogicaspect_p.h | 3 + src/plugins/renderers/opengl/debug/debug.pri | 3 +- src/plugins/renderers/opengl/renderer/renderer.cpp | 20 +- src/plugins/renderers/opengl/renderer/renderer_p.h | 3 +- .../renderplugins/scene2d/scene2dplugin.cpp | 6 +- src/quick3d/quick3dscene2d/items/qscene2d.cpp | 18 +- src/quick3d/quick3dscene2d/items/qscene2d.h | 3 - src/quick3d/quick3dscene2d/items/scene2d.cpp | 10 - src/quick3d/quick3dscene2d/items/scene2d_p.h | 1 - src/render/backend/backendnode_p.h | 1 + src/render/backend/cameralens.cpp | 4 +- src/render/backend/cameralens_p.h | 2 +- src/render/backend/computecommand.cpp | 1 - src/render/backend/entity.cpp | 5 +- src/render/backend/entity_p.h | 3 +- src/render/backend/nodefunctor_p.h | 4 +- src/render/backend/rendersettings.cpp | 3 +- src/render/backend/rendersettings_p.h | 2 +- src/render/framegraph/framegraph.pri | 3 - src/render/framegraph/framegraphnode.cpp | 1 - src/render/framegraph/framegraphnode_p.h | 12 +- src/render/framegraph/qblitframebuffer.cpp | 21 - src/render/framegraph/qblitframebuffer.h | 1 - src/render/framegraph/qbuffercapture.cpp | 2 - src/render/framegraph/qcameraselector.cpp | 10 - src/render/framegraph/qcameraselector.h | 1 - src/render/framegraph/qclearbuffers.cpp | 14 - src/render/framegraph/qclearbuffers.h | 1 - src/render/framegraph/qdispatchcompute.cpp | 12 - src/render/framegraph/qdispatchcompute.h | 1 - src/render/framegraph/qframegraphnode.cpp | 10 - src/render/framegraph/qframegraphnode.h | 1 - .../framegraph/qframegraphnodecreatedchange.cpp | 78 -- .../framegraph/qframegraphnodecreatedchange.h | 84 --- .../framegraph/qframegraphnodecreatedchange_p.h | 82 --- src/render/framegraph/qlayerfilter.cpp | 15 +- src/render/framegraph/qlayerfilter.h | 1 - src/render/framegraph/qmemorybarrier.cpp | 11 - src/render/framegraph/qmemorybarrier.h | 1 - src/render/framegraph/qproximityfilter.cpp | 11 - src/render/framegraph/qproximityfilter.h | 1 - src/render/framegraph/qrendercapture.cpp | 64 -- src/render/framegraph/qrendercapture.h | 10 - src/render/framegraph/qrenderpassfilter.cpp | 19 +- src/render/framegraph/qrenderpassfilter.h | 1 - src/render/framegraph/qrenderstateset.cpp | 14 +- src/render/framegraph/qrenderstateset.h | 1 - src/render/framegraph/qrendersurfaceselector.cpp | 12 - src/render/framegraph/qrendersurfaceselector.h | 3 - src/render/framegraph/qrendertargetselector.cpp | 11 - src/render/framegraph/qrendertargetselector.h | 1 - src/render/framegraph/qsetfence.cpp | 22 - src/render/framegraph/qsetfence.h | 2 - src/render/framegraph/qsetfence_p.h | 3 +- src/render/framegraph/qsortpolicy.cpp | 12 - src/render/framegraph/qsortpolicy.h | 1 - src/render/framegraph/qsubtreeenabler.cpp | 10 - src/render/framegraph/qsubtreeenabler.h | 1 - src/render/framegraph/qtechniquefilter.cpp | 19 +- src/render/framegraph/qtechniquefilter.h | 1 - src/render/framegraph/qviewport.cpp | 12 - src/render/framegraph/qviewport.h | 1 - src/render/framegraph/qwaitfence.cpp | 13 - src/render/framegraph/qwaitfence.h | 1 - src/render/framegraph/rendercapture.cpp | 5 - src/render/framegraph/setfence.cpp | 19 - src/render/framegraph/setfence_p.h | 4 - src/render/framegraph/statesetnode.cpp | 1 + src/render/frontend/qcameralens.cpp | 14 - src/render/frontend/qcameralens.h | 2 - src/render/frontend/qcomputecommand.cpp | 13 - src/render/frontend/qcomputecommand.h | 1 - src/render/frontend/qlayer.cpp | 9 - src/render/frontend/qlayer.h | 1 - src/render/frontend/qlevelofdetail.cpp | 22 - src/render/frontend/qlevelofdetail.h | 3 - src/render/frontend/qlevelofdetailswitch.cpp | 5 - src/render/frontend/qlevelofdetailswitch.h | 2 - src/render/frontend/qrenderaspect.cpp | 122 ++-- src/render/frontend/qrenderplugin_p.h | 4 - src/render/frontend/qrendersettings.cpp | 14 - src/render/frontend/qrendersettings.h | 1 - src/render/frontend/qrendertarget.cpp | 12 +- src/render/frontend/qrendertarget.h | 1 - src/render/frontend/qrendertargetoutput.cpp | 13 - src/render/frontend/qrendertargetoutput.h | 1 - src/render/geometry/buffer.cpp | 5 +- src/render/geometry/buffer_p.h | 2 +- src/render/geometry/geometry.cpp | 22 - src/render/geometry/geometry_p.h | 3 - src/render/geometry/geometryrenderer.cpp | 6 +- src/render/geometry/geometryrenderer_p.h | 2 +- src/render/geometry/joint.cpp | 4 +- src/render/geometry/joint_p.h | 2 +- src/render/geometry/qattribute.cpp | 28 - src/render/geometry/qattribute.h | 3 - src/render/geometry/qbuffer.cpp | 22 - src/render/geometry/qbuffer.h | 5 - src/render/geometry/qgeometry.cpp | 51 +- src/render/geometry/qgeometry.h | 2 - src/render/geometry/qgeometry_p.h | 2 + src/render/geometry/qgeometryrenderer.cpp | 25 - src/render/geometry/qgeometryrenderer.h | 3 - src/render/geometry/qgeometryrenderer_p.h | 5 - src/render/geometry/qmesh.cpp | 6 - src/render/geometry/qmesh.h | 2 - src/render/geometry/skeleton.cpp | 5 +- src/render/geometry/skeleton_p.h | 2 +- src/render/io/qsceneloader.cpp | 20 - src/render/io/qsceneloader.h | 5 - src/render/io/scene.cpp | 4 +- src/render/io/scene_p.h | 2 +- src/render/jobs/calcboundingvolumejob.cpp | 30 +- src/render/jobs/calcboundingvolumejob_p.h | 2 + src/render/lights/light.cpp | 4 +- src/render/lights/light_p.h | 2 +- src/render/lights/qabstractlight.cpp | 8 - src/render/lights/qabstractlight.h | 1 - src/render/lights/qenvironmentlight.cpp | 9 - src/render/lights/qenvironmentlight.h | 1 - src/render/materialsystem/qeffect.cpp | 19 +- src/render/materialsystem/qeffect.h | 1 - src/render/materialsystem/qfilterkey.cpp | 10 - src/render/materialsystem/qfilterkey.h | 1 - src/render/materialsystem/qmaterial.cpp | 14 +- src/render/materialsystem/qmaterial.h | 1 - src/render/materialsystem/qparameter.cpp | 10 - src/render/materialsystem/qparameter.h | 1 - src/render/materialsystem/qrenderpass.cpp | 24 +- src/render/materialsystem/qrenderpass.h | 1 - src/render/materialsystem/qshaderdata.cpp | 32 - src/render/materialsystem/qshaderdata.h | 1 - src/render/materialsystem/qshaderimage.cpp | 15 - src/render/materialsystem/qshaderimage.h | 1 - src/render/materialsystem/qshaderprogram.cpp | 31 - src/render/materialsystem/qshaderprogram.h | 2 - .../materialsystem/qshaderprogrambuilder.cpp | 22 - src/render/materialsystem/qshaderprogrambuilder.h | 3 - src/render/materialsystem/qtechnique.cpp | 26 +- src/render/materialsystem/qtechnique.h | 1 - src/render/materialsystem/shader.cpp | 7 +- src/render/materialsystem/shader_p.h | 3 +- src/render/materialsystem/shaderbuilder.cpp | 2 - src/render/materialsystem/shaderdata.cpp | 6 +- src/render/materialsystem/shaderdata_p.h | 2 +- src/render/materialsystem/technique.cpp | 4 +- src/render/materialsystem/technique_p.h | 2 +- src/render/picking/qabstractraycaster.cpp | 40 +- src/render/picking/qabstractraycaster.h | 2 - src/render/picking/qobjectpicker.cpp | 16 - src/render/picking/qobjectpicker.h | 5 - src/render/renderstates/genericstate_p.h | 1 - src/render/renderstates/qalphatest.cpp | 11 - src/render/renderstates/qalphatest.h | 1 - src/render/renderstates/qblendequation.cpp | 9 - src/render/renderstates/qblendequation.h | 1 - .../renderstates/qblendequationarguments.cpp | 14 - src/render/renderstates/qblendequationarguments.h | 1 - src/render/renderstates/qclipplane.cpp | 12 - src/render/renderstates/qclipplane.h | 1 - src/render/renderstates/qcolormask.cpp | 13 - src/render/renderstates/qcolormask.h | 1 - src/render/renderstates/qcullface.cpp | 10 - src/render/renderstates/qcullface.h | 1 - src/render/renderstates/qdepthrange.cpp | 11 - src/render/renderstates/qdepthrange.h | 1 - src/render/renderstates/qdepthtest.cpp | 10 - src/render/renderstates/qdepthtest.h | 1 - src/render/renderstates/qfrontface.cpp | 10 - src/render/renderstates/qfrontface.h | 1 - src/render/renderstates/qlinewidth.cpp | 12 - src/render/renderstates/qlinewidth.h | 1 - src/render/renderstates/qpointsize.cpp | 11 - src/render/renderstates/qpointsize.h | 1 - src/render/renderstates/qpolygonoffset.cpp | 11 - src/render/renderstates/qpolygonoffset.h | 1 - src/render/renderstates/qrastermode.cpp | 11 - src/render/renderstates/qrastermode.h | 1 - src/render/renderstates/qrenderstate.cpp | 7 - src/render/renderstates/qrenderstate.h | 1 - .../renderstates/qrenderstatecreatedchange.cpp | 87 --- .../renderstates/qrenderstatecreatedchange_p.h | 94 --- src/render/renderstates/qscissortest.cpp | 13 - src/render/renderstates/qscissortest.h | 1 - src/render/renderstates/qstencilmask.cpp | 11 - src/render/renderstates/qstencilmask.h | 1 - src/render/renderstates/qstenciloperation.cpp | 8 - src/render/renderstates/qstenciloperation.h | 1 - src/render/renderstates/qstenciltest.cpp | 8 - src/render/renderstates/qstenciltest.h | 1 - src/render/renderstates/renderstatenode.cpp | 1 - src/render/renderstates/renderstates.pri | 2 - src/render/texture/qabstracttexture.cpp | 81 +-- src/render/texture/qabstracttexture.h | 2 - src/render/texture/qabstracttextureimage.cpp | 12 - src/render/texture/qabstracttextureimage.h | 1 - src/render/texture/qtextureimage.cpp | 13 - src/render/texture/qtextureimage.h | 2 +- src/render/texture/texture.cpp | 48 +- src/render/texture/texture_p.h | 4 +- src/render/texture/textureimage.cpp | 4 +- src/render/texture/textureimage_p.h | 2 +- .../animation/animationclip/tst_animationclip.cpp | 1 - .../animationutils/tst_animationutils.cpp | 2 +- .../tst_blendedclipanimator.cpp | 2 +- .../animation/channelmapper/tst_channelmapper.cpp | 2 +- .../channelmapping/tst_channelmapping.cpp | 2 +- .../animation/clipanimator/tst_clipanimator.cpp | 2 +- .../animation/clipblendnode/tst_clipblendnode.cpp | 4 +- tests/auto/animation/clock/tst_clock.cpp | 2 +- .../tst_findrunningclipanimatorsjob.cpp | 2 +- .../qadditiveclipblend/tst_qadditiveclipblend.cpp | 117 +-- .../tst_qanimationcliploader.cpp | 64 +- .../tst_qblendedclipanimator.cpp | 116 +-- .../qcallbackmapping/tst_qcallbackmapping.cpp | 83 +-- .../qchannelmapper/tst_qchannelmapper.cpp | 50 +- .../qchannelmapping/tst_qchannelmapping.cpp | 104 +-- .../animation/qclipanimator/tst_qclipanimator.cpp | 91 +-- .../qclipblendvalue/tst_qclipblendvalue.cpp | 66 +- tests/auto/animation/qclock/tst_qclock.cpp | 59 +- .../qlerpclipblend/tst_qlerpclipblend.cpp | 90 +-- .../qskeletonmapping/tst_qskeletonmapping.cpp | 67 +- tests/auto/animation/skeleton/tst_skeleton.cpp | 2 +- tests/auto/core/common/common.pri | 9 +- tests/auto/core/common/qbackendnodetester.cpp | 29 - tests/auto/core/common/qbackendnodetester.h | 6 - tests/auto/core/common/testarbiter.h | 64 ++ tests/auto/core/common/testpostmanarbiter.cpp | 113 --- tests/auto/core/common/testpostmanarbiter.h | 83 --- tests/auto/core/core.pro | 1 - tests/auto/core/nodes/tst_nodes.cpp | 726 ++++-------------- tests/auto/core/qarmature/tst_qarmature.cpp | 54 +- tests/auto/core/qchangearbiter/qchangearbiter.pro | 2 + .../core/qchangearbiter/tst_qchangearbiter.cpp | 810 +-------------------- tests/auto/core/qentity/tst_qentity.cpp | 83 --- tests/auto/core/qjoint/tst_qjoint.cpp | 101 +-- tests/auto/core/qpostman/qpostman.pro | 11 - tests/auto/core/qpostman/tst_qpostman.cpp | 93 --- tests/auto/core/qscene/tst_qscene.cpp | 138 +--- tests/auto/core/qskeleton/tst_qskeleton.cpp | 55 +- .../core/qskeletonloader/tst_qskeletonloader.cpp | 79 +- tests/auto/core/qtransform/tst_qtransform.cpp | 112 +-- tests/auto/coretest/coretest.pro | 6 - tests/auto/coretest/qbackendnodetester.cpp | 21 - tests/auto/coretest/qbackendnodetester_p.h | 3 - tests/auto/coretest/testpostmanarbiter.cpp | 97 --- tests/auto/coretest/testpostmanarbiter_p.h | 91 --- .../abstractaxisinput/tst_abstractaxisinput.cpp | 9 - tests/auto/input/action/tst_action.cpp | 7 +- tests/auto/input/axis/tst_axis.cpp | 7 +- .../input/axisaccumulator/tst_axisaccumulator.cpp | 5 +- .../axisaccumulatorjob/tst_axisaccumulatorjob.cpp | 2 +- tests/auto/input/commons/testdevice.h | 2 +- .../loadproxydevicejob/tst_loadproxydevicejob.cpp | 6 +- .../tst_physicaldeviceproxy.cpp | 2 +- .../qabstractaxisinput/tst_qabstractaxisinput.cpp | 10 +- .../tst_qabstractphysicaldevicebackendnode.cpp | 1 - .../tst_qabstractphysicaldeviceproxy.cpp | 54 -- tests/auto/input/qaction/tst_qaction.cpp | 64 +- tests/auto/input/qactioninput/tst_qactioninput.cpp | 57 +- .../qanalogaxisinput/tst_qanalogaxisinput.cpp | 55 +- tests/auto/input/qaxis/tst_qaxis.cpp | 64 +- .../qaxisaccumulator/tst_qaxisaccumulator.cpp | 91 +-- .../qbuttonaxisinput/tst_qbuttonaxisinput.cpp | 83 +-- .../qkeyboardhandler/tst_qkeyboardhandler.cpp | 56 +- .../input/qlogicaldevice/tst_qlogicaldevice.cpp | 88 +-- tests/auto/input/qmousedevice/tst_qmousedevice.cpp | 72 +- tests/auto/input/utils/tst_utils.cpp | 4 +- tests/auto/render/armature/tst_armature.cpp | 2 +- .../render/boundingsphere/tst_boundingsphere.cpp | 2 +- tests/auto/render/buffer/tst_buffer.cpp | 7 +- .../render/computecommand/tst_computecommand.cpp | 7 +- tests/auto/render/entity/tst_entity.cpp | 4 - .../render/framegraphnode/tst_framegraphnode.cpp | 1 - tests/auto/render/geometry/tst_geometry.cpp | 16 +- tests/auto/render/joint/tst_joint.cpp | 2 +- .../render/levelofdetail/tst_levelofdetail.cpp | 2 +- .../auto/render/loadscenejob/tst_loadscenejob.cpp | 8 +- .../auto/render/objectpicker/tst_objectpicker.cpp | 2 +- .../opengl/computecommand/tst_computecommand.cpp | 5 +- .../opengl/glshadermanager/tst_glshadermanager.cpp | 14 +- tests/auto/render/opengl/renderer/tst_renderer.cpp | 3 +- .../render/opengl/renderviews/tst_renderviews.cpp | 2 +- .../opengl/renderviewutils/tst_renderviewutils.cpp | 17 +- tests/auto/render/opengl/textures/tst_textures.cpp | 6 +- .../tst_pickboundingvolumejob.cpp | 13 +- tests/auto/render/picking/tst_picking.cpp | 6 - .../render/qabstractlight/tst_qabstractlight.cpp | 122 +--- .../qabstracttexture/tst_qabstracttexture.cpp | 441 ++--------- .../tst_qabstracttextureimage.cpp | 90 +-- tests/auto/render/qattribute/tst_qattribute.cpp | 137 +--- .../qblitframebuffer/tst_qblitframebuffer.cpp | 136 ++-- tests/auto/render/qbuffer/tst_qbuffer.cpp | 86 +-- tests/auto/render/qcamera/tst_qcamera.cpp | 1 - tests/auto/render/qcameralens/tst_qcameralens.cpp | 172 ++--- .../render/qcameraselector/tst_qcameraselector.cpp | 67 +- .../render/qclearbuffers/tst_qclearbuffers.cpp | 74 +- .../render/qcomputecommand/tst_qcomputecommand.cpp | 130 +--- .../auto/render/qdefaultmeshes/qdefaultmeshes.pro | 12 - .../render/qdefaultmeshes/tst_qdefaultmeshes.cpp | 111 --- .../qdispatchcompute/tst_qdispatchcompute.cpp | 92 +-- tests/auto/render/qeffect/tst_qeffect.cpp | 87 +-- .../qenvironmentlight/tst_qenvironmentlight.cpp | 55 +- tests/auto/render/qfilterkey/tst_qfilterkey.cpp | 79 +- .../render/qframegraphnode/tst_qframegraphnode.cpp | 128 +--- tests/auto/render/qgeometry/tst_qgeometry.cpp | 113 +-- .../qgeometryrenderer/tst_qgeometryrenderer.cpp | 161 +--- .../auto/render/qlayerfilter/tst_qlayerfilter.cpp | 78 +- .../render/qlevelofdetail/tst_qlevelofdetail.cpp | 55 +- tests/auto/render/qmaterial/tst_qmaterial.cpp | 120 +-- .../render/qmemorybarrier/tst_qmemorybarrier.cpp | 66 +- tests/auto/render/qmesh/tst_qmesh.cpp | 82 +-- .../render/qobjectpicker/tst_qobjectpicker.cpp | 104 +-- tests/auto/render/qparameter/tst_qparameter.cpp | 89 +-- .../qproximityfilter/tst_qproximityfilter.cpp | 80 +- tests/auto/render/qraycaster/tst_qraycaster.cpp | 60 +- .../render/qrendercapture/tst_qrendercapture.cpp | 66 +- tests/auto/render/qrenderpass/tst_qrenderpass.cpp | 129 +--- .../qrenderpassfilter/tst_qrenderpassfilter.cpp | 121 +-- .../render/qrendersettings/tst_qrendersettings.cpp | 132 +--- .../auto/render/qrenderstate/tst_qrenderstate.cpp | 16 +- .../render/qrenderstateset/tst_qrenderstateset.cpp | 70 +- .../tst_qrendersurfaceselector.cpp | 96 +-- .../render/qrendertarget/tst_qrendertarget.cpp | 74 +- .../tst_qrendertargetoutput.cpp | 117 +-- .../tst_qrendertargetselector.cpp | 90 +-- tests/auto/render/qscene2d/tst_qscene2d.cpp | 93 +-- .../auto/render/qsceneloader/tst_qsceneloader.cpp | 66 +- .../qscreenraycaster/tst_qscreenraycaster.cpp | 14 +- tests/auto/render/qsetfence/tst_qsetfence.cpp | 74 +- .../auto/render/qshaderimage/tst_qshaderimage.cpp | 134 +--- .../render/qshaderprogram/tst_qshaderprogram.cpp | 166 +---- .../tst_qshaderprogrambuilder.cpp | 158 +--- .../qsharedgltexture/tst_qsharedgltexture.cpp | 66 +- tests/auto/render/qsortpolicy/tst_qsortpolicy.cpp | 57 +- tests/auto/render/qtechnique/tst_qtechnique.cpp | 151 +--- .../qtechniquefilter/tst_qtechniquefilter.cpp | 126 +--- .../render/qtextureimage/tst_qtextureimage.cpp | 82 +-- .../qtextureimagedata/tst_qtextureimagedata.cpp | 2 +- .../render/qtextureloader/tst_qtextureloader.cpp | 78 +- tests/auto/render/qviewport/tst_qviewport.cpp | 82 +-- tests/auto/render/qwaitfence/tst_qwaitfence.cpp | 105 +-- tests/auto/render/raycaster/tst_raycaster.cpp | 2 +- .../render/raycastingjob/tst_raycastingjob.cpp | 5 +- tests/auto/render/render.pro | 1 - .../render/rendercapture/tst_rendercapture.cpp | 2 +- tests/auto/render/scene2d/tst_scene2d.cpp | 1 - tests/auto/render/sceneloader/tst_sceneloader.cpp | 4 +- tests/auto/render/setfence/tst_setfence.cpp | 51 +- .../render/shaderbuilder/tst_shaderbuilder.cpp | 4 +- tests/auto/render/skeleton/tst_skeleton.cpp | 2 +- tests/auto/render/sortpolicy/tst_sortpolicy.cpp | 2 +- tests/auto/render/texture/tst_texture.cpp | 66 +- tests/auto/render/transform/tst_transform.cpp | 2 +- .../tst_updateshaderdatatransformjob.cpp | 1 - 573 files changed, 1914 insertions(+), 19297 deletions(-) delete mode 100644 src/animation/frontend/qanimationcallbacktrigger.cpp delete mode 100644 src/animation/frontend/qanimationcallbacktrigger_p.h delete mode 100644 src/animation/frontend/qchannelmappingcreatedchange.cpp delete mode 100644 src/animation/frontend/qchannelmappingcreatedchange_p.h delete mode 100644 src/animation/frontend/qchannelmappingcreatedchange_p_p.h delete mode 100644 src/animation/frontend/qclipblendnodecreatedchange.cpp delete mode 100644 src/animation/frontend/qclipblendnodecreatedchange.h delete mode 100644 src/animation/frontend/qclipblendnodecreatedchange_p.h delete mode 100644 src/core/changes/changes.pri delete mode 100644 src/core/changes/qcomponentaddedchange.cpp delete mode 100644 src/core/changes/qcomponentaddedchange.h delete mode 100644 src/core/changes/qcomponentaddedchange_p.h delete mode 100644 src/core/changes/qcomponentremovedchange.cpp delete mode 100644 src/core/changes/qcomponentremovedchange.h delete mode 100644 src/core/changes/qcomponentremovedchange_p.h delete mode 100644 src/core/changes/qdynamicpropertyupdatedchange.cpp delete mode 100644 src/core/changes/qdynamicpropertyupdatedchange.h delete mode 100644 src/core/changes/qdynamicpropertyupdatedchange_p.h delete mode 100644 src/core/changes/qnodecommand.cpp delete mode 100644 src/core/changes/qnodecommand.h delete mode 100644 src/core/changes/qnodecommand_p.h delete mode 100644 src/core/changes/qnodecreatedchange.cpp delete mode 100644 src/core/changes/qnodecreatedchange.h delete mode 100644 src/core/changes/qnodecreatedchange_p.h delete mode 100644 src/core/changes/qnodedestroyedchange.cpp delete mode 100644 src/core/changes/qnodedestroyedchange.h delete mode 100644 src/core/changes/qnodedestroyedchange_p.h delete mode 100644 src/core/changes/qpropertynodeaddedchange.cpp delete mode 100644 src/core/changes/qpropertynodeaddedchange.h delete mode 100644 src/core/changes/qpropertynodeaddedchange_p.h delete mode 100644 src/core/changes/qpropertynoderemovedchange.cpp delete mode 100644 src/core/changes/qpropertynoderemovedchange.h delete mode 100644 src/core/changes/qpropertynoderemovedchange_p.h delete mode 100644 src/core/changes/qpropertyupdatedchange.cpp delete mode 100644 src/core/changes/qpropertyupdatedchange.h delete mode 100644 src/core/changes/qpropertyupdatedchange_p.h delete mode 100644 src/core/changes/qpropertyupdatedchangebase.cpp delete mode 100644 src/core/changes/qpropertyupdatedchangebase.h delete mode 100644 src/core/changes/qpropertyupdatedchangebase_p.h delete mode 100644 src/core/changes/qpropertyvalueaddedchange.cpp delete mode 100644 src/core/changes/qpropertyvalueaddedchange.h delete mode 100644 src/core/changes/qpropertyvalueaddedchange_p.h delete mode 100644 src/core/changes/qpropertyvalueaddedchangebase.cpp delete mode 100644 src/core/changes/qpropertyvalueaddedchangebase.h delete mode 100644 src/core/changes/qpropertyvalueaddedchangebase_p.h delete mode 100644 src/core/changes/qpropertyvalueremovedchange.cpp delete mode 100644 src/core/changes/qpropertyvalueremovedchange.h delete mode 100644 src/core/changes/qpropertyvalueremovedchange_p.h delete mode 100644 src/core/changes/qpropertyvalueremovedchangebase.cpp delete mode 100644 src/core/changes/qpropertyvalueremovedchangebase.h delete mode 100644 src/core/changes/qpropertyvalueremovedchangebase_p.h delete mode 100644 src/core/changes/qscenechange.cpp delete mode 100644 src/core/changes/qscenechange.h delete mode 100644 src/core/changes/qscenechange_p.h delete mode 100644 src/core/changes/qskeletoncreatedchange.cpp delete mode 100644 src/core/changes/qskeletoncreatedchange_p.h delete mode 100644 src/core/changes/qskeletoncreatedchange_p_p.h delete mode 100644 src/core/changes/qstaticpropertyupdatedchangebase.cpp delete mode 100644 src/core/changes/qstaticpropertyupdatedchangebase.h delete mode 100644 src/core/changes/qstaticpropertyupdatedchangebase_p.h delete mode 100644 src/core/changes/qstaticpropertyvalueaddedchangebase.cpp delete mode 100644 src/core/changes/qstaticpropertyvalueaddedchangebase.h delete mode 100644 src/core/changes/qstaticpropertyvalueaddedchangebase_p.h delete mode 100644 src/core/changes/qstaticpropertyvalueremovedchangebase.cpp delete mode 100644 src/core/changes/qstaticpropertyvalueremovedchangebase.h delete mode 100644 src/core/changes/qstaticpropertyvalueremovedchangebase_p.h delete mode 100644 src/core/changes/qtypedpropertyupdatechange_p.h delete mode 100644 src/core/nodes/qnodecreatedchangegenerator.cpp delete mode 100644 src/core/nodes/qnodecreatedchangegenerator_p.h delete mode 100644 src/core/qlockableobserverinterface.cpp delete mode 100644 src/core/qlockableobserverinterface_p.h delete mode 100644 src/core/qobservableinterface.cpp delete mode 100644 src/core/qobservableinterface_p.h delete mode 100644 src/core/qobserverinterface.cpp delete mode 100644 src/core/qobserverinterface_p.h delete mode 100644 src/core/qpostman.cpp delete mode 100644 src/core/qpostman_p.h delete mode 100644 src/core/qpostman_p_p.h delete mode 100644 src/input/frontend/qphysicaldevicecreatedchange.cpp delete mode 100644 src/input/frontend/qphysicaldevicecreatedchange.h delete mode 100644 src/input/frontend/qphysicaldevicecreatedchange_p.h delete mode 100644 src/render/framegraph/qframegraphnodecreatedchange.cpp delete mode 100644 src/render/framegraph/qframegraphnodecreatedchange.h delete mode 100644 src/render/framegraph/qframegraphnodecreatedchange_p.h delete mode 100644 src/render/renderstates/qrenderstatecreatedchange.cpp delete mode 100644 src/render/renderstates/qrenderstatecreatedchange_p.h create mode 100644 tests/auto/core/common/testarbiter.h delete mode 100644 tests/auto/core/common/testpostmanarbiter.cpp delete mode 100644 tests/auto/core/common/testpostmanarbiter.h delete mode 100644 tests/auto/core/qpostman/qpostman.pro delete mode 100644 tests/auto/core/qpostman/tst_qpostman.cpp delete mode 100644 tests/auto/coretest/testpostmanarbiter.cpp delete mode 100644 tests/auto/coretest/testpostmanarbiter_p.h delete mode 100644 tests/auto/render/qdefaultmeshes/qdefaultmeshes.pro delete mode 100644 tests/auto/render/qdefaultmeshes/tst_qdefaultmeshes.cpp diff --git a/src/animation/backend/animationutils_p.h b/src/animation/backend/animationutils_p.h index 8c71e704a..81a964046 100644 --- a/src/animation/backend/animationutils_p.h +++ b/src/animation/backend/animationutils_p.h @@ -52,7 +52,6 @@ #include #include #include -#include #include #include diff --git a/src/animation/backend/backendnode_p.h b/src/animation/backend/backendnode_p.h index 4e450b6ec..b7bbff844 100644 --- a/src/animation/backend/backendnode_p.h +++ b/src/animation/backend/backendnode_p.h @@ -54,6 +54,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/animation/backend/channelmapping.cpp b/src/animation/backend/channelmapping.cpp index 1e3aa76f0..cfc6a16ef 100644 --- a/src/animation/backend/channelmapping.cpp +++ b/src/animation/backend/channelmapping.cpp @@ -42,7 +42,6 @@ #include #include #include -#include #include #include diff --git a/src/animation/backend/clipblendnode.cpp b/src/animation/backend/clipblendnode.cpp index 57fbdb920..50e251398 100644 --- a/src/animation/backend/clipblendnode.cpp +++ b/src/animation/backend/clipblendnode.cpp @@ -35,7 +35,6 @@ ****************************************************************************/ #include "clipblendnode_p.h" -#include #include QT_BEGIN_NAMESPACE @@ -60,11 +59,6 @@ void ClipBlendNode::setClipBlendNodeManager(ClipBlendNodeManager *manager) m_manager = manager; } -void ClipBlendNode::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) -{ - Q_UNUSED(change); -} - ClipBlendNode::BlendType Animation::ClipBlendNode::blendType() const { return m_blendType; diff --git a/src/animation/backend/clipblendnode_p.h b/src/animation/backend/clipblendnode_p.h index 9651106f9..e650270cd 100644 --- a/src/animation/backend/clipblendnode_p.h +++ b/src/animation/backend/clipblendnode_p.h @@ -88,7 +88,6 @@ public: protected: explicit ClipBlendNode(BlendType blendType); - void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) override; virtual ClipResults doBlend(const QVector &blendData) const = 0; private: @@ -110,14 +109,14 @@ public: { } - Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const final + Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const final { - if (m_manager->containsNode(change->subjectId())) - return static_cast(m_manager->lookupNode(change->subjectId())); + if (m_manager->containsNode(id)) + return static_cast(m_manager->lookupNode(id)); Backend *backend = new Backend(); backend->setClipBlendNodeManager(m_manager); backend->setHandler(m_handler); - m_manager->appendNode(change->subjectId(), backend); + m_manager->appendNode(id, backend); return backend; } diff --git a/src/animation/backend/clipblendvalue.cpp b/src/animation/backend/clipblendvalue.cpp index 0db9544f6..dc63d4367 100644 --- a/src/animation/backend/clipblendvalue.cpp +++ b/src/animation/backend/clipblendvalue.cpp @@ -35,7 +35,6 @@ ****************************************************************************/ #include "clipblendvalue_p.h" -#include #include #include diff --git a/src/animation/backend/nodefunctor_p.h b/src/animation/backend/nodefunctor_p.h index 463205e52..47552b613 100644 --- a/src/animation/backend/nodefunctor_p.h +++ b/src/animation/backend/nodefunctor_p.h @@ -71,9 +71,9 @@ public: { } - Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const final + Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeId nodeId) const final { - Backend *backend = m_manager->getOrCreateResource(change->subjectId()); + Backend *backend = m_manager->getOrCreateResource(nodeId); backend->setHandler(m_handler); return backend; } diff --git a/src/animation/frontend/frontend.pri b/src/animation/frontend/frontend.pri index baff81dd0..ccf433318 100644 --- a/src/animation/frontend/frontend.pri +++ b/src/animation/frontend/frontend.pri @@ -15,8 +15,6 @@ HEADERS += \ $$PWD/qchannelmapper_p.h \ $$PWD/qchannelmapping.h \ $$PWD/qchannelmapping_p.h \ - $$PWD/qclipblendnodecreatedchange.h \ - $$PWD/qclipblendnodecreatedchange_p.h \ $$PWD/qanimationcontroller.h \ $$PWD/qanimationcontroller_p.h \ $$PWD/qanimationgroup.h \ @@ -46,13 +44,10 @@ HEADERS += \ $$PWD/qanimationclip.h \ $$PWD/qanimationclip_p.h \ $$PWD/qanimationcallback.h \ - $$PWD/qanimationcallbacktrigger_p.h \ $$PWD/qclock.h \ $$PWD/qclock_p.h \ $$PWD/qabstractchannelmapping.h \ $$PWD/qabstractchannelmapping_p.h \ - $$PWD/qchannelmappingcreatedchange_p.h \ - $$PWD/qchannelmappingcreatedchange_p_p.h \ $$PWD/qskeletonmapping.h \ $$PWD/qskeletonmapping_p.h \ $$PWD/qcallbackmapping.h \ @@ -67,7 +62,6 @@ SOURCES += \ $$PWD/qblendedclipanimator.cpp \ $$PWD/qchannelmapper.cpp \ $$PWD/qchannelmapping.cpp \ - $$PWD/qclipblendnodecreatedchange.cpp \ $$PWD/qanimationcontroller.cpp \ $$PWD/qanimationgroup.cpp \ $$PWD/qkeyframeanimation.cpp \ @@ -84,10 +78,8 @@ SOURCES += \ $$PWD/qchannelcomponent.cpp \ $$PWD/qkeyframe.cpp \ $$PWD/qanimationclip.cpp \ - $$PWD/qanimationcallbacktrigger.cpp \ $$PWD/qclock.cpp \ $$PWD/qabstractchannelmapping.cpp \ - $$PWD/qchannelmappingcreatedchange.cpp \ $$PWD/qskeletonmapping.cpp \ $$PWD/qcallbackmapping.cpp diff --git a/src/animation/frontend/qabstractanimationclip.cpp b/src/animation/frontend/qabstractanimationclip.cpp index 08133072c..1f1572a7e 100644 --- a/src/animation/frontend/qabstractanimationclip.cpp +++ b/src/animation/frontend/qabstractanimationclip.cpp @@ -133,11 +133,6 @@ QAbstractAnimationClip::QAbstractAnimationClip(QAbstractAnimationClipPrivate &dd { } -// TODO Unused remove in Qt6 -void QAbstractAnimationClip::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &) -{ -} - /*! Destroys this animation clip. */ diff --git a/src/animation/frontend/qabstractanimationclip.h b/src/animation/frontend/qabstractanimationclip.h index fddee3dec..f68950c4c 100644 --- a/src/animation/frontend/qabstractanimationclip.h +++ b/src/animation/frontend/qabstractanimationclip.h @@ -62,8 +62,7 @@ Q_SIGNALS: protected: QAbstractAnimationClip(QAbstractAnimationClipPrivate &dd, Qt3DCore::QNode *parent = nullptr); - // TODO Unused remove in Qt6 - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; + private: Q_DECLARE_PRIVATE(QAbstractAnimationClip) }; diff --git a/src/animation/frontend/qabstractchannelmapping.cpp b/src/animation/frontend/qabstractchannelmapping.cpp index 599ec6ed7..e1ea7f047 100644 --- a/src/animation/frontend/qabstractchannelmapping.cpp +++ b/src/animation/frontend/qabstractchannelmapping.cpp @@ -46,7 +46,7 @@ namespace Qt3DAnimation { QAbstractChannelMappingPrivate::QAbstractChannelMappingPrivate() : Qt3DCore::QNodePrivate() - , m_mappingType(QChannelMappingCreatedChangeBase::ChannelMapping) + , m_mappingType(ChannelMapping) { } diff --git a/src/animation/frontend/qabstractchannelmapping_p.h b/src/animation/frontend/qabstractchannelmapping_p.h index 2d77ee265..867e6be48 100644 --- a/src/animation/frontend/qabstractchannelmapping_p.h +++ b/src/animation/frontend/qabstractchannelmapping_p.h @@ -52,7 +52,6 @@ // #include -#include QT_BEGIN_NAMESPACE @@ -69,7 +68,13 @@ public: Q_DECLARE_PUBLIC(QAbstractChannelMapping) - QChannelMappingCreatedChangeBase::MappingType m_mappingType; + enum MappingType { + ChannelMapping = 0, + SkeletonMapping, + CallbackMapping + }; + + MappingType m_mappingType; }; struct QAbstractChannelMappingData diff --git a/src/animation/frontend/qabstractclipanimator.cpp b/src/animation/frontend/qabstractclipanimator.cpp index 8c282da49..cb4621182 100644 --- a/src/animation/frontend/qabstractclipanimator.cpp +++ b/src/animation/frontend/qabstractclipanimator.cpp @@ -122,11 +122,6 @@ QAbstractClipAnimator::QAbstractClipAnimator(QAbstractClipAnimatorPrivate &dd, Q { } -// TODO Unused remove in Qt6 -void QAbstractClipAnimator::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &) -{ -} - QAbstractClipAnimator::~QAbstractClipAnimator() { } diff --git a/src/animation/frontend/qabstractclipanimator.h b/src/animation/frontend/qabstractclipanimator.h index dc9dc9077..687589b5e 100644 --- a/src/animation/frontend/qabstractclipanimator.h +++ b/src/animation/frontend/qabstractclipanimator.h @@ -94,8 +94,6 @@ protected: explicit QAbstractClipAnimator(Qt3DCore::QNode *parent = nullptr); QAbstractClipAnimator(QAbstractClipAnimatorPrivate &dd, Qt3DCore::QNode *parent = nullptr); - // TODO Unused remove in Qt6 - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; private: Q_DECLARE_PRIVATE(QAbstractClipAnimator) }; diff --git a/src/animation/frontend/qadditiveclipblend.cpp b/src/animation/frontend/qadditiveclipblend.cpp index dda3265c2..7ffb7facb 100644 --- a/src/animation/frontend/qadditiveclipblend.cpp +++ b/src/animation/frontend/qadditiveclipblend.cpp @@ -36,7 +36,6 @@ #include "qadditiveclipblend.h" #include "qadditiveclipblend_p.h" -#include QT_BEGIN_NAMESPACE @@ -135,17 +134,6 @@ QAdditiveClipBlend::~QAdditiveClipBlend() { } -Qt3DCore::QNodeCreatedChangeBasePtr QAdditiveClipBlend::createNodeCreationChange() const -{ - Q_D(const QAdditiveClipBlend); - auto creationChange = QClipBlendNodeCreatedChangePtr::create(this); - QAdditiveClipBlendData &data = creationChange->data; - data.baseClipId = Qt3DCore::qIdForNode(d->m_baseClip); - data.additiveClipId = Qt3DCore::qIdForNode(d->m_additiveClip); - data.additiveFactor = d->m_additiveFactor; - return creationChange; -} - /*! \qmlproperty real AdditiveClipBlend::additiveFactor diff --git a/src/animation/frontend/qadditiveclipblend.h b/src/animation/frontend/qadditiveclipblend.h index 70c5b3cea..a675be23d 100644 --- a/src/animation/frontend/qadditiveclipblend.h +++ b/src/animation/frontend/qadditiveclipblend.h @@ -74,7 +74,6 @@ protected: private: Q_DECLARE_PRIVATE(QAdditiveClipBlend) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // Qt3DAnimation diff --git a/src/animation/frontend/qanimationaspect.cpp b/src/animation/frontend/qanimationaspect.cpp index 744346e1f..b44ceaef4 100644 --- a/src/animation/frontend/qanimationaspect.cpp +++ b/src/animation/frontend/qanimationaspect.cpp @@ -104,34 +104,34 @@ QAnimationAspect::QAnimationAspect(QAnimationAspectPrivate &dd, QObject *parent) qRegisterMetaType>(); qRegisterMetaType(); - registerBackendType( + registerBackendType( QSharedPointer>::create(d->m_handler.data(), d->m_handler->animationClipLoaderManager())); - registerBackendType( + registerBackendType( QSharedPointer>::create(d->m_handler.data(), d->m_handler->clockManager())); - registerBackendType( + registerBackendType( QSharedPointer>::create(d->m_handler.data(), d->m_handler->clipAnimatorManager())); - registerBackendType( + registerBackendType( QSharedPointer>::create(d->m_handler.data(), d->m_handler->blendedClipAnimatorManager())); - registerBackendType( + registerBackendType( QSharedPointer>::create(d->m_handler.data(), d->m_handler->channelMappingManager())); - registerBackendType( + registerBackendType( QSharedPointer>::create(d->m_handler.data(), d->m_handler->channelMapperManager())); - registerBackendType( + registerBackendType( QSharedPointer>::create(d->m_handler.data(), d->m_handler->clipBlendNodeManager())); - registerBackendType( + registerBackendType( QSharedPointer>::create(d->m_handler.data(), d->m_handler->clipBlendNodeManager())); - registerBackendType( + registerBackendType( QSharedPointer>::create(d->m_handler.data(), d->m_handler->clipBlendNodeManager())); - registerBackendType( + registerBackendType( QSharedPointer>::create(d->m_handler.data(), d->m_handler->skeletonManager())); } diff --git a/src/animation/frontend/qanimationcallbacktrigger.cpp b/src/animation/frontend/qanimationcallbacktrigger.cpp deleted file mode 100644 index 83fccb5a4..000000000 --- a/src/animation/frontend/qanimationcallbacktrigger.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qanimationcallbacktrigger_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DAnimation { - -QAnimationCallbackTrigger::QAnimationCallbackTrigger(Qt3DCore::QNodeId subjectId) - : Qt3DCore::QSceneChange(Qt3DCore::CallbackTriggered, subjectId), - m_callback(nullptr) -{ -} - -} // namespace Qt3DAnimation - -QT_END_NAMESPACE diff --git a/src/animation/frontend/qanimationcallbacktrigger_p.h b/src/animation/frontend/qanimationcallbacktrigger_p.h deleted file mode 100644 index 9a05d421f..000000000 --- a/src/animation/frontend/qanimationcallbacktrigger_p.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DANIMATION_QANIMATIONCALLBACKTRIGGER_P_H -#define QT3DANIMATION_QANIMATIONCALLBACKTRIGGER_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DAnimation { - -class Q_AUTOTEST_EXPORT QAnimationCallbackTrigger : public Qt3DCore::QSceneChange -{ -public: - QAnimationCallbackTrigger(Qt3DCore::QNodeId subjectId); - - void setCallback(QAnimationCallback *callback) { m_callback = callback; } - QAnimationCallback *callback() const { return m_callback; } - - void setValue(const QVariant &value) { m_value = value; } - QVariant value() const { return m_value; } - -private: - QAnimationCallback *m_callback; - QVariant m_value; -}; - -typedef QSharedPointer QAnimationCallbackTriggerPtr; - -} // namespace Qt3DAnimation - -QT_END_NAMESPACE - -#endif // QT3DANIMATION_QANIMATIONCALLBACKTRIGGER_P_H diff --git a/src/animation/frontend/qanimationclip.cpp b/src/animation/frontend/qanimationclip.cpp index 74a9b8371..8dfbf2a1f 100644 --- a/src/animation/frontend/qanimationclip.cpp +++ b/src/animation/frontend/qanimationclip.cpp @@ -92,15 +92,6 @@ void QAnimationClip::setClipData(const Qt3DAnimation::QAnimationClipData &clipDa emit clipDataChanged(clipData); } -Qt3DCore::QNodeCreatedChangeBasePtr QAnimationClip::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QAnimationClip); - data.clipData = d->m_clipData; - return creationChange; -} - } // namespace Qt3DAnimation QT_END_NAMESPACE diff --git a/src/animation/frontend/qanimationclip.h b/src/animation/frontend/qanimationclip.h index cec758704..c93e162a4 100644 --- a/src/animation/frontend/qanimationclip.h +++ b/src/animation/frontend/qanimationclip.h @@ -72,7 +72,6 @@ protected: private: Q_DECLARE_PRIVATE(QAnimationClip) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DAnimation diff --git a/src/animation/frontend/qanimationcliploader.cpp b/src/animation/frontend/qanimationcliploader.cpp index bf901e54f..41cf3f8a6 100644 --- a/src/animation/frontend/qanimationcliploader.cpp +++ b/src/animation/frontend/qanimationcliploader.cpp @@ -112,11 +112,6 @@ QAnimationClipLoader::QAnimationClipLoader(QAnimationClipLoaderPrivate &dd, Qt3D { } -// TODO Unused remove in Qt6 -void QAnimationClipLoader::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &) -{ -} - QAnimationClipLoader::~QAnimationClipLoader() { } @@ -146,15 +141,6 @@ void QAnimationClipLoader::setSource(const QUrl &source) emit sourceChanged(source); } -Qt3DCore::QNodeCreatedChangeBasePtr QAnimationClipLoader::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QAnimationClipLoader); - data.source = d->m_source; - return creationChange; -} - } // namespace Qt3DAnimation QT_END_NAMESPACE diff --git a/src/animation/frontend/qanimationcliploader.h b/src/animation/frontend/qanimationcliploader.h index 1b68e852f..55a46af8c 100644 --- a/src/animation/frontend/qanimationcliploader.h +++ b/src/animation/frontend/qanimationcliploader.h @@ -78,12 +78,9 @@ Q_SIGNALS: protected: explicit QAnimationClipLoader(QAnimationClipLoaderPrivate &dd, Qt3DCore::QNode *parent = nullptr); - // TODO Unused remove in Qt6 - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; private: Q_DECLARE_PRIVATE(QAnimationClipLoader) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DAnimation diff --git a/src/animation/frontend/qblendedclipanimator.cpp b/src/animation/frontend/qblendedclipanimator.cpp index c48706606..e6c5caead 100644 --- a/src/animation/frontend/qblendedclipanimator.cpp +++ b/src/animation/frontend/qblendedclipanimator.cpp @@ -306,21 +306,6 @@ void QBlendedClipAnimator::setBlendTree(QAbstractClipBlendNode *blendTree) emit blendTreeChanged(blendTree); } -/*! \internal */ -Qt3DCore::QNodeCreatedChangeBasePtr QBlendedClipAnimator::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - QBlendedClipAnimatorData &data = creationChange->data; - Q_D(const QBlendedClipAnimator); - data.blendTreeRootId = Qt3DCore::qIdForNode(d->m_blendTreeRoot); - data.mapperId = Qt3DCore::qIdForNode(d->m_mapper); - data.clockId = Qt3DCore::qIdForNode(d->m_clock); - data.running = d->m_running; - data.loops = d->m_loops; - data.normalizedTime = d->m_normalizedTime; - return creationChange; -} - } // namespace Qt3DAnimation QT_END_NAMESPACE diff --git a/src/animation/frontend/qblendedclipanimator.h b/src/animation/frontend/qblendedclipanimator.h index f4463802f..2fb7595aa 100644 --- a/src/animation/frontend/qblendedclipanimator.h +++ b/src/animation/frontend/qblendedclipanimator.h @@ -72,7 +72,6 @@ protected: private: Q_DECLARE_PRIVATE(QBlendedClipAnimator) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DAnimation diff --git a/src/animation/frontend/qcallbackmapping.cpp b/src/animation/frontend/qcallbackmapping.cpp index a86785012..dcc352b17 100644 --- a/src/animation/frontend/qcallbackmapping.cpp +++ b/src/animation/frontend/qcallbackmapping.cpp @@ -37,8 +37,6 @@ #include "qcallbackmapping.h" #include "qcallbackmapping_p.h" -#include - #include #include @@ -52,7 +50,7 @@ QCallbackMappingPrivate::QCallbackMappingPrivate() , m_type(static_cast(QVariant::Invalid)) , m_callback(nullptr) { - m_mappingType = QChannelMappingCreatedChangeBase::CallbackMapping; + m_mappingType = QAbstractChannelMappingPrivate::CallbackMapping; } /*! @@ -140,18 +138,6 @@ void QCallbackMapping::setCallback(int type, QAnimationCallback *callback, QAnim } } -Qt3DCore::QNodeCreatedChangeBasePtr QCallbackMapping::createNodeCreationChange() const -{ - auto creationChange = QChannelMappingCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QCallbackMapping); - data.channelName = d->m_channelName; - data.type = d->m_type; - data.callback = d->m_callback; - data.callbackFlags = d->m_callbackFlags; - return creationChange; -} - } // namespace Qt3DAnimation QT_END_NAMESPACE diff --git a/src/animation/frontend/qcallbackmapping.h b/src/animation/frontend/qcallbackmapping.h index b98a3b430..056a19ac0 100644 --- a/src/animation/frontend/qcallbackmapping.h +++ b/src/animation/frontend/qcallbackmapping.h @@ -72,7 +72,6 @@ protected: private: Q_DECLARE_PRIVATE(QCallbackMapping) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE; }; } // namespace Qt3DAnimation diff --git a/src/animation/frontend/qchannelmapper.cpp b/src/animation/frontend/qchannelmapper.cpp index c5909adbc..2d0e0dd2d 100644 --- a/src/animation/frontend/qchannelmapper.cpp +++ b/src/animation/frontend/qchannelmapper.cpp @@ -36,7 +36,6 @@ #include "qchannelmapper.h" #include "qchannelmapper_p.h" -#include #include QT_BEGIN_NAMESPACE @@ -86,7 +85,7 @@ void QChannelMapper::addMapping(QAbstractChannelMapping *mapping) if (!mapping->parent()) mapping->setParent(this); - d->updateNode(mapping, "mappings", Qt3DCore::PropertyValueAdded); + d->update(); } } @@ -95,7 +94,7 @@ void QChannelMapper::removeMapping(QAbstractChannelMapping *mapping) Q_ASSERT(mapping); Q_D(QChannelMapper); d->m_mappings.removeOne(mapping); - d->updateNode(mapping, "mappings", Qt3DCore::PropertyValueRemoved); + d->update(); // Remove bookkeeping connection d->unregisterDestructionHelper(mapping); } @@ -106,15 +105,6 @@ QVector QChannelMapper::mappings() const return d->m_mappings; } -Qt3DCore::QNodeCreatedChangeBasePtr QChannelMapper::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QChannelMapper); - data.mappingIds = Qt3DCore::qIdsForNodes(d->m_mappings); - return creationChange; -} - } // namespace Qt3DAnimation QT_END_NAMESPACE diff --git a/src/animation/frontend/qchannelmapper.h b/src/animation/frontend/qchannelmapper.h index cb5532265..109bf7e06 100644 --- a/src/animation/frontend/qchannelmapper.h +++ b/src/animation/frontend/qchannelmapper.h @@ -64,7 +64,6 @@ protected: private: Q_DECLARE_PRIVATE(QChannelMapper) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DAnimation diff --git a/src/animation/frontend/qchannelmapping.cpp b/src/animation/frontend/qchannelmapping.cpp index 16651afe6..bbccb0f16 100644 --- a/src/animation/frontend/qchannelmapping.cpp +++ b/src/animation/frontend/qchannelmapping.cpp @@ -37,8 +37,6 @@ #include "qchannelmapping.h" #include "qchannelmapping_p.h" -#include - #include #include @@ -110,7 +108,7 @@ QChannelMappingPrivate::QChannelMappingPrivate() , m_type(static_cast(QVariant::Invalid)) , m_componentCount(0) { - m_mappingType = QChannelMappingCreatedChangeBase::ChannelMapping; + m_mappingType = ChannelMapping; } /*! @@ -248,19 +246,6 @@ void QChannelMapping::setProperty(const QString &property) d->updatePropertyNameTypeAndComponentCount(); } -Qt3DCore::QNodeCreatedChangeBasePtr QChannelMapping::createNodeCreationChange() const -{ - auto creationChange = QChannelMappingCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QChannelMapping); - data.channelName = d->m_channelName; - data.targetId = Qt3DCore::qIdForNode(d->m_target); - data.type = d->m_type; - data.componentCount = d->m_componentCount; - data.propertyName = d->m_propertyName; - return creationChange; -} - } // namespace Qt3DAnimation QT_END_NAMESPACE diff --git a/src/animation/frontend/qchannelmapping.h b/src/animation/frontend/qchannelmapping.h index e88e6daa9..ba2277a6c 100644 --- a/src/animation/frontend/qchannelmapping.h +++ b/src/animation/frontend/qchannelmapping.h @@ -77,7 +77,6 @@ protected: private: Q_DECLARE_PRIVATE(QChannelMapping) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DAnimation diff --git a/src/animation/frontend/qchannelmappingcreatedchange.cpp b/src/animation/frontend/qchannelmappingcreatedchange.cpp deleted file mode 100644 index 6812278ac..000000000 --- a/src/animation/frontend/qchannelmappingcreatedchange.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qchannelmappingcreatedchange_p.h" -#include "qchannelmappingcreatedchange_p_p.h" -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DAnimation { - -QChannelMappingCreatedChangeBasePrivate::QChannelMappingCreatedChangeBasePrivate(const QAbstractChannelMapping *mapping) - : Qt3DCore::QNodeCreatedChangeBasePrivate(mapping) - , m_mappingType(QAbstractChannelMappingPrivate::get(mapping)->m_mappingType) -{ -} - -/*! - \class Qt3DAnimation::QChannelMappingCreatedChangeBase - \inmodule Qt3DCore - \brief Base class for handling creation changes for QAbstractSkeleton sub-classes. -*/ -QChannelMappingCreatedChangeBase::QChannelMappingCreatedChangeBase(const QAbstractChannelMapping *mapping) - : Qt3DCore::QNodeCreatedChangeBase(*new QChannelMappingCreatedChangeBasePrivate(mapping), mapping) -{ -} - -/*! \internal */ -QChannelMappingCreatedChangeBase::~QChannelMappingCreatedChangeBase() -{ -} - -/*! \internal */ -QChannelMappingCreatedChangeBase::MappingType QChannelMappingCreatedChangeBase::type() const -{ - Q_D(const QChannelMappingCreatedChangeBase); - return d->m_mappingType; -} - -} // namespace Qt3DAnimation - -QT_END_NAMESPACE diff --git a/src/animation/frontend/qchannelmappingcreatedchange_p.h b/src/animation/frontend/qchannelmappingcreatedchange_p.h deleted file mode 100644 index 527ab524a..000000000 --- a/src/animation/frontend/qchannelmappingcreatedchange_p.h +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DANIMATION_QCHANNELMAPPINGCREATEDCHANGE_P_H -#define QT3DANIMATION_QCHANNELMAPPINGCREATEDCHANGE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DAnimation { - -class QChannelMappingCreatedChangeBasePrivate; - -class Q_3DANIMATIONSHARED_PRIVATE_EXPORT QChannelMappingCreatedChangeBase : public Qt3DCore::QNodeCreatedChangeBase -{ -public: - explicit QChannelMappingCreatedChangeBase(const QAbstractChannelMapping *mapping); - ~QChannelMappingCreatedChangeBase(); - - enum MappingType { - ChannelMapping = 0, - SkeletonMapping, - CallbackMapping - }; - - MappingType type() const; - -private: - Q_DECLARE_PRIVATE(QChannelMappingCreatedChangeBase) -}; - -typedef QSharedPointer QChannelMappingCreatedChangeBasePtr; - -template -class QChannelMappingCreatedChange : public QChannelMappingCreatedChangeBase -{ -public: - explicit QChannelMappingCreatedChange(const QAbstractChannelMapping *_mapping) - : QChannelMappingCreatedChangeBase(_mapping) - , data() - { - } - - T data; -}; - -template -using QChannelMappingCreatedChangePtr = QSharedPointer>; - -} // namespace Qt3DAnimation - -QT_END_NAMESPACE - -#endif // QT3DANIMATION_QCHANNELMAPPINGCREATEDCHANGE_P_H diff --git a/src/animation/frontend/qchannelmappingcreatedchange_p_p.h b/src/animation/frontend/qchannelmappingcreatedchange_p_p.h deleted file mode 100644 index 8a89104a8..000000000 --- a/src/animation/frontend/qchannelmappingcreatedchange_p_p.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DANIMATION_QCHANNELMAPPINGCREATEDCHANGE_P_P_H -#define QT3DANIMATION_QCHANNELMAPPINGCREATEDCHANGE_P_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DAnimation { - -class QAbstractChannelMapping; - -class QChannelMappingCreatedChangeBasePrivate : public Qt3DCore::QNodeCreatedChangeBasePrivate -{ -public: - QChannelMappingCreatedChangeBasePrivate(const QAbstractChannelMapping *mapping); - - QChannelMappingCreatedChangeBase::MappingType m_mappingType; -}; - -} // namespace Qt3DAnimation - -QT_END_NAMESPACE - -#endif // QT3DANIMATION_QCHANNELMAPPINGCREATEDCHANGE_P_P_H diff --git a/src/animation/frontend/qclipanimator.cpp b/src/animation/frontend/qclipanimator.cpp index ffad588c1..1f1d05a1b 100644 --- a/src/animation/frontend/qclipanimator.cpp +++ b/src/animation/frontend/qclipanimator.cpp @@ -163,21 +163,6 @@ void QClipAnimator::setClip(QAbstractAnimationClip *clip) emit clipChanged(clip); } -/*! \internal */ -Qt3DCore::QNodeCreatedChangeBasePtr QClipAnimator::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QClipAnimator); - data.clipId = Qt3DCore::qIdForNode(d->m_clip); - data.mapperId = Qt3DCore::qIdForNode(d->m_mapper); - data.clockId = Qt3DCore::qIdForNode(d->m_clock); - data.running = d->m_running; - data.loops = d->m_loops; - data.normalizedTime = d->m_normalizedTime; - return creationChange; -} - } // namespace Qt3DAnimation QT_END_NAMESPACE diff --git a/src/animation/frontend/qclipanimator.h b/src/animation/frontend/qclipanimator.h index bc77b20ff..6025a5343 100644 --- a/src/animation/frontend/qclipanimator.h +++ b/src/animation/frontend/qclipanimator.h @@ -73,7 +73,6 @@ protected: private: Q_DECLARE_PRIVATE(QClipAnimator) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DAnimation diff --git a/src/animation/frontend/qclipblendnodecreatedchange.cpp b/src/animation/frontend/qclipblendnodecreatedchange.cpp deleted file mode 100644 index 46079ad59..000000000 --- a/src/animation/frontend/qclipblendnodecreatedchange.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qclipblendnodecreatedchange.h" -#include "qclipblendnodecreatedchange_p.h" -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DAnimation { - -QClipBlendNodeCreatedChangeBasePrivate::QClipBlendNodeCreatedChangeBasePrivate(const QAbstractClipBlendNode *node) - : Qt3DCore::QNodeCreatedChangeBasePrivate(node) -{ -} - -/*! - \class Qt3DAnimation::QClipBlendNodeCreatedChangeBase - \inherits Qt3DCore::QNodeCreatedChangeBase - \inmodule Qt3DAnimation - \brief Base class for changes in QClipBlendNode. -*/ -QClipBlendNodeCreatedChangeBase::QClipBlendNodeCreatedChangeBase(const QAbstractClipBlendNode *node) - : Qt3DCore::QNodeCreatedChangeBase(*new QClipBlendNodeCreatedChangeBasePrivate(node), node) -{ -} - -QClipBlendNodeCreatedChangeBase::~QClipBlendNodeCreatedChangeBase() -{ -} -/*! - \typedef Qt3DAnimation::QClipBlendNodeCreatedChangeBasePtr - - A shared pointer for QClipBlendNodeCreatedChangeBase. -*/ - -} // Qt3DAnimation - -QT_END_NAMESPACE diff --git a/src/animation/frontend/qclipblendnodecreatedchange.h b/src/animation/frontend/qclipblendnodecreatedchange.h deleted file mode 100644 index 094e8128e..000000000 --- a/src/animation/frontend/qclipblendnodecreatedchange.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DANIMATION_QCLIPBLENDNODECREATEDCHANGE_H -#define QT3DANIMATION_QCLIPBLENDNODECREATEDCHANGE_H - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DAnimation { - -class QAbstractClipBlendNode; -class QClipBlendNodeCreatedChangeBasePrivate; - -class Q_3DANIMATIONSHARED_EXPORT QClipBlendNodeCreatedChangeBase : public Qt3DCore::QNodeCreatedChangeBase -{ -public: - explicit QClipBlendNodeCreatedChangeBase(const QAbstractClipBlendNode *node); - ~QClipBlendNodeCreatedChangeBase(); - -private: - Q_DECLARE_PRIVATE(QClipBlendNodeCreatedChangeBase) -}; - -typedef QSharedPointer QClipBlendNodeCreatedChangeBasePtr; - -template -class QClipBlendNodeCreatedChange : public QClipBlendNodeCreatedChangeBase -{ -public: - explicit QClipBlendNodeCreatedChange(const QAbstractClipBlendNode *node) - : QClipBlendNodeCreatedChangeBase(node) - , data() - { - } - - T data; -}; - -template -using QClipBlendNodeCreatedChangePtr = QSharedPointer>; - - -} // Qt3DAnimation - -QT_END_NAMESPACE - -#endif // QT3DANIMATION_QCLIPBLENDNODECREATEDCHANGE_H diff --git a/src/animation/frontend/qclipblendnodecreatedchange_p.h b/src/animation/frontend/qclipblendnodecreatedchange_p.h deleted file mode 100644 index 31342d3a8..000000000 --- a/src/animation/frontend/qclipblendnodecreatedchange_p.h +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DANIMATION_QCLIPBLENDNODECREATEDCHANGE_P_H -#define QT3DANIMATION_QCLIPBLENDNODECREATEDCHANGE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DAnimation { - -class QAbstractClipBlendNode; - -class QClipBlendNodeCreatedChangeBasePrivate : public Qt3DCore::QNodeCreatedChangeBasePrivate -{ -public: - QClipBlendNodeCreatedChangeBasePrivate(const QAbstractClipBlendNode *node); -}; - -} // Qt3DAnimation - -QT_END_NAMESPACE - -#endif // QT3DANIMATION_QCLIPBLENDNODECREATEDCHANGE_P_H diff --git a/src/animation/frontend/qclipblendvalue.cpp b/src/animation/frontend/qclipblendvalue.cpp index 053453e33..e7e8a8898 100644 --- a/src/animation/frontend/qclipblendvalue.cpp +++ b/src/animation/frontend/qclipblendvalue.cpp @@ -40,7 +40,6 @@ #include "qclipblendvalue.h" #include "qclipblendvalue_p.h" #include -#include QT_BEGIN_NAMESPACE @@ -120,15 +119,6 @@ void QClipBlendValue::setClip(Qt3DAnimation::QAbstractAnimationClip *clip) emit clipChanged(clip); } -Qt3DCore::QNodeCreatedChangeBasePtr QClipBlendValue::createNodeCreationChange() const -{ - Q_D(const QClipBlendValue); - auto creationChange = QClipBlendNodeCreatedChangePtr::create(this); - QClipBlendValueData &data = creationChange->data; - data.clipId = Qt3DCore::qIdForNode(d->m_clip); - return creationChange; -} - } // namespace Qt3DAnimation QT_END_NAMESPACE diff --git a/src/animation/frontend/qclipblendvalue.h b/src/animation/frontend/qclipblendvalue.h index b97fc6e58..aaceed3b5 100644 --- a/src/animation/frontend/qclipblendvalue.h +++ b/src/animation/frontend/qclipblendvalue.h @@ -73,7 +73,6 @@ protected: private: Q_DECLARE_PRIVATE(QClipBlendValue) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DAnimation diff --git a/src/animation/frontend/qclock.cpp b/src/animation/frontend/qclock.cpp index f38c21807..8d1cb5991 100644 --- a/src/animation/frontend/qclock.cpp +++ b/src/animation/frontend/qclock.cpp @@ -81,15 +81,6 @@ void QClock::setPlaybackRate(double playbackRate) emit playbackRateChanged(playbackRate); } -Qt3DCore::QNodeCreatedChangeBasePtr QClock::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QClock); - data.playbackRate = d->m_playbackRate; - return creationChange; -} - } QT_END_NAMESPACE diff --git a/src/animation/frontend/qclock.h b/src/animation/frontend/qclock.h index 8475f2831..14560f324 100644 --- a/src/animation/frontend/qclock.h +++ b/src/animation/frontend/qclock.h @@ -66,7 +66,6 @@ protected: private: Q_DECLARE_PRIVATE(QClock) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DAnimation diff --git a/src/animation/frontend/qlerpclipblend.cpp b/src/animation/frontend/qlerpclipblend.cpp index 89ce3ca6f..29503ff6c 100644 --- a/src/animation/frontend/qlerpclipblend.cpp +++ b/src/animation/frontend/qlerpclipblend.cpp @@ -36,7 +36,6 @@ #include "qlerpclipblend.h" #include "qlerpclipblend_p.h" -#include QT_BEGIN_NAMESPACE @@ -106,17 +105,6 @@ QLerpClipBlend::~QLerpClipBlend() { } -Qt3DCore::QNodeCreatedChangeBasePtr QLerpClipBlend::createNodeCreationChange() const -{ - Q_D(const QLerpClipBlend); - auto creationChange = QClipBlendNodeCreatedChangePtr::create(this); - QLerpClipBlendData &data = creationChange->data; - data.startClipId = Qt3DCore::qIdForNode(d->m_startClip); - data.endClipId = Qt3DCore::qIdForNode(d->m_endClip); - data.blendFactor = d->m_blendFactor; - return creationChange; -} - /*! \qmlproperty real LerpClipBlend::blendFactor diff --git a/src/animation/frontend/qlerpclipblend.h b/src/animation/frontend/qlerpclipblend.h index 6511d1c37..ce62e4e39 100644 --- a/src/animation/frontend/qlerpclipblend.h +++ b/src/animation/frontend/qlerpclipblend.h @@ -75,7 +75,6 @@ protected: private: Q_DECLARE_PRIVATE(QLerpClipBlend) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // Qt3DAnimation diff --git a/src/animation/frontend/qskeletonmapping.cpp b/src/animation/frontend/qskeletonmapping.cpp index 7569a5bab..e13cd87ec 100644 --- a/src/animation/frontend/qskeletonmapping.cpp +++ b/src/animation/frontend/qskeletonmapping.cpp @@ -41,8 +41,6 @@ #include "qskeletonmapping_p.h" #include -#include - QT_BEGIN_NAMESPACE namespace Qt3DAnimation { @@ -51,7 +49,7 @@ QSkeletonMappingPrivate::QSkeletonMappingPrivate() : QAbstractChannelMappingPrivate() , m_skeleton(nullptr) { - m_mappingType = QChannelMappingCreatedChangeBase::SkeletonMapping; + m_mappingType = QAbstractChannelMappingPrivate::SkeletonMapping; } QSkeletonMapping::QSkeletonMapping(Qt3DCore::QNode *parent) @@ -94,15 +92,6 @@ void QSkeletonMapping::setSkeleton(Qt3DCore::QAbstractSkeleton *skeleton) emit skeletonChanged(skeleton); } -Qt3DCore::QNodeCreatedChangeBasePtr QSkeletonMapping::createNodeCreationChange() const -{ - auto creationChange = QChannelMappingCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QSkeletonMapping); - data.skeletonId = Qt3DCore::qIdForNode(d->m_skeleton); - return creationChange; -} - } // namespace Qt3DAnimation QT_END_NAMESPACE diff --git a/src/animation/frontend/qskeletonmapping.h b/src/animation/frontend/qskeletonmapping.h index 275fce818..5f37bfeb9 100644 --- a/src/animation/frontend/qskeletonmapping.h +++ b/src/animation/frontend/qskeletonmapping.h @@ -75,7 +75,6 @@ protected: private: Q_DECLARE_PRIVATE(QSkeletonMapping) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE; }; } // namespace Qt3DAnimation diff --git a/src/core/aspects/qabstractaspect.cpp b/src/core/aspects/qabstractaspect.cpp index 824434ce6..3f569a4ed 100644 --- a/src/core/aspects/qabstractaspect.cpp +++ b/src/core/aspects/qabstractaspect.cpp @@ -45,16 +45,10 @@ #include #include -#include -#include -#include -#include -#include #include #include #include -#include #include #include #include @@ -180,14 +174,7 @@ QNodeId QAbstractAspect::rootEntityId() const Q_DECL_NOEXCEPT void QAbstractAspect::registerBackendType(const QMetaObject &obj, const QBackendNodeMapperPtr &functor) { Q_D(QAbstractAspect); - d->m_backendCreatorFunctors.insert(&obj, {functor, QAbstractAspectPrivate::DefaultMapper}); -} - -void QAbstractAspect::registerBackendType(const QMetaObject &obj, const QBackendNodeMapperPtr &functor, bool supportsSyncing) -{ - Q_D(QAbstractAspect); - const auto f = supportsSyncing ? QAbstractAspectPrivate::SupportsSyncing : QAbstractAspectPrivate::DefaultMapper; - d->m_backendCreatorFunctors.insert(&obj, {functor, f}); + d->m_backendCreatorFunctors.insert(&obj, functor); } void QAbstractAspect::unregisterBackendType(const QMetaObject &obj) @@ -208,24 +195,23 @@ QVector QAbstractAspect::jobsToExecute(qint64 time) return QVector(); } -QAbstractAspectPrivate::BackendNodeMapperAndInfo QAbstractAspectPrivate::mapperForNode(const QMetaObject *metaObj) const +QBackendNodeMapperPtr QAbstractAspectPrivate::mapperForNode(const QMetaObject *metaObj) const { Q_ASSERT(metaObj); - BackendNodeMapperAndInfo info; + QBackendNodeMapperPtr mapper; - while (metaObj != nullptr && info.first.isNull()) { - info = m_backendCreatorFunctors.value(metaObj); + while (metaObj != nullptr && mapper.isNull()) { + mapper = m_backendCreatorFunctors.value(metaObj); metaObj = metaObj->superClass(); } - return info; + return mapper; } void QAbstractAspectPrivate::syncDirtyFrontEndNodes(const QVector &nodes) { for (auto node: qAsConst(nodes)) { const QMetaObject *metaObj = QNodePrivate::get(node)->m_typeInfo; - const BackendNodeMapperAndInfo backendNodeMapperInfo = mapperForNode(metaObj); - const QBackendNodeMapperPtr backendNodeMapper = backendNodeMapperInfo.first; + const QBackendNodeMapperPtr backendNodeMapper = mapperForNode(metaObj); if (!backendNodeMapper) continue; @@ -234,168 +220,53 @@ void QAbstractAspectPrivate::syncDirtyFrontEndNodes(const QVector &node if (!backend) continue; - const bool supportsSyncing = backendNodeMapperInfo.second & SupportsSyncing; - if (supportsSyncing) - syncDirtyFrontEndNode(node, backend, false); - else - sendPropertyMessages(node, backend); + syncDirtyFrontEndNode(node, backend, false); } } -void QAbstractAspectPrivate::syncDirtyFrontEndSubNodes(const QVector &nodes) +void QAbstractAspectPrivate::syncDirtyEntityComponentNodes(const QVector &changes) { - for (const auto &nodeChange: qAsConst(nodes)) { - auto getBackend = [this](QNode *node) -> std::tuple { - const QMetaObject *metaObj = QNodePrivate::get(node)->m_typeInfo; - const BackendNodeMapperAndInfo backendNodeMapperInfo = mapperForNode(metaObj); - const QBackendNodeMapperPtr backendNodeMapper = backendNodeMapperInfo.first; - - if (!backendNodeMapper) - return {}; - - QBackendNode *backend = backendNodeMapper->get(node->id()); - if (!backend) - return {}; + auto getBackend = [this] (QNode *node) -> QBackendNode* { + const QMetaObject *metaObj = QNodePrivate::get(node)->m_typeInfo; + const QBackendNodeMapperPtr backendNodeMapper = mapperForNode(metaObj); - const bool supportsSyncing = backendNodeMapperInfo.second & SupportsSyncing; + if (!backendNodeMapper) + return nullptr; - return std::tuple(backend, supportsSyncing); - }; + return backendNodeMapper->get(node->id()); + }; - auto nodeInfo = getBackend(nodeChange.node); - if (!std::get<0>(nodeInfo)) + for (const auto &change: qAsConst(changes)) { + auto entityBackend = getBackend(change.node); + if (!entityBackend) continue; - auto subNodeInfo = getBackend(nodeChange.subNode); - if (!std::get<0>(subNodeInfo)) + auto componentBackend = getBackend(change.subNode); + if (!componentBackend) continue; - switch (nodeChange.change) { - case PropertyValueAdded: { - if (std::get<1>(nodeInfo)) - break; // do nothing as the node will be dirty anyway - - QPropertyValueAddedChange change(nodeChange.node->id()); - change.setPropertyName(nodeChange.property); - change.setAddedValue(QVariant::fromValue(nodeChange.subNode->id())); - QPropertyValueAddedChangePtr pChange(&change, [](QPropertyValueAddedChange *) { }); - std::get<0>(nodeInfo)->sceneChangeEvent(pChange); - } - break; - case PropertyValueRemoved: { - if (std::get<1>(nodeInfo)) - break; // do nothing as the node will be dirty anyway - - QPropertyValueRemovedChange change(nodeChange.node->id()); - change.setPropertyName(nodeChange.property); - change.setRemovedValue(QVariant::fromValue(nodeChange.subNode->id())); - QPropertyValueRemovedChangePtr pChange(&change, [](QPropertyValueRemovedChange *) { }); - std::get<0>(nodeInfo)->sceneChangeEvent(pChange); - } - break; - case ComponentAdded: { - // let the entity know it has a new component - if (std::get<1>(nodeInfo)) { - QBackendNodePrivate::get(std::get<0>(nodeInfo))->componentAdded(nodeChange.subNode); - } else { - QComponentAddedChange change(qobject_cast(nodeChange.subNode), qobject_cast(nodeChange.node)); - QComponentAddedChangePtr pChange(&change, [](QComponentAddedChange *) { }); - std::get<0>(nodeInfo)->sceneChangeEvent(pChange); - } - - // let the component know it was added to an entity - if (std::get<1>(subNodeInfo)) { - QBackendNodePrivate::get(std::get<0>(subNodeInfo))->addedToEntity(nodeChange.node); - } else { - QComponentAddedChange change(qobject_cast(nodeChange.subNode), qobject_cast(nodeChange.node)); - QComponentAddedChangePtr pChange(&change, [](QComponentAddedChange *) { }); - std::get<0>(subNodeInfo)->sceneChangeEvent(pChange); - } - } - break; - case ComponentRemoved: { - // let the entity know a component was removed - if (std::get<1>(nodeInfo)) { - QBackendNodePrivate::get(std::get<0>(nodeInfo))->componentRemoved(nodeChange.subNode); - } else { - QComponentRemovedChange change(qobject_cast(nodeChange.subNode), qobject_cast(nodeChange.node)); - QComponentRemovedChangePtr pChange(&change, [](QComponentRemovedChange *) { }); - std::get<0>(nodeInfo)->sceneChangeEvent(pChange); - } - - // let the component know it was removed from an entity - if (std::get<1>(subNodeInfo)) { - QBackendNodePrivate::get(std::get<0>(subNodeInfo))->removedFromEntity(nodeChange.node); - } else { - QComponentRemovedChange change(qobject_cast(nodeChange.node), qobject_cast(nodeChange.subNode)); - QComponentRemovedChangePtr pChange(&change, [](QComponentRemovedChange *) { }); - std::get<0>(nodeInfo)->sceneChangeEvent(pChange); - } - } - break; - default: + switch (change.change) { + case ComponentRelationshipChange::Added: + QBackendNodePrivate::get(entityBackend)->componentAdded(change.subNode); + QBackendNodePrivate::get(componentBackend)->addedToEntity(change.node); + break; + case ComponentRelationshipChange::Removed: + QBackendNodePrivate::get(entityBackend)->componentRemoved(change.subNode); + QBackendNodePrivate::get(componentBackend)->removedFromEntity(change.node); break; } } } -void QAbstractAspectPrivate::syncDirtyFrontEndNode(QNode *node, QBackendNode *backend, bool firstTime) const -{ - Q_ASSERT(false); // overload in derived class - if (!firstTime) - sendPropertyMessages(node, backend); -} - -void QAbstractAspectPrivate::sendPropertyMessages(QNode *node, QBackendNode *backend) const +void QAbstractAspectPrivate::syncDirtyFrontEndNode(QNode *, QBackendNode *, bool) const { - const int offset = QNode::staticMetaObject.propertyOffset(); - const auto metaObj = node->metaObject(); - const int count = metaObj->propertyCount(); - - const auto toBackendValue = [](const QVariant &data) -> QVariant - { - if (data.canConvert()) { - QNode *node = data.value(); - - // Ensure the node and all ancestors have issued their node creation changes. - // We can end up here if a newly created node with a parent is immediately set - // as a property on another node. In this case the deferred call to - // _q_postConstructorInit() will not have happened yet as the event - // loop will still be blocked. We need to do this for all ancestors, - // since the subtree of this node otherwise can end up on the backend - // with a reference to a non-existent parent. - if (node) - QNodePrivate::get(node)->_q_ensureBackendNodeCreated(); - - const QNodeId id = node ? node->id() : QNodeId(); - return QVariant::fromValue(id); - } - - return data; - }; - - QPropertyUpdatedChange change(node->id()); - QPropertyUpdatedChangePtr pchange(&change, [](QPropertyUpdatedChange *) { }); - for (int index = offset; index < count; index++) { - const QMetaProperty pro = metaObj->property(index); - change.setPropertyName(pro.name()); - change.setValue(toBackendValue(pro.read(node))); - backend->sceneChangeEvent(pchange); - } - - auto const dynamicProperties = node->dynamicPropertyNames(); - for (const QByteArray &name: dynamicProperties) { - change.setPropertyName(name.data()); - change.setValue(toBackendValue(node->property(name.data()))); - backend->sceneChangeEvent(pchange); - } + // this would usually be overloaded in derived aspect classes } QBackendNode *QAbstractAspectPrivate::createBackendNode(const NodeTreeChange &change) const { const QMetaObject *metaObj = change.metaObj; - const BackendNodeMapperAndInfo backendNodeMapperInfo = mapperForNode(metaObj); - const QBackendNodeMapperPtr backendNodeMapper = backendNodeMapperInfo.first; + const QBackendNodeMapperPtr backendNodeMapper = mapperForNode(metaObj); if (!backendNodeMapper) return nullptr; @@ -405,23 +276,14 @@ QBackendNode *QAbstractAspectPrivate::createBackendNode(const NodeTreeChange &ch return backend; QNode *node = change.node; - QNodeCreatedChangeBasePtr creationChange; - const bool supportsSyncing = backendNodeMapperInfo.second & SupportsSyncing; - if (supportsSyncing) { - // All objects modified to use syncing should only use the id in the creation functor - QNodeCreatedChangeBase changeObj(node); - creationChange = QNodeCreatedChangeBasePtr(&changeObj, [](QNodeCreatedChangeBase *) {}); - backend = backendNodeMapper->create(creationChange); - } else { - creationChange = node->createNodeCreationChange(); - backend = backendNodeMapper->create(creationChange); - } + QNodeId nodeId = qIdForNode(node); + backend = backendNodeMapper->create(nodeId); if (!backend) return nullptr; // TODO: Find some place else to do all of this function from the arbiter - backend->setPeerId(change.id); + backend->setPeerId(nodeId); // Backend could be null if the user decides that his functor should only // perform some action when encountering a given type of item but doesn't need to @@ -430,20 +292,7 @@ QBackendNode *QAbstractAspectPrivate::createBackendNode(const NodeTreeChange &ch QBackendNodePrivate *backendPriv = QBackendNodePrivate::get(backend); backendPriv->setEnabled(node->isEnabled()); - // TO DO: Find a way to specify the changes to observe - // Register backendNode with QChangeArbiter - if (m_arbiter != nullptr) { // Unit tests may not have the arbiter registered - qCDebug(Nodes) << q_func()->objectName() << "Creating backend node for node id" - << node->id() << "of type" << QNodePrivate::get(node)->m_typeInfo->className(); - m_arbiter->registerObserver(backendPriv, backend->peerId(), AllChanges); - if (backend->mode() == QBackendNode::ReadWrite) - m_arbiter->scene()->addObservable(backendPriv, backend->peerId()); - } - - if (supportsSyncing) - syncDirtyFrontEndNode(node, backend, true); - else - backend->initializeFromPeer(creationChange); + syncDirtyFrontEndNode(node, backend, true); return backend; } @@ -451,23 +300,12 @@ QBackendNode *QAbstractAspectPrivate::createBackendNode(const NodeTreeChange &ch void QAbstractAspectPrivate::clearBackendNode(const NodeTreeChange &change) const { const QMetaObject *metaObj = change.metaObj; - const BackendNodeMapperAndInfo backendNodeMapperInfo = mapperForNode(metaObj); - const QBackendNodeMapperPtr backendNodeMapper = backendNodeMapperInfo.first; + const QBackendNodeMapperPtr backendNodeMapper = mapperForNode(metaObj); if (!backendNodeMapper) return; - // Request the mapper to destroy the corresponding backend node - QBackendNode *backend = backendNodeMapper->get(change.id); - if (backend) { - qCDebug(Nodes) << "Deleting backend node for node id" - << change.id << "of type" << metaObj->className(); - QBackendNodePrivate *backendPriv = QBackendNodePrivate::get(backend); - m_arbiter->unregisterObserver(backendPriv, backend->peerId()); - if (backend->mode() == QBackendNode::ReadWrite) - m_arbiter->scene()->removeObservable(backendPriv, backend->peerId()); - backendNodeMapper->destroy(change.id); - } + backendNodeMapper->destroy(change.id); } void QAbstractAspectPrivate::setRootAndCreateNodes(QEntity *rootObject, const QVector &nodesChanges) diff --git a/src/core/aspects/qabstractaspect.h b/src/core/aspects/qabstractaspect.h index 3b2f31c50..e15b987c1 100644 --- a/src/core/aspects/qabstractaspect.h +++ b/src/core/aspects/qabstractaspect.h @@ -42,7 +42,6 @@ #include #include -#include #include #include @@ -78,10 +77,7 @@ protected: template void registerBackendType(const QBackendNodeMapperPtr &functor); - template - void registerBackendType(const QBackendNodeMapperPtr &functor); void registerBackendType(const QMetaObject &obj, const QBackendNodeMapperPtr &functor); - void registerBackendType(const QMetaObject &obj, const QBackendNodeMapperPtr &functor, bool supportsSyncing); template void unregisterBackendType(); void unregisterBackendType(const QMetaObject &); @@ -108,12 +104,6 @@ void QAbstractAspect::registerBackendType(const QBackendNodeMapperPtr &functor) registerBackendType(Frontend::staticMetaObject, functor); } -template -void QAbstractAspect::registerBackendType(const QBackendNodeMapperPtr &functor) -{ - registerBackendType(Frontend::staticMetaObject, functor, supportsSyncing); -} - template void QAbstractAspect::unregisterBackendType() { @@ -128,7 +118,6 @@ QT_END_NAMESPACE QT_BEGIN_NAMESPACE \ namespace Qt3DCore { \ typedef QAbstractAspect *(*AspectCreateFunction)(QObject *); \ - QT_DEPRECATED Q_3DCORESHARED_EXPORT void qt3d_QAspectFactory_addDefaultFactory(const QString &, const QMetaObject *, AspectCreateFunction); \ Q_3DCORESHARED_EXPORT void qt3d_QAspectFactory_addDefaultFactory(const QLatin1String &, const QMetaObject *, AspectCreateFunction); \ } \ QT_END_NAMESPACE \ diff --git a/src/core/aspects/qabstractaspect_p.h b/src/core/aspects/qabstractaspect_p.h index dd13ac5bf..eed85433f 100644 --- a/src/core/aspects/qabstractaspect_p.h +++ b/src/core/aspects/qabstractaspect_p.h @@ -52,12 +52,11 @@ // #include -#include #include #include #include -#include +#include #include #include @@ -72,7 +71,6 @@ class QBackendNode; class QEntity; class QAspectManager; class QAbstractAspectJobManager; -class QChangeArbiter; class QServiceLocator; namespace Debug { @@ -133,7 +131,7 @@ public: QBackendNode *createBackendNode(const NodeTreeChange &change) const; void clearBackendNode(const NodeTreeChange &change) const; void syncDirtyFrontEndNodes(const QVector &nodes); - void syncDirtyFrontEndSubNodes(const QVector &nodes); + void syncDirtyEntityComponentNodes(const QVector &nodes); virtual void syncDirtyFrontEndNode(QNode *node, QBackendNode *backend, bool firstTime) const; void sendPropertyMessages(QNode *node, QBackendNode *backend) const; @@ -146,19 +144,14 @@ public: Q_DECLARE_PUBLIC(QAbstractAspect) - enum NodeMapperInfo { - DefaultMapper = 0, - SupportsSyncing = 1 << 0 - }; - using BackendNodeMapperAndInfo = QPair; - BackendNodeMapperAndInfo mapperForNode(const QMetaObject *metaObj) const; + QBackendNodeMapperPtr mapperForNode(const QMetaObject *metaObj) const; QEntity *m_root; QNodeId m_rootId; QAspectManager *m_aspectManager; QAbstractAspectJobManager *m_jobManager; QChangeArbiter *m_arbiter; - QHash m_backendCreatorFunctors; + QHash m_backendCreatorFunctors; QMutex m_singleShotMutex; QVector m_singleShotJobs; diff --git a/src/core/aspects/qaspectengine.cpp b/src/core/aspects/qaspectengine.cpp index d28306197..c11de2e26 100644 --- a/src/core/aspects/qaspectengine.cpp +++ b/src/core/aspects/qaspectengine.cpp @@ -52,7 +52,6 @@ #include #include #include -#include #include #include #include @@ -115,17 +114,14 @@ QAspectEnginePrivate *QAspectEnginePrivate::get(QAspectEngine *q) QAspectEnginePrivate::QAspectEnginePrivate() : QObjectPrivate() , m_aspectManager(nullptr) - , m_postman(nullptr) , m_scene(nullptr) , m_initialized(false) , m_runMode(QAspectEngine::Automatic) { qRegisterMetaType(); - qRegisterMetaType(); qRegisterMetaType(); qRegisterMetaType(); qRegisterMetaType(); - qRegisterMetaType(); } QAspectEnginePrivate::~QAspectEnginePrivate() @@ -226,8 +222,6 @@ QAspectEngine::QAspectEngine(QObject *parent) qCDebug(Aspects) << Q_FUNC_INFO; Q_D(QAspectEngine); d->m_scene = new QScene(this); - d->m_postman = new QPostman(this); - d->m_postman->setScene(d->m_scene); d->m_aspectManager = new QAspectManager(this); } @@ -248,7 +242,6 @@ QAspectEngine::~QAspectEngine() for (auto aspect : aspects) unregisterAspect(aspect); - delete d->m_postman; delete d->m_scene; } @@ -265,8 +258,6 @@ void QAspectEnginePrivate::initialize() m_aspectManager->initialize(); QChangeArbiter *arbiter = m_aspectManager->changeArbiter(); m_scene->setArbiter(arbiter); - QChangeArbiter::createUnmanagedThreadLocalChangeQueue(arbiter); - arbiter->setPostman(m_postman); arbiter->setScene(m_scene); m_initialized = true; m_aspectManager->setPostConstructorInit(m_scene->postConstructorInit()); @@ -283,19 +274,12 @@ void QAspectEnginePrivate::shutdown() { qCDebug(Aspects) << Q_FUNC_INFO; - // Flush any change batch waiting in the postman that may contain node - // destruction changes that the aspects should process before we exit - // the simulation loop - m_postman->submitChangeBatch(); - // Exit the simulation loop. Waits for this to be completed on the aspect // thread before returning exitSimulationLoop(); // Cleanup the scene before quitting the backend m_scene->setArbiter(nullptr); - QChangeArbiter *arbiter = m_aspectManager->changeArbiter(); - QChangeArbiter::destroyUnmanagedThreadLocalChangeQueue(arbiter); m_initialized = false; } diff --git a/src/core/aspects/qaspectengine_p.h b/src/core/aspects/qaspectengine_p.h index 8f3abcd38..47a756511 100644 --- a/src/core/aspects/qaspectengine_p.h +++ b/src/core/aspects/qaspectengine_p.h @@ -52,7 +52,6 @@ // #include -#include #include #include @@ -66,7 +65,6 @@ namespace Qt3DCore { class QEntity; class QNode; class QAspectManager; -class QPostman; class QScene; class Q_3DCORE_PRIVATE_EXPORT QAspectEnginePrivate : public QObjectPrivate @@ -79,7 +77,6 @@ public: QAspectFactory m_factory; QAspectManager *m_aspectManager; - QPostman *m_postman; QScene *m_scene; QSharedPointer m_root; QVector m_aspects; diff --git a/src/core/aspects/qaspectfactory.cpp b/src/core/aspects/qaspectfactory.cpp index 2f1530257..5528a9966 100644 --- a/src/core/aspects/qaspectfactory.cpp +++ b/src/core/aspects/qaspectfactory.cpp @@ -60,15 +60,6 @@ Q_3DCORESHARED_EXPORT void qt3d_QAspectFactory_addDefaultFactory(const QLatin1St defaultAspectNames->insert(metaObject, name); } -Q_3DCORESHARED_EXPORT void qt3d_QAspectFactory_addDefaultFactory(const QString &name, - const QMetaObject *metaObject, - QAspectFactory::CreateFunction factory) -{ - return qt3d_QAspectFactory_addDefaultFactory(QLatin1String(name.toLatin1()), - metaObject, - factory); -} - QAspectFactory::QAspectFactory() : m_factories(*defaultFactories), m_aspectNames(*defaultAspectNames) diff --git a/src/core/aspects/qaspectmanager.cpp b/src/core/aspects/qaspectmanager.cpp index f0dc366b2..225d7550e 100644 --- a/src/core/aspects/qaspectmanager.cpp +++ b/src/core/aspects/qaspectmanager.cpp @@ -217,9 +217,6 @@ void QAspectManager::exitSimulationLoop() for (QAbstractAspect *aspect : qAsConst(m_aspects)) aspect->d_func()->onEngineAboutToShutdown(); - // Process any pending changes from the frontend before we shut the aspects down - m_changeArbiter->syncChanges(); - // Give aspects a chance to perform any shutdown actions. This may include unqueuing // any blocking work on the main thread that could potentially deadlock during shutdown. qCDebug(Aspects) << "Calling onEngineShutdown() for each aspect"; @@ -249,7 +246,6 @@ void QAspectManager::initialize() qCDebug(Aspects) << Q_FUNC_INFO; m_jobManager->initialize(); m_scheduler->setAspectManager(this); - m_changeArbiter->initialize(m_jobManager); } /*! @@ -517,21 +513,16 @@ void QAspectManager::processFrame() } // Sync node / subnode relationship changes - const auto dirtySubNodes = m_changeArbiter->takeDirtyFrontEndSubNodes(); + const auto dirtySubNodes = m_changeArbiter->takeDirtyEntityComponentNodes(); if (dirtySubNodes.size()) for (QAbstractAspect *aspect : qAsConst(m_aspects)) - QAbstractAspectPrivate::get(aspect)->syncDirtyFrontEndSubNodes(dirtySubNodes); + QAbstractAspectPrivate::get(aspect)->syncDirtyEntityComponentNodes(dirtySubNodes); // Sync property updates const auto dirtyFrontEndNodes = m_changeArbiter->takeDirtyFrontEndNodes(); if (dirtyFrontEndNodes.size()) for (QAbstractAspect *aspect : qAsConst(m_aspects)) QAbstractAspectPrivate::get(aspect)->syncDirtyFrontEndNodes(dirtyFrontEndNodes); - - // TO DO: Having this done in the main thread actually means aspects could just - // as simply read info out of the Frontend classes without risk of introducing - // races. This could therefore be removed for Qt 6. - m_changeArbiter->syncChanges(); } // For each Aspect diff --git a/src/core/aspects/qaspectmanager_p.h b/src/core/aspects/qaspectmanager_p.h index 2038e0822..e6772e095 100644 --- a/src/core/aspects/qaspectmanager_p.h +++ b/src/core/aspects/qaspectmanager_p.h @@ -51,8 +51,8 @@ // We mean it. // -#include #include +#include #include #include #include diff --git a/src/core/changes/changes.pri b/src/core/changes/changes.pri deleted file mode 100644 index 39c6a4022..000000000 --- a/src/core/changes/changes.pri +++ /dev/null @@ -1,63 +0,0 @@ -INCLUDEPATH += $$PWD - -HEADERS += \ - $$PWD/qscenechange.h \ - $$PWD/qscenechange_p.h \ - $$PWD/qnodecreatedchange_p.h \ - $$PWD/qnodecreatedchange.h \ - $$PWD/qcomponentaddedchange.h \ - $$PWD/qcomponentaddedchange_p.h \ - $$PWD/qcomponentremovedchange.h \ - $$PWD/qcomponentremovedchange_p.h \ - $$PWD/qnodedestroyedchange.h \ - $$PWD/qnodedestroyedchange_p.h \ - $$PWD/qpropertyvalueaddedchangebase.h \ - $$PWD/qpropertyvalueaddedchangebase_p.h \ - $$PWD/qpropertyvalueremovedchangebase.h \ - $$PWD/qpropertyvalueremovedchangebase_p.h \ - $$PWD/qpropertyupdatedchangebase.h \ - $$PWD/qpropertyupdatedchangebase_p.h \ - $$PWD/qdynamicpropertyupdatedchange_p.h \ - $$PWD/qdynamicpropertyupdatedchange.h \ - $$PWD/qstaticpropertyupdatedchangebase.h \ - $$PWD/qstaticpropertyupdatedchangebase_p.h \ - $$PWD/qpropertyupdatedchange.h \ - $$PWD/qpropertyupdatedchange_p.h \ - $$PWD/qtypedpropertyupdatechange_p.h \ - $$PWD/qstaticpropertyvalueaddedchangebase.h \ - $$PWD/qstaticpropertyvalueaddedchangebase_p.h \ - $$PWD/qstaticpropertyvalueremovedchangebase.h \ - $$PWD/qstaticpropertyvalueremovedchangebase_p.h \ - $$PWD/qpropertynodeaddedchange.h \ - $$PWD/qpropertynodeaddedchange_p.h \ - $$PWD/qpropertynoderemovedchange_p.h \ - $$PWD/qpropertynoderemovedchange.h \ - $$PWD/qpropertyvalueaddedchange.h \ - $$PWD/qpropertyvalueaddedchange_p.h \ - $$PWD/qpropertyvalueremovedchange.h \ - $$PWD/qpropertyvalueremovedchange_p.h \ - $$PWD/qnodecommand.h \ - $$PWD/qnodecommand_p.h \ - $$PWD/qskeletoncreatedchange_p.h \ - $$PWD/qskeletoncreatedchange_p_p.h - -SOURCES += \ - $$PWD/qscenechange.cpp \ - $$PWD/qnodecreatedchange.cpp \ - $$PWD/qnodedestroyedchange.cpp \ - $$PWD/qcomponentaddedchange.cpp \ - $$PWD/qcomponentremovedchange.cpp \ - $$PWD/qpropertyvalueaddedchangebase.cpp \ - $$PWD/qpropertyvalueremovedchangebase.cpp \ - $$PWD/qpropertyupdatedchangebase.cpp \ - $$PWD/qdynamicpropertyupdatedchange.cpp \ - $$PWD/qstaticpropertyupdatedchangebase.cpp \ - $$PWD/qpropertyupdatedchange.cpp \ - $$PWD/qstaticpropertyvalueaddedchangebase.cpp \ - $$PWD/qstaticpropertyvalueremovedchangebase.cpp \ - $$PWD/qpropertynodeaddedchange.cpp \ - $$PWD/qpropertynoderemovedchange.cpp \ - $$PWD/qpropertyvalueaddedchange.cpp \ - $$PWD/qpropertyvalueremovedchange.cpp \ - $$PWD/qnodecommand.cpp \ - $$PWD/qskeletoncreatedchange.cpp diff --git a/src/core/changes/qcomponentaddedchange.cpp b/src/core/changes/qcomponentaddedchange.cpp deleted file mode 100644 index 50d7fd237..000000000 --- a/src/core/changes/qcomponentaddedchange.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qcomponentaddedchange.h" -#include "qcomponentaddedchange_p.h" - -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QComponentAddedChangePrivate::QComponentAddedChangePrivate(const QEntity *entity, - const QComponent *component) - : QSceneChangePrivate() - , m_entityId(entity->id()) - , m_componentId(component->id()) - , m_componentMetaObject(QNodePrivate::findStaticMetaObject(component->metaObject())) -{ -} - -/*! - * \class Qt3DCore::QComponentAddedChange - * \inheaderfile Qt3DCore/QComponentAddedChange - * \inherits Qt3DCore::QSceneChange - * \inmodule Qt3DCore - * \brief The QComponentAddedChange class is used to notify when a component is added to an entity. - * - */ - -/*! - * \typedef Qt3DCore::QComponentAddedChangePtr - * \relates Qt3DCore::QComponentAddedChange - * - * A shared pointer for QComponentAddedChange. - */ - -/*! - * Constructs a new QComponentAddedChange which will notify \a entity that \a component was added - */ -QComponentAddedChange::QComponentAddedChange(const QEntity *entity, - const QComponent *component) - : QSceneChange(*new QComponentAddedChangePrivate(entity, component), - ComponentAdded, entity->id()) -{ -} - -/*! - * Constructs a new QComponentAddedChange which will notify \a component that it was added to \a entity - */ -QComponentAddedChange::QComponentAddedChange(const QComponent *component, - const QEntity *entity) - : QSceneChange(*new QComponentAddedChangePrivate(entity, component), - ComponentAdded, component->id()) -{ -} - -QComponentAddedChange::~QComponentAddedChange() -{ -} - -/*! - \return the id of the entity the component was added to. - */ -QNodeId QComponentAddedChange::entityId() const Q_DECL_NOTHROW -{ - Q_D(const QComponentAddedChange); - return d->m_entityId; -} - -/*! - \return the id of the component added. - */ -QNodeId QComponentAddedChange::componentId() const Q_DECL_NOTHROW -{ - Q_D(const QComponentAddedChange); - return d->m_componentId; -} - -/*! - * \return the metaobject. - */ -const QMetaObject *QComponentAddedChange::componentMetaObject() const Q_DECL_NOTHROW -{ - Q_D(const QComponentAddedChange); - return d->m_componentMetaObject; -} - -QT_END_NAMESPACE - -} // namespace Qt3DCore - diff --git a/src/core/changes/qcomponentaddedchange.h b/src/core/changes/qcomponentaddedchange.h deleted file mode 100644 index 9e1522024..000000000 --- a/src/core/changes/qcomponentaddedchange.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QCOMPONENTADDEDCHANGE_H -#define QT3DCORE_QCOMPONENTADDEDCHANGE_H - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QComponent; -class QEntity; -class QComponentAddedChangePrivate; - -class Q_3DCORESHARED_EXPORT QComponentAddedChange : public QSceneChange -{ -public: - Q3D_DECL_DEPRECATED explicit QComponentAddedChange(const QEntity *entity, - const QComponent *component); - Q3D_DECL_DEPRECATED explicit QComponentAddedChange(const QComponent *component, - const QEntity *entity); - ~QComponentAddedChange(); - - QNodeId entityId() const Q_DECL_NOTHROW; - QNodeId componentId() const Q_DECL_NOTHROW; - const QMetaObject *componentMetaObject() const Q_DECL_NOTHROW; - -private: - Q_DECLARE_PRIVATE(QComponentAddedChange) -}; - -Q3D_DECL_DEPRECATED typedef QSharedPointer QComponentAddedChangePtr; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QCOMPONENTADDEDCHANGE_H diff --git a/src/core/changes/qcomponentaddedchange_p.h b/src/core/changes/qcomponentaddedchange_p.h deleted file mode 100644 index 2a600288d..000000000 --- a/src/core/changes/qcomponentaddedchange_p.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QCOMPONENTADDEDCHANGE_P_H -#define QT3DCORE_QCOMPONENTADDEDCHANGE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -#include -#include - -struct QMetaObject; - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QComponent; -class QEntity; - -class Q_3DCORE_PRIVATE_EXPORT QComponentAddedChangePrivate : public QSceneChangePrivate -{ -public: - QComponentAddedChangePrivate(const QEntity *entity, const QComponent *component); - - QNodeId m_entityId; - QNodeId m_componentId; - const QMetaObject *m_componentMetaObject; -}; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QCOMPONENTADDEDCHANGE_P_H - diff --git a/src/core/changes/qcomponentremovedchange.cpp b/src/core/changes/qcomponentremovedchange.cpp deleted file mode 100644 index f338f11af..000000000 --- a/src/core/changes/qcomponentremovedchange.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qcomponentremovedchange.h" -#include "qcomponentremovedchange_p.h" - -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QComponentRemovedChangePrivate::QComponentRemovedChangePrivate(const QEntity *entity, - const QComponent *component) - : QSceneChangePrivate() - , m_entityId(entity->id()) - , m_componentId(component->id()) - , m_componentMetaObject(QNodePrivate::findStaticMetaObject(component->metaObject())) -{ -} - -/*! - * \class Qt3DCore::QComponentRemovedChange - * \inheaderfile Qt3DCore/QComponentRemovedChange - * \inherits Qt3DCore::QSceneChange - * \inmodule Qt3DCore - * \brief The QComponentRemovedChange class is used to notify when a component is removed from an entity. - * - */ - -/*! - * \typedef Qt3DCore::QComponentRemovedChangePtr - * \relates Qt3DCore::QComponentRemovedChange - * - * A shared pointer for QComponentRemovedChange. - */ - -/*! - * Constructs a new QComponentRemovedChange which will notify \a entity that \a component was removed. - */ -QComponentRemovedChange::QComponentRemovedChange(const QEntity *entity, - const QComponent *component) - : QSceneChange(*new QComponentRemovedChangePrivate(entity, component), - ComponentRemoved, entity->id()) -{ -} - -/*! - * Constructs a new QComponentRemovedChange which will notify \a component that it was removed from \a entity - */ -QComponentRemovedChange::QComponentRemovedChange(const QComponent *component, - const QEntity *entity) - : QSceneChange(*new QComponentRemovedChangePrivate(entity, component), - ComponentRemoved, component->id()) -{ - -} - -QComponentRemovedChange::~QComponentRemovedChange() -{ -} - -/*! - \return the id of the entity the component was removed from. - */ -QNodeId QComponentRemovedChange::entityId() const Q_DECL_NOTHROW -{ - Q_D(const QComponentRemovedChange); - return d->m_entityId; -} - -/*! - \return the id of the component removed. - */ -QNodeId QComponentRemovedChange::componentId() const Q_DECL_NOTHROW -{ - Q_D(const QComponentRemovedChange); - return d->m_componentId; -} - -/*! - * \return the metaobject. - */ -const QMetaObject *QComponentRemovedChange::componentMetaObject() const Q_DECL_NOTHROW -{ - Q_D(const QComponentRemovedChange); - return d->m_componentMetaObject; -} - -QT_END_NAMESPACE - -} // namespace Qt3DCore - diff --git a/src/core/changes/qcomponentremovedchange.h b/src/core/changes/qcomponentremovedchange.h deleted file mode 100644 index e0b039780..000000000 --- a/src/core/changes/qcomponentremovedchange.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QCOMPONENTREMOVEDCHANGE_H -#define QT3DCORE_QCOMPONENTREMOVEDCHANGE_H - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QComponent; -class QEntity; -class QComponentRemovedChangePrivate; - -class Q_3DCORESHARED_EXPORT QComponentRemovedChange : public QSceneChange -{ -public: - Q3D_DECL_DEPRECATED explicit QComponentRemovedChange(const QEntity *entity, - const QComponent *component); - Q3D_DECL_DEPRECATED explicit QComponentRemovedChange(const QComponent *component, - const QEntity *entity); - ~QComponentRemovedChange(); - - QNodeId entityId() const Q_DECL_NOTHROW; - QNodeId componentId() const Q_DECL_NOTHROW; - const QMetaObject *componentMetaObject() const Q_DECL_NOTHROW; - -private: - Q_DECLARE_PRIVATE(QComponentRemovedChange) -}; - -Q3D_DECL_DEPRECATED typedef QSharedPointer QComponentRemovedChangePtr; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QCOMPONENTREMOVEDCHANGE_H diff --git a/src/core/changes/qcomponentremovedchange_p.h b/src/core/changes/qcomponentremovedchange_p.h deleted file mode 100644 index fe84da252..000000000 --- a/src/core/changes/qcomponentremovedchange_p.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QCOMPONENTREMOVEDCHANGE_P_H -#define QT3DCORE_QCOMPONENTREMOVEDCHANGE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -#include -#include - -struct QMetaObject; - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QComponent; -class QEntity; - -class Q_3DCORE_PRIVATE_EXPORT QComponentRemovedChangePrivate : public QSceneChangePrivate -{ -public: - QComponentRemovedChangePrivate(const QEntity *entity, const QComponent *component); - - QNodeId m_entityId; - QNodeId m_componentId; - const QMetaObject *m_componentMetaObject; -}; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QCOMPONENTREMOVEDCHANGE_P_H - diff --git a/src/core/changes/qdynamicpropertyupdatedchange.cpp b/src/core/changes/qdynamicpropertyupdatedchange.cpp deleted file mode 100644 index 30e541a0d..000000000 --- a/src/core/changes/qdynamicpropertyupdatedchange.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdynamicpropertyupdatedchange.h" -#include "qdynamicpropertyupdatedchange_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QDynamicPropertyUpdatedChangePrivate::QDynamicPropertyUpdatedChangePrivate() - : QPropertyUpdatedChangeBasePrivate() -{ -} - -QDynamicPropertyUpdatedChangePrivate::~QDynamicPropertyUpdatedChangePrivate() -{ -} - -/*! - * \class Qt3DCore::QDynamicPropertyUpdatedChange - * \inheaderfile Qt3DCore/QDynamicPropertyUpdatedChange - * \inherits Qt3DCore::QPropertyUpdatedChangeBase - * \inmodule Qt3DCore - * \brief The QDynamicPropertyUpdatedChange class is used to notify when a dynamic property value is updated. - * - */ - -/*! - * \typedef Qt3DCore::QDynamicPropertyUpdatedChangePtr - * \relates Qt3DCore::QDynamicPropertyUpdatedChange - * - * A shared pointer for QDynamicPropertyUpdatedChange. - */ - -/*! - * Constructs a new QDynamicPropertyUpdatedChange with \a subjectId. - */ -QDynamicPropertyUpdatedChange::QDynamicPropertyUpdatedChange(QNodeId subjectId) - : QPropertyUpdatedChangeBase(*new QDynamicPropertyUpdatedChangePrivate, subjectId) -{ -} - -QDynamicPropertyUpdatedChange::QDynamicPropertyUpdatedChange(QDynamicPropertyUpdatedChangePrivate &dd, - QNodeId subjectId) - : QPropertyUpdatedChangeBase(dd, subjectId) -{ -} - -QDynamicPropertyUpdatedChange::~QDynamicPropertyUpdatedChange() -{ -} - -/*! - * \return name of the property. - */ -QByteArray QDynamicPropertyUpdatedChange::propertyName() const -{ - Q_D(const QDynamicPropertyUpdatedChange); - return d->m_propertyName; -} - -/*! - * Sets the property change \a name. - */ -void QDynamicPropertyUpdatedChange::setPropertyName(const QByteArray &name) -{ - Q_D(QDynamicPropertyUpdatedChange); - d->m_propertyName = name; -} - -/*! - * \return property value. - */ -QVariant QDynamicPropertyUpdatedChange::value() const -{ - Q_D(const QDynamicPropertyUpdatedChange); - return d->m_value; -} - -/*! - * Set the property change \a value. - */ -void QDynamicPropertyUpdatedChange::setValue(const QVariant &value) -{ - Q_D(QDynamicPropertyUpdatedChange); - d->m_value = value; -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/changes/qdynamicpropertyupdatedchange.h b/src/core/changes/qdynamicpropertyupdatedchange.h deleted file mode 100644 index 7009e1fe7..000000000 --- a/src/core/changes/qdynamicpropertyupdatedchange.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QDYNAMICPROPERTYUPDATEDCHANGE_H -#define QT3DCORE_QDYNAMICPROPERTYUPDATEDCHANGE_H - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QDynamicPropertyUpdatedChangePrivate; - -class Q_3DCORESHARED_EXPORT QDynamicPropertyUpdatedChange : public QPropertyUpdatedChangeBase -{ -public: - Q3D_DECL_DEPRECATED explicit QDynamicPropertyUpdatedChange(QNodeId subjectId); - ~QDynamicPropertyUpdatedChange(); - - QByteArray propertyName() const; - void setPropertyName(const QByteArray &name); - - QVariant value() const; - void setValue(const QVariant &value); - -protected: - Q_DECLARE_PRIVATE(QDynamicPropertyUpdatedChange) - QDynamicPropertyUpdatedChange(QDynamicPropertyUpdatedChangePrivate &dd, QNodeId subjectId); -}; - -Q3D_DECL_DEPRECATED typedef QSharedPointer QDynamicPropertyUpdatedChangePtr; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QNODEDYNAMICPROPERTYUPDATEDCHANGE_H diff --git a/src/core/changes/qdynamicpropertyupdatedchange_p.h b/src/core/changes/qdynamicpropertyupdatedchange_p.h deleted file mode 100644 index 233d55c8e..000000000 --- a/src/core/changes/qdynamicpropertyupdatedchange_p.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QDYNAMICPROPERTYUPDATEDCHANGE_P_H -#define QT3DCORE_QDYNAMICPROPERTYUPDATEDCHANGE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyUpdatedChange; -class QFrameAllocator; - -class Q_3DCORE_PRIVATE_EXPORT QDynamicPropertyUpdatedChangePrivate : public QPropertyUpdatedChangeBasePrivate -{ -public: - QDynamicPropertyUpdatedChangePrivate(); - virtual ~QDynamicPropertyUpdatedChangePrivate(); - - Q_DECLARE_PUBLIC(QDynamicPropertyUpdatedChange) - - QByteArray m_propertyName; - QVariant m_value; -}; - -} // Qt3D - -QT_END_NAMESPACE - -#endif // QT3DCORE_QDYNAMICPROPERTYUPDATEDCHANGE_P_H - diff --git a/src/core/changes/qnodecommand.cpp b/src/core/changes/qnodecommand.cpp deleted file mode 100644 index 0836da6e7..000000000 --- a/src/core/changes/qnodecommand.cpp +++ /dev/null @@ -1,162 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qnodecommand.h" -#include "qnodecommand_p.h" -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QNodeCommandPrivate::QNodeCommandPrivate() - : QSceneChangePrivate() - , m_commandId(createId()) - , m_replyToCommandId() -{ -} - -QNodeCommandPrivate::~QNodeCommandPrivate() -{ -} - -QNodeCommand::CommandId QNodeCommandPrivate::createId() -{ - static QBasicAtomicInteger next = Q_BASIC_ATOMIC_INITIALIZER(0); - return next.fetchAndAddRelaxed(1) + 1; -} - -/*! - * \class Qt3DCore::QNodeCommand - * \inheaderfile Qt3DCore/QNodeCommand - * \inherits Qt3DCore::QSceneChange - * \inmodule Qt3DCore - * \since 5.10 - * \brief The QNodeCommand class is the base class for all CommandRequested QSceneChange events. - * - * The QNodeCommand class is the base class for all QSceneChange events that - * have the changeType() CommandRequested. - * - * You can subclass this to create your own node update types for communication between - * your QNode and QBackendNode subclasses when writing your own aspects. - */ - -/*! - * \typedef Qt3DCore::QNodeCommandPtr - * \relates Qt3DCore::QNodeCommand - * - * A shared pointer for QNodeCommand. - */ - -/*! - * \typedef QNodeCommand::CommandId - * - * Type of the command id, defined either as quint64 or quint32 - * depending on the platform support. - */ - -/*! - * Constructs a new QNodeCommand with \a id. - */ -QNodeCommand::QNodeCommand(QNodeId id) - : QSceneChange(*new QNodeCommandPrivate(), CommandRequested, id) -{ -} - -QNodeCommand::QNodeCommand(QNodeCommandPrivate &dd, QNodeId id) - : QSceneChange(dd, CommandRequested, id) -{ -} - -QNodeCommand::~QNodeCommand() -{ -} - -/*! - * \return commandId. - */ -QNodeCommand::CommandId QNodeCommand::commandId() const -{ - Q_D(const QNodeCommand); - return d->m_commandId; -} - -/*! - * \return name. - */ -QString QNodeCommand::name() const -{ - Q_D(const QNodeCommand); - return d->m_name; -} - -void QNodeCommand::setName(const QString &name) -{ - Q_D(QNodeCommand); - d->m_name = name; -} - -/*! - * \return data. - */ -QVariant QNodeCommand::data() const -{ - Q_D(const QNodeCommand); - return d->m_data; -} - -void QNodeCommand::setData(const QVariant &data) -{ - Q_D(QNodeCommand); - d->m_data = data; -} - -QNodeCommand::CommandId QNodeCommand::inReplyTo() const -{ - Q_D(const QNodeCommand); - return d->m_replyToCommandId; -} - -void QNodeCommand::setReplyToCommandId(QNodeCommand::CommandId id) -{ - Q_D(QNodeCommand); - d->m_replyToCommandId = id; -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/changes/qnodecommand.h b/src/core/changes/qnodecommand.h deleted file mode 100644 index a31af1d6d..000000000 --- a/src/core/changes/qnodecommand.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QNODECOMMAND_H -#define QT3DCORE_QNODECOMMAND_H - -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QNodeCommandPrivate; - -class Q_3DCORESHARED_EXPORT QNodeCommand : public QSceneChange -{ -public: -#if defined(Q_ATOMIC_INT64_IS_SUPPORTED) - typedef quint64 CommandId; -#else - typedef quint32 CommandId; -#endif - - Q3D_DECL_DEPRECATED explicit QNodeCommand(QNodeId id); - ~QNodeCommand(); - - CommandId commandId() const; - - QString name() const; - void setName(const QString &name); - QVariant data() const; - void setData(const QVariant &data); - CommandId inReplyTo() const; - void setReplyToCommandId(CommandId id); - -protected: - explicit QNodeCommand(QNodeCommandPrivate &dd, QNodeId id); - -private: - Q_DECLARE_PRIVATE(QNodeCommand) -}; - -typedef QSharedPointer QNodeCommandPtr; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QNODECOMMAND_H diff --git a/src/core/changes/qnodecommand_p.h b/src/core/changes/qnodecommand_p.h deleted file mode 100644 index e89dbe1a9..000000000 --- a/src/core/changes/qnodecommand_p.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QNODECOMMAND_P_H -#define QT3DCORE_QNODECOMMAND_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class Q_3DCORE_PRIVATE_EXPORT QNodeCommandPrivate : public QSceneChangePrivate -{ -public: - QNodeCommandPrivate(); - ~QNodeCommandPrivate(); - - static QNodeCommand::CommandId createId(); - - QNodeCommand::CommandId m_commandId; - QNodeCommand::CommandId m_replyToCommandId; - QString m_name; - QVariant m_data; -}; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QNODECOMMAND_P_H diff --git a/src/core/changes/qnodecreatedchange.cpp b/src/core/changes/qnodecreatedchange.cpp deleted file mode 100644 index a14e8b7fd..000000000 --- a/src/core/changes/qnodecreatedchange.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qnodecreatedchange.h" -#include "qnodecreatedchange_p.h" - -#include - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QNodeCreatedChangeBasePrivate::QNodeCreatedChangeBasePrivate(const QNode *node) - : QSceneChangePrivate() - , m_parentId(node->parentNode() ? node->parentNode()->id() : QNodeId()) - , m_metaObject(QNodePrivate::findStaticMetaObject(node->metaObject())) - , m_nodeEnabled(node->isEnabled()) -{ -} - -/*! - * \class Qt3DCore::QNodeCreatedChangeBase - * \inheaderfile Qt3DCore/QNodeCreatedChangeBase - * \inherits Qt3DCore::QSceneChange - * \inmodule Qt3DCore - * \brief The QNodeCreatedChangeBase class is the base class for all NodeCreated QSceneChange events. - * - * The QNodeCreatedChangeBase class is the base class for all QSceneChange events that - * have the changeType() NodeCreated. You should not need to instantiate this class. - * Usually you should be using one of its subclasses such as QNodeCreatedChange. - * - * You can subclass this to create your own node update types for communication between - * your QNode and QBackendNode subclasses when writing your own aspects. - */ - -/*! - * \typedef Qt3DCore::QNodeCreatedChangeBasePtr - * \relates Qt3DCore::QNodeCreatedChangeBase - * - * A shared pointer for QNodeCreatedChangeBase. - */ - -/*! - * Constructs a new QNodeCreatedChangeBase with \a node. - */ -QNodeCreatedChangeBase::QNodeCreatedChangeBase(const QNode *node) - : QSceneChange(*new QNodeCreatedChangeBasePrivate(node), NodeCreated, node->id()) -{ -} - -QNodeCreatedChangeBase::QNodeCreatedChangeBase(QNodeCreatedChangeBasePrivate &dd, const QNode *node) - : QSceneChange(dd, NodeCreated, node->id()) -{ -} - -QNodeCreatedChangeBase::~QNodeCreatedChangeBase() -{ -} - -/*! - * \return parent id. - */ -QNodeId QNodeCreatedChangeBase::parentId() const Q_DECL_NOTHROW -{ - Q_D(const QNodeCreatedChangeBase); - return d->m_parentId; -} - -/*! - * \return metaobject. - */ -const QMetaObject *QNodeCreatedChangeBase::metaObject() const Q_DECL_NOTHROW -{ - Q_D(const QNodeCreatedChangeBase); - return d->m_metaObject; -} - -/*! - * \return node enabled. - */ -bool QNodeCreatedChangeBase::isNodeEnabled() const Q_DECL_NOTHROW -{ - Q_D(const QNodeCreatedChangeBase); - return d->m_nodeEnabled; -} - -} // namespace Qt3DCore - -/*! - * \class Qt3DCore::QNodeCreatedChange - * \inheaderfile Qt3DCore/QNodeCreatedChange - * \inherits Qt3DCore::QNodeCreatedChangeBase - * \since 5.7 - * \inmodule Qt3DCore - * \brief Used to notify when a node is created. - */ - -QT_END_NAMESPACE diff --git a/src/core/changes/qnodecreatedchange.h b/src/core/changes/qnodecreatedchange.h deleted file mode 100644 index 31d00f3ac..000000000 --- a/src/core/changes/qnodecreatedchange.h +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QNODECREATEDCHANGE_H -#define QT3DCORE_QNODECREATEDCHANGE_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QNode; -class QNodeCreatedChangeBasePrivate; - -class Q_3DCORESHARED_EXPORT QNodeCreatedChangeBase : public QSceneChange -{ -public: - Q3D_DECL_DEPRECATED explicit QNodeCreatedChangeBase(const QNode *node); - ~QNodeCreatedChangeBase(); - - QNodeId parentId() const Q_DECL_NOTHROW; - const QMetaObject *metaObject() const Q_DECL_NOTHROW; - bool isNodeEnabled() const Q_DECL_NOTHROW; - -protected: - QNodeCreatedChangeBase(QNodeCreatedChangeBasePrivate &dd, const QNode *node); - -private: - Q_DECLARE_PRIVATE(QNodeCreatedChangeBase) -}; - -typedef QSharedPointer QNodeCreatedChangeBasePtr; - -template -class QNodeCreatedChange : public QNodeCreatedChangeBase -{ -public: - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - explicit QNodeCreatedChange(const QNode *_node) - : QNodeCreatedChangeBase(_node) - , data() - { - } - QT_WARNING_POP - - T data; -}; - -template -using QNodeCreatedChangePtr = QSharedPointer>; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QNODECREATEDCHANGE_H diff --git a/src/core/changes/qnodecreatedchange_p.h b/src/core/changes/qnodecreatedchange_p.h deleted file mode 100644 index 153ccc0e8..000000000 --- a/src/core/changes/qnodecreatedchange_p.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QNODECREATEDCHANGE_P_H -#define QT3DCORE_QNODECREATEDCHANGE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -#include -#include - -QT_BEGIN_NAMESPACE - -struct QMetaObject; - -namespace Qt3DCore { - -class QNode; - -class Q_3DCORE_PRIVATE_EXPORT QNodeCreatedChangeBasePrivate : public QSceneChangePrivate -{ -public: - QNodeCreatedChangeBasePrivate(const QNode *node); - - QNodeId m_parentId; - const QMetaObject *m_metaObject; - bool m_nodeEnabled; -}; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QNODECREATEDCHANGE_P_H diff --git a/src/core/changes/qnodedestroyedchange.cpp b/src/core/changes/qnodedestroyedchange.cpp deleted file mode 100644 index 2d304dcbc..000000000 --- a/src/core/changes/qnodedestroyedchange.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qnodedestroyedchange.h" -#include "qnodedestroyedchange_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -/*! - * \class Qt3DCore::QNodeDestroyedChange - * \inheaderfile Qt3DCore/QNodeDestroyedChange - * \inherits Qt3DCore::QSceneChange - * \since 5.7 - * \inmodule Qt3DCore - * \brief Used to notify when a node is destroyed. - */ - -/*! - * \typedef Qt3DCore::QNodeDestroyedChangePtr - * \relates Qt3DCore::QNodeDestroyedChange - * - * A shared pointer for QNodeDestroyedChange. - */ - -/*! - * Constructs a new QNodeDestroyedChange with \a node and its \a subtreeIdsAndTypes. - */ -QNodeDestroyedChange::QNodeDestroyedChange(const QNode *node, const QVector &subtreeIdsAndTypes) - : QSceneChange(*new QNodeDestroyedChangePrivate, NodeDeleted, node->id()) -{ - Q_D(QNodeDestroyedChange); - d->m_subtreeIdsAndTypes = subtreeIdsAndTypes; -} - -QNodeDestroyedChange::~QNodeDestroyedChange() -{ -} - -/*! - \return a vector of subtree node id type pairs - */ -QVector QNodeDestroyedChange::subtreeIdsAndTypes() const -{ - Q_D(const QNodeDestroyedChange); - return d->m_subtreeIdsAndTypes; -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/changes/qnodedestroyedchange.h b/src/core/changes/qnodedestroyedchange.h deleted file mode 100644 index dce6da59e..000000000 --- a/src/core/changes/qnodedestroyedchange.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QNODEDESTROYEDCHANGE_H -#define QT3DCORE_QNODEDESTROYEDCHANGE_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QNodeDestroyedChangePrivate; - -class Q_3DCORESHARED_EXPORT QNodeDestroyedChange : public QSceneChange -{ -public: - Q3D_DECL_DEPRECATED explicit QNodeDestroyedChange(const QNode *node, const QVector &subtreeIdsAndTypes); - ~QNodeDestroyedChange(); - - QVector subtreeIdsAndTypes() const; - -private: - Q_DECLARE_PRIVATE(QNodeDestroyedChange) -}; - -Q3D_DECL_DEPRECATED typedef QSharedPointer QNodeDestroyedChangePtr; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QNODEDESTROYEDCHANGE_H diff --git a/src/core/changes/qnodedestroyedchange_p.h b/src/core/changes/qnodedestroyedchange_p.h deleted file mode 100644 index 081ca858f..000000000 --- a/src/core/changes/qnodedestroyedchange_p.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QNODEDESTROYEDCHANGE_P_H -#define QT3DCORE_QNODEDESTROYEDCHANGE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QNodeDestroyedChange; - -class QNodeDestroyedChangePrivate : public QSceneChangePrivate -{ -public: - QVector m_subtreeIdsAndTypes; -}; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QNODEDESTROYEDCHANGE_P_H diff --git a/src/core/changes/qpropertynodeaddedchange.cpp b/src/core/changes/qpropertynodeaddedchange.cpp deleted file mode 100644 index 347d7f188..000000000 --- a/src/core/changes/qpropertynodeaddedchange.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpropertynodeaddedchange.h" -#include "qpropertynodeaddedchange_p.h" - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QPropertyNodeAddedChangePrivate::QPropertyNodeAddedChangePrivate() - : QStaticPropertyValueAddedChangeBasePrivate() - , m_addedNodeIdTypePair() -{ -} - -/*! - * \class Qt3DCore::QPropertyNodeAddedChange - * \inheaderfile Qt3DCore/QPropertyNodeAddedChange - * \inherits Qt3DCore::QStaticPropertyValueAddedChangeBase - * \inmodule Qt3DCore - * \brief Used to notify when a node is added to a property. - * - */ - -/*! - * \typedef Qt3DCore::QPropertyNodeAddedChangePtr - * \relates Qt3DCore::QPropertyNodeAddedChange - * - * A shared pointer for QPropertyNodeAddedChange. - */ - -/*! - * Constructs a new QPropertyNodeAddedChange with \a subjectId, \a node. - */ -QPropertyNodeAddedChange::QPropertyNodeAddedChange(QNodeId subjectId, QNode *node) - : QStaticPropertyValueAddedChangeBase(*new QPropertyNodeAddedChangePrivate, subjectId) -{ - Q_D(QPropertyNodeAddedChange); - Q_ASSERT(node); - d->m_addedNodeIdTypePair = QNodeIdTypePair(node->id(), QNodePrivate::findStaticMetaObject(node->metaObject())); - - // Ensure the node has issued a node creation change. We can end - // up here if a newly created node with a parent is immediately set - // as a property on another node. In this case the deferred call to - // _q_postConstructorInit() will not have happened yet as the event - // loop will still be blocked. So force it here and we catch this - // eventuality in the _q_postConstructorInit() function so that we - // do not repeat the creation and new child scene change events. - QNodePrivate::get(node)->_q_ensureBackendNodeCreated(); -} - -/*! \internal */ -QPropertyNodeAddedChange::~QPropertyNodeAddedChange() -{ -} - -/*! - * \return the id of the node added to the property. - */ -QNodeId QPropertyNodeAddedChange::addedNodeId() const -{ - Q_D(const QPropertyNodeAddedChange); - return d->m_addedNodeIdTypePair.id; -} - -/*! - * \return the meta object of the node added to the property. - */ -const QMetaObject *QPropertyNodeAddedChange::metaObject() const -{ - Q_D(const QPropertyNodeAddedChange); - return d->m_addedNodeIdTypePair.type; -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/changes/qpropertynodeaddedchange.h b/src/core/changes/qpropertynodeaddedchange.h deleted file mode 100644 index 062244f88..000000000 --- a/src/core/changes/qpropertynodeaddedchange.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYNODEADDEDCHANGE_H -#define QT3DCORE_QPROPERTYNODEADDEDCHANGE_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyNodeAddedChangePrivate; - -class Q_3DCORESHARED_EXPORT QPropertyNodeAddedChange : public QStaticPropertyValueAddedChangeBase -{ -public: - Q3D_DECL_DEPRECATED explicit QPropertyNodeAddedChange(QNodeId subjectId, QNode *node); - ~QPropertyNodeAddedChange(); - - QNodeId addedNodeId() const; - const QMetaObject *metaObject() const; - -private: - Q_DECLARE_PRIVATE(QPropertyNodeAddedChange) -}; - -Q3D_DECL_DEPRECATED typedef QSharedPointer QPropertyNodeAddedChangePtr; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYNODEADDEDCHANGE_H diff --git a/src/core/changes/qpropertynodeaddedchange_p.h b/src/core/changes/qpropertynodeaddedchange_p.h deleted file mode 100644 index 50840501c..000000000 --- a/src/core/changes/qpropertynodeaddedchange_p.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYNODEADDEDCHANGE_P_H -#define QT3DCORE_QPROPERTYNODEADDEDCHANGE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyUpdatedChange; - -class QPropertyNodeAddedChangePrivate : public QStaticPropertyValueAddedChangeBasePrivate -{ -public: - QPropertyNodeAddedChangePrivate(); - - Q_DECLARE_PUBLIC(QPropertyNodeAddedChange) - - QNodeIdTypePair m_addedNodeIdTypePair; -}; - -} // Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYNODEADDEDCHANGE_P_H diff --git a/src/core/changes/qpropertynoderemovedchange.cpp b/src/core/changes/qpropertynoderemovedchange.cpp deleted file mode 100644 index d19629c37..000000000 --- a/src/core/changes/qpropertynoderemovedchange.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpropertynoderemovedchange.h" -#include "qpropertynoderemovedchange_p.h" - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QPropertyNodeRemovedChangePrivate::QPropertyNodeRemovedChangePrivate() - : QStaticPropertyValueRemovedChangeBasePrivate() - , m_propertyName(nullptr) - , m_removedNodeIdTypePair() -{ -} - -/*! - * \class Qt3DCore::QPropertyNodeRemovedChange - * \inheaderfile Qt3DCore/QPropertyNodeRemovedChange - * \inherits Qt3DCore::QStaticPropertyValueRemovedChangeBase - * \inmodule Qt3DCore - * \brief The QPropertyNodeRemovedChange class is used to notify when a node is removed from a property. - * - */ - - -/*! - * \typedef Qt3DCore::QPropertyNodeRemovedChangePtr - * \relates Qt3DCore::QPropertyNodeRemovedChange - * - * A shared pointer for QPropertyNodeRemovedChange. - */ - -/*! - * Constructs a new QPropertyNodeRemovedChange with \a subjectId, \a node. - */ -QPropertyNodeRemovedChange::QPropertyNodeRemovedChange(QNodeId subjectId, QNode *node) - : QStaticPropertyValueRemovedChangeBase(*new QPropertyNodeRemovedChangePrivate, subjectId) -{ - Q_D(QPropertyNodeRemovedChange); - d->m_removedNodeIdTypePair = QNodeIdTypePair(node->id(), QNodePrivate::get(node)->m_typeInfo); -} - -/*! \internal */ -QPropertyNodeRemovedChange::~QPropertyNodeRemovedChange() -{ -} - -/*! - * \return the id of the node removed to the property. - */ -QNodeId QPropertyNodeRemovedChange::removedNodeId() const -{ - Q_D(const QPropertyNodeRemovedChange); - return d->m_removedNodeIdTypePair.id; -} - -/*! - * \return the metaObject of the node removed to the property. - */ -const QMetaObject *QPropertyNodeRemovedChange::metaObject() const -{ - Q_D(const QPropertyNodeRemovedChange); - return d->m_removedNodeIdTypePair.type; -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/changes/qpropertynoderemovedchange.h b/src/core/changes/qpropertynoderemovedchange.h deleted file mode 100644 index a8ea9d6c4..000000000 --- a/src/core/changes/qpropertynoderemovedchange.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYNODEREMOVEDCHANGE_H -#define QT3DCORE_QPROPERTYNODEREMOVEDCHANGE_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyNodeRemovedChangePrivate; - -class Q_3DCORESHARED_EXPORT QPropertyNodeRemovedChange : public QStaticPropertyValueRemovedChangeBase -{ -public: - Q3D_DECL_DEPRECATED explicit QPropertyNodeRemovedChange(QNodeId subjectId, QNode *node); - ~QPropertyNodeRemovedChange(); - - QNodeId removedNodeId() const; - const QMetaObject *metaObject() const; - -private: - Q_DECLARE_PRIVATE(QPropertyNodeRemovedChange) -}; - -Q3D_DECL_DEPRECATED typedef QSharedPointer QPropertyNodeRemovedChangePtr; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYNODEREMOVEDCHANGE_H diff --git a/src/core/changes/qpropertynoderemovedchange_p.h b/src/core/changes/qpropertynoderemovedchange_p.h deleted file mode 100644 index 8df349757..000000000 --- a/src/core/changes/qpropertynoderemovedchange_p.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYNODEREMOVEDCHANGE_P_H -#define QT3DCORE_QPROPERTYNODEREMOVEDCHANGE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyUpdatedChange; - -class QPropertyNodeRemovedChangePrivate : public QStaticPropertyValueRemovedChangeBasePrivate -{ -public: - QPropertyNodeRemovedChangePrivate(); - - Q_DECLARE_PUBLIC(QPropertyNodeRemovedChange) - - const char *m_propertyName; - QNodeIdTypePair m_removedNodeIdTypePair; -}; - -} // Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYNODEREMOVEDCHANGE_P_H diff --git a/src/core/changes/qpropertyupdatedchange.cpp b/src/core/changes/qpropertyupdatedchange.cpp deleted file mode 100644 index 6b9352dfa..000000000 --- a/src/core/changes/qpropertyupdatedchange.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpropertyupdatedchange.h" -#include "qpropertyupdatedchange_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QPropertyUpdatedChangePrivate::QPropertyUpdatedChangePrivate() - : QStaticPropertyUpdatedChangeBasePrivate() -{ -} - -QPropertyUpdatedChangePrivate::~QPropertyUpdatedChangePrivate() -{ -} - -/*! - * \class Qt3DCore::QPropertyUpdatedChange - * \inheaderfile Qt3DCore/QPropertyUpdatedChange - * \inherits Qt3DCore::QStaticPropertyUpdatedChangeBase - * \inmodule Qt3DCore - * \brief The QPropertyUpdatedChange class is used to notify when a property value is updated. - * - */ - -/*! - * \typedef Qt3DCore::QPropertyUpdatedChangePtr - * \relates Qt3DCore::QPropertyUpdatedChange - * - * A shared pointer for QPropertyUpdatedChange. - */ - -/*! - * Constructs a new QPropertyUpdatedChange with \a subjectId. - */ -QPropertyUpdatedChange::QPropertyUpdatedChange(QNodeId subjectId) - : QStaticPropertyUpdatedChangeBase(*new QPropertyUpdatedChangePrivate, subjectId) -{ -} - -/*! - * \internal - */ -QPropertyUpdatedChange::QPropertyUpdatedChange(QPropertyUpdatedChangePrivate &dd, - QNodeId subjectId) - : QStaticPropertyUpdatedChangeBase(dd, subjectId) -{ -} - -QPropertyUpdatedChange::~QPropertyUpdatedChange() -{ -} - -/*! - * \return property value. - */ -QVariant QPropertyUpdatedChange::value() const -{ - Q_D(const QPropertyUpdatedChange); - return d->m_value; -} - -/*! - * Set the property change \a value. - */ -void QPropertyUpdatedChange::setValue(const QVariant &value) -{ - Q_D(QPropertyUpdatedChange); - d->m_value = value; -} - -} // Qt3D - -QT_END_NAMESPACE diff --git a/src/core/changes/qpropertyupdatedchange.h b/src/core/changes/qpropertyupdatedchange.h deleted file mode 100644 index aa0dd9364..000000000 --- a/src/core/changes/qpropertyupdatedchange.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYUPDATEDCHANGE_H -#define QT3DCORE_QPROPERTYUPDATEDCHANGE_H - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyUpdatedChangePrivate; - -class Q_3DCORESHARED_EXPORT QPropertyUpdatedChange : public QStaticPropertyUpdatedChangeBase -{ -public: - Q3D_DECL_DEPRECATED explicit QPropertyUpdatedChange(QNodeId subjectId); - virtual ~QPropertyUpdatedChange(); - - QVariant value() const; - void setValue(const QVariant &value); - -protected: - Q_DECLARE_PRIVATE(QPropertyUpdatedChange) - QPropertyUpdatedChange(QPropertyUpdatedChangePrivate &dd, QNodeId subjectId); -}; - -Q3D_DECL_DEPRECATED typedef QSharedPointer QPropertyUpdatedChangePtr; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYUPDATEDCHANGE_H diff --git a/src/core/changes/qpropertyupdatedchange_p.h b/src/core/changes/qpropertyupdatedchange_p.h deleted file mode 100644 index ad908a8c4..000000000 --- a/src/core/changes/qpropertyupdatedchange_p.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYUPDATEDCHANGE_P_H -#define QT3DCORE_QPROPERTYUPDATEDCHANGE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyUpdatedChange; - -class QPropertyUpdatedChangePrivate : public QStaticPropertyUpdatedChangeBasePrivate -{ -public: - QPropertyUpdatedChangePrivate(); - virtual ~QPropertyUpdatedChangePrivate(); - - Q_DECLARE_PUBLIC(QPropertyUpdatedChange) - - QVariant m_value; -}; - -} // Qt3D - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYUPDATEDCHANGE_P_H diff --git a/src/core/changes/qpropertyupdatedchangebase.cpp b/src/core/changes/qpropertyupdatedchangebase.cpp deleted file mode 100644 index 3080fb647..000000000 --- a/src/core/changes/qpropertyupdatedchangebase.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpropertyupdatedchangebase.h" -#include "qpropertyupdatedchangebase_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QPropertyUpdatedChangeBasePrivate::QPropertyUpdatedChangeBasePrivate() - : QSceneChangePrivate() - , m_isIntermediate(false) -{ -} - -QPropertyUpdatedChangeBasePrivate::~QPropertyUpdatedChangeBasePrivate() -{ -} - -QPropertyUpdatedChangeBasePrivate *QPropertyUpdatedChangeBasePrivate::get(QPropertyUpdatedChangeBase *q) -{ - return q->d_func(); -} - -/*! - * \class Qt3DCore::QPropertyUpdatedChangeBase - * \inheaderfile Qt3DCore/QPropertyUpdatedChangeBase - * \inmodule Qt3DCore - * \brief The QPropertyUpdatedChangeBase class is the base class for all PropertyUpdated QSceneChange events. - * - * The QPropertyUpdatedChangeBase class is the base class for all QSceneChange events that - * have the changeType() PropertyUpdated. You should not need to instantiate this class. - * Usually you should be using one of its subclasses such as QPropertyUpdatedChange or - * QTypedPropertyUpdatedChange. - * - * You can subclass this to create your own node update types for communication between - * your QNode and QBackendNode subclasses when writing your own aspects. - */ - -/*! - * \typedef Qt3DCore::QPropertyUpdatedChangeBasePtr - * \relates Qt3DCore::QPropertyUpdatedChangeBase - * - * A shared pointer for QPropertyUpdatedChangeBase. - */ - -/*! - * Constructs a new QPropertyUpdatedChangeBase with \a subjectId - */ -QPropertyUpdatedChangeBase::QPropertyUpdatedChangeBase(QNodeId subjectId) - : QSceneChange(*new QPropertyUpdatedChangeBasePrivate, PropertyUpdated, subjectId) -{ -} - -QPropertyUpdatedChangeBase::QPropertyUpdatedChangeBase(QPropertyUpdatedChangeBasePrivate &dd, QNodeId subjectId) - : QSceneChange(dd, PropertyUpdated, subjectId) -{ -} - -QPropertyUpdatedChangeBase::~QPropertyUpdatedChangeBase() -{ -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/changes/qpropertyupdatedchangebase.h b/src/core/changes/qpropertyupdatedchangebase.h deleted file mode 100644 index 5a0f6c87f..000000000 --- a/src/core/changes/qpropertyupdatedchangebase.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYUPDATEDCHANGEBASE_H -#define QT3DCORE_QPROPERTYUPDATEDCHANGEBASE_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyUpdatedChangeBasePrivate; - -class Q_3DCORESHARED_EXPORT QPropertyUpdatedChangeBase : public QSceneChange -{ -public: - ~QPropertyUpdatedChangeBase(); - -protected: - Q3D_DECL_DEPRECATED explicit QPropertyUpdatedChangeBase(QNodeId subjectId); - QPropertyUpdatedChangeBase(QPropertyUpdatedChangeBasePrivate &dd, QNodeId subjectId); - Q_DECLARE_PRIVATE(QPropertyUpdatedChangeBase) -}; - -Q3D_DECL_DEPRECATED typedef QSharedPointer QPropertyUpdatedChangeBasePtr; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYUPDATEDCHANGEBASE_H diff --git a/src/core/changes/qpropertyupdatedchangebase_p.h b/src/core/changes/qpropertyupdatedchangebase_p.h deleted file mode 100644 index 6dd7186f2..000000000 --- a/src/core/changes/qpropertyupdatedchangebase_p.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYUPDATEDCHANGEBASE_P_H -#define QT3DCORE_QPROPERTYUPDATEDCHANGEBASE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyUpdatedChangeBase; - -class Q_3DCORE_PRIVATE_EXPORT QPropertyUpdatedChangeBasePrivate : public QSceneChangePrivate -{ -public: - QPropertyUpdatedChangeBasePrivate(); - virtual ~QPropertyUpdatedChangeBasePrivate(); - - static QPropertyUpdatedChangeBasePrivate *get(QPropertyUpdatedChangeBase *q); - - Q_DECLARE_PUBLIC(QPropertyUpdatedChangeBase) - - // Frontend nodes should not receive intermediate animated property - // updated by default. Only if they subscribe. The animation aspect - // will set this to true for animating properties apart from the final - // frame's update. - bool m_isIntermediate; -}; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYUPDATEDCHANGEBASE_P_H - diff --git a/src/core/changes/qpropertyvalueaddedchange.cpp b/src/core/changes/qpropertyvalueaddedchange.cpp deleted file mode 100644 index 28d912632..000000000 --- a/src/core/changes/qpropertyvalueaddedchange.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpropertyvalueaddedchange.h" -#include "qpropertyvalueaddedchange_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QPropertyValueAddedChangePrivate::QPropertyValueAddedChangePrivate() - : QStaticPropertyValueAddedChangeBasePrivate() -{ -} - - -/*! - * \class Qt3DCore::QPropertyValueAddedChange - * \inheaderfile Qt3DCore/QPropertyValueAddedChange - * \inherits Qt3DCore::QStaticPropertyValueAddedChangeBase - * \inmodule Qt3DCore - * \brief Used to notify when a value is added to a property. - * - */ - -/*! - * \typedef Qt3DCore::QPropertyValueAddedChangePtr - * \relates Qt3DCore::QPropertyValueAddedChange - * - * A shared pointer for QPropertyValueAddedChange. - */ - -/*! - * Constructs a new QPropertyValueAddedChange with \a subjectId. - */ -QPropertyValueAddedChange::QPropertyValueAddedChange(QNodeId subjectId) - : QStaticPropertyValueAddedChangeBase(*new QPropertyValueAddedChangePrivate, subjectId) -{ -} - -QPropertyValueAddedChange::~QPropertyValueAddedChange() -{ -} - -/*! - * Sets the value added to the property to \a value. - */ -void QPropertyValueAddedChange::setAddedValue(const QVariant &value) -{ - Q_D(QPropertyValueAddedChange); - d->m_addedValue = value; -} - -/*! - * \return the value added to the property. - */ -QVariant QPropertyValueAddedChange::addedValue() const -{ - Q_D(const QPropertyValueAddedChange); - return d->m_addedValue; -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/changes/qpropertyvalueaddedchange.h b/src/core/changes/qpropertyvalueaddedchange.h deleted file mode 100644 index e70d78b7e..000000000 --- a/src/core/changes/qpropertyvalueaddedchange.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYVALUEADDEDCHANGE_H -#define QT3DCORE_QPROPERTYVALUEADDEDCHANGE_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyValueAddedChangePrivate; - -class Q_3DCORESHARED_EXPORT QPropertyValueAddedChange : public QStaticPropertyValueAddedChangeBase -{ -public: - Q3D_DECL_DEPRECATED explicit QPropertyValueAddedChange(QNodeId subjectId); - ~QPropertyValueAddedChange(); - - void setAddedValue(const QVariant &value); - QVariant addedValue() const; - -private: - Q_DECLARE_PRIVATE(QPropertyValueAddedChange) -}; - -Q3D_DECL_DEPRECATED typedef QSharedPointer QPropertyValueAddedChangePtr; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYVALUEADDEDCHANGE_H diff --git a/src/core/changes/qpropertyvalueaddedchange_p.h b/src/core/changes/qpropertyvalueaddedchange_p.h deleted file mode 100644 index 3f7ea33fe..000000000 --- a/src/core/changes/qpropertyvalueaddedchange_p.h +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYVALUEADDEDCHANGE_P_H -#define QT3DCORE_QPROPERTYVALUEADDEDCHANGE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyValueAddedChange; - -class Q_3DCORE_PRIVATE_EXPORT QPropertyValueAddedChangePrivate : public QStaticPropertyValueAddedChangeBasePrivate -{ -public: - QPropertyValueAddedChangePrivate(); - - Q_DECLARE_PUBLIC(QPropertyValueAddedChange) - - QVariant m_addedValue; -}; - -} // Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYVALUEADDEDCHANGE_P_H - diff --git a/src/core/changes/qpropertyvalueaddedchangebase.cpp b/src/core/changes/qpropertyvalueaddedchangebase.cpp deleted file mode 100644 index aea5e1fd4..000000000 --- a/src/core/changes/qpropertyvalueaddedchangebase.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpropertyvalueaddedchangebase.h" - -#include "qpropertyvalueaddedchangebase_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QPropertyValueAddedChangeBasePrivate::QPropertyValueAddedChangeBasePrivate() - : QSceneChangePrivate() -{ -} - -QPropertyValueAddedChangeBasePrivate::~QPropertyValueAddedChangeBasePrivate() -{ -} - -/*! - * \class Qt3DCore::QPropertyValueAddedChangeBase - * \inheaderfile Qt3DCore/QPropertyValueAddedChangeBase - * \inmodule Qt3DCore - * \brief The QPropertyValueAddedChangeBase class is the base class for all PropertyValueAdded QSceneChange events. - * - * The QPropertyValueAddedChangeBase class is the base class for all QSceneChange events that - * have the changeType() PropertyValueAdded. You should not need to instantiate this class. - * Usually you should be using one of its subclasses such as QPropertyNodeAddedChange. - * - * You can subclass this to create your own node added types for communication between - * your QNode and QBackendNode subclasses when writing your own aspects. - */ - -/*! - * \typedef Qt3DCore::QPropertyValueAddedChangeBasePtr - * \relates Qt3DCore::QPropertyValueAddedChangeBase - * - * A shared pointer for QPropertyValueAddedChangeBase. - */ - -/*! - * Constructs a new QPropertyValueAddedChangeBase with \a subjectId - */ -QPropertyValueAddedChangeBase::QPropertyValueAddedChangeBase(QNodeId subjectId) - : QSceneChange(*new QPropertyValueAddedChangeBasePrivate, PropertyValueAdded, subjectId) -{ -} - -/*! \internal */ -QPropertyValueAddedChangeBase::QPropertyValueAddedChangeBase(QPropertyValueAddedChangeBasePrivate &dd, - QNodeId subjectId) - : QSceneChange(dd, PropertyValueAdded, subjectId) -{ -} - -QPropertyValueAddedChangeBase::~QPropertyValueAddedChangeBase() -{ -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/changes/qpropertyvalueaddedchangebase.h b/src/core/changes/qpropertyvalueaddedchangebase.h deleted file mode 100644 index 148411de8..000000000 --- a/src/core/changes/qpropertyvalueaddedchangebase.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYVALUEADDEDCHANGEBASE_H -#define QT3DCORE_QPROPERTYVALUEADDEDCHANGEBASE_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyValueAddedChangeBasePrivate; - -class Q_3DCORESHARED_EXPORT QPropertyValueAddedChangeBase : public QSceneChange -{ -public: - ~QPropertyValueAddedChangeBase(); - -protected: - Q3D_DECL_DEPRECATED explicit QPropertyValueAddedChangeBase(QNodeId subjectId); - Q3D_DECL_DEPRECATED explicit QPropertyValueAddedChangeBase(QPropertyValueAddedChangeBasePrivate &dd, QNodeId subjectId); - Q_DECLARE_PRIVATE(QPropertyValueAddedChangeBase) -}; - -Q3D_DECL_DEPRECATED typedef QSharedPointer QPropertyValueAddedChangeBasePtr; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYVALUEADDEDCHANGEBASE_H diff --git a/src/core/changes/qpropertyvalueaddedchangebase_p.h b/src/core/changes/qpropertyvalueaddedchangebase_p.h deleted file mode 100644 index 57d97e4c0..000000000 --- a/src/core/changes/qpropertyvalueaddedchangebase_p.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYVALUEADDEDCHANGEBASE_P_H -#define QT3DCORE_QPROPERTYVALUEADDEDCHANGEBASE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyValueAddedChangeBase; - -class Q_3DCORE_PRIVATE_EXPORT QPropertyValueAddedChangeBasePrivate : public QSceneChangePrivate -{ -public: - QPropertyValueAddedChangeBasePrivate(); - virtual ~QPropertyValueAddedChangeBasePrivate(); - - Q_DECLARE_PUBLIC(QPropertyValueAddedChangeBase) -}; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYVALUEADDEDCHANGEBASE_P_H - diff --git a/src/core/changes/qpropertyvalueremovedchange.cpp b/src/core/changes/qpropertyvalueremovedchange.cpp deleted file mode 100644 index 89cf5620f..000000000 --- a/src/core/changes/qpropertyvalueremovedchange.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpropertyvalueremovedchange.h" - -#include "qpropertyvalueremovedchange_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QPropertyValueRemovedChangePrivate::QPropertyValueRemovedChangePrivate() - : QStaticPropertyValueRemovedChangeBasePrivate() -{ -} - - -/*! - * \class Qt3DCore::QPropertyValueRemovedChange - * \inheaderfile Qt3DCore/QPropertyValueRemovedChange - * \inherits Qt3DCore::QStaticPropertyValueRemovedChangeBase - * \inmodule Qt3DCore - * \brief Used to notify when a value is added to a property. - * - */ - -/*! - * \typedef Qt3DCore::QPropertyValueRemovedChangePtr - * \relates Qt3DCore::QPropertyValueRemovedChange - * - * A shared pointer for QPropertyValueRemovedChange. - */ - -/*! - * Constructs a new QPropertyValueRemovedChange with \a subjectId. - */ -QPropertyValueRemovedChange::QPropertyValueRemovedChange(QNodeId subjectId) - : QStaticPropertyValueRemovedChangeBase(*new QPropertyValueRemovedChangePrivate, subjectId) -{ -} - -QPropertyValueRemovedChange::~QPropertyValueRemovedChange() -{ -} - -/*! - * Sets the value removed from the property to \a value. - */ -void QPropertyValueRemovedChange::setRemovedValue(const QVariant &value) -{ - Q_D(QPropertyValueRemovedChange); - d->m_RemovedValue = value; -} - -/*! - * \return the value removed from the property. - */ -QVariant QPropertyValueRemovedChange::removedValue() const -{ - Q_D(const QPropertyValueRemovedChange); - return d->m_RemovedValue; -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/changes/qpropertyvalueremovedchange.h b/src/core/changes/qpropertyvalueremovedchange.h deleted file mode 100644 index 70eb42db4..000000000 --- a/src/core/changes/qpropertyvalueremovedchange.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYVALUEREMOVEDCHANGE_H -#define QT3DCORE_QPROPERTYVALUEREMOVEDCHANGE_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyValueRemovedChangePrivate; - -class Q_3DCORESHARED_EXPORT QPropertyValueRemovedChange : public QStaticPropertyValueRemovedChangeBase -{ -public: - Q3D_DECL_DEPRECATED explicit QPropertyValueRemovedChange(QNodeId subjectId); - ~QPropertyValueRemovedChange(); - - void setRemovedValue(const QVariant &value); - QVariant removedValue() const; - -private: - Q_DECLARE_PRIVATE(QPropertyValueRemovedChange) -}; - -Q3D_DECL_DEPRECATED typedef QSharedPointer QPropertyValueRemovedChangePtr; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYVALUEREMOVEDCHANGE_H diff --git a/src/core/changes/qpropertyvalueremovedchange_p.h b/src/core/changes/qpropertyvalueremovedchange_p.h deleted file mode 100644 index 119dabefc..000000000 --- a/src/core/changes/qpropertyvalueremovedchange_p.h +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYVALUEREMOVEDCHANGE_P_H -#define QT3DCORE_QPROPERTYVALUEREMOVEDCHANGE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyValueRemovedChange; - -class Q_3DCORE_PRIVATE_EXPORT QPropertyValueRemovedChangePrivate : public QStaticPropertyValueRemovedChangeBasePrivate -{ -public: - QPropertyValueRemovedChangePrivate(); - - Q_DECLARE_PUBLIC(QPropertyValueRemovedChange) - - QVariant m_RemovedValue; -}; - -} // Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYVALUEREMOVEDCHANGE_P_H - diff --git a/src/core/changes/qpropertyvalueremovedchangebase.cpp b/src/core/changes/qpropertyvalueremovedchangebase.cpp deleted file mode 100644 index 16d3c5946..000000000 --- a/src/core/changes/qpropertyvalueremovedchangebase.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpropertyvalueremovedchangebase.h" - -#include "qpropertyvalueremovedchangebase_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QPropertyValueRemovedChangeBasePrivate::QPropertyValueRemovedChangeBasePrivate() - : QSceneChangePrivate() -{ -} - -QPropertyValueRemovedChangeBasePrivate::~QPropertyValueRemovedChangeBasePrivate() -{ -} - -/*! - * \class Qt3DCore::QPropertyValueRemovedChangeBase - * \inheaderfile Qt3DCore/QPropertyValueRemovedChangeBase - * \inmodule Qt3DCore - * \brief The QPropertyValueRemovedChangeBase class is the base class for all PropertyValueRemoved QSceneChange events. - * - * The QPropertyValueRemovedChangeBase class is the base class for all QSceneChange events that - * have the changeType() PropertyValueRemoved. You should not need to instantiate this class. - * Usually you should be using one of its subclasses such as QPropertyNodeRemovedChange. - * - * You can subclass this to create your own node Removed types for communication between - * your QNode and QBackendNode subclasses when writing your own aspects. - */ - -/*! - * \typedef Qt3DCore::QPropertyValueRemovedChangeBasePtr - * \relates Qt3DCore::QPropertyValueRemovedChangeBase - * - * A shared pointer for QPropertyValueRemovedChangeBase. - */ - -/*! - * Constructs a new QPropertyValueRemovedChangeBase with \a subjectId - */ -QPropertyValueRemovedChangeBase::QPropertyValueRemovedChangeBase(QNodeId subjectId) - : QSceneChange(*new QPropertyValueRemovedChangeBasePrivate, PropertyValueRemoved, subjectId) -{ -} - -/*! \internal */ -QPropertyValueRemovedChangeBase::QPropertyValueRemovedChangeBase(QPropertyValueRemovedChangeBasePrivate &dd, - QNodeId subjectId) - : QSceneChange(dd, PropertyValueRemoved, subjectId) -{ -} - -QPropertyValueRemovedChangeBase::~QPropertyValueRemovedChangeBase() -{ -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/changes/qpropertyvalueremovedchangebase.h b/src/core/changes/qpropertyvalueremovedchangebase.h deleted file mode 100644 index b5ead7d22..000000000 --- a/src/core/changes/qpropertyvalueremovedchangebase.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYVALUEREMOVEDCHANGEBASE_H -#define QT3DCORE_QPROPERTYVALUEREMOVEDCHANGEBASE_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyValueRemovedChangeBasePrivate; - -class Q_3DCORESHARED_EXPORT QPropertyValueRemovedChangeBase : public QSceneChange -{ -public: - ~QPropertyValueRemovedChangeBase(); - -protected: - Q_DECLARE_PRIVATE(QPropertyValueRemovedChangeBase) - Q3D_DECL_DEPRECATED explicit QPropertyValueRemovedChangeBase(QNodeId subjectId); - Q3D_DECL_DEPRECATED explicit QPropertyValueRemovedChangeBase(QPropertyValueRemovedChangeBasePrivate &dd, QNodeId subjectId); -}; - -Q3D_DECL_DEPRECATED typedef QSharedPointer QPropertyValueRemovedChangeBasePtr; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYVALUEREMOVEDCHANGEBASE_H diff --git a/src/core/changes/qpropertyvalueremovedchangebase_p.h b/src/core/changes/qpropertyvalueremovedchangebase_p.h deleted file mode 100644 index f62f7f24d..000000000 --- a/src/core/changes/qpropertyvalueremovedchangebase_p.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPROPERTYVALUEREMOVEDCHANGEBASE_P_H -#define QT3DCORE_QPROPERTYVALUEREMOVEDCHANGEBASE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyValueRemovedChangeBase; - -class Q_3DCORE_PRIVATE_EXPORT QPropertyValueRemovedChangeBasePrivate : public QSceneChangePrivate -{ -public: - QPropertyValueRemovedChangeBasePrivate(); - virtual ~QPropertyValueRemovedChangeBasePrivate(); - - Q_DECLARE_PUBLIC(QPropertyValueRemovedChangeBase) -}; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPROPERTYVALUEREMOVEDCHANGEBASE_P_H - diff --git a/src/core/changes/qscenechange.cpp b/src/core/changes/qscenechange.cpp deleted file mode 100644 index 822451b5f..000000000 --- a/src/core/changes/qscenechange.cpp +++ /dev/null @@ -1,169 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qscenechange.h" - -#include "qscenechange_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -/*! - * \enum Qt3DCore::ChangeFlag - * \relates Qt3DCore::QSceneChange - * \obsolete - * - * The types of change that can be sent and received by Qt3D's change notification system. - * - * \value NodeCreated A new instance of a QNode subclass has been created. - * \value NodeDeleted A QNode has been deleted. - * \value PropertyUpdated A QNode property has been updated. - * \value PropertyValueAdded A QNode has been added to the scene. - * \value PropertyValueRemoved A QNode has been removed from the scene. - * \value CommandRequested A QNodeCommand has been sent between a node and its backend. - * \value ComponentAdded A QComponent has been added to a QEntity. - * \value ComponentRemoved A QComponent has been removed from a QEntity. - * \value CallbackTriggered A QNode triggered a callback. - * \value AllChanges Allows an observer to monitor for any of the above changes. - */ - -QSceneChangePrivate::QSceneChangePrivate() - : q_ptr(nullptr) - , m_subjectId() - , m_deliveryFlags(QSceneChange::BackendNodes) - , m_type(AllChanges) -{ -} - -QSceneChangePrivate::~QSceneChangePrivate() -{ -} - -/*! - * \class Qt3DCore::QSceneChange - * \inheaderfile Qt3DCore/QSceneChange - * \inmodule Qt3DCore - * \brief The base class for changes that can be sent and received by Qt3D's change notification system. - */ - -/*! - * \typedef Qt3DCore::QSceneChangePtr - * \relates Qt3DCore::QSceneChange - * - * A shared pointer for QSceneChange. - */ - -/*! - * \enum QSceneChange::DeliveryFlag - * - * The types of change that can be sent and received by Qt3D's change notification system. - * - * \value BackendNodes - * \value Nodes - * \value DeliverToAll - */ - -/*! - * Constructs a new QSceneChange with \a type and \a subjectId. - */ -QSceneChange::QSceneChange(ChangeFlag type, QNodeId subjectId) - : d_ptr(new QSceneChangePrivate) -{ - d_ptr->q_ptr = this; - Q_D(QSceneChange); - d->m_type = type; - d->m_subjectId = subjectId; -} - -/*! \internal */ -QSceneChange::QSceneChange(QSceneChangePrivate &dd, - ChangeFlag type, QNodeId subjectId) - : d_ptr(&dd) -{ - d_ptr->q_ptr = this; - Q_D(QSceneChange); - d->m_type = type; - d->m_subjectId = subjectId; -} - -QSceneChange::~QSceneChange() -{ - delete d_ptr; -} - -/*! - * Returns the scene change type. - */ -ChangeFlag QSceneChange::type() const Q_DECL_NOTHROW -{ - Q_D(const QSceneChange); - return d->m_type; -} - -/*! - Sets the delivery flags of the change to \a flags. - */ -void QSceneChange::setDeliveryFlags(DeliveryFlags flags) Q_DECL_NOTHROW -{ - Q_D(QSceneChange); - d->m_deliveryFlags = flags; -} - -/*! - Returns the set delivery flags. - */ -QSceneChange::DeliveryFlags QSceneChange::deliveryFlags() const Q_DECL_NOTHROW -{ - Q_D(const QSceneChange); - return d->m_deliveryFlags; -} - -/*! - * \return scene change subject id. - */ -QNodeId QSceneChange::subjectId() const Q_DECL_NOTHROW -{ - Q_D(const QSceneChange); - return d->m_subjectId; -} - -} // Qt3D - -QT_END_NAMESPACE diff --git a/src/core/changes/qscenechange.h b/src/core/changes/qscenechange.h deleted file mode 100644 index 3fc896aca..000000000 --- a/src/core/changes/qscenechange.h +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QSCENECHANGE_H -#define QT3DCORE_QSCENECHANGE_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -enum Q3D_DECL_DEPRECATED ChangeFlag { - NodeCreated = 1 << 0, - NodeDeleted = 1 << 1, - PropertyUpdated = 1 << 2, - PropertyValueAdded = 1 << 3, - PropertyValueRemoved = 1 << 4, - ComponentAdded = 1 << 5, - ComponentRemoved = 1 << 6, - CommandRequested = 1 << 7, - CallbackTriggered = 1 << 8, - AllChanges = 0xFFFFFFFF -}; - -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED -Q_DECLARE_FLAGS(ChangeFlags, ChangeFlag) -Q_DECLARE_OPERATORS_FOR_FLAGS(ChangeFlags) -QT_WARNING_POP - -class QNode; -class QSceneChangePrivate; - -class Q_3DCORESHARED_EXPORT QSceneChange -{ -public: - enum DeliveryFlag { - BackendNodes = 0x0001, - Nodes = 0x0010, - DeliverToAll = BackendNodes | Nodes - }; - Q_DECLARE_FLAGS(DeliveryFlags, DeliveryFlag) - - virtual ~QSceneChange(); - - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - ChangeFlag type() const Q_DECL_NOTHROW; - QT_WARNING_POP - - void setDeliveryFlags(DeliveryFlags flags) Q_DECL_NOTHROW; - DeliveryFlags deliveryFlags() const Q_DECL_NOTHROW; - - QNodeId subjectId() const Q_DECL_NOTHROW; - -protected: - Q_DECLARE_PRIVATE(QSceneChange) - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - Q3D_DECL_DEPRECATED explicit QSceneChange(ChangeFlag type, QNodeId subjectId); - Q3D_DECL_DEPRECATED explicit QSceneChange(QSceneChangePrivate &dd, - ChangeFlag type, QNodeId subjectId); - QT_WARNING_POP - QSceneChangePrivate *d_ptr; - -private: - Q_DISABLE_COPY(QSceneChange) -}; - -Q_DECLARE_OPERATORS_FOR_FLAGS(QSceneChange::DeliveryFlags) - -typedef QSharedPointer QSceneChangePtr; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QSCENECHANGE_H diff --git a/src/core/changes/qscenechange_p.h b/src/core/changes/qscenechange_p.h deleted file mode 100644 index 4e112fe93..000000000 --- a/src/core/changes/qscenechange_p.h +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QSCENECHANGE_P_H -#define QT3DCORE_QSCENECHANGE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QSceneChange; -class QNodeId; - -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED -struct NodeRelationshipChange { - QNode *node; - QNode *subNode; - ChangeFlag change; - const char *property; -}; -QT_WARNING_POP - -class Q_3DCORE_PRIVATE_EXPORT QSceneChangePrivate -{ -public : - QSceneChangePrivate(); - virtual ~QSceneChangePrivate(); - - Q_DECLARE_PUBLIC(QSceneChange) - - QSceneChange *q_ptr; - - QNodeId m_subjectId; - QSceneChange::DeliveryFlags m_deliveryFlags; - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - ChangeFlag m_type; - QT_WARNING_POP -}; - -} // Qt3D - -QT_END_NAMESPACE - -#endif // QT3DCORE_QSCENECHANGE_P_H diff --git a/src/core/changes/qskeletoncreatedchange.cpp b/src/core/changes/qskeletoncreatedchange.cpp deleted file mode 100644 index 80895c394..000000000 --- a/src/core/changes/qskeletoncreatedchange.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qskeletoncreatedchange_p.h" -#include "qskeletoncreatedchange_p_p.h" -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QSkeletonCreatedChangeBasePrivate::QSkeletonCreatedChangeBasePrivate(const QAbstractSkeleton *skeleton) - : Qt3DCore::QNodeCreatedChangeBasePrivate(skeleton) - , m_type(QAbstractSkeletonPrivate::get(skeleton)->m_type) -{ - -} - -/* - \internal - \class Qt3DCore::QSkeletonCreatedChangeBase - \inmodule Qt3DCore - \brief Base class for handling creation changes for QAbstractSkeleton sub-classes. -*/ -QSkeletonCreatedChangeBase::QSkeletonCreatedChangeBase(const QAbstractSkeleton *skeleton) - : Qt3DCore::QNodeCreatedChangeBase(*new QSkeletonCreatedChangeBasePrivate(skeleton), skeleton) -{ -} - -/*! \internal */ -QSkeletonCreatedChangeBase::~QSkeletonCreatedChangeBase() -{ -} - -/*! \internal */ -QSkeletonCreatedChangeBase::SkeletonType QSkeletonCreatedChangeBase::type() const -{ - Q_D(const QSkeletonCreatedChangeBase); - return d->m_type; -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/changes/qskeletoncreatedchange_p.h b/src/core/changes/qskeletoncreatedchange_p.h deleted file mode 100644 index 9f0c361da..000000000 --- a/src/core/changes/qskeletoncreatedchange_p.h +++ /dev/null @@ -1,102 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QSKELETONCREATEDCHANGE_P_H -#define QT3DCORE_QSKELETONCREATEDCHANGE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QSkeletonCreatedChangeBasePrivate; - -class Q_3DCORESHARED_EXPORT QSkeletonCreatedChangeBase : public QNodeCreatedChangeBase -{ -public: - Q3D_DECL_DEPRECATED explicit QSkeletonCreatedChangeBase(const QAbstractSkeleton *skeleton); - ~QSkeletonCreatedChangeBase(); - - enum SkeletonType { - Skeleton = 0, - SkeletonLoader - }; - - SkeletonType type() const; - -private: - Q_DECLARE_PRIVATE(QSkeletonCreatedChangeBase) -}; - -Q3D_DECL_DEPRECATED typedef QSharedPointer QSkeletonCreatedChangeBasePtr; - -template -class QSkeletonCreatedChange : public QSkeletonCreatedChangeBase -{ -public: - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - explicit QSkeletonCreatedChange(const QAbstractSkeleton *_skeleton) - : QSkeletonCreatedChangeBase(_skeleton) - , data() - { - } - QT_WARNING_POP - - T data; -}; - -template -using QSkeletonCreatedChangePtr = QSharedPointer>; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QSKELETONCREATEDCHANGE_P_H diff --git a/src/core/changes/qskeletoncreatedchange_p_p.h b/src/core/changes/qskeletoncreatedchange_p_p.h deleted file mode 100644 index 961458ab6..000000000 --- a/src/core/changes/qskeletoncreatedchange_p_p.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QSKELETONCREATEDCHANGE_P_P_H -#define QT3DCORE_QSKELETONCREATEDCHANGE_P_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QAbstractSkeleton; - -class QSkeletonCreatedChangeBasePrivate : public Qt3DCore::QNodeCreatedChangeBasePrivate -{ -public: - QSkeletonCreatedChangeBasePrivate(const QAbstractSkeleton *skeleton); - - QSkeletonCreatedChangeBase::SkeletonType m_type; -}; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QSKELETONCREATEDCHANGE_P_P_H diff --git a/src/core/changes/qstaticpropertyupdatedchangebase.cpp b/src/core/changes/qstaticpropertyupdatedchangebase.cpp deleted file mode 100644 index 6aed5a822..000000000 --- a/src/core/changes/qstaticpropertyupdatedchangebase.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qstaticpropertyupdatedchangebase.h" - -#include "qstaticpropertyupdatedchangebase_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QStaticPropertyUpdatedChangeBasePrivate::QStaticPropertyUpdatedChangeBasePrivate() - : QPropertyUpdatedChangeBasePrivate(), - m_propertyName(nullptr) -{ -} - -QStaticPropertyUpdatedChangeBasePrivate::~QStaticPropertyUpdatedChangeBasePrivate() -{ -} - - -/*! - * \class Qt3DCore::QStaticPropertyUpdatedChangeBase - * \inheaderfile Qt3DCore/QStaticPropertyUpdatedChangeBase - * \inmodule Qt3DCore - * \since 5.7 - * \brief The QStaticPropertyUpdatedChangeBase class is the base class for all static PropertyUpdated QSceneChange events. - * - */ - -/*! - * \typedef Qt3DCore::QStaticPropertyUpdatedChangeBasePtr - * \relates Qt3DCore::QStaticPropertyUpdatedChangeBase - * - * A shared pointer for QStaticPropertyUpdatedChangeBase. - */ - -/*! - * Constructs a new QStaticPropertyUpdatedChangeBase with \a subjectId - */ -QStaticPropertyUpdatedChangeBase::QStaticPropertyUpdatedChangeBase(QNodeId subjectId) - : QPropertyUpdatedChangeBase(*new QStaticPropertyUpdatedChangeBasePrivate, subjectId) -{ -} - -/*! \internal */ -QStaticPropertyUpdatedChangeBase::QStaticPropertyUpdatedChangeBase(QStaticPropertyUpdatedChangeBasePrivate &dd, - QNodeId subjectId) - : QPropertyUpdatedChangeBase(dd, subjectId) -{ -} - -QStaticPropertyUpdatedChangeBase::~QStaticPropertyUpdatedChangeBase() -{ -} - -/*! - * \return name of the property. - */ -const char *QStaticPropertyUpdatedChangeBase::propertyName() const -{ - Q_D(const QStaticPropertyUpdatedChangeBase); - return d->m_propertyName; -} - -/*! - * Sets the property change \a name. - */ -void QStaticPropertyUpdatedChangeBase::setPropertyName(const char *name) -{ - Q_D(QStaticPropertyUpdatedChangeBase); - d->m_propertyName = name; -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/changes/qstaticpropertyupdatedchangebase.h b/src/core/changes/qstaticpropertyupdatedchangebase.h deleted file mode 100644 index c59a87a20..000000000 --- a/src/core/changes/qstaticpropertyupdatedchangebase.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QSTATICPROPERTYUPDATEDCHANGEBASE_H -#define QT3DCORE_QSTATICPROPERTYUPDATEDCHANGEBASE_H - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QStaticPropertyUpdatedChangeBasePrivate; - -class Q_3DCORESHARED_EXPORT QStaticPropertyUpdatedChangeBase : public QPropertyUpdatedChangeBase -{ -public: - ~QStaticPropertyUpdatedChangeBase(); - - const char *propertyName() const; - void setPropertyName(const char *name); - -protected: - Q3D_DECL_DEPRECATED explicit QStaticPropertyUpdatedChangeBase(QNodeId subjectId); - Q3D_DECL_DEPRECATED explicit QStaticPropertyUpdatedChangeBase(QStaticPropertyUpdatedChangeBasePrivate &dd, QNodeId subjectId); - Q_DECLARE_PRIVATE(QStaticPropertyUpdatedChangeBase) -}; - -Q3D_DECL_DEPRECATED typedef QSharedPointer QStaticPropertyUpdatedChangeBasePtr; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QSTATICPROPERTYUPDATEDCHANGEBASE_H diff --git a/src/core/changes/qstaticpropertyupdatedchangebase_p.h b/src/core/changes/qstaticpropertyupdatedchangebase_p.h deleted file mode 100644 index 6b7d4c974..000000000 --- a/src/core/changes/qstaticpropertyupdatedchangebase_p.h +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QSTATICPROPERTYUPDATEDCHANGEBASE_P_H -#define QT3DCORE_QSTATICPROPERTYUPDATEDCHANGEBASE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QPropertyUpdatedChange; - -class QStaticPropertyUpdatedChangeBasePrivate : public QPropertyUpdatedChangeBasePrivate -{ -public: - QStaticPropertyUpdatedChangeBasePrivate(); - virtual ~QStaticPropertyUpdatedChangeBasePrivate(); - - Q_DECLARE_PUBLIC(QStaticPropertyUpdatedChangeBase) - - /// FIXME: use QMetaProperty here once the NodeDeleted etc. change events - /// get refactored to their own QSceneChange subclass - const char *m_propertyName; -}; - -} // Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QSTATICPROPERTYUPDATEDCHANGEBASE_P_H - diff --git a/src/core/changes/qstaticpropertyvalueaddedchangebase.cpp b/src/core/changes/qstaticpropertyvalueaddedchangebase.cpp deleted file mode 100644 index ad2afc699..000000000 --- a/src/core/changes/qstaticpropertyvalueaddedchangebase.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qstaticpropertyvalueaddedchangebase.h" - -#include "qstaticpropertyvalueaddedchangebase_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QStaticPropertyValueAddedChangeBasePrivate::QStaticPropertyValueAddedChangeBasePrivate() - : QPropertyValueAddedChangeBasePrivate(), - m_propertyName(nullptr) -{ -} - -/*! - * \class Qt3DCore::QStaticPropertyValueAddedChangeBase - * \inheaderfile Qt3DCore/QStaticPropertyValueAddedChangeBase - * \inmodule Qt3DCore - * \since 5.7 - * \brief The QStaticPropertyValueAddedChangeBase class is the base class for all static PropertyValueAdded QSceneChange events. - * - */ - -/*! - * Constructs a new QStaticPropertyValueAddedChangeBase with \a subjectId - */ -QStaticPropertyValueAddedChangeBase::QStaticPropertyValueAddedChangeBase(QNodeId subjectId) - : QPropertyValueAddedChangeBase(*new QStaticPropertyValueAddedChangeBasePrivate, subjectId) -{ -} - -QStaticPropertyValueAddedChangeBase::QStaticPropertyValueAddedChangeBase(QStaticPropertyValueAddedChangeBasePrivate &dd, - QNodeId subjectId) - : QPropertyValueAddedChangeBase(dd, subjectId) -{ -} - -QStaticPropertyValueAddedChangeBase::~QStaticPropertyValueAddedChangeBase() -{ -} - -/*! - * \return name of the property. - */ -const char *QStaticPropertyValueAddedChangeBase::propertyName() const -{ - Q_D(const QStaticPropertyValueAddedChangeBase); - return d->m_propertyName; -} - -/*! - * Sets the property change \a name. - */ -void QStaticPropertyValueAddedChangeBase::setPropertyName(const char *name) -{ - Q_D(QStaticPropertyValueAddedChangeBase); - d->m_propertyName = name; -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/changes/qstaticpropertyvalueaddedchangebase.h b/src/core/changes/qstaticpropertyvalueaddedchangebase.h deleted file mode 100644 index 7e6807764..000000000 --- a/src/core/changes/qstaticpropertyvalueaddedchangebase.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QSTATICPROPERTYVALUEADDEDCHANGEBASE_H -#define QT3DCORE_QSTATICPROPERTYVALUEADDEDCHANGEBASE_H - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QStaticPropertyValueAddedChangeBasePrivate; - -class Q_3DCORESHARED_EXPORT QStaticPropertyValueAddedChangeBase : public QPropertyValueAddedChangeBase -{ -public: - ~QStaticPropertyValueAddedChangeBase(); - - const char *propertyName() const; - void setPropertyName(const char *name); - -protected: - Q_DECLARE_PRIVATE(QStaticPropertyValueAddedChangeBase) - Q3D_DECL_DEPRECATED explicit QStaticPropertyValueAddedChangeBase(QNodeId subjectId); - QStaticPropertyValueAddedChangeBase(QStaticPropertyValueAddedChangeBasePrivate &dd, - QNodeId subjectId); -}; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QSTATICPROPERTYVALUEADDEDCHANGEBASE_H diff --git a/src/core/changes/qstaticpropertyvalueaddedchangebase_p.h b/src/core/changes/qstaticpropertyvalueaddedchangebase_p.h deleted file mode 100644 index 3c7d62840..000000000 --- a/src/core/changes/qstaticpropertyvalueaddedchangebase_p.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QSTATICPROPERTYVALUEADDEDCHANGEBASE_P_H -#define QT3DCORE_QSTATICPROPERTYVALUEADDEDCHANGEBASE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QStaticPropertyValueAddedChangeBase; - -class Q_3DCORE_PRIVATE_EXPORT QStaticPropertyValueAddedChangeBasePrivate : public QPropertyValueAddedChangeBasePrivate -{ -public: - QStaticPropertyValueAddedChangeBasePrivate(); - - Q_DECLARE_PUBLIC(QStaticPropertyValueAddedChangeBase) - - const char *m_propertyName; -}; - -} // Qt3D - -QT_END_NAMESPACE - -#endif // QT3DCORE_QSTATICPROPERTYVALUEADDEDCHANGEBASE_P_H - diff --git a/src/core/changes/qstaticpropertyvalueremovedchangebase.cpp b/src/core/changes/qstaticpropertyvalueremovedchangebase.cpp deleted file mode 100644 index 2094d5aa2..000000000 --- a/src/core/changes/qstaticpropertyvalueremovedchangebase.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qstaticpropertyvalueremovedchangebase.h" -#include "qstaticpropertyvalueremovedchangebase_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QStaticPropertyValueRemovedChangeBasePrivate::QStaticPropertyValueRemovedChangeBasePrivate() - : QPropertyValueRemovedChangeBasePrivate(), - m_propertyName(nullptr) -{ -} - -/*! - * \class Qt3DCore::QStaticPropertyValueRemovedChangeBase - * \inheaderfile Qt3DCore/QStaticPropertyValueRemovedChangeBase - * \inmodule Qt3DCore - * \since 5.7 - * \brief The QStaticPropertyValueRemovedChangeBase class is the base class for all static PropertyValueRemoved QSceneChange events. - * - */ - -/*! - * Constructs a new QStaticPropertyValueRemovedChangeBase with \a subjectId - */ -QStaticPropertyValueRemovedChangeBase::QStaticPropertyValueRemovedChangeBase(QNodeId subjectId) - : QPropertyValueRemovedChangeBase(*new QStaticPropertyValueRemovedChangeBasePrivate, subjectId) -{ -} - -QStaticPropertyValueRemovedChangeBase::QStaticPropertyValueRemovedChangeBase(QStaticPropertyValueRemovedChangeBasePrivate &dd, - QNodeId subjectId) - : QPropertyValueRemovedChangeBase(dd, subjectId) -{ -} - -QStaticPropertyValueRemovedChangeBase::~QStaticPropertyValueRemovedChangeBase() -{ -} - -/*! - * \return name of the property. - */ -const char *QStaticPropertyValueRemovedChangeBase::propertyName() const -{ - Q_D(const QStaticPropertyValueRemovedChangeBase); - return d->m_propertyName; -} - -/*! - * Sets the property change \a name. - */ -void QStaticPropertyValueRemovedChangeBase::setPropertyName(const char *name) -{ - Q_D(QStaticPropertyValueRemovedChangeBase); - d->m_propertyName = name; -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/changes/qstaticpropertyvalueremovedchangebase.h b/src/core/changes/qstaticpropertyvalueremovedchangebase.h deleted file mode 100644 index d1b96f83e..000000000 --- a/src/core/changes/qstaticpropertyvalueremovedchangebase.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QSTATICPROPERTYVALUEREMOVEDCHANGEBASE_H -#define QT3DCORE_QSTATICPROPERTYVALUEREMOVEDCHANGEBASE_H - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QStaticPropertyValueRemovedChangeBasePrivate; - -class Q_3DCORESHARED_EXPORT QStaticPropertyValueRemovedChangeBase : public QPropertyValueRemovedChangeBase -{ -public: - ~QStaticPropertyValueRemovedChangeBase(); - - const char *propertyName() const; - void setPropertyName(const char *name); - -protected: - Q_DECLARE_PRIVATE(QStaticPropertyValueRemovedChangeBase) - Q3D_DECL_DEPRECATED explicit QStaticPropertyValueRemovedChangeBase(QNodeId subjectId); - QStaticPropertyValueRemovedChangeBase(QStaticPropertyValueRemovedChangeBasePrivate &dd, - QNodeId subjectId); -}; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QSTATICPROPERTYVALUEREMOVEDCHANGEBASE_H diff --git a/src/core/changes/qstaticpropertyvalueremovedchangebase_p.h b/src/core/changes/qstaticpropertyvalueremovedchangebase_p.h deleted file mode 100644 index 1c26efa6c..000000000 --- a/src/core/changes/qstaticpropertyvalueremovedchangebase_p.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QSTATICPROPERTYVALUEREMOVEDCHANGEBASE_P_H -#define QT3DCORE_QSTATICPROPERTYVALUEREMOVEDCHANGEBASE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QStaticPropertyValueRemovedChangeBase; - -class Q_3DCORE_PRIVATE_EXPORT QStaticPropertyValueRemovedChangeBasePrivate : public QPropertyValueRemovedChangeBasePrivate -{ -public: - QStaticPropertyValueRemovedChangeBasePrivate(); - - Q_DECLARE_PUBLIC(QStaticPropertyValueRemovedChangeBase) - - const char *m_propertyName; -}; - -} // Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QSTATICPROPERTYVALUEREMOVEDCHANGEBASE_P_H - diff --git a/src/core/changes/qtypedpropertyupdatechange_p.h b/src/core/changes/qtypedpropertyupdatechange_p.h deleted file mode 100644 index 6793144ca..000000000 --- a/src/core/changes/qtypedpropertyupdatechange_p.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QTYPEDPROPERTYUPDATECHANGE_P_H -#define QT3DCORE_QTYPEDPROPERTYUPDATECHANGE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -template -class QTypedPropertyUpdatedChange : public QStaticPropertyUpdatedChangeBase -{ -public: - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - explicit QTypedPropertyUpdatedChange(QNodeId _subjectId) - : QStaticPropertyUpdatedChangeBase(_subjectId) - , data() - { - } - QT_WARNING_POP - - T data; -}; - -template -using QTypedPropertyUpdatedChangePtr = QSharedPointer>; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QTYPEDPROPERTYUPDATECHANGE_P_H - diff --git a/src/core/core.pri b/src/core/core.pri index ea95ab10d..de80fb25f 100644 --- a/src/core/core.pri +++ b/src/core/core.pri @@ -5,22 +5,13 @@ HEADERS += \ $$PWD/qtickclock_p.h \ $$PWD/qscheduler_p.h \ $$PWD/corelogging_p.h \ - $$PWD/qpostman_p.h \ - $$PWD/qobservableinterface_p.h \ - $$PWD/qobserverinterface_p.h \ - $$PWD/qlockableobserverinterface_p.h \ $$PWD/qchangearbiter_p.h \ $$PWD/qt3dcore_global_p.h \ - $$PWD/qscene_p.h \ - $$PWD/qpostman_p_p.h + $$PWD/qscene_p.h SOURCES += \ $$PWD/qtickclock.cpp \ $$PWD/qscheduler.cpp \ $$PWD/qchangearbiter.cpp \ $$PWD/corelogging.cpp \ - $$PWD/qobservableinterface.cpp \ - $$PWD/qobserverinterface.cpp \ - $$PWD/qlockableobserverinterface.cpp \ - $$PWD/qpostman.cpp \ $$PWD/qscene.cpp diff --git a/src/core/core.pro b/src/core/core.pro index b76198e35..2acd64981 100644 --- a/src/core/core.pro +++ b/src/core/core.pro @@ -11,7 +11,6 @@ gcov { include(core.pri) include(aspects/aspects.pri) -include(changes/changes.pri) include(jobs/jobs.pri) include(nodes/nodes.pri) include(transforms/transforms.pri) diff --git a/src/core/nodes/nodes.pri b/src/core/nodes/nodes.pri index 785ae2b21..097f1cbc7 100644 --- a/src/core/nodes/nodes.pri +++ b/src/core/nodes/nodes.pri @@ -13,7 +13,6 @@ HEADERS += \ $$PWD/qnodevisitor_p.h \ $$PWD/propertychangehandler_p.h \ $$PWD/qdestructionidandtypecollector_p.h \ - $$PWD/qnodecreatedchangegenerator_p.h \ $$PWD/qabstractnodefactory_p.h SOURCES += \ @@ -25,5 +24,4 @@ SOURCES += \ $$PWD/qnodevisitor.cpp \ $$PWD/qabstractnodefactory.cpp \ $$PWD/propertychangehandler.cpp \ - $$PWD/qdestructionidandtypecollector.cpp \ - $$PWD/qnodecreatedchangegenerator.cpp + $$PWD/qdestructionidandtypecollector.cpp diff --git a/src/core/nodes/qbackendnode.cpp b/src/core/nodes/qbackendnode.cpp index 4138ea060..433c305cc 100644 --- a/src/core/nodes/qbackendnode.cpp +++ b/src/core/nodes/qbackendnode.cpp @@ -42,8 +42,6 @@ #include #include -#include -#include #include @@ -59,32 +57,10 @@ QBackendNodeMapper::~QBackendNodeMapper() QBackendNodePrivate::QBackendNodePrivate(QBackendNode::Mode mode) : q_ptr(nullptr) , m_mode(mode) - , m_arbiter(nullptr) , m_enabled(false) { } -// Called by backend thread (renderer or other) while we are locked to sync changes -void QBackendNodePrivate::setArbiter(QLockableObserverInterface *arbiter) -{ - Q_ASSERT(m_mode == QBackendNode::ReadWrite); - m_arbiter = arbiter; -} - -// Called by backend thread/worker threads. We don't need locking -// as setting/unsetting the arbiter cannot happen at that time -void QBackendNodePrivate::notifyObservers(const QSceneChangePtr &e) -{ - Q_ASSERT(m_mode == QBackendNode::ReadWrite); - if (m_arbiter != nullptr) - m_arbiter->sceneChangeEvent(e); -} - -void QBackendNodePrivate::sceneChangeEvent(const QSceneChangePtr &e) -{ - q_func()->sceneChangeEvent(e); -} - void QBackendNodePrivate::setEnabled(bool enabled) { m_enabled = enabled; @@ -124,7 +100,7 @@ void QBackendNodePrivate::componentRemoved(QNode *frontend) */ /*! - * \fn Qt3DCore::QBackendNode *Qt3DCore::QBackendNodeMapper::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const + * \fn Qt3DCore::QBackendNode *Qt3DCore::QBackendNodeMapper::create(Qt3DCore::QNodeId id) const * * \TODO * @@ -218,55 +194,6 @@ QBackendNode::QBackendNode(QBackendNodePrivate &dd) d_ptr->q_ptr = this; } -/*! - * Notifies observers of scene change \a e. - * \obsolete - */ -void QBackendNode::notifyObservers(const QSceneChangePtr &e) -{ - Q_D(QBackendNode); - d->notifyObservers(e); -} - -/*! - \obsolete - - Send the command named \a name with contents \a data, - and specify \a replyTo as the command id to which the - reply needs to be sent. -*/ -QNodeCommand::CommandId QBackendNode::sendCommand(const QString &name, - const QVariant &data, - QNodeCommand::CommandId replyTo) -{ - auto e = QNodeCommandPtr::create(peerId()); - e->setName(name); - e->setData(data); - e->setReplyToCommandId(replyTo); - e->setDeliveryFlags(QSceneChange::Nodes); - notifyObservers(e); - return e->commandId(); -} - -/*! - Send the reply to \a command. - \obsolete -*/ -void QBackendNode::sendReply(const QNodeCommandPtr &command) -{ - command->setDeliveryFlags(QSceneChange::Nodes); - notifyObservers(command); -} - -/*! - * \obsolete - */ -void QBackendNode::initializeFromPeer(const QNodeCreatedChangeBasePtr &change) -{ - Q_UNUSED(change) - qCDebug(Nodes) << Q_FUNC_INFO << change->metaObject()->className() << "does not override"; -} - /*! * Enables or disables the backend node by \a enabled. */ @@ -276,25 +203,6 @@ void QBackendNode::setEnabled(bool enabled) Q_DECL_NOTHROW d->m_enabled = enabled; } -/*! - * \obsolete - */ -void QBackendNode::sceneChangeEvent(const QSceneChangePtr &e) -{ - Q_D(QBackendNode); - - switch (e->type()) { - case PropertyUpdated: { - auto propertyChange = qSharedPointerCast(e); - if (propertyChange->propertyName() == QByteArrayLiteral("enabled")) - d->m_enabled = propertyChange->value().toBool(); - break; - } - default: - break; - } -} - } // Qt3D QT_END_NAMESPACE diff --git a/src/core/nodes/qbackendnode.h b/src/core/nodes/qbackendnode.h index 691375999..4af1ae996 100644 --- a/src/core/nodes/qbackendnode.h +++ b/src/core/nodes/qbackendnode.h @@ -40,10 +40,7 @@ #ifndef QT3DCORE_QBACKENDNODE_H #define QT3DCORE_QBACKENDNODE_H -#include #include -#include -#include #include QT_BEGIN_NAMESPACE @@ -62,7 +59,7 @@ class Q_3DCORESHARED_EXPORT QBackendNodeMapper { public: virtual ~QBackendNodeMapper(); - virtual QBackendNode *create(const QNodeCreatedChangeBasePtr &change) const = 0; // TODO QT6 change to only take a NodeId + virtual QBackendNode *create(QNodeId id) const = 0; virtual QBackendNode *get(QNodeId id) const = 0; virtual void destroy(QNodeId id) const = 0; }; @@ -90,20 +87,13 @@ public: protected: Q_DECLARE_PRIVATE(QBackendNode) explicit QBackendNode(QBackendNodePrivate &dd); - Q3D_DECL_DEPRECATED void notifyObservers(const QSceneChangePtr &e); - Q3D_DECL_DEPRECATED QNodeCommand::CommandId sendCommand(const QString &name, const QVariant &data, - QNodeCommand::CommandId replyTo = QNodeCommand::CommandId()); - Q3D_DECL_DEPRECATED void sendReply(const QNodeCommandPtr &command); - Q3D_DECL_DEPRECATED virtual void sceneChangeEvent(const QSceneChangePtr &e); QBackendNodePrivate *d_ptr; private: Q_DISABLE_COPY(QBackendNode) void setPeerId(QNodeId id) Q_DECL_NOEXCEPT; - Q3D_DECL_DEPRECATED virtual void initializeFromPeer(const QNodeCreatedChangeBasePtr &change); - friend class QBackendNodePropertyChange; friend class QAbstractAspectPrivate; #if defined(QT_BUILD_INTERNAL) friend class QBackendNodeTester; diff --git a/src/core/nodes/qbackendnode_p.h b/src/core/nodes/qbackendnode_p.h index 260eef087..8a4e4c57c 100644 --- a/src/core/nodes/qbackendnode_p.h +++ b/src/core/nodes/qbackendnode_p.h @@ -53,10 +53,6 @@ #include #include - -#include -#include -#include #include QT_BEGIN_NAMESPACE @@ -66,15 +62,10 @@ namespace Qt3DCore { class QNode; class Q_3DCORE_PRIVATE_EXPORT QBackendNodePrivate - : public QObserverInterface - , public QObservableInterface { public: QBackendNodePrivate(QBackendNode::Mode mode); - void setArbiter(QLockableObserverInterface *arbiter) override; - void notifyObservers(const QSceneChangePtr &e) override; - void sceneChangeEvent(const QSceneChangePtr &e) override; void setEnabled(bool enabled); static QBackendNodePrivate *get(QBackendNode *n); @@ -83,7 +74,6 @@ public: QBackendNode *q_ptr; QBackendNode::Mode m_mode; - QLockableObserverInterface *m_arbiter; QNodeId m_peerId; bool m_enabled; diff --git a/src/core/nodes/qentity.cpp b/src/core/nodes/qentity.cpp index 1199dfc4b..ac07faaef 100644 --- a/src/core/nodes/qentity.cpp +++ b/src/core/nodes/qentity.cpp @@ -41,7 +41,6 @@ #include "qentity_p.h" #include -#include #include #include @@ -144,7 +143,7 @@ void QEntityPrivate::removeDestroyedComponent(QComponent *comp) Q_CHECK_PTR(comp); qCDebug(Nodes) << Q_FUNC_INFO << comp; - updateNode(comp, nullptr, ComponentRemoved); + updateComponentRelationShip(comp, ComponentRelationshipChange::Removed); m_components.removeOne(comp); // Remove bookkeeping connection @@ -223,7 +222,7 @@ void QEntity::addComponent(QComponent *comp) // Ensures proper bookkeeping d->registerPrivateDestructionHelper(comp, &QEntityPrivate::removeDestroyedComponent); - d->updateNode(comp, nullptr, ComponentAdded); + d->updateComponentRelationShip(comp, ComponentRelationshipChange::Added); static_cast(QComponentPrivate::get(comp))->addEntity(this); } @@ -238,7 +237,7 @@ void QEntity::removeComponent(QComponent *comp) static_cast(QComponentPrivate::get(comp))->removeEntity(this); - d->updateNode(comp, nullptr, ComponentRemoved); + d->updateComponentRelationShip(comp, ComponentRelationshipChange::Removed); d->m_components.removeOne(comp); @@ -294,35 +293,17 @@ QString QEntityPrivate::dumpSceneGraph() const return dumpSG(q).join('\n'); } -QNodeCreatedChangeBasePtr QEntity::createNodeCreationChange() const +void QEntityPrivate::updateComponentRelationShip(QComponent *component, ComponentRelationshipChange::RelationShip change) { - auto creationChange = QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - - Q_D(const QEntity); - data.parentEntityId = parentEntity() ? parentEntity()->id() : Qt3DCore::QNodeId(); - - // Find all child entities - QQueue queue; - queue.append(childNodes().toList()); - data.childEntityIds.reserve(queue.size()); - while (!queue.isEmpty()) { - auto *child = queue.dequeue(); - auto *childEntity = qobject_cast(child); - if (childEntity != nullptr) - data.childEntityIds.push_back(childEntity->id()); - else - queue.append(child->childNodes().toList()); + if (m_changeArbiter) { + // Ensure node has its postConstructorInit called if we reach this + // point, we could otherwise endup referencing a node that has yet + // to be created in the backend + QNodePrivate::get(component)->_q_ensureBackendNodeCreated(); + + Q_Q(QEntity); + m_changeArbiter->addDirtyEntityComponentNodes(q, component, change); } - - data.componentIdsAndTypes.reserve(d->m_components.size()); - const QComponentVector &components = d->m_components; - for (QComponent *c : components) { - const auto idAndType = QNodeIdTypePair(c->id(), QNodePrivate::findStaticMetaObject(c->metaObject())); - data.componentIdsAndTypes.push_back(idAndType); - } - - return creationChange; } void QEntity::onParentChanged(QObject *) diff --git a/src/core/nodes/qentity.h b/src/core/nodes/qentity.h index 62398faa1..ab87da4eb 100644 --- a/src/core/nodes/qentity.h +++ b/src/core/nodes/qentity.h @@ -88,8 +88,6 @@ private Q_SLOTS: private: Q_DECLARE_PRIVATE(QEntity) - - QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; typedef QSharedPointer QEntityPtr; diff --git a/src/core/nodes/qentity_p.h b/src/core/nodes/qentity_p.h index 992f81931..d074148c1 100644 --- a/src/core/nodes/qentity_p.h +++ b/src/core/nodes/qentity_p.h @@ -55,6 +55,7 @@ #include #include +#include QT_BEGIN_NAMESPACE @@ -69,6 +70,7 @@ public : Q_DECLARE_PUBLIC(QEntity) QNodeId parentEntityId() const; + void updateComponentRelationShip(QComponent *component, ComponentRelationshipChange::RelationShip change); template QVector componentsOfType() const diff --git a/src/core/nodes/qnode.cpp b/src/core/nodes/qnode.cpp index ad084242f..918ce0827 100644 --- a/src/core/nodes/qnode.cpp +++ b/src/core/nodes/qnode.cpp @@ -43,12 +43,7 @@ #include #include -#include #include -#include -#include -#include -#include #include #include #include @@ -57,7 +52,6 @@ #include #include #include -#include #include #include #include @@ -141,13 +135,6 @@ void QNodePrivate::notifyDestructionChangesAndRemoveFromScene() { Q_Q(QNode); - // We notify the backend that the parent lost us as a child - if (m_changeArbiter != nullptr && !m_parentId.isNull()) { - const auto change = QPropertyNodeRemovedChangePtr::create(m_parentId, q); - change->setPropertyName("children"); - notifyObservers(change); - } - // Tell the backend we are about to be destroyed if (m_hasBackendNode && m_scene && m_scene->engine()) QAspectEnginePrivate::get(m_scene->engine())->removeNode(q); @@ -238,9 +225,7 @@ void QNodePrivate::_q_addChild(QNode *childNode) // we need to catch that to avoid sending more than one new child event // to the backend. childD->m_notifiedParent = true; - const auto change = QPropertyNodeAddedChangePtr::create(m_id, childNode); - change->setPropertyName("children"); - notifyObservers(change); + update(); } // Update the scene @@ -261,13 +246,7 @@ void QNodePrivate::_q_removeChild(QNode *childNode) Q_ASSERT_X(childNode->parent() == q_func(), Q_FUNC_INFO, "not a child of this node"); QNodePrivate::get(childNode)->m_parentId = QNodeId(); - - // We notify the backend that we lost a child - if (m_changeArbiter != nullptr) { - const auto change = QPropertyNodeRemovedChangePtr::create(m_id, childNode); - change->setPropertyName("children"); - notifyObservers(change); - } + update(); } /*! @@ -458,7 +437,7 @@ void QNodePrivate::addEntityComponentToScene(QNode *root) \internal */ // Called in the main thread by QScene -> following QEvent::childAdded / addChild -void QNodePrivate::setArbiter(QLockableObserverInterface *arbiter) +void QNodePrivate::setArbiter(QChangeArbiter *arbiter) { if (m_changeArbiter && m_changeArbiter != arbiter) { unregisterNotifiedProperties(); @@ -467,7 +446,7 @@ void QNodePrivate::setArbiter(QLockableObserverInterface *arbiter) Q_Q(QNode); m_changeArbiter->removeDirtyFrontEndNode(q); } - m_changeArbiter = static_cast(arbiter); + m_changeArbiter = arbiter; if (m_changeArbiter) registerNotifiedProperties(); } @@ -522,53 +501,6 @@ void QNodePrivate::_q_ensureBackendNodeCreated() \sa QEntity, QComponent */ -/*! - * Sends the \a change QSceneChangePtr to any QBackendNodes in the registered - * aspects that correspond to this QNode. - * - * You only need to call this function if you wish to send a specific type of - * change in place of the automatic handling. - * - * Note: as of Qt 5.14, change messages are deprecated and should not be used, - * in particular for properties. - */ -void QNode::notifyObservers(const QSceneChangePtr &change) -{ - Q_D(QNode); - d->notifyObservers(change); -} - -/*! - \obsolete - - Called when one or more backend aspects sends a notification \a change to the - current Qt3DCore::QNode instance. - - \note This method should be reimplemented in your subclasses to properly - handle the \a change. -*/ -void QNode::sceneChangeEvent(const QSceneChangePtr &change) -{ - Q_UNUSED(change) - if (change->type() == Qt3DCore::PropertyUpdated) { - // TODO: Do this more efficiently. We could pass the metaobject and property - // index to the animation aspect via the QChannelMapping. This would - // allow us to avoid the propertyIndex lookup here by sending them in - // a new subclass of QPropertyUpdateChange. - // Try to find property and call setter - auto e = qSharedPointerCast(change); - const QMetaObject *mo = metaObject(); - const int propertyIndex = mo->indexOfProperty(e->propertyName()); - QMetaProperty mp = mo->property(propertyIndex); - bool wasBlocked = blockNotifications(true); - mp.write(this, e->value()); - blockNotifications(wasBlocked); - } else { - // Nothing is handling this change, warn the user. - qWarning() << Q_FUNC_INFO << "sceneChangeEvent should have been subclassed"; - } -} - /*! \internal */ @@ -618,25 +550,6 @@ void QNodePrivate::notifyDynamicPropertyChange(const QByteArray &name, const QVa update(); } -/*! - \internal - */ -// Called by the main thread -void QNodePrivate::notifyObservers(const QSceneChangePtr &change) -{ - Q_ASSERT(change); - - // Don't send notifications if we are blocking - if (m_blockNotifications && change->type() == PropertyUpdated) - return; - - if (m_changeArbiter != nullptr) { - QAbstractPostman *postman = m_changeArbiter->postman(); - if (postman != nullptr) - postman->notifyBackend(change); - } -} - // Inserts this tree into the main Scene tree. // Needed when SceneLoaders provide a cloned tree from the backend // and need to insert it in the main scene tree @@ -682,19 +595,6 @@ void QNodePrivate::update() } } -void QNodePrivate::updateNode(QNode *node, const char *property, ChangeFlag change) -{ - if (m_changeArbiter) { - // Ensure node has its postConstructorInit called if we reach this - // point, we could otherwise endup referencing a node that has yet - // to be created in the backend - QNodePrivate::get(node)->_q_ensureBackendNodeCreated(); - - Q_Q(QNode); - m_changeArbiter->addDirtyFrontEndNode(q, node, property, change); - } -} - /*! \internal */ @@ -999,21 +899,6 @@ void QNode::clearPropertyTrackings() d->updatePropertyTrackMode(); } -/*! - * \obsolete - */ -QNodeCreatedChangeBasePtr QNode::createNodeCreationChange() const -{ - // Uncomment this when implementing new frontend and backend types. - // Any classes that don't override this function will be noticeable here. - // Note that some classes actually don't need to override as they have - // no additional data to send. In those cases this default implementation - // is perfectly fine. - // const QMetaObject *mo = metaObject(); - // qDebug() << Q_FUNC_INFO << mo->className(); - return QNodeCreatedChangeBasePtr::create(this); -} - /*! \fn Qt3DCore::QNodeCommand::CommandId Qt3DCore::QNodeCommand::inReplyTo() const @@ -1052,52 +937,6 @@ QNodeCreatedChangeBasePtr QNode::createNodeCreationChange() const Erases all values that have been saved by the property tracking. */ -/*! - * \brief Sends a command message to the backend node - * \obsolete - * - * Creates a QNodeCommand message and dispatches it to the backend node. The - * command is given and a \a name and some \a data which can be used in the - * backend node to perform various operations. - * This returns a CommandId which can be used to identify the initial command - * when receiving a message in reply. If the command message is to be sent in - * reply to another command, \a replyTo contains the id of that command. - * - * \sa QNodeCommand, QNode::sendReply - */ -QNodeCommand::CommandId QNode::sendCommand(const QString &name, - const QVariant &data, - QNodeCommand::CommandId replyTo) -{ - Q_D(QNode); - - // Bail out early, if we can, to avoid operator new - if (d->m_blockNotifications) - return QNodeCommand::CommandId(0); - - auto e = QNodeCommandPtr::create(d->m_id); - e->setName(name); - e->setData(data); - e->setReplyToCommandId(replyTo); - d->notifyObservers(e); - return e->commandId(); -} - -/*! - * \brief Send a \a command back to the backend node. - * \obsolete - * - * Assumes the command is to be to sent back in reply to itself to the backend node. - * - * \sa QNodeCommand, QNode::sendCommand - */ -void QNode::sendReply(const QNodeCommandPtr &command) -{ - Q_D(QNode); - command->setDeliveryFlags(QSceneChange::BackendNodes); - d->notifyObservers(command); -} - namespace { diff --git a/src/core/nodes/qnode.h b/src/core/nodes/qnode.h index efdec8da5..f24daf63f 100644 --- a/src/core/nodes/qnode.h +++ b/src/core/nodes/qnode.h @@ -40,10 +40,7 @@ #ifndef QT3DCORE_QNODE_H #define QT3DCORE_QNODE_H -#include #include -#include -#include #include #include @@ -99,10 +96,6 @@ public: void clearPropertyTracking(const QString &propertyName); void clearPropertyTrackings(); - Q3D_DECL_DEPRECATED QNodeCommand::CommandId sendCommand(const QString &name, const QVariant &data = QVariant(), - QNodeCommand::CommandId replyTo = QNodeCommand::CommandId()); - Q3D_DECL_DEPRECATED void sendReply(const QNodeCommandPtr &command); - public Q_SLOTS: void setParent(QNode *parent); void setEnabled(bool isEnabled); @@ -116,12 +109,9 @@ Q_SIGNALS: protected: explicit QNode(QNodePrivate &dd, QNode *parent = nullptr); - Q3D_DECL_DEPRECATED void notifyObservers(const QSceneChangePtr &change); - Q3D_DECL_DEPRECATED virtual void sceneChangeEvent(const QSceneChangePtr &change); private: Q_DECLARE_PRIVATE(QNode) - Q3D_DECL_DEPRECATED virtual QNodeCreatedChangeBasePtr createNodeCreationChange() const; // We only want setParent(QNode *) to be callable // when dealing with QNode objects @@ -135,8 +125,6 @@ private: friend class QAspectEngine; friend class QAspectEnginePrivate; friend class QAbstractAspectPrivate; - friend class QNodeCreatedChangeGenerator; - friend class QPostman; friend class QScene; #if defined(QT_BUILD_INTERNAL) diff --git a/src/core/nodes/qnode_p.h b/src/core/nodes/qnode_p.h index 5aa4c5328..907f0062a 100644 --- a/src/core/nodes/qnode_p.h +++ b/src/core/nodes/qnode_p.h @@ -57,7 +57,6 @@ #include #include -#include #include #include #include @@ -69,7 +68,7 @@ namespace Qt3DCore { class QNode; class QAspectEngine; -class Q_3DCORE_PRIVATE_EXPORT QNodePrivate : public QObjectPrivate, public QObservableInterface +class Q_3DCORE_PRIVATE_EXPORT QNodePrivate : public QObjectPrivate { public: QNodePrivate(); @@ -80,26 +79,21 @@ public: virtual void setScene(QScene *scene); QScene *scene() const; - void setArbiter(QLockableObserverInterface *arbiter) override; + void setArbiter(QChangeArbiter *arbiter); void notifyPropertyChange(const char *name, const QVariant &value); void notifyDynamicPropertyChange(const QByteArray &name, const QVariant &value); - void notifyObservers(const QSceneChangePtr &change) override; void insertTree(QNode *treeRoot, int depth = 0); void updatePropertyTrackMode(); void update(); - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - void updateNode(QNode *node, const char* property, ChangeFlag change); - QT_WARNING_POP Q_DECLARE_PUBLIC(QNode) // For now this just protects access to the m_changeArbiter. // Later on we may decide to extend support for multiple observers. - QAbstractArbiter *m_changeArbiter; + QChangeArbiter *m_changeArbiter; QMetaObject *m_typeInfo; QScene *m_scene; mutable QNodeId m_id; diff --git a/src/core/nodes/qnodecreatedchangegenerator.cpp b/src/core/nodes/qnodecreatedchangegenerator.cpp deleted file mode 100644 index d91949fb1..000000000 --- a/src/core/nodes/qnodecreatedchangegenerator.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qnodecreatedchangegenerator_p.h" - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QNodeCreatedChangeGenerator::QNodeCreatedChangeGenerator(QNode *rootNode) -{ - QNodeVisitor visitor; - visitor.traverse(rootNode, this, &QNodeCreatedChangeGenerator::createCreationChange); -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/nodes/qnodecreatedchangegenerator_p.h b/src/core/nodes/qnodecreatedchangegenerator_p.h deleted file mode 100644 index 35e5b673e..000000000 --- a/src/core/nodes/qnodecreatedchangegenerator_p.h +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QNODECREATEDCHANGEGENERATOR_H -#define QT3DCORE_QNODECREATEDCHANGEGENERATOR_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#include -#include - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class Q_3DCORE_PRIVATE_EXPORT QNodeCreatedChangeGenerator -{ -public: - QNodeCreatedChangeGenerator(QNode *rootNode); - - QVector creationChanges() const { return m_creationChanges; } - -private: - void createCreationChange(QNode *node) - { - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - const auto creationChange = node->createNodeCreationChange(); - m_creationChanges.push_back(creationChange); - - // Store the metaobject of the node in the QNode so that we have it available - // to us during destruction in the QNode destructor. This allows us to send - // the QNodeId and the metaobject as typeinfo to the backend aspects so they - // in turn can find the correct QBackendNodeMapper object to handle the destruction - // of the corresponding backend nodes. - QNodePrivate *d = QNodePrivate::get(node); - d->m_typeInfo = const_cast(creationChange->metaObject()); - - // Mark this node as having been handled for creation so that it is picked up - d->m_hasBackendNode = true; - QT_WARNING_POP - } - - QVector m_creationChanges; -}; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QNODECREATEDCHANGEGENERATOR_H diff --git a/src/core/qchangearbiter.cpp b/src/core/qchangearbiter.cpp index e5745b017..678178a44 100644 --- a/src/core/qchangearbiter.cpp +++ b/src/core/qchangearbiter.cpp @@ -39,6 +39,7 @@ #include "qchangearbiter_p.h" +#include #include #include #include @@ -47,7 +48,6 @@ #include #include -#include #include #include @@ -56,127 +56,14 @@ QT_BEGIN_NAMESPACE namespace Qt3DCore { -/* !\internal - \class Qt3DCore::QChangeArbiter - \inmodule Qt3DCore - \since 5.5 - - \brief Acts as a message router between observables and observers. - - Observables can be of two types: QNode observables and \l {QObservableInterface}s. - QNode notifications are sent from the frontend QNode and delivered to the backend observers. - QObservableInterface notifications are sent from backend nodes to backend observers and/or to the - registered QPostman, which in turn delivers the notifications to the target frontend QNode. - - QNode observables are registered automatically. However, QObservableInterface object have to be registered manually - by providing the QNodeId of the corresponding frontend QNode. - - Observers can be registered to receive messages from a QObservableInterface/QNode observable by providing a QNode NodeUuid. - When a notification from a QObservableInterface is received, it is then sent to all observers observing the - QNode NodeUuid as well as the QPostman to update the frontend QNode. -*/ QChangeArbiter::QChangeArbiter(QObject *parent) : QObject(parent) - , m_jobManager(nullptr) - , m_postman(nullptr) , m_scene(nullptr) { - // The QMutex has to be recursive to handle the case where : - // 1) SyncChanges is called, mutex is locked - // 2) Changes are distributed - // 3) An observer decides to register a new observable upon receiving notification - // 4) registerObserver locks the mutex once again -> we need recursion otherwise deadlock - // 5) Mutex is unlocked - leaving registerObserver - // 6) Mutex is unlocked - leaving SyncChanges } QChangeArbiter::~QChangeArbiter() { - if (m_jobManager != nullptr) - m_jobManager->waitForPerThreadFunction(QChangeArbiter::destroyThreadLocalChangeQueue, this); - m_lockingChangeQueues.clear(); - m_changeQueues.clear(); -} - -void QChangeArbiter::initialize(QAbstractAspectJobManager *jobManager) -{ - Q_CHECK_PTR(jobManager); - m_jobManager = jobManager; - - // Init TLS for the change queues - m_jobManager->waitForPerThreadFunction(QChangeArbiter::createThreadLocalChangeQueue, this); -} - -void QChangeArbiter::distributeQueueChanges(QChangeQueue *changeQueue) -{ - for (int i = 0, n = int(changeQueue->size()); i < n; i++) { - QSceneChangePtr& change = (*changeQueue)[i]; - // Lookup which observers care about the subject this change came from - // and distribute the change to them - if (change.isNull()) - continue; - - if (change->type() == NodeCreated || change->type() == NodeDeleted) { - Q_ASSERT(false); // messages no longer used - } - - const QNodeId nodeId = change->subjectId(); - const auto it = m_nodeObservations.constFind(nodeId); - if (it != m_nodeObservations.cend()) { - const QObserverList &observers = it.value(); - for (const QObserverPair &observer : observers) { - if ((change->type() & observer.first) && - (change->deliveryFlags() & QSceneChange::BackendNodes)) - observer.second->sceneChangeEvent(change); - } - // Also send change to the postman - if (change->deliveryFlags() & QSceneChange::Nodes) { - // Check if QNode actually cares about the change - if (m_postman->shouldNotifyFrontend(change)) - m_postman->sceneChangeEvent(change); - } - } - } - changeQueue->clear(); -} - -QThreadStorage *QChangeArbiter::tlsChangeQueue() -{ - return &(m_tlsChangeQueue); -} - -void QChangeArbiter::appendChangeQueue(QChangeArbiter::QChangeQueue *queue) -{ - const std::lock_guard locker(m_mutex);; - m_changeQueues.append(queue); -} - -void QChangeArbiter::removeChangeQueue(QChangeArbiter::QChangeQueue *queue) -{ - const std::lock_guard locker(m_mutex);; - m_changeQueues.removeOne(queue); -} - -void QChangeArbiter::appendLockingChangeQueue(QChangeArbiter::QChangeQueue *queue) -{ - const std::lock_guard locker(m_mutex);; - m_lockingChangeQueues.append(queue); -} - -void QChangeArbiter::removeLockingChangeQueue(QChangeArbiter::QChangeQueue *queue) -{ - const std::lock_guard locker(m_mutex);; - m_lockingChangeQueues.removeOne(queue); -} - -void QChangeArbiter::syncChanges() -{ - const std::lock_guard locker(m_mutex);; - for (QChangeArbiter::QChangeQueue *changeQueue : qAsConst(m_changeQueues)) - distributeQueueChanges(changeQueue); - - for (QChangeQueue *changeQueue : qAsConst(m_lockingChangeQueues)) - distributeQueueChanges(changeQueue); } void QChangeArbiter::setScene(QScene *scene) @@ -184,69 +71,11 @@ void QChangeArbiter::setScene(QScene *scene) m_scene = scene; } -QAbstractPostman *QChangeArbiter::postman() const -{ - return m_postman; -} - QScene *QChangeArbiter::scene() const { return m_scene; } -void QChangeArbiter::registerObserver(QObserverInterface *observer, - QNodeId nodeId, - ChangeFlags changeFlags) -{ - const std::lock_guard locker(m_mutex);; - QObserverList &observerList = m_nodeObservations[nodeId]; - observerList.append(QObserverPair(changeFlags, observer)); -} - -void QChangeArbiter::unregisterObserver(QObserverInterface *observer, QNodeId nodeId) -{ - const std::lock_guard locker(m_mutex);; - const auto it = m_nodeObservations.find(nodeId); - if (it != m_nodeObservations.end()) { - QObserverList &observers = it.value(); - for (int i = observers.count() - 1; i >= 0; i--) { - if (observers[i].second == observer) - observers.removeAt(i); - } - if (observers.isEmpty()) - m_nodeObservations.erase(it); - } -} - -void QChangeArbiter::sceneChangeEvent(const QSceneChangePtr &e) -{ - // qCDebug(ChangeArbiter) << Q_FUNC_INFO << QThread::currentThread(); - - // Add the change to the thread local storage queue - no locking required => yay! - QChangeQueue *localChangeQueue = m_tlsChangeQueue.localData(); - localChangeQueue->push_back(e); - - emit receivedChange(); - - // qCDebug(ChangeArbiter) << "Change queue for thread" << QThread::currentThread() << "now contains" << localChangeQueue->count() << "items"; -} - -void QChangeArbiter::sceneChangeEventWithLock(const QSceneChangePtr &e) -{ - const std::lock_guard locker(m_mutex);; - sceneChangeEvent(e); -} - -void QChangeArbiter::sceneChangeEventWithLock(const QSceneChangeList &e) -{ - const std::lock_guard locker(m_mutex);; - QChangeQueue *localChangeQueue = m_tlsChangeQueue.localData(); - qCDebug(ChangeArbiter) << Q_FUNC_INFO << "Handles " << e.size() << " changes at once"; - localChangeQueue->insert(localChangeQueue->end(), e.begin(), e.end()); - - emit receivedChange(); -} - void QChangeArbiter::addDirtyFrontEndNode(QNode *node) { if (!m_dirtyFrontEndNodes.contains(node)) { @@ -255,18 +84,19 @@ void QChangeArbiter::addDirtyFrontEndNode(QNode *node) } } -void QChangeArbiter::addDirtyFrontEndNode(QNode *node, QNode *subNode, const char *property, ChangeFlag change) +void QChangeArbiter::addDirtyEntityComponentNodes(QEntity *entity, QComponent *component, + ComponentRelationshipChange::RelationShip change) { - addDirtyFrontEndNode(node); - m_dirtySubNodeChanges.push_back({node, subNode, change, property}); + addDirtyFrontEndNode(entity); + m_dirtyEntityComponentNodeChanges.push_back({entity, component, change}); } void QChangeArbiter::removeDirtyFrontEndNode(QNode *node) { m_dirtyFrontEndNodes.removeOne(node); - m_dirtySubNodeChanges.erase(std::remove_if(m_dirtySubNodeChanges.begin(), m_dirtySubNodeChanges.end(), [node](const NodeRelationshipChange &elt) { + m_dirtyEntityComponentNodeChanges.erase(std::remove_if(m_dirtyEntityComponentNodeChanges.begin(), m_dirtyEntityComponentNodeChanges.end(), [node](const ComponentRelationshipChange &elt) { return elt.node == node || elt.subNode == node; - }), m_dirtySubNodeChanges.end()); + }), m_dirtyEntityComponentNodeChanges.end()); } QVector QChangeArbiter::takeDirtyFrontEndNodes() @@ -274,72 +104,9 @@ QVector QChangeArbiter::takeDirtyFrontEndNodes() return std::move(m_dirtyFrontEndNodes); } -QVector QChangeArbiter::takeDirtyFrontEndSubNodes() -{ - return std::move(m_dirtySubNodeChanges); -} - -// Either we have the postman or we could make the QChangeArbiter agnostic to the postman -// but that would require adding it to every QObserverList in m_aspectObservations. -void QChangeArbiter::setPostman(QAbstractPostman *postman) -{ - if (m_postman != postman) { - // Unregister old postman here if needed - m_postman = postman; - } -} - -void QChangeArbiter::createUnmanagedThreadLocalChangeQueue(void *changeArbiter) -{ - Q_ASSERT(changeArbiter); - - QChangeArbiter *arbiter = static_cast(changeArbiter); - - qCDebug(ChangeArbiter) << Q_FUNC_INFO << QThread::currentThread(); - if (!arbiter->tlsChangeQueue()->hasLocalData()) { - QChangeQueue *localChangeQueue = new QChangeQueue; - arbiter->tlsChangeQueue()->setLocalData(localChangeQueue); - arbiter->appendLockingChangeQueue(localChangeQueue); - } -} - -void QChangeArbiter::destroyUnmanagedThreadLocalChangeQueue(void *changeArbiter) -{ - Q_ASSERT(changeArbiter); - - QChangeArbiter *arbiter = static_cast(changeArbiter); - qCDebug(ChangeArbiter) << Q_FUNC_INFO << QThread::currentThread(); - if (arbiter->tlsChangeQueue()->hasLocalData()) { - QChangeQueue *localChangeQueue = arbiter->tlsChangeQueue()->localData(); - arbiter->removeLockingChangeQueue(localChangeQueue); - arbiter->tlsChangeQueue()->setLocalData(nullptr); - } -} - -void QChangeArbiter::createThreadLocalChangeQueue(void *changeArbiter) -{ - Q_CHECK_PTR(changeArbiter); - - QChangeArbiter *arbiter = static_cast(changeArbiter); - - qCDebug(ChangeArbiter) << Q_FUNC_INFO << QThread::currentThread(); - if (!arbiter->tlsChangeQueue()->hasLocalData()) { - QChangeQueue *localChangeQueue = new QChangeQueue; - arbiter->tlsChangeQueue()->setLocalData(localChangeQueue); - arbiter->appendChangeQueue(localChangeQueue); - } -} - -void QChangeArbiter::destroyThreadLocalChangeQueue(void *changeArbiter) +QVector QChangeArbiter::takeDirtyEntityComponentNodes() { - // TODO: Implement me! - Q_UNUSED(changeArbiter); - QChangeArbiter *arbiter = static_cast(changeArbiter); - if (arbiter->tlsChangeQueue()->hasLocalData()) { - QChangeQueue *localChangeQueue = arbiter->tlsChangeQueue()->localData(); - arbiter->removeChangeQueue(localChangeQueue); - arbiter->tlsChangeQueue()->setLocalData(nullptr); - } + return std::move(m_dirtyEntityComponentNodeChanges); } } // namespace Qt3DCore diff --git a/src/core/qchangearbiter_p.h b/src/core/qchangearbiter_p.h index 483b46575..91c232d2a 100644 --- a/src/core/qchangearbiter_p.h +++ b/src/core/qchangearbiter_p.h @@ -52,7 +52,6 @@ // #include -#include #include #include #include @@ -62,9 +61,7 @@ #include #include -#include #include -#include QT_BEGIN_NAMESPACE @@ -76,103 +73,48 @@ class QAbstractAspectJobManager; class QSceneObserverInterface; class QAbstractPostman; class QScene; +class QEntity; +class QComponent; - -class Q_3DCORE_PRIVATE_EXPORT QAbstractArbiter : public QLockableObserverInterface +struct ComponentRelationshipChange { -public: - virtual QAbstractPostman *postman() const = 0; - virtual void addDirtyFrontEndNode(QNode *node) = 0; - virtual void removeDirtyFrontEndNode(QNode *node) = 0; - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - virtual void addDirtyFrontEndNode(QNode *node, QNode *subNode, const char *property, ChangeFlag change) = 0; - QT_WARNING_POP + QNode *node; + QNode *subNode; + + enum RelationShip { + Added = 0, + Removed + }; + RelationShip change; }; -class Q_3DCORE_PRIVATE_EXPORT QChangeArbiter final +class Q_3DCORE_PRIVATE_EXPORT QChangeArbiter : public QObject - , public QAbstractArbiter { Q_OBJECT public: explicit QChangeArbiter(QObject *parent = nullptr); ~QChangeArbiter(); - void initialize(Qt3DCore::QAbstractAspectJobManager *jobManager); - - void syncChanges(); - - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - void registerObserver(QObserverInterface *observer, - QNodeId nodeId, - ChangeFlags changeFlags = AllChanges); - QT_WARNING_POP - void unregisterObserver(QObserverInterface *observer, - QNodeId nodeId); - - void sceneChangeEvent(const QSceneChangePtr &e) override; // QLockableObserverInterface impl - void sceneChangeEventWithLock(const QSceneChangePtr &e) override; // QLockableObserverInterface impl - void sceneChangeEventWithLock(const QSceneChangeList &e) override; // QLockableObserverInterface impl - - void addDirtyFrontEndNode(QNode *node) override; - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - void addDirtyFrontEndNode(QNode *node, QNode *subNode, const char *property, ChangeFlag change) override; - QT_WARNING_POP - void removeDirtyFrontEndNode(QNode *node) override; + void addDirtyFrontEndNode(QNode *node); + void addDirtyEntityComponentNodes(QEntity *entity, QComponent *component, + ComponentRelationshipChange::RelationShip change); + + void removeDirtyFrontEndNode(QNode *node); QVector takeDirtyFrontEndNodes(); - QVector takeDirtyFrontEndSubNodes(); + QVector takeDirtyEntityComponentNodes(); - void setPostman(Qt3DCore::QAbstractPostman *postman); void setScene(Qt3DCore::QScene *scene); - QAbstractPostman *postman() const final; QScene *scene() const; - static void createUnmanagedThreadLocalChangeQueue(void *changeArbiter); - static void destroyUnmanagedThreadLocalChangeQueue(void *changeArbiter); - static void createThreadLocalChangeQueue(void *changeArbiter); - static void destroyThreadLocalChangeQueue(void *changeArbiter); - Q_SIGNALS: void receivedChange(); protected: - typedef std::vector QChangeQueue; - typedef QPair QObserverPair; - typedef QVector QObserverList; - - void distributeQueueChanges(QChangeQueue *queue); - - QThreadStorage *tlsChangeQueue(); - void appendChangeQueue(QChangeQueue *queue); - void removeChangeQueue(QChangeQueue *queue); - void appendLockingChangeQueue(QChangeQueue *queue); - void removeLockingChangeQueue(QChangeQueue *queue); - -private: - mutable QRecursiveMutex m_mutex; - QAbstractAspectJobManager *m_jobManager; - - // The lists of observers indexed by observable (QNodeId). - // m_nodeObservations is for observables in the main thread's object tree - QHash m_nodeObservations; - - // Each thread has a TLS ChangeQueue so we never need to lock whilst - // receiving a QSceneChange. - QThreadStorage m_tlsChangeQueue; - - // We store a list of the ChangeQueue's from each thread. This will only - // be accessed from the aspect thread during the syncChanges() phase. - QList m_changeQueues; - QList m_lockingChangeQueues; - QAbstractPostman *m_postman; QScene *m_scene; - QVector m_dirtyFrontEndNodes; - QVector m_dirtySubNodeChanges; + QVector m_dirtyEntityComponentNodeChanges; }; } // namespace Qt3DCore diff --git a/src/core/qlockableobserverinterface.cpp b/src/core/qlockableobserverinterface.cpp deleted file mode 100644 index ac0bf4c32..000000000 --- a/src/core/qlockableobserverinterface.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qlockableobserverinterface_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QLockableObserverInterface::~QLockableObserverInterface() -{ -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/qlockableobserverinterface_p.h b/src/core/qlockableobserverinterface_p.h deleted file mode 100644 index 57650aba2..000000000 --- a/src/core/qlockableobserverinterface_p.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QLOCKABLEOBSERVERINTERFACE_P_H -#define QT3DCORE_QLOCKABLEOBSERVERINTERFACE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -typedef std::vector QSceneChangeList; - -class Q_3DCORE_PRIVATE_EXPORT QLockableObserverInterface : public QObserverInterface -{ -public: - virtual ~QLockableObserverInterface(); - virtual void sceneChangeEventWithLock(const QSceneChangePtr &e) = 0; - virtual void sceneChangeEventWithLock(const QSceneChangeList &e) = 0; -}; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -Q_DECLARE_METATYPE(Qt3DCore::QLockableObserverInterface *) // LCOV_EXCL_LINE - -#endif // QT3DCORE_QLOCKABLEOBSERVERINTERFACE_P_H diff --git a/src/core/qobservableinterface.cpp b/src/core/qobservableinterface.cpp deleted file mode 100644 index 51c4dbbf9..000000000 --- a/src/core/qobservableinterface.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qobservableinterface_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QObservableInterface::~QObservableInterface() -{ -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/qobservableinterface_p.h b/src/core/qobservableinterface_p.h deleted file mode 100644 index e4d343d63..000000000 --- a/src/core/qobservableinterface_p.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QOBSERVABLEINTERFACE_P_H -#define QT3DCORE_QOBSERVABLEINTERFACE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QLockableObserverInterface; - -class Q_3DCORE_PRIVATE_EXPORT QObservableInterface -{ -public: - virtual ~QObservableInterface(); - - virtual void setArbiter(QLockableObserverInterface *arbiter) = 0; - -protected: - virtual void notifyObservers(const QSceneChangePtr &e) = 0; -}; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QOBSERVABLEINTERFACE_P_H diff --git a/src/core/qobserverinterface.cpp b/src/core/qobserverinterface.cpp deleted file mode 100644 index 0e452f169..000000000 --- a/src/core/qobserverinterface.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qobserverinterface_p.h" - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QObserverInterface::~QObserverInterface() -{ -} - -} // namespace Qt3DCore - -QT_END_NAMESPACE diff --git a/src/core/qobserverinterface_p.h b/src/core/qobserverinterface_p.h deleted file mode 100644 index d19905dd2..000000000 --- a/src/core/qobserverinterface_p.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QOBSERVERINTERFACE_P_H -#define QT3DCORE_QOBSERVERINTERFACE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class Q_3DCORESHARED_EXPORT QObserverInterface -{ -public: - virtual ~QObserverInterface(); - virtual void sceneChangeEvent(const QSceneChangePtr &e) = 0; -}; - -} // namespace Qt3DCore - -QT_END_NAMESPACE - -Q_DECLARE_METATYPE(Qt3DCore::QObserverInterface *) // LCOV_EXCL_LINE - -#endif // QT3DCORE_QOBSERVERINTERFACE_P_H diff --git a/src/core/qpostman.cpp b/src/core/qpostman.cpp deleted file mode 100644 index 6d6484f18..000000000 --- a/src/core/qpostman.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qpostman_p.h" -#include "qpostman_p_p.h" - -#include -#include - -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -QPostmanPrivate *QPostmanPrivate::get(QPostman *q) -{ - return q->d_func(); -} - -QPostman::QPostman(QObject *parent) - : QObject(*new QPostmanPrivate, parent) -{ - qRegisterMetaType("QSceneChangePtr"); -} - -QPostman::~QPostman() -{ -} - -void QPostman::setScene(QScene *scene) -{ - Q_D(QPostman); - d->m_scene = scene; -} - -static inline QMetaMethod notifyFrontendNodeMethod() -{ - int idx = QPostman::staticMetaObject.indexOfMethod("notifyFrontendNode(QSceneChangePtr)"); - Q_ASSERT(idx != -1); - return QPostman::staticMetaObject.method(idx); -} - -void QPostman::sceneChangeEvent(const QSceneChangePtr &e) -{ - static const QMetaMethod notifyFrontendNode = notifyFrontendNodeMethod(); - notifyFrontendNode.invoke(this, Q_ARG(QSceneChangePtr, e)); -} - -static inline QMetaMethod submitChangeBatchMethod() -{ - int idx = QPostman::staticMetaObject.indexOfMethod("submitChangeBatch()"); - Q_ASSERT(idx != -1); - return QPostman::staticMetaObject.method(idx); -} - -/* - * \internal - * This will start or append \a change to a batch of changes from frontend - * nodes. Once the batch is complete, when the event loop returns, the batch is - * sent to the QChangeArbiter to notify the backend aspects. - */ -void QPostman::notifyBackend(const QSceneChangePtr &change) -{ - // If batch in progress - // add change - // otherwise start batch - // by calling a queued slot - Q_D(QPostman); - if (d->m_batch.empty()) { - static const QMetaMethod submitChangeBatch = submitChangeBatchMethod(); - submitChangeBatch.invoke(this, Qt::QueuedConnection); - } - d->m_batch.push_back(change); -} - -// AspectThread -bool QPostman::shouldNotifyFrontend(const QSceneChangePtr &e) -{ - Q_D(QPostman); - const QPropertyUpdatedChangePtr propertyChange = qSharedPointerDynamicCast(e); - if (Q_LIKELY(d->m_scene != nullptr) && !propertyChange.isNull()) { - const QScene::NodePropertyTrackData propertyTrackData - = d->m_scene->lookupNodePropertyTrackData(e->subjectId()); - - const QNode::PropertyTrackingMode trackMode = propertyTrackData.trackedPropertiesOverrides.value(QLatin1String(propertyChange->propertyName()), - propertyTrackData.defaultTrackMode); - - switch (trackMode) { - case QNode::TrackAllValues: - return true; - - case QNode::DontTrackValues: - return false; - - case QNode::TrackFinalValues: { - const bool isIntermediate - = QPropertyUpdatedChangeBasePrivate::get(propertyChange.data())->m_isIntermediate; - return !isIntermediate; - } - - default: - Q_UNREACHABLE(); - return false; - } - } - return true; -} - -// Main Thread -void QPostman::notifyFrontendNode(const QSceneChangePtr &e) -{ - Q_D(QPostman); - if (!e.isNull() && d->m_scene != nullptr) { - QNode *n = d->m_scene->lookupNode(e->subjectId()); - if (n != nullptr) - n->sceneChangeEvent(e); - } -} - -void QPostman::submitChangeBatch() -{ - Q_D(QPostman); - QLockableObserverInterface *arbiter = nullptr; - if (d->m_scene && (arbiter = d->m_scene->arbiter()) != nullptr) { - arbiter->sceneChangeEventWithLock(d->m_batch); - d->m_batch.clear(); - } -} - -} //Qt3D - -QT_END_NAMESPACE diff --git a/src/core/qpostman_p.h b/src/core/qpostman_p.h deleted file mode 100644 index 3e5f91742..000000000 --- a/src/core/qpostman_p.h +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPOSTMAN_P_H -#define QT3DCORE_QPOSTMAN_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QScene; -class QPostmanPrivate; - -class Q_3DCORE_PRIVATE_EXPORT QAbstractPostman : public QObserverInterface -{ -public: - virtual void setScene(QScene *sceneLookup) = 0; - virtual void notifyBackend(const QSceneChangePtr &change) = 0; - virtual bool shouldNotifyFrontend(const QSceneChangePtr &change) = 0; -}; - -class Q_AUTOTEST_EXPORT QPostman final - : public QObject - , public QAbstractPostman -{ - Q_OBJECT -public: - explicit QPostman(QObject *parent = nullptr); - ~QPostman(); - - void setScene(QScene *sceneLookup) final; - void sceneChangeEvent(const QSceneChangePtr &e) final; - void notifyBackend(const QSceneChangePtr &change) final; - bool shouldNotifyFrontend(const QSceneChangePtr &e) final; - -public Q_SLOTS: - void submitChangeBatch(); - -private: - Q_DECLARE_PRIVATE(QPostman) - Q_INVOKABLE void notifyFrontendNode(const QSceneChangePtr &e); - -}; - -} // Qt3D - -QT_END_NAMESPACE - -Q_DECLARE_METATYPE(Qt3DCore::QAbstractPostman*) // LCOV_EXCL_LINE - -#endif // QT3DCORE_QPOSTMAN_P_H diff --git a/src/core/qpostman_p_p.h b/src/core/qpostman_p_p.h deleted file mode 100644 index 0a34c2e02..000000000 --- a/src/core/qpostman_p_p.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_QPOSTMAN_P_P_H -#define QT3DCORE_QPOSTMAN_P_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - -class QScene; -class QPostman; - -class Q_3DCORE_PRIVATE_EXPORT QPostmanPrivate : public QObjectPrivate -{ -public: - QPostmanPrivate() - : QObjectPrivate() - , m_scene(nullptr) - { - } - - static QPostmanPrivate *get(QPostman *q); - - Q_DECLARE_PUBLIC(QPostman) - QScene *m_scene; - std::vector m_batch; -}; - -} // Qt3DCore - -QT_END_NAMESPACE - -#endif // QT3DCORE_QPOSTMAN_P_P_H diff --git a/src/core/qscene.cpp b/src/core/qscene.cpp index 1b8996e8d..17f89603f 100644 --- a/src/core/qscene.cpp +++ b/src/core/qscene.cpp @@ -43,9 +43,7 @@ #include #include -#include #include -#include QT_BEGIN_NAMESPACE @@ -65,10 +63,8 @@ public: QAspectEngine *m_engine; QHash m_nodeLookupTable; QMultiHash m_componentToEntities; - QMultiHash m_observablesLookupTable; - QHash m_observableToUuid; QHash m_nodePropertyTrackModeLookupTable; - QAbstractArbiter *m_arbiter; + QChangeArbiter *m_arbiter; QScopedPointer m_postConstructorInit; mutable QReadWriteLock m_lock; mutable QReadWriteLock m_nodePropertyTrackModeLock; @@ -91,17 +87,6 @@ QAspectEngine *QScene::engine() const return d->m_engine; } -// Called by any thread -void QScene::addObservable(QObservableInterface *observable, QNodeId id) -{ - Q_D(QScene); - QWriteLocker lock(&d->m_lock); - d->m_observablesLookupTable.insert(id, observable); - d->m_observableToUuid.insert(observable, id); - if (d->m_arbiter != nullptr) - observable->setArbiter(d->m_arbiter); -} - // Called by main thread only void QScene::addObservable(QNode *observable) { @@ -114,43 +99,18 @@ void QScene::addObservable(QNode *observable) } } -// Called by any thread -void QScene::removeObservable(QObservableInterface *observable, QNodeId id) -{ - Q_D(QScene); - QWriteLocker lock(&d->m_lock); - d->m_observablesLookupTable.remove(id, observable); - d->m_observableToUuid.remove(observable); - observable->setArbiter(nullptr); -} - // Called by main thread void QScene::removeObservable(QNode *observable) { Q_D(QScene); if (observable != nullptr) { QWriteLocker lock(&d->m_lock); - QNodeId nodeUuid = observable->id(); - const auto p = d->m_observablesLookupTable.equal_range(nodeUuid); // must be non-const equal_range to ensure p.second stays valid - auto it = p.first; - while (it != p.second) { - it.value()->setArbiter(nullptr); - d->m_observableToUuid.remove(it.value()); - it = d->m_observablesLookupTable.erase(it); - } + const QNodeId nodeUuid = observable->id(); d->m_nodeLookupTable.remove(nodeUuid); observable->d_func()->setArbiter(nullptr); } } -// Called by any thread -QObservableList QScene::lookupObservables(QNodeId id) const -{ - Q_D(const QScene); - QReadLocker lock(&d->m_lock); - return d->m_observablesLookupTable.values(id); -} - // Called by any thread QNode *QScene::lookupNode(QNodeId id) const { @@ -170,26 +130,19 @@ QVector QScene::lookupNodes(const QVector &ids) const return nodes; } -QNodeId QScene::nodeIdFromObservable(QObservableInterface *observable) const -{ - Q_D(const QScene); - QReadLocker lock(&d->m_lock); - return d->m_observableToUuid.value(observable); -} - QNode *QScene::rootNode() const { Q_D(const QScene); return d->m_rootNode; } -void QScene::setArbiter(QAbstractArbiter *arbiter) +void QScene::setArbiter(QChangeArbiter *arbiter) { Q_D(QScene); d->m_arbiter = arbiter; } -QAbstractArbiter *QScene::arbiter() const +QChangeArbiter *QScene::arbiter() const { Q_D(const QScene); return d->m_arbiter; diff --git a/src/core/qscene_p.h b/src/core/qscene_p.h index cdb85ebe6..b2341b159 100644 --- a/src/core/qscene_p.h +++ b/src/core/qscene_p.h @@ -55,7 +55,6 @@ #include #include -#include #include QT_BEGIN_NAMESPACE @@ -65,9 +64,7 @@ namespace Qt3DCore { class QScenePrivate; class QAspectEngine; class NodePostConstructorInit; -class QAbstractArbiter; - -typedef QList QObservableList; +class QChangeArbiter; class Q_3DCORE_PRIVATE_EXPORT QScene { @@ -77,20 +74,16 @@ public: QAspectEngine *engine() const; - void addObservable(QObservableInterface *observable, QNodeId id); void addObservable(QNode *observable); - void removeObservable(QObservableInterface *observable, QNodeId id); void removeObservable(QNode *observable); - QObservableList lookupObservables(QNodeId id) const; QNode *lookupNode(QNodeId id) const; QVector lookupNodes(const QVector &ids) const; - QNodeId nodeIdFromObservable(QObservableInterface *observable) const; QNode *rootNode() const; - void setArbiter(QAbstractArbiter *arbiter); - QAbstractArbiter *arbiter() const; + void setArbiter(QChangeArbiter *arbiter); + QChangeArbiter *arbiter() const; // Component -> Entities QVector entitiesForComponent(QNodeId id) const; diff --git a/src/core/transforms/qabstractskeleton.cpp b/src/core/transforms/qabstractskeleton.cpp index 4a30d0710..cdda89418 100644 --- a/src/core/transforms/qabstractskeleton.cpp +++ b/src/core/transforms/qabstractskeleton.cpp @@ -46,7 +46,7 @@ namespace Qt3DCore { QAbstractSkeletonPrivate::QAbstractSkeletonPrivate() : Qt3DCore::QNodePrivate() - , m_type(QSkeletonCreatedChangeBase::Skeleton) + , m_type(Skeleton) , m_jointCount(0) { } @@ -105,13 +105,6 @@ QAbstractSkeleton::~QAbstractSkeleton() { } -/*! \internal */ -void QAbstractSkeleton::sceneChangeEvent(const QSceneChangePtr &change) -{ - // TODO Unused remove in Qt6 - Q_UNUSED(change) -} - /*! \property Qt3DCore::QAbstractSkeleton::jointCount diff --git a/src/core/transforms/qabstractskeleton.h b/src/core/transforms/qabstractskeleton.h index 1c2eba08f..7da78011f 100644 --- a/src/core/transforms/qabstractskeleton.h +++ b/src/core/transforms/qabstractskeleton.h @@ -64,8 +64,6 @@ Q_SIGNALS: protected: QAbstractSkeleton(QAbstractSkeletonPrivate &dd, Qt3DCore::QNode *parent = nullptr); - // TODO Unused remove in Qt6 - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; private: Q_DECLARE_PRIVATE(QAbstractSkeleton) diff --git a/src/core/transforms/qabstractskeleton_p.h b/src/core/transforms/qabstractskeleton_p.h index 35d0df755..333fa5fdf 100644 --- a/src/core/transforms/qabstractskeleton_p.h +++ b/src/core/transforms/qabstractskeleton_p.h @@ -51,8 +51,8 @@ // We mean it. // +#include #include -#include #include QT_BEGIN_NAMESPACE @@ -62,6 +62,11 @@ namespace Qt3DCore { class Q_3DCORE_PRIVATE_EXPORT QAbstractSkeletonPrivate : public Qt3DCore::QNodePrivate { public: + enum SkeletonType { + Skeleton = 0, + SkeletonLoader + }; + QAbstractSkeletonPrivate(); void setJointCount(int jointCount); @@ -70,7 +75,7 @@ public: static const QAbstractSkeletonPrivate *get(const QAbstractSkeleton *q); static QAbstractSkeletonPrivate *get(QAbstractSkeleton *q); - QSkeletonCreatedChangeBase::SkeletonType m_type; + SkeletonType m_type; int m_jointCount; QVector m_localPoses; diff --git a/src/core/transforms/qarmature.cpp b/src/core/transforms/qarmature.cpp index d9fef7767..56d310152 100644 --- a/src/core/transforms/qarmature.cpp +++ b/src/core/transforms/qarmature.cpp @@ -157,16 +157,6 @@ void QArmature::setSkeleton(Qt3DCore::QAbstractSkeleton *skeleton) } } -/*! \internal */ -Qt3DCore::QNodeCreatedChangeBasePtr QArmature::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QArmature); - data.skeletonId = qIdForNode(d->m_skeleton); - return creationChange; -} - } // namespace Qt3DCore QT_END_NAMESPACE diff --git a/src/core/transforms/qarmature.h b/src/core/transforms/qarmature.h index e3beffa01..5e02f99c3 100644 --- a/src/core/transforms/qarmature.h +++ b/src/core/transforms/qarmature.h @@ -72,7 +72,6 @@ protected: private: Q_DECLARE_PRIVATE(QArmature) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DCore diff --git a/src/core/transforms/qjoint.cpp b/src/core/transforms/qjoint.cpp index 408d42f6d..de7d913e3 100644 --- a/src/core/transforms/qjoint.cpp +++ b/src/core/transforms/qjoint.cpp @@ -40,8 +40,6 @@ #include "qjoint.h" #include "qjoint_p.h" -#include - QT_BEGIN_NAMESPACE namespace Qt3DCore { @@ -350,7 +348,7 @@ void QJoint::addChildJoint(QJoint *joint) d->registerDestructionHelper(joint, &QJoint::removeChildJoint, d->m_childJoints); if (d->m_changeArbiter != nullptr) - d->updateNode(joint, "childJoint", PropertyValueAdded); + d->update(); } } @@ -363,7 +361,7 @@ void QJoint::removeChildJoint(QJoint *joint) Q_D(QJoint); if (d->m_childJoints.contains(joint)) { if (d->m_changeArbiter != nullptr) - d->updateNode(joint, "childJoint", PropertyValueRemoved); + d->update(); d->m_childJoints.removeOne(joint); @@ -390,21 +388,6 @@ QString QJoint::name() const return d->m_name; } -/*! \internal */ -Qt3DCore::QNodeCreatedChangeBasePtr QJoint::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QJoint); - data.inverseBindMatrix = d->m_inverseBindMatrix; - data.childJointIds = qIdsForNodes(d->m_childJoints); - data.rotation = d->m_rotation; - data.scale = d->m_scale; - data.translation = d->m_translation; - data.name = d->m_name; - return creationChange; -} - } // namespace Qt3DCore QT_END_NAMESPACE diff --git a/src/core/transforms/qjoint.h b/src/core/transforms/qjoint.h index d3672e99f..1bd404a1a 100644 --- a/src/core/transforms/qjoint.h +++ b/src/core/transforms/qjoint.h @@ -105,7 +105,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QJoint) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DCore diff --git a/src/core/transforms/qskeleton.cpp b/src/core/transforms/qskeleton.cpp index 141d8c0c4..751daaabe 100644 --- a/src/core/transforms/qskeleton.cpp +++ b/src/core/transforms/qskeleton.cpp @@ -40,7 +40,6 @@ #include "qskeleton.h" #include "qskeleton_p.h" #include -#include QT_BEGIN_NAMESPACE @@ -50,7 +49,7 @@ QSkeletonPrivate::QSkeletonPrivate() : QAbstractSkeletonPrivate() , m_rootJoint(nullptr) { - m_type = QSkeletonCreatedChangeBase::Skeleton; + m_type = Skeleton; } /*! @@ -137,16 +136,6 @@ void QSkeleton::setRootJoint(Qt3DCore::QJoint *rootJoint) } } -/*! \internal */ -Qt3DCore::QNodeCreatedChangeBasePtr QSkeleton::createNodeCreationChange() const -{ - auto creationChange = QSkeletonCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QSkeleton); - data.rootJointId = qIdForNode(d->m_rootJoint); - return creationChange; -} - } // namespace Qt3DCore QT_END_NAMESPACE diff --git a/src/core/transforms/qskeleton.h b/src/core/transforms/qskeleton.h index ecffe1aa9..51763b488 100644 --- a/src/core/transforms/qskeleton.h +++ b/src/core/transforms/qskeleton.h @@ -69,7 +69,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QSkeleton) - QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DCore diff --git a/src/core/transforms/qskeletonloader.cpp b/src/core/transforms/qskeletonloader.cpp index b1a311a0c..e86c72fbf 100644 --- a/src/core/transforms/qskeletonloader.cpp +++ b/src/core/transforms/qskeletonloader.cpp @@ -40,8 +40,6 @@ #include "qskeletonloader.h" #include "qskeletonloader_p.h" #include -#include -#include QT_BEGIN_NAMESPACE @@ -54,7 +52,7 @@ QSkeletonLoaderPrivate::QSkeletonLoaderPrivate() , m_status(QSkeletonLoader::NotReady) , m_rootJoint(nullptr) { - m_type = QSkeletonCreatedChangeBase::SkeletonLoader; + m_type = SkeletonLoader; } void QSkeletonLoaderPrivate::setStatus(QSkeletonLoader::Status status) @@ -241,23 +239,6 @@ void QSkeletonLoader::setRootJoint(QJoint *rootJoint) d->setRootJoint(rootJoint); } -/*! \internal */ -void QSkeletonLoader::sceneChangeEvent(const QSceneChangePtr &change) -{ - QAbstractSkeleton::sceneChangeEvent(change); -} - -/*! \internal */ -Qt3DCore::QNodeCreatedChangeBasePtr QSkeletonLoader::createNodeCreationChange() const -{ - auto creationChange = QSkeletonCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QSkeletonLoader); - data.source = d->m_source; - data.createJoints = d->m_createJoints; - return creationChange; -} - } // namespace Qt3DCore QT_END_NAMESPACE diff --git a/src/core/transforms/qskeletonloader.h b/src/core/transforms/qskeletonloader.h index 516a84b0a..23b8cdda4 100644 --- a/src/core/transforms/qskeletonloader.h +++ b/src/core/transforms/qskeletonloader.h @@ -89,11 +89,9 @@ Q_SIGNALS: protected: explicit QSkeletonLoader(QSkeletonLoaderPrivate &dd, Qt3DCore::QNode *parent = nullptr); - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; private: Q_DECLARE_PRIVATE(QSkeletonLoader) - QNodeCreatedChangeBasePtr createNodeCreationChange() const override; void setRootJoint(QJoint *rootJoint); // Needed for lifetime management of created joints }; diff --git a/src/core/transforms/qskeletonloader_p.h b/src/core/transforms/qskeletonloader_p.h index 6bd4e1eef..3284b772a 100644 --- a/src/core/transforms/qskeletonloader_p.h +++ b/src/core/transforms/qskeletonloader_p.h @@ -54,8 +54,6 @@ #include #include "qskeletonloader.h" -#include - #include QT_BEGIN_NAMESPACE @@ -89,8 +87,6 @@ struct QSkeletonLoaderData }; class QJoint; -typedef QTypedPropertyUpdatedChange> QJointChange; -typedef QTypedPropertyUpdatedChangePtr> QJointChangePtr; } // namespace Qt3DCore diff --git a/src/core/transforms/qtransform.cpp b/src/core/transforms/qtransform.cpp index d41b87f79..edbca7280 100644 --- a/src/core/transforms/qtransform.cpp +++ b/src/core/transforms/qtransform.cpp @@ -40,8 +40,6 @@ #include "qtransform.h" #include "qtransform_p.h" -#include - #include QT_BEGIN_NAMESPACE @@ -234,35 +232,15 @@ QTransform::QTransform(QTransformPrivate &dd, QNode *parent) { } -/*! - \internal - */ -// TODO Unused remove in Qt6 -void QTransform::sceneChangeEvent(const QSceneChangePtr &change) -{ - Q_D(QTransform); - switch (change->type()) { - case PropertyUpdated: { - Qt3DCore::QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast(change); - if (propertyChange->propertyName() == QByteArrayLiteral("worldMatrix")) { - const bool blocked = blockNotifications(true); - d->setWorldMatrix(propertyChange->value().value()); - blockNotifications(blocked); - } - break; - } - default: - break; - } -} - void QTransformPrivate::setWorldMatrix(const QMatrix4x4 &worldMatrix) { Q_Q(QTransform); if (m_worldMatrix == worldMatrix) return; + const bool blocked = q->blockNotifications(true); m_worldMatrix = worldMatrix; emit q->worldMatrixChanged(worldMatrix); + q->blockNotifications(blocked); } void QTransform::setMatrix(const QMatrix4x4 &m) @@ -631,19 +609,6 @@ QMatrix4x4 QTransform::rotateFromAxes(const QVector3D &xAxis, const QVector3D &y 0.0f, 0.0f, 0.0f, 1.0f); } -QNodeCreatedChangeBasePtr QTransform::createNodeCreationChange() const -{ - auto creationChange = QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - - Q_D(const QTransform); - data.rotation = d->m_rotation; - data.scale = d->m_scale; - data.translation = d->m_translation; - - return creationChange; -} - } // namespace Qt3DCore QT_END_NAMESPACE diff --git a/src/core/transforms/qtransform.h b/src/core/transforms/qtransform.h index ce6bf42fa..fa2d84baf 100644 --- a/src/core/transforms/qtransform.h +++ b/src/core/transforms/qtransform.h @@ -119,12 +119,9 @@ Q_SIGNALS: protected: explicit QTransform(QTransformPrivate &dd, QNode *parent = nullptr); - // TODO Unused remove in Qt6 - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; private: Q_DECLARE_PRIVATE(QTransform) - QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DCore diff --git a/src/input/backend/backendnode_p.h b/src/input/backend/backendnode_p.h index a7749852b..34fdc4362 100644 --- a/src/input/backend/backendnode_p.h +++ b/src/input/backend/backendnode_p.h @@ -53,6 +53,7 @@ #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/input/backend/genericdevicebackendnode.cpp b/src/input/backend/genericdevicebackendnode.cpp index d56a674fc..3d8c5750b 100644 --- a/src/input/backend/genericdevicebackendnode.cpp +++ b/src/input/backend/genericdevicebackendnode.cpp @@ -108,11 +108,11 @@ GenericDeviceBackendFunctor::GenericDeviceBackendFunctor(QInputAspect *inputaspe { } -Qt3DCore::QBackendNode *GenericDeviceBackendFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const +Qt3DCore::QBackendNode *GenericDeviceBackendFunctor::create(Qt3DCore::QNodeId id) const { - GenericDeviceBackendNode *backendNode = m_handler->genericDeviceBackendNodeManager()->getOrCreateResource(change->subjectId()); + GenericDeviceBackendNode *backendNode = m_handler->genericDeviceBackendNodeManager()->getOrCreateResource(id); backendNode->setInputAspect(m_inputAspect); - m_handler->appendGenericDevice(m_handler->genericDeviceBackendNodeManager()->lookupHandle(change->subjectId())); + m_handler->appendGenericDevice(m_handler->genericDeviceBackendNodeManager()->lookupHandle(id)); return backendNode; } diff --git a/src/input/backend/genericdevicebackendnode_p.h b/src/input/backend/genericdevicebackendnode_p.h index 3ae712115..36b0d8c99 100644 --- a/src/input/backend/genericdevicebackendnode_p.h +++ b/src/input/backend/genericdevicebackendnode_p.h @@ -89,7 +89,7 @@ class GenericDeviceBackendFunctor : public Qt3DCore::QBackendNodeMapper public: explicit GenericDeviceBackendFunctor(QInputAspect *inputaspect, InputHandler *handler); - Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const override; + Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const override; Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const override; void destroy(Qt3DCore::QNodeId id) const override; diff --git a/src/input/backend/inputbackendnodefunctor_p.h b/src/input/backend/inputbackendnodefunctor_p.h index 629e599f2..1d18025f0 100644 --- a/src/input/backend/inputbackendnodefunctor_p.h +++ b/src/input/backend/inputbackendnodefunctor_p.h @@ -69,9 +69,9 @@ public: { } - Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const final + Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const final { - Backend *backend = m_manager->getOrCreateResource(change->subjectId()); + Backend *backend = m_manager->getOrCreateResource(id); return backend; } diff --git a/src/input/backend/inputsettings.cpp b/src/input/backend/inputsettings.cpp index 4fdd61a1b..ce4aa89d9 100644 --- a/src/input/backend/inputsettings.cpp +++ b/src/input/backend/inputsettings.cpp @@ -71,9 +71,9 @@ InputSettingsFunctor::InputSettingsFunctor(InputHandler *handler) { } -Qt3DCore::QBackendNode *InputSettingsFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const +Qt3DCore::QBackendNode *InputSettingsFunctor::create(Qt3DCore::QNodeId id) const { - Q_UNUSED(change); + Q_UNUSED(id); if (m_handler->inputSettings() != nullptr) { qWarning() << "Input settings already specified"; return nullptr; diff --git a/src/input/backend/inputsettings_p.h b/src/input/backend/inputsettings_p.h index 33f56cc0b..c495e18ec 100644 --- a/src/input/backend/inputsettings_p.h +++ b/src/input/backend/inputsettings_p.h @@ -79,7 +79,7 @@ class InputSettingsFunctor : public Qt3DCore::QBackendNodeMapper public: explicit InputSettingsFunctor(InputHandler *handler); - Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const override; + Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const override; Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const override; void destroy(Qt3DCore::QNodeId id) const override; diff --git a/src/input/backend/keyboarddevice.cpp b/src/input/backend/keyboarddevice.cpp index 0e45d1c84..0a35cefbb 100644 --- a/src/input/backend/keyboarddevice.cpp +++ b/src/input/backend/keyboarddevice.cpp @@ -433,12 +433,12 @@ KeyboardDeviceFunctor::KeyboardDeviceFunctor(QInputAspect *inputaspect, InputHan { } -Qt3DCore::QBackendNode *KeyboardDeviceFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const +Qt3DCore::QBackendNode *KeyboardDeviceFunctor::create(Qt3DCore::QNodeId id) const { - KeyboardDevice *keyboardDevice = m_handler->keyboardDeviceManager()->getOrCreateResource(change->subjectId()); + KeyboardDevice *keyboardDevice = m_handler->keyboardDeviceManager()->getOrCreateResource(id); keyboardDevice->setInputAspect(m_inputAspect); keyboardDevice->setInputHandler(m_handler); - m_handler->appendKeyboardDevice(m_handler->keyboardDeviceManager()->lookupHandle(change->subjectId())); + m_handler->appendKeyboardDevice(m_handler->keyboardDeviceManager()->lookupHandle(id)); return keyboardDevice; } diff --git a/src/input/backend/keyboarddevice_p.h b/src/input/backend/keyboarddevice_p.h index 2df5eb64d..76e207889 100644 --- a/src/input/backend/keyboarddevice_p.h +++ b/src/input/backend/keyboarddevice_p.h @@ -265,7 +265,7 @@ class KeyboardDeviceFunctor : public Qt3DCore::QBackendNodeMapper public: explicit KeyboardDeviceFunctor(QInputAspect *inputaspect, InputHandler *handler); - Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const override; + Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const override; Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const override; void destroy(Qt3DCore::QNodeId id) const override; diff --git a/src/input/backend/keyboardhandler.cpp b/src/input/backend/keyboardhandler.cpp index 026012e52..f2e365ce2 100644 --- a/src/input/backend/keyboardhandler.cpp +++ b/src/input/backend/keyboardhandler.cpp @@ -120,9 +120,9 @@ KeyboardHandlerFunctor::KeyboardHandlerFunctor(InputHandler *handler) { } -Qt3DCore::QBackendNode *KeyboardHandlerFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const +Qt3DCore::QBackendNode *KeyboardHandlerFunctor::create(Qt3DCore::QNodeId id) const { - KeyboardHandler *input = m_handler->keyboardInputManager()->getOrCreateResource(change->subjectId()); + KeyboardHandler *input = m_handler->keyboardInputManager()->getOrCreateResource(id); input->setInputHandler(m_handler); return input; } diff --git a/src/input/backend/keyboardhandler_p.h b/src/input/backend/keyboardhandler_p.h index a5c13efbf..530361c97 100644 --- a/src/input/backend/keyboardhandler_p.h +++ b/src/input/backend/keyboardhandler_p.h @@ -91,7 +91,7 @@ class KeyboardHandlerFunctor : public Qt3DCore::QBackendNodeMapper public: explicit KeyboardHandlerFunctor(InputHandler *handler); - Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const override; + Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const override; Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const override; void destroy(Qt3DCore::QNodeId id) const override; diff --git a/src/input/backend/logicaldevice.cpp b/src/input/backend/logicaldevice.cpp index 17426922f..0cd6534cf 100644 --- a/src/input/backend/logicaldevice.cpp +++ b/src/input/backend/logicaldevice.cpp @@ -80,9 +80,9 @@ LogicalDeviceNodeFunctor::LogicalDeviceNodeFunctor(LogicalDeviceManager *manager { } -Qt3DCore::QBackendNode *LogicalDeviceNodeFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const +Qt3DCore::QBackendNode *LogicalDeviceNodeFunctor::create(Qt3DCore::QNodeId id) const { - HLogicalDevice handle = m_manager->getOrAcquireHandle(change->subjectId()); + HLogicalDevice handle = m_manager->getOrAcquireHandle(id); LogicalDevice *backend = m_manager->data(handle); m_manager->addActiveDevice(handle); return backend; diff --git a/src/input/backend/logicaldevice_p.h b/src/input/backend/logicaldevice_p.h index 292f2a5c3..6e75e0e77 100644 --- a/src/input/backend/logicaldevice_p.h +++ b/src/input/backend/logicaldevice_p.h @@ -84,7 +84,7 @@ class LogicalDeviceNodeFunctor : public Qt3DCore::QBackendNodeMapper public: explicit LogicalDeviceNodeFunctor(LogicalDeviceManager *manager); - Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const final; + Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const final; Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const final; void destroy(Qt3DCore::QNodeId id) const final; diff --git a/src/input/backend/mousedevice.cpp b/src/input/backend/mousedevice.cpp index c5b2a22ce..5c4ebf6ab 100644 --- a/src/input/backend/mousedevice.cpp +++ b/src/input/backend/mousedevice.cpp @@ -187,12 +187,12 @@ MouseDeviceFunctor::MouseDeviceFunctor(QInputAspect *inputAspect, InputHandler * { } -Qt3DCore::QBackendNode *MouseDeviceFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const +Qt3DCore::QBackendNode *MouseDeviceFunctor::create(Qt3DCore::QNodeId id) const { - MouseDevice *controller = m_handler->mouseDeviceManager()->getOrCreateResource(change->subjectId()); + MouseDevice *controller = m_handler->mouseDeviceManager()->getOrCreateResource(id); controller->setInputAspect(m_inputAspect); controller->setInputHandler(m_handler); - m_handler->appendMouseDevice(m_handler->mouseDeviceManager()->lookupHandle(change->subjectId())); + m_handler->appendMouseDevice(m_handler->mouseDeviceManager()->lookupHandle(id)); return controller; } diff --git a/src/input/backend/mousedevice_p.h b/src/input/backend/mousedevice_p.h index d41bb527b..41f51ba27 100644 --- a/src/input/backend/mousedevice_p.h +++ b/src/input/backend/mousedevice_p.h @@ -126,7 +126,7 @@ class MouseDeviceFunctor : public Qt3DCore::QBackendNodeMapper public: explicit MouseDeviceFunctor(Qt3DInput::QInputAspect *inputAspect, InputHandler *handler); - Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const override; + Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const override; Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const override; void destroy(Qt3DCore::QNodeId id) const override; diff --git a/src/input/backend/mousehandler.cpp b/src/input/backend/mousehandler.cpp index 9c7ff9817..bef28912e 100644 --- a/src/input/backend/mousehandler.cpp +++ b/src/input/backend/mousehandler.cpp @@ -96,9 +96,9 @@ MouseHandlerFunctor::MouseHandlerFunctor(InputHandler *handler) { } -Qt3DCore::QBackendNode *MouseHandlerFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const +Qt3DCore::QBackendNode *MouseHandlerFunctor::create(Qt3DCore::QNodeId id) const { - MouseHandler *input = m_handler->mouseInputManager()->getOrCreateResource(change->subjectId()); + MouseHandler *input = m_handler->mouseInputManager()->getOrCreateResource(id); input->setInputHandler(m_handler); return input; } diff --git a/src/input/backend/mousehandler_p.h b/src/input/backend/mousehandler_p.h index 693c42471..df6a1c12e 100644 --- a/src/input/backend/mousehandler_p.h +++ b/src/input/backend/mousehandler_p.h @@ -84,7 +84,7 @@ class MouseHandlerFunctor : public Qt3DCore::QBackendNodeMapper public: explicit MouseHandlerFunctor(InputHandler *handler); - Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const override; + Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const override; Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const override; void destroy(Qt3DCore::QNodeId id) const override; diff --git a/src/input/backend/physicaldeviceproxy.cpp b/src/input/backend/physicaldeviceproxy.cpp index 390b525eb..f30233530 100644 --- a/src/input/backend/physicaldeviceproxy.cpp +++ b/src/input/backend/physicaldeviceproxy.cpp @@ -117,9 +117,9 @@ PhysicalDeviceProxyNodeFunctor::PhysicalDeviceProxyNodeFunctor(PhysicalDevicePro { } -Qt3DCore::QBackendNode *PhysicalDeviceProxyNodeFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const +Qt3DCore::QBackendNode *PhysicalDeviceProxyNodeFunctor::create(Qt3DCore::QNodeId id) const { - HPhysicalDeviceProxy handle = m_manager->getOrAcquireHandle(change->subjectId()); + HPhysicalDeviceProxy handle = m_manager->getOrAcquireHandle(id); PhysicalDeviceProxy *backend = m_manager->data(handle); backend->setManager(m_manager); return backend; diff --git a/src/input/backend/physicaldeviceproxy_p.h b/src/input/backend/physicaldeviceproxy_p.h index 6dd2a54be..3ec8c92e6 100644 --- a/src/input/backend/physicaldeviceproxy_p.h +++ b/src/input/backend/physicaldeviceproxy_p.h @@ -92,7 +92,7 @@ class PhysicalDeviceProxyNodeFunctor: public Qt3DCore::QBackendNodeMapper public: explicit PhysicalDeviceProxyNodeFunctor(PhysicalDeviceProxyManager *manager); - Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const final; + Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const final; Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const final; void destroy(Qt3DCore::QNodeId id) const final; diff --git a/src/input/backend/qabstractphysicaldevicebackendnode.cpp b/src/input/backend/qabstractphysicaldevicebackendnode.cpp index 6e6899e32..18d932a21 100644 --- a/src/input/backend/qabstractphysicaldevicebackendnode.cpp +++ b/src/input/backend/qabstractphysicaldevicebackendnode.cpp @@ -43,7 +43,6 @@ #include #include #include -#include #include #include diff --git a/src/input/frontend/frontend.pri b/src/input/frontend/frontend.pri index ecde941a3..e86e00b64 100644 --- a/src/input/frontend/frontend.pri +++ b/src/input/frontend/frontend.pri @@ -42,8 +42,6 @@ HEADERS += \ $$PWD/qaxissetting_p.h \ $$PWD/qinputsequence_p.h \ $$PWD/qinputchord_p.h \ - $$PWD/qphysicaldevicecreatedchange.h \ - $$PWD/qphysicaldevicecreatedchange_p.h \ $$PWD/qaxisaccumulator.h \ $$PWD/qaxisaccumulator_p.h \ $$PWD/qabstractphysicaldeviceproxy_p.h \ @@ -75,7 +73,6 @@ SOURCES += \ $$PWD/qinputchord.cpp \ $$PWD/qinputsequence.cpp \ $$PWD/qinputsettings.cpp \ - $$PWD/qphysicaldevicecreatedchange.cpp \ $$PWD/qaxisaccumulator.cpp \ $$PWD/qabstractphysicaldeviceproxy.cpp diff --git a/src/input/frontend/qabstractaxisinput.cpp b/src/input/frontend/qabstractaxisinput.cpp index e3974421a..d7022835d 100644 --- a/src/input/frontend/qabstractaxisinput.cpp +++ b/src/input/frontend/qabstractaxisinput.cpp @@ -40,7 +40,6 @@ #include "qabstractaxisinput_p.h" #include -#include QT_BEGIN_NAMESPACE diff --git a/src/input/frontend/qabstractphysicaldevice.cpp b/src/input/frontend/qabstractphysicaldevice.cpp index 33c86f7b8..100852d2a 100644 --- a/src/input/frontend/qabstractphysicaldevice.cpp +++ b/src/input/frontend/qabstractphysicaldevice.cpp @@ -41,7 +41,6 @@ #include "qabstractphysicaldevice_p.h" #include -#include #include @@ -165,7 +164,7 @@ void QAbstractPhysicalDevice::addAxisSetting(QAxisSetting *axisSetting) { Q_D(QAbstractPhysicalDevice); if (axisSetting && !d->m_axisSettings.contains(axisSetting)) { - d->updateNode(axisSetting, "axisSettings", Qt3DCore::PropertyValueAdded); + d->update(); d->m_axisSettings.push_back(axisSetting); } } @@ -177,7 +176,7 @@ void QAbstractPhysicalDevice::removeAxisSetting(QAxisSetting *axisSetting) { Q_D(QAbstractPhysicalDevice); if (axisSetting && d->m_axisSettings.contains(axisSetting)) { - d->updateNode(axisSetting, "axisSettings", Qt3DCore::PropertyValueRemoved); + d->update(); d->m_axisSettings.removeOne(axisSetting); } } @@ -209,15 +208,6 @@ void QAbstractPhysicalDevicePrivate::postButtonEvent(int button, qreal value) update(); } -/*! - \internal -*/ -Qt3DCore::QNodeCreatedChangeBasePtr QAbstractPhysicalDevice::createNodeCreationChange() const -{ - auto creationChange = QPhysicalDeviceCreatedChangeBasePtr::create(this); - return creationChange; -} - } QT_END_NAMESPACE diff --git a/src/input/frontend/qabstractphysicaldevice.h b/src/input/frontend/qabstractphysicaldevice.h index 9e95d05f0..3161443ae 100644 --- a/src/input/frontend/qabstractphysicaldevice.h +++ b/src/input/frontend/qabstractphysicaldevice.h @@ -75,7 +75,6 @@ public: protected: QAbstractPhysicalDevice(QAbstractPhysicalDevicePrivate &dd, Qt3DCore::QNode *parent = nullptr); Q_DECLARE_PRIVATE(QAbstractPhysicalDevice) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // Qt3DInput diff --git a/src/input/frontend/qabstractphysicaldeviceproxy.cpp b/src/input/frontend/qabstractphysicaldeviceproxy.cpp index 4ed116440..ae1401921 100644 --- a/src/input/frontend/qabstractphysicaldeviceproxy.cpp +++ b/src/input/frontend/qabstractphysicaldeviceproxy.cpp @@ -40,8 +40,6 @@ #include "qabstractphysicaldeviceproxy_p.h" #include "qabstractphysicaldeviceproxy_p_p.h" -#include - QT_BEGIN_NAMESPACE @@ -164,20 +162,6 @@ QAbstractPhysicalDeviceProxy::QAbstractPhysicalDeviceProxy(QAbstractPhysicalDevi { } -/*! - \internal - */ -Qt3DCore::QNodeCreatedChangeBasePtr QAbstractPhysicalDeviceProxy::createNodeCreationChange() const -{ - auto creationChange = QPhysicalDeviceCreatedChangePtr::create(this); - QAbstractPhysicalDeviceProxyData &data = creationChange->data; - - Q_D(const QAbstractPhysicalDeviceProxy); - data.deviceName = d->m_deviceName; - - return creationChange; -} - /*! \internal */ diff --git a/src/input/frontend/qabstractphysicaldeviceproxy_p.h b/src/input/frontend/qabstractphysicaldeviceproxy_p.h index 4a7b1dfc5..512679191 100644 --- a/src/input/frontend/qabstractphysicaldeviceproxy_p.h +++ b/src/input/frontend/qabstractphysicaldeviceproxy_p.h @@ -89,7 +89,6 @@ Q_SIGNALS: protected: QAbstractPhysicalDeviceProxy(QAbstractPhysicalDeviceProxyPrivate &dd, Qt3DCore::QNode *parent = nullptr); - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; private: Q_DECLARE_PRIVATE(QAbstractPhysicalDeviceProxy) diff --git a/src/input/frontend/qaction.cpp b/src/input/frontend/qaction.cpp index 8cceaab51..c13aaa6bd 100644 --- a/src/input/frontend/qaction.cpp +++ b/src/input/frontend/qaction.cpp @@ -41,7 +41,6 @@ #include "qaction_p.h" #include -#include #include @@ -118,7 +117,7 @@ void QAction::addInput(QAbstractActionInput *input) // Ensures proper bookkeeping d->registerDestructionHelper(input, &QAction::removeInput, d->m_inputs); - d->updateNode(input, "inputs", Qt3DCore::PropertyValueAdded); + d->update(); } } @@ -130,7 +129,7 @@ void QAction::removeInput(QAbstractActionInput *input) Q_D(QAction); if (d->m_inputs.contains(input)) { - d->updateNode(input, "inputs", Qt3DCore::PropertyValueRemoved); + d->update(); d->m_inputs.removeOne(input); @@ -148,19 +147,6 @@ QVector QAction::inputs() const return d->m_inputs; } -// TODO Unused remove in Qt6 -void QAction::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &) -{ -} - -Qt3DCore::QNodeCreatedChangeBasePtr QAction::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - data.inputIds = qIdsForNodes(inputs()); - return creationChange; -} - } // Qt3DInput QT_END_NAMESPACE diff --git a/src/input/frontend/qaction.h b/src/input/frontend/qaction.h index ef74debe5..63a9c7033 100644 --- a/src/input/frontend/qaction.h +++ b/src/input/frontend/qaction.h @@ -67,13 +67,8 @@ public: Q_SIGNALS: void activeChanged(bool isActive); -protected: - // TODO Unused remove in Qt6 - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; - private: Q_DECLARE_PRIVATE(QAction) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // Qt3DInput diff --git a/src/input/frontend/qactioninput.cpp b/src/input/frontend/qactioninput.cpp index f013147f2..42db5d28f 100644 --- a/src/input/frontend/qactioninput.cpp +++ b/src/input/frontend/qactioninput.cpp @@ -41,7 +41,6 @@ #include #include -#include QT_BEGIN_NAMESPACE @@ -198,18 +197,6 @@ void QActionInput::setButtons(const QVector &buttons) } } -Qt3DCore::QNodeCreatedChangeBasePtr QActionInput::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - - Q_D(const QActionInput); - data.sourceDeviceId = qIdForNode(d->m_sourceDevice); - data.buttons = d->m_buttons; - - return creationChange; -} - } // Qt3DInput QT_END_NAMESPACE diff --git a/src/input/frontend/qactioninput.h b/src/input/frontend/qactioninput.h index be620c5fb..7bc9a768d 100644 --- a/src/input/frontend/qactioninput.h +++ b/src/input/frontend/qactioninput.h @@ -74,7 +74,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QActionInput) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // Qt3DInput diff --git a/src/input/frontend/qanalogaxisinput.cpp b/src/input/frontend/qanalogaxisinput.cpp index 7b85983e3..8503fe4db 100644 --- a/src/input/frontend/qanalogaxisinput.cpp +++ b/src/input/frontend/qanalogaxisinput.cpp @@ -109,18 +109,6 @@ int QAnalogAxisInput::axis() const return d->m_axis; } -Qt3DCore::QNodeCreatedChangeBasePtr QAnalogAxisInput::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - - Q_D(const QAnalogAxisInput); - data.sourceDeviceId = qIdForNode(d->m_sourceDevice); - data.axis = d->m_axis; - - return creationChange; -} - } // Qt3DInput QT_END_NAMESPACE diff --git a/src/input/frontend/qanalogaxisinput.h b/src/input/frontend/qanalogaxisinput.h index fca13a822..058c19df8 100644 --- a/src/input/frontend/qanalogaxisinput.h +++ b/src/input/frontend/qanalogaxisinput.h @@ -68,7 +68,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QAnalogAxisInput) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // Qt3DInput diff --git a/src/input/frontend/qaxis.cpp b/src/input/frontend/qaxis.cpp index d76135fd7..d41cf904f 100644 --- a/src/input/frontend/qaxis.cpp +++ b/src/input/frontend/qaxis.cpp @@ -40,7 +40,6 @@ #include "qaxis_p.h" #include -#include QT_BEGIN_NAMESPACE @@ -114,7 +113,7 @@ void QAxis::addInput(QAbstractAxisInput *input) // Ensures proper bookkeeping d->registerDestructionHelper(input, &QAxis::removeInput, d->m_inputs); - d->updateNode(input, "input", Qt3DCore::PropertyValueAdded); + d->update(); } } @@ -136,7 +135,7 @@ void QAxis::removeInput(QAbstractAxisInput *input) Q_D(QAxis); if (d->m_inputs.contains(input)) { - d->updateNode(input, "input", Qt3DCore::PropertyValueRemoved); + d->update(); d->m_inputs.removeOne(input); @@ -167,19 +166,6 @@ float QAxis::value() const return d->m_value; } -// TODO Unused remove in Qt6 -void QAxis::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &) -{ -} - -Qt3DCore::QNodeCreatedChangeBasePtr QAxis::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - data.inputIds = qIdsForNodes(inputs()); - return creationChange; -} - } // Qt3DInput QT_END_NAMESPACE diff --git a/src/input/frontend/qaxis.h b/src/input/frontend/qaxis.h index 3dbe54a4f..4482dbedc 100644 --- a/src/input/frontend/qaxis.h +++ b/src/input/frontend/qaxis.h @@ -66,13 +66,8 @@ public: Q_SIGNALS: void valueChanged(float value); -protected: - // TODO Unused remove in Qt6 - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; - private: Q_DECLARE_PRIVATE(QAxis) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // Qt3DInput diff --git a/src/input/frontend/qaxisaccumulator.cpp b/src/input/frontend/qaxisaccumulator.cpp index a7bb14441..94942126e 100644 --- a/src/input/frontend/qaxisaccumulator.cpp +++ b/src/input/frontend/qaxisaccumulator.cpp @@ -41,7 +41,6 @@ #include "qaxisaccumulator_p.h" #include -#include QT_BEGIN_NAMESPACE @@ -289,23 +288,6 @@ void QAxisAccumulator::setScale(float scale) emit scaleChanged(scale); } -// TODO Unused remove in Qt6 -void QAxisAccumulator::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &) -{ -} - -/*! \internal */ -Qt3DCore::QNodeCreatedChangeBasePtr QAxisAccumulator::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QAxisAccumulator); - data.sourceAxisId = qIdForNode(d->m_sourceAxis); - data.sourceAxisType = d->m_sourceAxisType; - data.scale = d->m_scale; - return creationChange; -} - } // namespace Qt3DInput QT_END_NAMESPACE diff --git a/src/input/frontend/qaxisaccumulator.h b/src/input/frontend/qaxisaccumulator.h index e711b0691..4f12f2a69 100644 --- a/src/input/frontend/qaxisaccumulator.h +++ b/src/input/frontend/qaxisaccumulator.h @@ -87,13 +87,8 @@ Q_SIGNALS: void velocityChanged(float value); void scaleChanged(float scale); -protected: - // TODO Unused remove in Qt6 - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; - private: Q_DECLARE_PRIVATE(QAxisAccumulator) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DInput diff --git a/src/input/frontend/qaxissetting.cpp b/src/input/frontend/qaxissetting.cpp index 4a8f37785..d5ea709f6 100644 --- a/src/input/frontend/qaxissetting.cpp +++ b/src/input/frontend/qaxissetting.cpp @@ -40,8 +40,6 @@ #include "qaxissetting.h" #include "qaxissetting_p.h" -#include - QT_BEGIN_NAMESPACE namespace Qt3DInput { @@ -226,19 +224,6 @@ void QAxisSetting::setSmoothEnabled(bool enabled) emit smoothChanged(enabled); } -Qt3DCore::QNodeCreatedChangeBasePtr QAxisSetting::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - - Q_D(const QAxisSetting); - data.deadZoneRadius = d->m_deadZoneRadius; - data.axes = d->m_axes; - data.smooth = d->m_smooth; - - return creationChange; -} - } // namespace Qt3DInput QT_END_NAMESPACE diff --git a/src/input/frontend/qaxissetting.h b/src/input/frontend/qaxissetting.h index 979643e39..5f814cf8a 100644 --- a/src/input/frontend/qaxissetting.h +++ b/src/input/frontend/qaxissetting.h @@ -77,7 +77,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QAxisSetting) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DInput diff --git a/src/input/frontend/qbuttonaxisinput.cpp b/src/input/frontend/qbuttonaxisinput.cpp index fb74b8efd..6cd997156 100644 --- a/src/input/frontend/qbuttonaxisinput.cpp +++ b/src/input/frontend/qbuttonaxisinput.cpp @@ -176,21 +176,6 @@ void QButtonAxisInput::setDeceleration(float deceleration) } } -Qt3DCore::QNodeCreatedChangeBasePtr QButtonAxisInput::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - - Q_D(const QButtonAxisInput); - data.sourceDeviceId = qIdForNode(d->m_sourceDevice); - data.buttons = d->m_buttons; - data.scale = d->m_scale; - data.acceleration = d->m_acceleration; - data.deceleration = d->m_deceleration; - - return creationChange; -} - } // Qt3DInput QT_END_NAMESPACE diff --git a/src/input/frontend/qbuttonaxisinput.h b/src/input/frontend/qbuttonaxisinput.h index 15c6eec28..e17b6d94e 100644 --- a/src/input/frontend/qbuttonaxisinput.h +++ b/src/input/frontend/qbuttonaxisinput.h @@ -83,7 +83,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QButtonAxisInput) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // Qt3DInput diff --git a/src/input/frontend/qinputaspect.cpp b/src/input/frontend/qinputaspect.cpp index e109461f0..e91e545bb 100644 --- a/src/input/frontend/qinputaspect.cpp +++ b/src/input/frontend/qinputaspect.cpp @@ -145,26 +145,26 @@ QInputAspect::QInputAspect(QInputAspectPrivate &dd, QObject *parent) qRegisterMetaType(); - registerBackendType(QBackendNodeMapperPtr(new Input::KeyboardDeviceFunctor(this, d_func()->m_inputHandler.data()))); - registerBackendType(QBackendNodeMapperPtr(new Input::KeyboardHandlerFunctor(d_func()->m_inputHandler.data()))); - registerBackendType(QBackendNodeMapperPtr(new Input::MouseDeviceFunctor(this, d_func()->m_inputHandler.data()))); - registerBackendType(QBackendNodeMapperPtr(new Input::MouseHandlerFunctor(d_func()->m_inputHandler.data()))); - registerBackendType(QBackendNodeMapperPtr(new Input::InputNodeFunctor(d_func()->m_inputHandler->axisManager()))); - registerBackendType(QBackendNodeMapperPtr(new Input::InputNodeFunctor(d_func()->m_inputHandler->axisAccumulatorManager()))); - registerBackendType(QBackendNodeMapperPtr(new Input::InputNodeFunctor(d_func()->m_inputHandler->analogAxisInputManager()))); - registerBackendType(QBackendNodeMapperPtr(new Input::InputNodeFunctor(d_func()->m_inputHandler->buttonAxisInputManager()))); - registerBackendType(QBackendNodeMapperPtr(new Input::InputNodeFunctor(d_func()->m_inputHandler->axisSettingManager()))); - registerBackendType(QBackendNodeMapperPtr(new Input::InputNodeFunctor(d_func()->m_inputHandler->actionManager()))); - registerBackendType(QBackendNodeMapperPtr(new Input::InputNodeFunctor(d_func()->m_inputHandler->actionInputManager()))); - registerBackendType(QBackendNodeMapperPtr(new Input::InputNodeFunctor(d_func()->m_inputHandler->inputChordManager()))); - registerBackendType(QBackendNodeMapperPtr(new Input::InputNodeFunctor(d_func()->m_inputHandler->inputSequenceManager()))); - registerBackendType(QBackendNodeMapperPtr(new Input::LogicalDeviceNodeFunctor(d_func()->m_inputHandler->logicalDeviceManager()))); - registerBackendType(QBackendNodeMapperPtr(new Input::GenericDeviceBackendFunctor(this, d_func()->m_inputHandler.data()))); - registerBackendType(QBackendNodeMapperPtr(new Input::InputSettingsFunctor(d_func()->m_inputHandler.data()))); - registerBackendType(QBackendNodeMapperPtr(new Input::PhysicalDeviceProxyNodeFunctor(d_func()->m_inputHandler->physicalDeviceProxyManager()))); + registerBackendType(QBackendNodeMapperPtr(new Input::KeyboardDeviceFunctor(this, d_func()->m_inputHandler.data()))); + registerBackendType(QBackendNodeMapperPtr(new Input::KeyboardHandlerFunctor(d_func()->m_inputHandler.data()))); + registerBackendType(QBackendNodeMapperPtr(new Input::MouseDeviceFunctor(this, d_func()->m_inputHandler.data()))); + registerBackendType(QBackendNodeMapperPtr(new Input::MouseHandlerFunctor(d_func()->m_inputHandler.data()))); + registerBackendType(QBackendNodeMapperPtr(new Input::InputNodeFunctor(d_func()->m_inputHandler->axisManager()))); + registerBackendType(QBackendNodeMapperPtr(new Input::InputNodeFunctor(d_func()->m_inputHandler->axisAccumulatorManager()))); + registerBackendType(QBackendNodeMapperPtr(new Input::InputNodeFunctor(d_func()->m_inputHandler->analogAxisInputManager()))); + registerBackendType(QBackendNodeMapperPtr(new Input::InputNodeFunctor(d_func()->m_inputHandler->buttonAxisInputManager()))); + registerBackendType(QBackendNodeMapperPtr(new Input::InputNodeFunctor(d_func()->m_inputHandler->axisSettingManager()))); + registerBackendType(QBackendNodeMapperPtr(new Input::InputNodeFunctor(d_func()->m_inputHandler->actionManager()))); + registerBackendType(QBackendNodeMapperPtr(new Input::InputNodeFunctor(d_func()->m_inputHandler->actionInputManager()))); + registerBackendType(QBackendNodeMapperPtr(new Input::InputNodeFunctor(d_func()->m_inputHandler->inputChordManager()))); + registerBackendType(QBackendNodeMapperPtr(new Input::InputNodeFunctor(d_func()->m_inputHandler->inputSequenceManager()))); + registerBackendType(QBackendNodeMapperPtr(new Input::LogicalDeviceNodeFunctor(d_func()->m_inputHandler->logicalDeviceManager()))); + registerBackendType(QBackendNodeMapperPtr(new Input::GenericDeviceBackendFunctor(this, d_func()->m_inputHandler.data()))); + registerBackendType(QBackendNodeMapperPtr(new Input::InputSettingsFunctor(d_func()->m_inputHandler.data()))); + registerBackendType(QBackendNodeMapperPtr(new Input::PhysicalDeviceProxyNodeFunctor(d_func()->m_inputHandler->physicalDeviceProxyManager()))); #ifdef HAVE_QGAMEPAD - registerBackendType(QBackendNodeMapperPtr(new Input::GenericDeviceBackendFunctor(this, d_func()->m_inputHandler.data()))); + registerBackendType(QBackendNodeMapperPtr(new Input::GenericDeviceBackendFunctor(this, d_func()->m_inputHandler.data()))); #endif Q_D(QInputAspect); diff --git a/src/input/frontend/qinputchord.cpp b/src/input/frontend/qinputchord.cpp index 0c4d15190..474e25254 100644 --- a/src/input/frontend/qinputchord.cpp +++ b/src/input/frontend/qinputchord.cpp @@ -40,7 +40,6 @@ #include "qinputchord_p.h" #include -#include QT_BEGIN_NAMESPACE @@ -154,7 +153,7 @@ void QInputChord::addChord(QAbstractActionInput *input) if (!input->parent()) input->setParent(this); - d->updateNode(input, "input", Qt3DCore::PropertyValueAdded); + d->update(); } } @@ -167,7 +166,7 @@ void QInputChord::removeChord(QAbstractActionInput *input) { Q_D(QInputChord); if (d->m_chords.contains(input)) { - d->updateNode(input, "input", Qt3DCore::PropertyValueRemoved); + d->update(); d->m_chords.removeOne(input); @@ -185,18 +184,6 @@ QVector QInputChord::chords() const return d->m_chords; } -Qt3DCore::QNodeCreatedChangeBasePtr QInputChord::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - QInputChordData &data = creationChange->data; - - Q_D(const QInputChord); - data.chordIds = qIdsForNodes(chords()); - data.timeout = d->m_timeout; - - return creationChange; -} - QInputChordPrivate::QInputChordPrivate() : QAbstractActionInputPrivate(), m_timeout(0) diff --git a/src/input/frontend/qinputchord.h b/src/input/frontend/qinputchord.h index 570590229..fd917c745 100644 --- a/src/input/frontend/qinputchord.h +++ b/src/input/frontend/qinputchord.h @@ -74,7 +74,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QInputChord) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // Qt3DInput diff --git a/src/input/frontend/qinputsequence.cpp b/src/input/frontend/qinputsequence.cpp index d59ebc0f3..ba571bbb9 100644 --- a/src/input/frontend/qinputsequence.cpp +++ b/src/input/frontend/qinputsequence.cpp @@ -41,7 +41,6 @@ #include #include -#include #include @@ -207,7 +206,7 @@ void QInputSequence::addSequence(QAbstractActionInput *input) if (!input->parent()) input->setParent(this); - d->updateNode(input, "input", Qt3DCore::PropertyValueAdded); + d->update(); } } @@ -220,7 +219,7 @@ void QInputSequence::removeSequence(QAbstractActionInput *input) { Q_D(QInputSequence); if (d->m_sequences.contains(input)) { - d->updateNode(input, "input", Qt3DCore::PropertyValueRemoved); + d->update(); d->m_sequences.removeOne(input); @@ -238,19 +237,6 @@ QVector QInputSequence::sequences() const return d->m_sequences; } -Qt3DCore::QNodeCreatedChangeBasePtr QInputSequence::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - QInputSequenceData &data = creationChange->data; - - Q_D(const QInputSequence); - data.sequenceIds = qIdsForNodes(sequences()); - data.timeout = d->m_timeout; - data.buttonInterval = d->m_buttonInterval; - - return creationChange; -} - } // Qt3DInput QT_END_NAMESPACE diff --git a/src/input/frontend/qinputsequence.h b/src/input/frontend/qinputsequence.h index 9d4aea6fc..47e4aa488 100644 --- a/src/input/frontend/qinputsequence.h +++ b/src/input/frontend/qinputsequence.h @@ -78,7 +78,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QInputSequence) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // Qt3DInput diff --git a/src/input/frontend/qinputsettings.cpp b/src/input/frontend/qinputsettings.cpp index ccc53e47b..8ed302ac9 100644 --- a/src/input/frontend/qinputsettings.cpp +++ b/src/input/frontend/qinputsettings.cpp @@ -40,8 +40,6 @@ #include "qinputsettings.h" #include "qinputsettings_p.h" -#include - QT_BEGIN_NAMESPACE namespace Qt3DInput { @@ -132,17 +130,6 @@ void QInputSettings::eventSourceDestroyed() emit eventSourceChanged(nullptr); } -Qt3DCore::QNodeCreatedChangeBasePtr QInputSettings::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - - Q_D(const QInputSettings); - data.eventSource = d->m_eventSource; - - return creationChange; -} - } // Qt3DInput diff --git a/src/input/frontend/qinputsettings.h b/src/input/frontend/qinputsettings.h index 10e883ac4..cc1e5bdce 100644 --- a/src/input/frontend/qinputsettings.h +++ b/src/input/frontend/qinputsettings.h @@ -67,7 +67,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QInputSettings) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; void eventSourceDestroyed(); }; diff --git a/src/input/frontend/qkeyboarddevice.cpp b/src/input/frontend/qkeyboarddevice.cpp index 1ec1f8ead..0fe3a1338 100644 --- a/src/input/frontend/qkeyboarddevice.cpp +++ b/src/input/frontend/qkeyboarddevice.cpp @@ -309,11 +309,6 @@ QKeyboardDevice::QKeyboardDevice(QKeyboardDevicePrivate &dd, QNode *parent) { } -// TODO Unused remove in Qt6 -void QKeyboardDevice::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &) -{ -} - /*! * Set the active input to \a activeInput */ diff --git a/src/input/frontend/qkeyboarddevice.h b/src/input/frontend/qkeyboarddevice.h index df2f47020..ee4b864f7 100644 --- a/src/input/frontend/qkeyboarddevice.h +++ b/src/input/frontend/qkeyboarddevice.h @@ -71,8 +71,6 @@ public: protected: explicit QKeyboardDevice(QKeyboardDevicePrivate &dd, QNode *parent = nullptr); - // TODO Unused remove in Qt6 - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; Q_SIGNALS: void activeInputChanged(QKeyboardHandler *activeInput); diff --git a/src/input/frontend/qkeyboardhandler.cpp b/src/input/frontend/qkeyboardhandler.cpp index 92ce39c31..5126c4692 100644 --- a/src/input/frontend/qkeyboardhandler.cpp +++ b/src/input/frontend/qkeyboardhandler.cpp @@ -237,23 +237,6 @@ void QKeyboardHandler::setFocus(bool focus) } } -// TODO Unused remove in Qt6 -void QKeyboardHandler::sceneChangeEvent(const QSceneChangePtr &) -{ -} - -Qt3DCore::QNodeCreatedChangeBasePtr QKeyboardHandler::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - - Q_D(const QKeyboardHandler); - data.keyboardDeviceId = qIdForNode(d->m_keyboardDevice); - data.focus = d->m_focus; - - return creationChange; -} - /*! \qmlsignal Qt3D.Input::KeyboardHandler::digit0Pressed(KeyEvent event) diff --git a/src/input/frontend/qkeyboardhandler.h b/src/input/frontend/qkeyboardhandler.h index b4425de72..1ee9ef1af 100644 --- a/src/input/frontend/qkeyboardhandler.h +++ b/src/input/frontend/qkeyboardhandler.h @@ -115,13 +115,8 @@ Q_SIGNALS: void pressed(Qt3DInput::QKeyEvent *event); void released(Qt3DInput::QKeyEvent *event); -protected: - // TODO Unused remove in Qt6 - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; - private: Q_DECLARE_PRIVATE(QKeyboardHandler) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DInput diff --git a/src/input/frontend/qlogicaldevice.cpp b/src/input/frontend/qlogicaldevice.cpp index 44e04baa8..cf723f9aa 100644 --- a/src/input/frontend/qlogicaldevice.cpp +++ b/src/input/frontend/qlogicaldevice.cpp @@ -40,7 +40,6 @@ #include "qlogicaldevice.h" #include "qlogicaldevice_p.h" -#include #include #include @@ -173,7 +172,7 @@ void QLogicalDevice::addAction(QAction *action) // Ensures proper bookkeeping d->registerDestructionHelper(action, &QLogicalDevice::removeAction, d->m_actions); - d->updateNode(action, "action", Qt3DCore::PropertyValueAdded); + d->update(); } } @@ -184,7 +183,7 @@ void QLogicalDevice::removeAction(QAction *action) { Q_D(QLogicalDevice); if (d->m_actions.contains(action)) { - d->updateNode(action, "action", Qt3DCore::PropertyValueRemoved); + d->update(); d->m_actions.removeOne(action); @@ -224,7 +223,7 @@ void QLogicalDevice::addAxis(QAxis *axis) // Ensures proper bookkeeping d->registerDestructionHelper(axis, &QLogicalDevice::removeAxis, d->m_axes); - d->updateNode(axis, "axis", Qt3DCore::PropertyValueAdded); + d->update(); } } @@ -235,7 +234,7 @@ void QLogicalDevice::removeAxis(QAxis *axis) { Q_D(QLogicalDevice); if (d->m_axes.contains(axis)) { - d->updateNode(axis, "axis", Qt3DCore::PropertyValueRemoved); + d->update(); d->m_axes.removeOne(axis); @@ -253,15 +252,6 @@ QVector QLogicalDevice::axes() const return d->m_axes; } -Qt3DCore::QNodeCreatedChangeBasePtr QLogicalDevice::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - data.actionIds = qIdsForNodes(actions()); - data.axisIds = qIdsForNodes(axes()); - return creationChange; -} - } // Qt3DInput QT_END_NAMESPACE diff --git a/src/input/frontend/qlogicaldevice.h b/src/input/frontend/qlogicaldevice.h index b60000717..5f8a08e6e 100644 --- a/src/input/frontend/qlogicaldevice.h +++ b/src/input/frontend/qlogicaldevice.h @@ -68,7 +68,6 @@ public: private: Q_DECLARE_PRIVATE(QLogicalDevice) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // Qt3DInput diff --git a/src/input/frontend/qmousedevice.cpp b/src/input/frontend/qmousedevice.cpp index 5872fbcd2..36d3a1b3c 100644 --- a/src/input/frontend/qmousedevice.cpp +++ b/src/input/frontend/qmousedevice.cpp @@ -41,7 +41,6 @@ #include "qmousedevice_p.h" #include -#include #include QT_BEGIN_NAMESPACE @@ -259,24 +258,6 @@ void QMouseDevice::setUpdateAxesContinuously(bool updateAxesContinuously) emit updateAxesContinuouslyChanged(updateAxesContinuously); } -/*! \internal */ -void QMouseDevice::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) -{ - Q_UNUSED(change); - // TODO: To be completed as the mouse input aspect takes shape -} - -Qt3DCore::QNodeCreatedChangeBasePtr QMouseDevice::createNodeCreationChange() const -{ - auto creationChange = QPhysicalDeviceCreatedChangePtr::create(this); - auto &data = creationChange->data; - - Q_D(const QMouseDevice); - data.sensitivity = d->m_sensitivity; - - return creationChange; -} - } // namespace Qt3DInput QT_END_NAMESPACE diff --git a/src/input/frontend/qmousedevice.h b/src/input/frontend/qmousedevice.h index 7754c2e29..66ad39e0f 100644 --- a/src/input/frontend/qmousedevice.h +++ b/src/input/frontend/qmousedevice.h @@ -88,12 +88,8 @@ Q_SIGNALS: void sensitivityChanged(float value); void updateAxesContinuouslyChanged(bool updateAxesContinuously); -protected: - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; - private: Q_DECLARE_PRIVATE(QMouseDevice) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DInput diff --git a/src/input/frontend/qmousehandler.cpp b/src/input/frontend/qmousehandler.cpp index 89d76a057..49ccce0c5 100644 --- a/src/input/frontend/qmousehandler.cpp +++ b/src/input/frontend/qmousehandler.cpp @@ -298,10 +298,6 @@ void QMouseHandler::setSourceDevice(QMouseDevice *mouseDevice) } } -// TODO Unused remove in Qt6 -void QMouseHandler::sceneChangeEvent(const QSceneChangePtr &) -{ -} /*! * \property Qt3DInput::QMouseHandler::sourceDevice @@ -339,17 +335,6 @@ void QMouseHandler::setContainsMouse(bool contains) } } -Qt3DCore::QNodeCreatedChangeBasePtr QMouseHandler::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - - Q_D(const QMouseHandler); - data.mouseDeviceId = qIdForNode(d->m_mouseDevice); - - return creationChange; -} - } // namespace Qt3DInput QT_END_NAMESPACE diff --git a/src/input/frontend/qmousehandler.h b/src/input/frontend/qmousehandler.h index d95dbf4c3..307d30e9f 100644 --- a/src/input/frontend/qmousehandler.h +++ b/src/input/frontend/qmousehandler.h @@ -87,13 +87,10 @@ Q_SIGNALS: #endif protected: - // TODO Unused remove in Qt6 - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; void setContainsMouse(bool contains); private: Q_DECLARE_PRIVATE(QMouseHandler) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DInput diff --git a/src/input/frontend/qphysicaldevicecreatedchange.cpp b/src/input/frontend/qphysicaldevicecreatedchange.cpp deleted file mode 100644 index 905633b7f..000000000 --- a/src/input/frontend/qphysicaldevicecreatedchange.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qphysicaldevicecreatedchange.h" -#include "qphysicaldevicecreatedchange_p.h" - -#include -#include -#include - - -QT_BEGIN_NAMESPACE - -namespace Qt3DInput { - -QPhysicalDeviceCreatedChangeBasePrivate::QPhysicalDeviceCreatedChangeBasePrivate(const QAbstractPhysicalDevice *device) - : Qt3DCore::QNodeCreatedChangeBasePrivate(device) - , m_axisSettingIds(Qt3DCore::qIdsForNodes(device->axisSettings())) -{ - -} - -/*! - \class Qt3DInput::QPhysicalDeviceCreatedChangeBase - \inmodule Qt3DInput - \brief Base class for handling changes in physical devices. -*/ -QPhysicalDeviceCreatedChangeBase::QPhysicalDeviceCreatedChangeBase(const QAbstractPhysicalDevice *device) - : Qt3DCore::QNodeCreatedChangeBase(*new QPhysicalDeviceCreatedChangeBasePrivate(device), device) -{ -} - -/*! \internal */ -QPhysicalDeviceCreatedChangeBase::~QPhysicalDeviceCreatedChangeBase() -{ -} - -/*! - Returns a list of node ids. -*/ -Qt3DCore::QNodeIdVector Qt3DInput::QPhysicalDeviceCreatedChangeBase::axisSettingIds() const -{ - Q_D(const QPhysicalDeviceCreatedChangeBase); - return d->m_axisSettingIds; -} - -QT_END_NAMESPACE - -} // namespace Qt3DInput diff --git a/src/input/frontend/qphysicaldevicecreatedchange.h b/src/input/frontend/qphysicaldevicecreatedchange.h deleted file mode 100644 index 6ffe559e9..000000000 --- a/src/input/frontend/qphysicaldevicecreatedchange.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DINPUT_QPHYSICALDEVICECREATIONCHANGEBASE_H -#define QT3DINPUT_QPHYSICALDEVICECREATIONCHANGEBASE_H - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DInput { - -class QAbstractPhysicalDevice; -class QPhysicalDeviceCreatedChangeBasePrivate; - -class Q_3DINPUTSHARED_EXPORT QPhysicalDeviceCreatedChangeBase : public Qt3DCore::QNodeCreatedChangeBase -{ -public: - explicit QPhysicalDeviceCreatedChangeBase(const QAbstractPhysicalDevice *device); - ~QPhysicalDeviceCreatedChangeBase(); - - Qt3DCore::QNodeIdVector axisSettingIds() const; - -private: - Q_DECLARE_PRIVATE(QPhysicalDeviceCreatedChangeBase) -}; - -typedef QSharedPointer QPhysicalDeviceCreatedChangeBasePtr; - -template -class QPhysicalDeviceCreatedChange : public QPhysicalDeviceCreatedChangeBase -{ -public: - explicit QPhysicalDeviceCreatedChange(const QAbstractPhysicalDevice *_device) - : QPhysicalDeviceCreatedChangeBase(_device) - , data() - { - } - - T data; -}; - -template -using QPhysicalDeviceCreatedChangePtr = QSharedPointer>; - -} // namespace Qt3DInput - -QT_END_NAMESPACE - -#endif // QT3DINPUT_QPHYSICALDEVICECREATIONCHANGEBASE_H diff --git a/src/input/frontend/qphysicaldevicecreatedchange_p.h b/src/input/frontend/qphysicaldevicecreatedchange_p.h deleted file mode 100644 index 7dcc7eb47..000000000 --- a/src/input/frontend/qphysicaldevicecreatedchange_p.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DINPUT_QPHYSICALDEVICECREATEDCHANGEBASE_P_H -#define QT3DINPUT_QPHYSICALDEVICECREATEDCHANGEBASE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DInput { - -class QAbstractPhysicalDevice; - -class QPhysicalDeviceCreatedChangeBasePrivate : public Qt3DCore::QNodeCreatedChangeBasePrivate -{ -public: - QPhysicalDeviceCreatedChangeBasePrivate(const QAbstractPhysicalDevice *device); - - Qt3DCore::QNodeIdVector m_axisSettingIds; -}; - -} // namespace Qt3DInput - -QT_END_NAMESPACE - -#endif // QT3DINPUT_QPHYSICALDEVICECREATEDCHANGEBASE_P_H diff --git a/src/logic/handler.cpp b/src/logic/handler.cpp index 884d5f582..be6d03c3d 100644 --- a/src/logic/handler.cpp +++ b/src/logic/handler.cpp @@ -54,15 +54,11 @@ Handler::Handler() { } -void Handler::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) +void Handler::syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime) { - Q_UNUSED(change); - m_logicManager->appendHandler(this); -} - -void Handler::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) -{ - QBackendNode::sceneChangeEvent(e); + Q_UNUSED(frontEnd) + if (firstTime) + m_logicManager->appendHandler(this); } HandlerFunctor::HandlerFunctor(Manager *manager) @@ -70,9 +66,9 @@ HandlerFunctor::HandlerFunctor(Manager *manager) { } -Qt3DCore::QBackendNode *HandlerFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const +Qt3DCore::QBackendNode *HandlerFunctor::create(Qt3DCore::QNodeId id) const { - Handler *handler = m_manager->logicHandlerManager()->getOrCreateResource(change->subjectId()); + Handler *handler = m_manager->logicHandlerManager()->getOrCreateResource(id); handler->setManager(m_manager); return handler; } diff --git a/src/logic/handler_p.h b/src/logic/handler_p.h index 91b625ecc..85b6e7475 100644 --- a/src/logic/handler_p.h +++ b/src/logic/handler_p.h @@ -57,6 +57,10 @@ QT_BEGIN_NAMESPACE +namespace Qt3DCore { +class QNode; +} + namespace Qt3DLogic { namespace Logic { @@ -70,12 +74,9 @@ public: void setManager(Manager *manager) { m_logicManager = manager; } Manager *logicManager() const { return m_logicManager; } -protected: - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) override; + void syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime); private: - void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) final; - Manager *m_logicManager; }; @@ -85,7 +86,7 @@ class HandlerFunctor : public Qt3DCore::QBackendNodeMapper public: explicit HandlerFunctor(Manager *handler); - Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const override; + Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const override; Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const override; void destroy(Qt3DCore::QNodeId id) const override; diff --git a/src/logic/manager.cpp b/src/logic/manager.cpp index db90e6ad9..1131081ee 100644 --- a/src/logic/manager.cpp +++ b/src/logic/manager.cpp @@ -74,8 +74,10 @@ void Manager::setExecutor(Executor *executor) void Manager::appendHandler(Handler *handler) { HHandler handle = m_logicHandlerManager->lookupHandle(handler->peerId()); - m_logicHandlers.append(handle); - m_logicComponentIds.append(handler->peerId()); + if (!m_logicHandlers.contains(handle)) { + m_logicHandlers.append(handle); + m_logicComponentIds.append(handler->peerId()); + } } void Manager::removeHandler(Qt3DCore::QNodeId id) diff --git a/src/logic/qlogicaspect.cpp b/src/logic/qlogicaspect.cpp index c4459a84d..e5085929c 100644 --- a/src/logic/qlogicaspect.cpp +++ b/src/logic/qlogicaspect.cpp @@ -93,6 +93,13 @@ void QLogicAspectPrivate::registerBackendTypes() q->registerBackendType(QBackendNodeMapperPtr(new Logic::HandlerFunctor(m_manager.data()))); } + +void QLogicAspectPrivate::syncDirtyFrontEndNode(QNode *node, QBackendNode *backend, bool firstTime) const +{ + Logic::Handler *handler = static_cast(backend); + handler->syncFromFrontEnd(node, firstTime); +} + /*! Constructs a new Qt3DLogic::QLogicAspect instance with \a parent. */ @@ -125,7 +132,6 @@ QVector QLogicAspect::jobsToExecute(qint64 time) // Create jobs that will get executed by the threadpool QVector jobs; - if (d->m_manager->hasFrameActions()) jobs.append(d->m_callbackJob); diff --git a/src/logic/qlogicaspect_p.h b/src/logic/qlogicaspect_p.h index 2a6a7259a..268b8b7eb 100644 --- a/src/logic/qlogicaspect_p.h +++ b/src/logic/qlogicaspect_p.h @@ -79,6 +79,9 @@ class QLogicAspectPrivate : public Qt3DCore::QAbstractAspectPrivate QScopedPointer m_manager; QScopedPointer m_executor; QSharedPointer m_callbackJob; + + void syncDirtyFrontEndNode(Qt3DCore::QNode *node, Qt3DCore::QBackendNode *backend, bool firstTime) const override; + }; } // namespace Qt3DLogic diff --git a/src/plugins/renderers/opengl/debug/debug.pri b/src/plugins/renderers/opengl/debug/debug.pri index c5153bbf7..38a056f6b 100644 --- a/src/plugins/renderers/opengl/debug/debug.pri +++ b/src/plugins/renderers/opengl/debug/debug.pri @@ -3,8 +3,7 @@ INCLUDEPATH += $$PWD include($$QT3D_ROOT/src/3rdparty/imgui/imgui.pri) HEADERS += \ - $$PWD/imguirenderer_p.h \ - $$PWD/imconfig.h + $$PWD/imguirenderer_p.h SOURCES += \ $$PWD/imguirenderer.cpp diff --git a/src/plugins/renderers/opengl/renderer/renderer.cpp b/src/plugins/renderers/opengl/renderer/renderer.cpp index d01f22847..14350337b 100644 --- a/src/plugins/renderers/opengl/renderer/renderer.cpp +++ b/src/plugins/renderers/opengl/renderer/renderer.cpp @@ -97,6 +97,7 @@ #include #include #include +#include #include #include @@ -269,7 +270,6 @@ Renderer::Renderer(QRenderAspect::RenderType type) , m_bufferGathererJob(SynchronizerJobPtr::create([this] { lookForDirtyBuffers(); }, JobTypes::DirtyBufferGathering)) , m_vaoGathererJob(SynchronizerJobPtr::create([this] { lookForAbandonedVaos(); }, JobTypes::DirtyVaoGathering)) , m_textureGathererJob(SynchronizerJobPtr::create([this] { lookForDirtyTextures(); }, JobTypes::DirtyTextureGathering)) - , m_sendSetFenceHandlesToFrontendJob(SynchronizerJobPtr::create([this] { sendSetFenceHandlesToFrontend(); }, JobTypes::SendSetFenceHandlesToFrontend)) , m_introspectShaderJob(SynchronizerPostFramePtr::create([this] { reloadDirtyShaders(); }, [this] (Qt3DCore::QAspectManager *m) { sendShaderChangesToFrontend(m); }, JobTypes::DirtyShaderGathering)) @@ -1275,8 +1275,8 @@ void Renderer::sendTextureChangesToFrontend(Qt3DCore::QAspectManager *manager) } } -// Executed in a job -void Renderer::sendSetFenceHandlesToFrontend() +// Executed in main thread when jobs done +void Renderer::sendSetFenceHandlesToFrontend(Qt3DCore::QAspectManager *manager) { const QVector> updatedSetFence = std::move(m_updatedSetFences); FrameGraphManager *fgManager = m_nodesManager->frameGraphManager(); @@ -1284,14 +1284,15 @@ void Renderer::sendSetFenceHandlesToFrontend() FrameGraphNode *fgNode = fgManager->lookupNode(pair.first); if (fgNode != nullptr) { // Node could have been deleted before we got a chance to notify it Q_ASSERT(fgNode->nodeType() == FrameGraphNode::SetFence); - SetFence *setFenceNode = static_cast(fgNode); - setFenceNode->setHandleType(QSetFence::OpenGLFenceId); - setFenceNode->setHandle(QVariant::fromValue(pair.second)); + QSetFence *frontend = static_cast(manager->lookupNode(fgNode->peerId())); + QSetFencePrivate *dFrontend = static_cast(QNodePrivate::get(frontend)); + dFrontend->setHandleType(QSetFence::OpenGLFenceId); + dFrontend->setHandle(QVariant::fromValue(pair.second)); } } } -// Executed in a job (in main thread when jobs done) +// Executed in main thread when jobs done void Renderer::sendDisablesToFrontend(Qt3DCore::QAspectManager *manager) { // SubtreeEnabled @@ -1853,6 +1854,7 @@ void Renderer::jobsDone(Qt3DCore::QAspectManager *manager) sendTextureChangesToFrontend(manager); sendDisablesToFrontend(manager); + sendSetFenceHandlesToFrontend(manager); } // Jobs we may have to run even if no rendering will happen @@ -1878,10 +1880,6 @@ QVector Renderer::preRenderingJobs() QVector jobs; - // Do we need to notify frontend about fence change? - if (m_updatedSetFences.size() > 0) - jobs.push_back(m_sendSetFenceHandlesToFrontendJob); - if (m_sendBufferCaptureJob->hasRequests()) jobs.push_back(m_sendBufferCaptureJob); diff --git a/src/plugins/renderers/opengl/renderer/renderer_p.h b/src/plugins/renderers/opengl/renderer/renderer_p.h index 4a6a26d93..8c3a252bb 100644 --- a/src/plugins/renderers/opengl/renderer/renderer_p.h +++ b/src/plugins/renderers/opengl/renderer/renderer_p.h @@ -415,7 +415,6 @@ private: SynchronizerJobPtr m_bufferGathererJob; SynchronizerJobPtr m_vaoGathererJob; SynchronizerJobPtr m_textureGathererJob; - SynchronizerJobPtr m_sendSetFenceHandlesToFrontendJob; SynchronizerPostFramePtr m_introspectShaderJob; SynchronizerJobPtr m_syncLoadingJobs; SynchronizerJobPtr m_cacheRenderableEntitiesJob; @@ -429,7 +428,7 @@ private: void reloadDirtyShaders(); void sendShaderChangesToFrontend(Qt3DCore::QAspectManager *manager); void sendTextureChangesToFrontend(Qt3DCore::QAspectManager *manager); - void sendSetFenceHandlesToFrontend(); + void sendSetFenceHandlesToFrontend(Qt3DCore::QAspectManager *manager); void sendDisablesToFrontend(Qt3DCore::QAspectManager *manager); QMutex m_abandonedVaosMutex; diff --git a/src/plugins/renderplugins/scene2d/scene2dplugin.cpp b/src/plugins/renderplugins/scene2d/scene2dplugin.cpp index dfb6c8f2b..bffaa5b0b 100644 --- a/src/plugins/renderplugins/scene2d/scene2dplugin.cpp +++ b/src/plugins/renderplugins/scene2d/scene2dplugin.cpp @@ -58,9 +58,9 @@ public: { } - Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const final + Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const final { - Backend *backend = m_manager->getOrCreateResource(change->subjectId()); + Backend *backend = m_manager->getOrCreateResource(id); backend->setRenderer(m_renderer); return backend; } @@ -96,7 +96,7 @@ bool Scene2DPlugin::registerBackendTypes(QRenderAspect *aspect, { registerBackendType(aspect, Qt3DRender::Quick::QScene2D::staticMetaObject, QSharedPointer > - ::create(renderer, m_scene2dNodeManager), true); + ::create(renderer, m_scene2dNodeManager)); return true; } bool Scene2DPlugin::unregisterBackendTypes(QRenderAspect *aspect) diff --git a/src/quick3d/quick3dscene2d/items/qscene2d.cpp b/src/quick3d/quick3dscene2d/items/qscene2d.cpp index b12adb8ed..70516ff09 100644 --- a/src/quick3d/quick3dscene2d/items/qscene2d.cpp +++ b/src/quick3d/quick3dscene2d/items/qscene2d.cpp @@ -280,20 +280,6 @@ void QScene2D::setOutput(Qt3DRender::QRenderTargetOutput *output) } } -Qt3DCore::QNodeCreatedChangeBasePtr QScene2D::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QScene2D); - data.renderPolicy = d->m_renderManager->m_renderPolicy; - data.sharedObject = d->m_renderManager->m_sharedObject; - data.output = d->m_output ? d->m_output->id() : Qt3DCore::QNodeId(); - for (Qt3DCore::QEntity *e : d->m_entities) - data.entityIds.append(e->id()); - data.mouseEnabled = d->m_renderManager->m_mouseEnabled; - return creationChange; -} - bool QScene2D::isMouseEnabled() const { Q_D(const QScene2D); @@ -329,7 +315,7 @@ void QScene2D::addEntity(Qt3DCore::QEntity *entity) d->m_entities.append(entity); d->registerDestructionHelper(entity, &QScene2D::removeEntity, d->m_entities); - d->updateNode(entity, "entities", PropertyValueAdded); + d->update(); } } @@ -343,7 +329,7 @@ void QScene2D::removeEntity(Qt3DCore::QEntity *entity) d->m_entities.removeAll(entity); d->unregisterDestructionHelper(entity); - d->updateNode(entity, "entities", PropertyValueRemoved); + d->update(); } } diff --git a/src/quick3d/quick3dscene2d/items/qscene2d.h b/src/quick3d/quick3dscene2d/items/qscene2d.h index 38eaf7359..e87c0be05 100644 --- a/src/quick3d/quick3dscene2d/items/qscene2d.h +++ b/src/quick3d/quick3dscene2d/items/qscene2d.h @@ -100,9 +100,6 @@ Q_SIGNALS: protected: Q_DECLARE_PRIVATE(QScene2D) - -private: - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Quick diff --git a/src/quick3d/quick3dscene2d/items/scene2d.cpp b/src/quick3d/quick3dscene2d/items/scene2d.cpp index 063464b95..dcc99ed8c 100644 --- a/src/quick3d/quick3dscene2d/items/scene2d.cpp +++ b/src/quick3d/quick3dscene2d/items/scene2d.cpp @@ -34,9 +34,6 @@ ** ****************************************************************************/ -#include -#include -#include #include #include #include @@ -457,9 +454,6 @@ bool Scene2D::registerObjectPickerEvents(Qt3DCore::QEntity *qentity) handlePickEvent(QEvent::MouseMove, pick); }); - Qt3DCore::QBackendNodePrivate *priv = Qt3DCore::QBackendNodePrivate::get(this); - Qt3DCore::QChangeArbiter *arbiter = static_cast(priv->m_arbiter); - arbiter->registerObserver(d_ptr, entity->componentUuid()); return true; } @@ -469,10 +463,6 @@ void Scene2D::unregisterObjectPickerEvents(Qt3DCore::QNodeId entityId) if (!resourceAccessor()->accessResource(RenderBackendResourceAccessor::EntityHandle, entityId, (void**)&entity, nullptr)) return; - - Qt3DCore::QBackendNodePrivate *priv = Qt3DCore::QBackendNodePrivate::get(this); - Qt3DCore::QChangeArbiter *arbiter = static_cast(priv->m_arbiter); - arbiter->unregisterObserver(d_ptr, entity->componentUuid()); } void Scene2D::handlePickEvent(int type, const Qt3DRender::QPickEvent *ev) diff --git a/src/quick3d/quick3dscene2d/items/scene2d_p.h b/src/quick3d/quick3dscene2d/items/scene2d_p.h index 2f2b556ec..c7626f73d 100644 --- a/src/quick3d/quick3dscene2d/items/scene2d_p.h +++ b/src/quick3d/quick3dscene2d/items/scene2d_p.h @@ -49,7 +49,6 @@ // #include -#include #include #include diff --git a/src/render/backend/backendnode_p.h b/src/render/backend/backendnode_p.h index 3b880f759..946d310ed 100644 --- a/src/render/backend/backendnode_p.h +++ b/src/render/backend/backendnode_p.h @@ -53,6 +53,7 @@ #include #include +#include #include #include diff --git a/src/render/backend/cameralens.cpp b/src/render/backend/cameralens.cpp index ab74e8b56..3e0e4626d 100644 --- a/src/render/backend/cameralens.cpp +++ b/src/render/backend/cameralens.cpp @@ -220,9 +220,9 @@ CameraLensFunctor::CameraLensFunctor(AbstractRenderer *renderer, QRenderAspect * { } -QBackendNode *CameraLensFunctor::create(const QNodeCreatedChangeBasePtr &change) const +QBackendNode *CameraLensFunctor::create(const QNodeId id) const { - CameraLens *backend = m_manager->getOrCreateResource(change->subjectId()); + CameraLens *backend = m_manager->getOrCreateResource(id); backend->setRenderer(m_renderer); backend->setRenderAspect(m_renderAspect); return backend; diff --git a/src/render/backend/cameralens_p.h b/src/render/backend/cameralens_p.h index 4afa38620..e9473ea6b 100644 --- a/src/render/backend/cameralens_p.h +++ b/src/render/backend/cameralens_p.h @@ -70,7 +70,7 @@ class CameraLensFunctor : public Qt3DCore::QBackendNodeMapper { public: explicit CameraLensFunctor(AbstractRenderer *renderer, QRenderAspect *renderAspect); - Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const override; + Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const override; Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const override; void destroy(Qt3DCore::QNodeId id) const override; diff --git a/src/render/backend/computecommand.cpp b/src/render/backend/computecommand.cpp index bc82291f0..7c6d655cb 100644 --- a/src/render/backend/computecommand.cpp +++ b/src/render/backend/computecommand.cpp @@ -39,7 +39,6 @@ #include "computecommand_p.h" #include -#include #include #include diff --git a/src/render/backend/entity.cpp b/src/render/backend/entity.cpp index d766baaaf..aeb318c5a 100644 --- a/src/render/backend/entity.cpp +++ b/src/render/backend/entity.cpp @@ -63,7 +63,6 @@ #include #include #include -#include #include #include @@ -427,9 +426,9 @@ RenderEntityFunctor::RenderEntityFunctor(AbstractRenderer *renderer, NodeManager { } -Qt3DCore::QBackendNode *RenderEntityFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const +Qt3DCore::QBackendNode *RenderEntityFunctor::create(Qt3DCore::QNodeId id) const { - HEntity renderNodeHandle = m_nodeManagers->renderNodesManager()->getOrAcquireHandle(change->subjectId()); + HEntity renderNodeHandle = m_nodeManagers->renderNodesManager()->getOrAcquireHandle(id); Entity *entity = m_nodeManagers->renderNodesManager()->data(renderNodeHandle); entity->setNodeManagers(m_nodeManagers); entity->setHandle(renderNodeHandle); diff --git a/src/render/backend/entity_p.h b/src/render/backend/entity_p.h index 8ac10454e..474d8747b 100644 --- a/src/render/backend/entity_p.h +++ b/src/render/backend/entity_p.h @@ -55,7 +55,6 @@ #include #include #include -#include #include #include #include @@ -306,7 +305,7 @@ class Q_AUTOTEST_EXPORT RenderEntityFunctor : public Qt3DCore::QBackendNodeMappe { public: explicit RenderEntityFunctor(AbstractRenderer *renderer, NodeManagers *manager); - Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const override; + Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const override; Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const override; void destroy(Qt3DCore::QNodeId id) const override; diff --git a/src/render/backend/nodefunctor_p.h b/src/render/backend/nodefunctor_p.h index 2c479639f..06e730449 100644 --- a/src/render/backend/nodefunctor_p.h +++ b/src/render/backend/nodefunctor_p.h @@ -72,9 +72,9 @@ public: { } - Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const final + Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const final { - Backend *backend = m_manager->getOrCreateResource(change->subjectId()); + Backend *backend = m_manager->getOrCreateResource(id); backend->setRenderer(m_renderer); return backend; } diff --git a/src/render/backend/rendersettings.cpp b/src/render/backend/rendersettings.cpp index 3af617bfc..c1948d4b1 100644 --- a/src/render/backend/rendersettings.cpp +++ b/src/render/backend/rendersettings.cpp @@ -109,9 +109,8 @@ RenderSettingsFunctor::RenderSettingsFunctor(AbstractRenderer *renderer) { } -Qt3DCore::QBackendNode *RenderSettingsFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const +Qt3DCore::QBackendNode *RenderSettingsFunctor::create(Qt3DCore::QNodeId) const { - Q_UNUSED(change) if (m_renderer->settings() != nullptr) { qWarning() << "Renderer settings already exists"; return nullptr; diff --git a/src/render/backend/rendersettings_p.h b/src/render/backend/rendersettings_p.h index af1ee58ec..fbee23b3a 100644 --- a/src/render/backend/rendersettings_p.h +++ b/src/render/backend/rendersettings_p.h @@ -94,7 +94,7 @@ class RenderSettingsFunctor : public Qt3DCore::QBackendNodeMapper { public: explicit RenderSettingsFunctor(AbstractRenderer *renderer); - Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const override; + Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const override; Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const override; void destroy(Qt3DCore::QNodeId id) const override; diff --git a/src/render/framegraph/framegraph.pri b/src/render/framegraph/framegraph.pri index a622bd281..61a75cae0 100644 --- a/src/render/framegraph/framegraph.pri +++ b/src/render/framegraph/framegraph.pri @@ -48,8 +48,6 @@ HEADERS += \ $$PWD/qbuffercapture.h \ $$PWD/qbuffercapture_p.h \ $$PWD/buffercapture_p.h \ - $$PWD/qframegraphnodecreatedchange.h \ - $$PWD/qframegraphnodecreatedchange_p.h \ $$PWD/qmemorybarrier.h \ $$PWD/qmemorybarrier_p.h \ $$PWD/memorybarrier_p.h \ @@ -108,7 +106,6 @@ SOURCES += \ $$PWD/rendercapture.cpp \ $$PWD/qbuffercapture.cpp \ $$PWD/buffercapture.cpp \ - $$PWD/qframegraphnodecreatedchange.cpp \ $$PWD/qmemorybarrier.cpp \ $$PWD/memorybarrier.cpp \ $$PWD/qproximityfilter.cpp \ diff --git a/src/render/framegraph/framegraphnode.cpp b/src/render/framegraph/framegraphnode.cpp index 92116af7d..9f58f5899 100644 --- a/src/render/framegraph/framegraphnode.cpp +++ b/src/render/framegraph/framegraphnode.cpp @@ -40,7 +40,6 @@ #include "framegraphnode_p.h" #include #include -#include QT_BEGIN_NAMESPACE diff --git a/src/render/framegraph/framegraphnode_p.h b/src/render/framegraph/framegraphnode_p.h index 92d7ae2f1..de0969786 100644 --- a/src/render/framegraph/framegraphnode_p.h +++ b/src/render/framegraph/framegraphnode_p.h @@ -146,9 +146,9 @@ public: { } - Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const override + Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const override { - return createBackendFrameGraphNode(change); + return createBackendFrameGraphNode(id); } Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const override @@ -162,16 +162,16 @@ public: } protected: - Backend *createBackendFrameGraphNode(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const + Backend *createBackendFrameGraphNode(const Qt3DCore::QNodeId &id) const { - if (!m_manager->containsNode(change->subjectId())) { + if (!m_manager->containsNode(id)) { Backend *backend = new Backend(); backend->setFrameGraphManager(m_manager); backend->setRenderer(m_renderer); - m_manager->appendNode(change->subjectId(), backend); + m_manager->appendNode(id, backend); return backend; } - return static_cast(m_manager->lookupNode(change->subjectId())); + return static_cast(m_manager->lookupNode(id)); } private: diff --git a/src/render/framegraph/qblitframebuffer.cpp b/src/render/framegraph/qblitframebuffer.cpp index 252758af4..356b2db06 100644 --- a/src/render/framegraph/qblitframebuffer.cpp +++ b/src/render/framegraph/qblitframebuffer.cpp @@ -40,8 +40,6 @@ #include "qblitframebuffer.h" #include "qblitframebuffer_p.h" -#include - QT_BEGIN_NAMESPACE namespace Qt3DRender { @@ -434,25 +432,6 @@ void QBlitFramebuffer::setInterpolationMethod(QBlitFramebuffer::InterpolationMet } } -/*! - \internal - */ -Qt3DCore::QNodeCreatedChangeBasePtr QBlitFramebuffer::createNodeCreationChange() const -{ - auto creationChange = QFrameGraphNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QBlitFramebuffer); - data.m_sourceRect = d->m_sourceRect; - data.m_destinationRect = d->m_destinationRect; - data.m_sourceRenderTargetId = Qt3DCore::qIdForNode(d->m_source); - data.m_destinationRenderTargetId = Qt3DCore::qIdForNode(d->m_destination); - data.m_sourceAttachmentPoint = d->m_sourceAttachmentPoint; - data.m_destinationAttachmentPoint = d->m_destinationAttachmentPoint; - data.m_interpolationMethod = d->m_interpolationMethod; - - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/framegraph/qblitframebuffer.h b/src/render/framegraph/qblitframebuffer.h index 79c216d24..22c422928 100644 --- a/src/render/framegraph/qblitframebuffer.h +++ b/src/render/framegraph/qblitframebuffer.h @@ -101,7 +101,6 @@ protected: private: Q_DECLARE_PRIVATE(QBlitFramebuffer) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/framegraph/qbuffercapture.cpp b/src/render/framegraph/qbuffercapture.cpp index 3eaa5dfd2..49b923534 100644 --- a/src/render/framegraph/qbuffercapture.cpp +++ b/src/render/framegraph/qbuffercapture.cpp @@ -39,8 +39,6 @@ #include #include -#include -#include QT_BEGIN_NAMESPACE diff --git a/src/render/framegraph/qcameraselector.cpp b/src/render/framegraph/qcameraselector.cpp index af293dc56..f9deba592 100644 --- a/src/render/framegraph/qcameraselector.cpp +++ b/src/render/framegraph/qcameraselector.cpp @@ -41,7 +41,6 @@ #include "qcameraselector_p.h" #include #include -#include QT_BEGIN_NAMESPACE @@ -139,15 +138,6 @@ Qt3DCore::QEntity *QCameraSelector::camera() const return d->m_camera; } -Qt3DCore::QNodeCreatedChangeBasePtr QCameraSelector::createNodeCreationChange() const -{ - auto creationChange = QFrameGraphNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QCameraSelector); - data.cameraId = qIdForNode(d->m_camera); - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/framegraph/qcameraselector.h b/src/render/framegraph/qcameraselector.h index 861948d94..61d730f57 100644 --- a/src/render/framegraph/qcameraselector.h +++ b/src/render/framegraph/qcameraselector.h @@ -71,7 +71,6 @@ protected: private: Q_DECLARE_PRIVATE(QCameraSelector) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/framegraph/qclearbuffers.cpp b/src/render/framegraph/qclearbuffers.cpp index 31a31420c..177f6f097 100644 --- a/src/render/framegraph/qclearbuffers.cpp +++ b/src/render/framegraph/qclearbuffers.cpp @@ -39,7 +39,6 @@ #include "qclearbuffers.h" #include "qclearbuffers_p.h" -#include QT_BEGIN_NAMESPACE @@ -232,19 +231,6 @@ void QClearBuffers::setColorBuffer(QRenderTargetOutput *buffer) } } -Qt3DCore::QNodeCreatedChangeBasePtr QClearBuffers::createNodeCreationChange() const -{ - auto creationChange = QFrameGraphNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QClearBuffers); - data.buffersType = d->m_buffersType; - data.clearColor = d->m_clearColor; - data.clearDepthValue = d->m_clearDepthValue; - data.clearStencilValue = d->m_clearStencilValue; - data.bufferId = Qt3DCore::qIdForNode(d->m_buffer); - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/framegraph/qclearbuffers.h b/src/render/framegraph/qclearbuffers.h index 441a83e78..ed6c441bc 100644 --- a/src/render/framegraph/qclearbuffers.h +++ b/src/render/framegraph/qclearbuffers.h @@ -102,7 +102,6 @@ protected: private: Q_DECLARE_PRIVATE(QClearBuffers) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/framegraph/qdispatchcompute.cpp b/src/render/framegraph/qdispatchcompute.cpp index 6e018d8ef..f9d1df621 100644 --- a/src/render/framegraph/qdispatchcompute.cpp +++ b/src/render/framegraph/qdispatchcompute.cpp @@ -39,7 +39,6 @@ #include "qdispatchcompute.h" #include "qdispatchcompute_p.h" -#include QT_BEGIN_NAMESPACE @@ -162,17 +161,6 @@ void QDispatchCompute::setWorkGroupZ(int workGroupZ) } -Qt3DCore::QNodeCreatedChangeBasePtr QDispatchCompute::createNodeCreationChange() const -{ - auto creationChange = QFrameGraphNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QDispatchCompute); - data.workGroupX = d->m_workGroupX; - data.workGroupY = d->m_workGroupY; - data.workGroupZ = d->m_workGroupZ; - return creationChange; -} - } // Qt3DRender QT_END_NAMESPACE diff --git a/src/render/framegraph/qdispatchcompute.h b/src/render/framegraph/qdispatchcompute.h index dd6efb3ec..96a5f1796 100644 --- a/src/render/framegraph/qdispatchcompute.h +++ b/src/render/framegraph/qdispatchcompute.h @@ -75,7 +75,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QDispatchCompute) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // Qt3DRender diff --git a/src/render/framegraph/qframegraphnode.cpp b/src/render/framegraph/qframegraphnode.cpp index f49f6433a..797e24324 100644 --- a/src/render/framegraph/qframegraphnode.cpp +++ b/src/render/framegraph/qframegraphnode.cpp @@ -39,7 +39,6 @@ #include "qframegraphnode.h" #include "qframegraphnode_p.h" -#include #include @@ -305,15 +304,6 @@ QFrameGraphNode::QFrameGraphNode(QFrameGraphNodePrivate &dd, QNode *parent) { } -Qt3DCore::QNodeCreatedChangeBasePtr QFrameGraphNode::createNodeCreationChange() const -{ - // connect to the parentChanged signal here rather than constructor because - // until now there's no backend node to notify when parent changes - connect(this, &QNode::parentChanged, this, &QFrameGraphNode::onParentChanged); - - return QFrameGraphNodeCreatedChangeBasePtr::create(this); -} - void QFrameGraphNode::onParentChanged(QObject *) { // Direct sync update request diff --git a/src/render/framegraph/qframegraphnode.h b/src/render/framegraph/qframegraphnode.h index 826f01a1e..647d36764 100644 --- a/src/render/framegraph/qframegraphnode.h +++ b/src/render/framegraph/qframegraphnode.h @@ -61,7 +61,6 @@ public: protected: explicit QFrameGraphNode(QFrameGraphNodePrivate &dd, Qt3DCore::QNode *parent = nullptr); - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; private Q_SLOTS: void onParentChanged(QObject *); diff --git a/src/render/framegraph/qframegraphnodecreatedchange.cpp b/src/render/framegraph/qframegraphnodecreatedchange.cpp deleted file mode 100644 index 464c98bc3..000000000 --- a/src/render/framegraph/qframegraphnodecreatedchange.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qframegraphnodecreatedchange.h" -#include "qframegraphnodecreatedchange_p.h" - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { - -QFrameGraphNodeCreatedChangeBasePrivate::QFrameGraphNodeCreatedChangeBasePrivate(const QFrameGraphNode *node) - : Qt3DCore::QNodeCreatedChangeBasePrivate(node) - , m_parentFrameGraphNodeId(Qt3DCore::qIdForNode(node->parentFrameGraphNode())) - , m_childFrameGraphNodeIds(Qt3DCore::qIdsForNodes(QFrameGraphNodePrivate::get(node)->childFrameGraphNodes())) -{ -} - -/*! - \class Qt3DRender::QFrameGraphNodeCreatedChangeBase - \inmodule Qt3DRender - - \brief A base class for changes in the FrameGraphNode. -*/ -QFrameGraphNodeCreatedChangeBase::QFrameGraphNodeCreatedChangeBase(const QFrameGraphNode *node) - : Qt3DCore::QNodeCreatedChangeBase(*new QFrameGraphNodeCreatedChangeBasePrivate(node), node) -{ -} - -/*! \internal */ -QFrameGraphNodeCreatedChangeBase::~QFrameGraphNodeCreatedChangeBase() -{ -} - -Qt3DCore::QNodeId QFrameGraphNodeCreatedChangeBase::parentFrameGraphNodeId() const -{ - Q_D(const QFrameGraphNodeCreatedChangeBase); - return d->m_parentFrameGraphNodeId; -} - -} // Qt3DRender - -QT_END_NAMESPACE diff --git a/src/render/framegraph/qframegraphnodecreatedchange.h b/src/render/framegraph/qframegraphnodecreatedchange.h deleted file mode 100644 index 96ca0fb38..000000000 --- a/src/render/framegraph/qframegraphnodecreatedchange.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DRENDER_RENDER_QFRAMEGRAPHNODECREATEDCHANGE_H -#define QT3DRENDER_RENDER_QFRAMEGRAPHNODECREATEDCHANGE_H - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { - -class QFrameGraphNode; -class QFrameGraphNodeCreatedChangeBasePrivate; - -class Q_3DRENDERSHARED_EXPORT QFrameGraphNodeCreatedChangeBase : public Qt3DCore::QNodeCreatedChangeBase -{ -public: - explicit QFrameGraphNodeCreatedChangeBase(const QFrameGraphNode *node); - ~QFrameGraphNodeCreatedChangeBase(); - - Qt3DCore::QNodeId parentFrameGraphNodeId() const; - -private: - Q_DECLARE_PRIVATE(QFrameGraphNodeCreatedChangeBase) -}; - -typedef QSharedPointer QFrameGraphNodeCreatedChangeBasePtr; - -template -class QFrameGraphNodeCreatedChange : public QFrameGraphNodeCreatedChangeBase -{ -public: - explicit QFrameGraphNodeCreatedChange(const QFrameGraphNode *node) - : QFrameGraphNodeCreatedChangeBase(node) - , data() - { - } - - T data; -}; - -template -using QFrameGraphNodeCreatedChangePtr = QSharedPointer>; - -} // Qt3DRender - -QT_END_NAMESPACE - -#endif // QT3DRENDER_RENDER_QFRAMEGRAPHNODECREATEDCHANGE_H diff --git a/src/render/framegraph/qframegraphnodecreatedchange_p.h b/src/render/framegraph/qframegraphnodecreatedchange_p.h deleted file mode 100644 index c0437afc5..000000000 --- a/src/render/framegraph/qframegraphnodecreatedchange_p.h +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DRENDER_RENDER_QFRAMEGRAPHNODECREATEDCHANGE_P_H -#define QT3DRENDER_RENDER_QFRAMEGRAPHNODECREATEDCHANGE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { - -class QFrameGraphNode; - -class QFrameGraphNodeCreatedChangeBasePrivate : public Qt3DCore::QNodeCreatedChangeBasePrivate -{ -public: - QFrameGraphNodeCreatedChangeBasePrivate(const QFrameGraphNode *node); - - Qt3DCore::QNodeId m_parentFrameGraphNodeId; - Qt3DCore::QNodeIdVector m_childFrameGraphNodeIds; - - static QFrameGraphNodeCreatedChangeBasePrivate *get(QFrameGraphNodeCreatedChangeBase *change) - { - return change->d_func(); - } - static const QFrameGraphNodeCreatedChangeBasePrivate *get(const QFrameGraphNodeCreatedChangeBase *change) - { - return change->d_func(); - } -}; - -} // Qt3DRender - -QT_END_NAMESPACE - -#endif // QT3DRENDER_RENDER_QFRAMEGRAPHNODECREATEDCHANGE_P_H diff --git a/src/render/framegraph/qlayerfilter.cpp b/src/render/framegraph/qlayerfilter.cpp index 8bad46f5d..50f3eb429 100644 --- a/src/render/framegraph/qlayerfilter.cpp +++ b/src/render/framegraph/qlayerfilter.cpp @@ -40,7 +40,6 @@ #include "qlayerfilter.h" #include "qlayerfilter_p.h" #include "qlayer.h" -#include QT_BEGIN_NAMESPACE @@ -203,7 +202,7 @@ void QLayerFilter::addLayer(QLayer *layer) if (!layer->parent()) layer->setParent(this); - d->updateNode(layer, "layer", Qt3DCore::PropertyValueAdded); + d->update(); } } @@ -214,7 +213,7 @@ void QLayerFilter::removeLayer(QLayer *layer) { Q_ASSERT(layer); Q_D(QLayerFilter); - d->updateNode(layer, "layer", Qt3DCore::PropertyValueRemoved); + d->update(); d->m_layers.removeOne(layer); // Remove bookkeeping connection d->unregisterDestructionHelper(layer); @@ -244,16 +243,6 @@ void QLayerFilter::setFilterMode(QLayerFilter::FilterMode filterMode) } } -Qt3DCore::QNodeCreatedChangeBasePtr QLayerFilter::createNodeCreationChange() const -{ - auto creationChange = QFrameGraphNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QLayerFilter); - data.layerIds = qIdsForNodes(d->m_layers); - data.filterMode = d->m_filterMode; - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/framegraph/qlayerfilter.h b/src/render/framegraph/qlayerfilter.h index dd628e74e..f430814d5 100644 --- a/src/render/framegraph/qlayerfilter.h +++ b/src/render/framegraph/qlayerfilter.h @@ -83,7 +83,6 @@ protected: private: Q_DECLARE_PRIVATE(QLayerFilter) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/framegraph/qmemorybarrier.cpp b/src/render/framegraph/qmemorybarrier.cpp index 5da462f1b..1b44fac79 100644 --- a/src/render/framegraph/qmemorybarrier.cpp +++ b/src/render/framegraph/qmemorybarrier.cpp @@ -39,7 +39,6 @@ #include "qmemorybarrier.h" #include "qmemorybarrier_p.h" -#include QT_BEGIN_NAMESPACE @@ -155,16 +154,6 @@ QMemoryBarrier::QMemoryBarrier(QMemoryBarrierPrivate &dd, Qt3DCore::QNode *paren { } -Qt3DCore::QNodeCreatedChangeBasePtr QMemoryBarrier::createNodeCreationChange() const -{ - auto creationChange = QFrameGraphNodeCreatedChangePtr::create(this); - QMemoryBarrierData &data = creationChange->data; - Q_D(const QMemoryBarrier); - data.waitOperations = d->m_waitOperations; - return creationChange; -} - - } // Qt3DRender QT_END_NAMESPACE diff --git a/src/render/framegraph/qmemorybarrier.h b/src/render/framegraph/qmemorybarrier.h index 29b439700..518b007ab 100644 --- a/src/render/framegraph/qmemorybarrier.h +++ b/src/render/framegraph/qmemorybarrier.h @@ -89,7 +89,6 @@ protected: private: Q_DECLARE_PRIVATE(QMemoryBarrier) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // Qt3DRender diff --git a/src/render/framegraph/qproximityfilter.cpp b/src/render/framegraph/qproximityfilter.cpp index cd1ecf776..6836956a4 100644 --- a/src/render/framegraph/qproximityfilter.cpp +++ b/src/render/framegraph/qproximityfilter.cpp @@ -40,7 +40,6 @@ #include "qproximityfilter.h" #include "qproximityfilter_p.h" #include -#include QT_BEGIN_NAMESPACE @@ -181,16 +180,6 @@ void QProximityFilter::setDistanceThreshold(float distanceThreshold) emit distanceThresholdChanged(distanceThreshold); } -Qt3DCore::QNodeCreatedChangeBasePtr QProximityFilter::createNodeCreationChange() const -{ - auto creationChange = QFrameGraphNodeCreatedChangePtr::create(this); - QProximityFilterData &data = creationChange->data; - Q_D(const QProximityFilter); - data.entityId = Qt3DCore::qIdForNode(d->m_entity); - data.distanceThreshold = d->m_distanceThreshold; - return creationChange; -} - } // Qt3DRender QT_END_NAMESPACE diff --git a/src/render/framegraph/qproximityfilter.h b/src/render/framegraph/qproximityfilter.h index 56bcd6eaf..56b48c46f 100644 --- a/src/render/framegraph/qproximityfilter.h +++ b/src/render/framegraph/qproximityfilter.h @@ -74,7 +74,6 @@ protected: private: Q_DECLARE_PRIVATE(QProximityFilter) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/framegraph/qrendercapture.cpp b/src/render/framegraph/qrendercapture.cpp index a10083374..12afbeee8 100644 --- a/src/render/framegraph/qrendercapture.cpp +++ b/src/render/framegraph/qrendercapture.cpp @@ -36,9 +36,6 @@ #include #include -#include -#include -#include #include #include @@ -119,17 +116,6 @@ namespace Qt3DRender { * \since 5.9 */ -#if QT_DEPRECATED_SINCE(5, 9) -/*! - * \qmlmethod void Qt3D.Render::RenderCaptureReply::saveToFile(fileName) - * \deprecated - * - * Saves the render capture result as an image to \a fileName. - * - * Deprecated in 5.9. Use saveImage(). - */ -#endif - /*! * \qmlmethod RenderCaptureReply Qt3D.Render::RenderCapture::requestCapture(int captureId) * \deprecated @@ -228,21 +214,6 @@ bool QRenderCaptureReply::saveImage(const QString &fileName) const return false; } -#if QT_DEPRECATED_SINCE(5, 9) -/*! - * \deprecated - * Saves the render capture result as an image to \a fileName. - * - * Deprecated in 5.9. Use saveImage(). - */ -void QRenderCaptureReply::saveToFile(const QString &fileName) const -{ - Q_D(const QRenderCaptureReply); - if (d->m_complete) - d->m_image.save(fileName); -} -#endif - /*! * \internal */ @@ -373,41 +344,6 @@ Qt3DRender::QRenderCaptureReply *QRenderCapture::requestCapture() return requestCapture(QRect()); } -/*! - * \internal - */ -void QRenderCapture::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) -{ - Q_D(QRenderCapture); - Qt3DCore::QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast(change); - if (propertyChange->type() == Qt3DCore::PropertyUpdated) { - if (propertyChange->propertyName() == QByteArrayLiteral("renderCaptureData")) { - RenderCaptureDataPtr data = propertyChange->value().value(); - QPointer reply = d->takeReply(data.data()->captureId); - if (reply) { - d->setImage(reply, data.data()->image); - emit reply->completed(); -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED - if (reply) - emit reply->completeChanged(true); -QT_WARNING_POP - } - } - } -} - -/*! - * \internal - */ -Qt3DCore::QNodeCreatedChangeBasePtr QRenderCapture::createNodeCreationChange() const -{ - auto creationChange = QFrameGraphNodeCreatedChangePtr::create(this); - QRenderCaptureInitData &data = creationChange->data; - data.captureId = 0; - return creationChange; -} - } // Qt3DRender QT_END_NAMESPACE diff --git a/src/render/framegraph/qrendercapture.h b/src/render/framegraph/qrendercapture.h index 8fa5d0455..890dfd409 100644 --- a/src/render/framegraph/qrendercapture.h +++ b/src/render/framegraph/qrendercapture.h @@ -61,13 +61,8 @@ public: bool isComplete() const; Q_INVOKABLE bool saveImage(const QString &fileName) const; -#if QT_DEPRECATED_SINCE(5, 9) - // ### Qt 6: remove this - Q_DECL_DEPRECATED_X("Use saveImage instead") Q_INVOKABLE void saveToFile(const QString &fileName) const; -#endif Q_SIGNALS: - Q_DECL_DEPRECATED_X("Use completed instead") void completeChanged(bool isComplete); void completed(); private: @@ -84,17 +79,12 @@ class Q_3DRENDERSHARED_EXPORT QRenderCapture : public QFrameGraphNode public: explicit QRenderCapture(Qt3DCore::QNode *parent = nullptr); - Q_INVOKABLE Q_DECL_DEPRECATED_X("Use the overload with no id parameter") Qt3DRender::QRenderCaptureReply *requestCapture(int captureId); Q_REVISION(9) Q_INVOKABLE Qt3DRender::QRenderCaptureReply *requestCapture(); Q_REVISION(10) Q_INVOKABLE Qt3DRender::QRenderCaptureReply *requestCapture(const QRect &rect); -protected: - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; - private: Q_DECLARE_PRIVATE(QRenderCapture) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // Qt3DRender diff --git a/src/render/framegraph/qrenderpassfilter.cpp b/src/render/framegraph/qrenderpassfilter.cpp index 952657eb6..dc6cefd00 100644 --- a/src/render/framegraph/qrenderpassfilter.cpp +++ b/src/render/framegraph/qrenderpassfilter.cpp @@ -42,7 +42,6 @@ #include #include -#include QT_BEGIN_NAMESPACE @@ -139,7 +138,7 @@ void QRenderPassFilter::addMatch(QFilterKey *filterKey) if (!filterKey->parent()) filterKey->setParent(this); - d->updateNode(filterKey, "match", Qt3DCore::PropertyValueAdded); + d->update(); } } @@ -151,7 +150,7 @@ void QRenderPassFilter::removeMatch(QFilterKey *filterKey) Q_ASSERT(filterKey); Q_D(QRenderPassFilter); - d->updateNode(filterKey, "match", Qt3DCore::PropertyValueRemoved); + d->update(); d->m_matchList.removeOne(filterKey); // Remove bookkeeping connection d->unregisterDestructionHelper(filterKey); @@ -177,7 +176,7 @@ void QRenderPassFilter::addParameter(QParameter *parameter) if (!parameter->parent()) parameter->setParent(this); - d->updateNode(parameter, "parameter", Qt3DCore::PropertyValueAdded); + d->update(); } } @@ -189,7 +188,7 @@ void QRenderPassFilter::removeParameter(QParameter *parameter) Q_ASSERT(parameter); Q_D(QRenderPassFilter); - d->updateNode(parameter, "parameter", Qt3DCore::PropertyValueRemoved); + d->update(); d->m_parameters.removeOne(parameter); // Remove bookkeeping connection d->unregisterDestructionHelper(parameter); @@ -204,16 +203,6 @@ QVector QRenderPassFilter::parameters() const return d->m_parameters; } -Qt3DCore::QNodeCreatedChangeBasePtr QRenderPassFilter::createNodeCreationChange() const -{ - auto creationChange = QFrameGraphNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QRenderPassFilter); - data.matchIds = qIdsForNodes(d->m_matchList); - data.parameterIds = qIdsForNodes(d->m_parameters); - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/framegraph/qrenderpassfilter.h b/src/render/framegraph/qrenderpassfilter.h index 9fb11757f..49a9e1d3e 100644 --- a/src/render/framegraph/qrenderpassfilter.h +++ b/src/render/framegraph/qrenderpassfilter.h @@ -74,7 +74,6 @@ protected: private: Q_DECLARE_PRIVATE(QRenderPassFilter) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/framegraph/qrenderstateset.cpp b/src/render/framegraph/qrenderstateset.cpp index 5341b3c7d..2b701e67e 100644 --- a/src/render/framegraph/qrenderstateset.cpp +++ b/src/render/framegraph/qrenderstateset.cpp @@ -41,7 +41,6 @@ #include "qrenderstateset_p.h" #include -#include QT_BEGIN_NAMESPACE @@ -191,7 +190,7 @@ void QRenderStateSet::addRenderState(QRenderState *state) if (!state->parent()) state->setParent(this); - d->updateNode(state, "renderState", Qt3DCore::PropertyValueAdded); + d->update(); } } @@ -203,7 +202,7 @@ void QRenderStateSet::removeRenderState(QRenderState *state) Q_ASSERT(state); Q_D(QRenderStateSet); - d->updateNode(state, "renderState", Qt3DCore::PropertyValueRemoved); + d->update(); d->m_renderStates.removeOne(state); // Remove bookkeeping connection d->unregisterDestructionHelper(state); @@ -218,15 +217,6 @@ QVector QRenderStateSet::renderStates() const return d->m_renderStates; } -Qt3DCore::QNodeCreatedChangeBasePtr QRenderStateSet::createNodeCreationChange() const -{ - auto creationChange = QFrameGraphNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QRenderStateSet); - data.renderStateIds = qIdsForNodes(d->m_renderStates); - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/framegraph/qrenderstateset.h b/src/render/framegraph/qrenderstateset.h index b08da1ff5..cf4c0cdd5 100644 --- a/src/render/framegraph/qrenderstateset.h +++ b/src/render/framegraph/qrenderstateset.h @@ -66,7 +66,6 @@ protected: private: Q_DECLARE_PRIVATE(QRenderStateSet) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/framegraph/qrendersurfaceselector.cpp b/src/render/framegraph/qrendersurfaceselector.cpp index df30663cb..3b8eb0ae8 100644 --- a/src/render/framegraph/qrendersurfaceselector.cpp +++ b/src/render/framegraph/qrendersurfaceselector.cpp @@ -45,7 +45,6 @@ #include #include #include -#include QT_BEGIN_NAMESPACE @@ -315,17 +314,6 @@ void QRenderSurfaceSelector::setExternalRenderTargetSize(const QSize &size) } } -Qt3DCore::QNodeCreatedChangeBasePtr QRenderSurfaceSelector::createNodeCreationChange() const -{ - auto creationChange = QFrameGraphNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QRenderSurfaceSelector); - data.surface = QPointer(surface()); - data.externalRenderTargetSize = d->m_externalRenderTargetSize; - data.surfacePixelRatio = d->m_surfacePixelRatio; - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/framegraph/qrendersurfaceselector.h b/src/render/framegraph/qrendersurfaceselector.h index 73d513311..8af7e1d5a 100644 --- a/src/render/framegraph/qrendersurfaceselector.h +++ b/src/render/framegraph/qrendersurfaceselector.h @@ -81,9 +81,6 @@ Q_SIGNALS: protected: Q_DECLARE_PRIVATE(QRenderSurfaceSelector) explicit QRenderSurfaceSelector(QRenderSurfaceSelectorPrivate &dd, Qt3DCore::QNode *parent = nullptr); - -private: - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/framegraph/qrendertargetselector.cpp b/src/render/framegraph/qrendertargetselector.cpp index c997c23cc..b2c8468f2 100644 --- a/src/render/framegraph/qrendertargetselector.cpp +++ b/src/render/framegraph/qrendertargetselector.cpp @@ -41,7 +41,6 @@ #include "qrendertargetselector_p.h" #include #include -#include QT_BEGIN_NAMESPACE @@ -171,16 +170,6 @@ QRenderTargetSelector::QRenderTargetSelector(QRenderTargetSelectorPrivate &dd, Q { } -Qt3DCore::QNodeCreatedChangeBasePtr QRenderTargetSelector::createNodeCreationChange() const -{ - auto creationChange = QFrameGraphNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QRenderTargetSelector); - data.targetId = qIdForNode(d->m_target); - data.outputs = d->m_outputs; - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/framegraph/qrendertargetselector.h b/src/render/framegraph/qrendertargetselector.h index c6b7b641d..cb6c679ff 100644 --- a/src/render/framegraph/qrendertargetselector.h +++ b/src/render/framegraph/qrendertargetselector.h @@ -76,7 +76,6 @@ protected: private: Q_DECLARE_PRIVATE(QRenderTargetSelector) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/framegraph/qsetfence.cpp b/src/render/framegraph/qsetfence.cpp index 262dbd4ad..ae25ba80f 100644 --- a/src/render/framegraph/qsetfence.cpp +++ b/src/render/framegraph/qsetfence.cpp @@ -39,8 +39,6 @@ #include "qsetfence.h" #include "qsetfence_p.h" -#include -#include QT_BEGIN_NAMESPACE @@ -150,26 +148,6 @@ void QSetFencePrivate::setHandle(QVariant handle) } } -void QSetFence::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) -{ - Qt3DCore::QPropertyUpdatedChangePtr e = qSharedPointerCast(change); - if (e->type() == Qt3DCore::PropertyUpdated) { - Q_D(QSetFence); - if (e->propertyName() == QByteArrayLiteral("handle")) - d->setHandle(e->value()); - else if (e->propertyName() == QByteArrayLiteral("handleType")) - d->setHandleType(static_cast(e->value().toInt())); - } -} - -Qt3DCore::QNodeCreatedChangeBasePtr QSetFence::createNodeCreationChange() const -{ - auto creationChange = QFrameGraphNodeCreatedChangePtr::create(this); - QSetFenceData &data = creationChange->data; - Q_UNUSED(data); // Might be of use later - return creationChange; -} - } // Qt3DRender QT_END_NAMESPACE diff --git a/src/render/framegraph/qsetfence.h b/src/render/framegraph/qsetfence.h index 4ad92ae52..8747a0e02 100644 --- a/src/render/framegraph/qsetfence.h +++ b/src/render/framegraph/qsetfence.h @@ -72,11 +72,9 @@ Q_SIGNALS: protected: explicit QSetFence(QSetFencePrivate &dd, Qt3DCore::QNode *parent = nullptr); - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; private: Q_DECLARE_PRIVATE(QSetFence) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // Qt3DRender diff --git a/src/render/framegraph/qsetfence_p.h b/src/render/framegraph/qsetfence_p.h index 026afffa5..2a929bde6 100644 --- a/src/render/framegraph/qsetfence_p.h +++ b/src/render/framegraph/qsetfence_p.h @@ -53,12 +53,13 @@ #include #include +#include QT_BEGIN_NAMESPACE namespace Qt3DRender { -class QSetFencePrivate : public QFrameGraphNodePrivate +class Q_3DRENDERSHARED_PRIVATE_EXPORT QSetFencePrivate : public QFrameGraphNodePrivate { public: QSetFencePrivate(); diff --git a/src/render/framegraph/qsortpolicy.cpp b/src/render/framegraph/qsortpolicy.cpp index 5c04025b0..a107f1906 100644 --- a/src/render/framegraph/qsortpolicy.cpp +++ b/src/render/framegraph/qsortpolicy.cpp @@ -38,9 +38,6 @@ ****************************************************************************/ #include "qsortpolicy_p.h" -#include -#include -#include QT_BEGIN_NAMESPACE @@ -152,15 +149,6 @@ QSortPolicy::QSortPolicy(QSortPolicyPrivate &dd, QNode *parent) { } -QNodeCreatedChangeBasePtr QSortPolicy::createNodeCreationChange() const -{ - auto creationChange = QFrameGraphNodeCreatedChangePtr::create(this); - QSortPolicyData &data = creationChange->data; - Q_D(const QSortPolicy); - data.sortTypes = d->m_sortTypes; - return creationChange; -} - /*! \return the current sort types in use */ diff --git a/src/render/framegraph/qsortpolicy.h b/src/render/framegraph/qsortpolicy.h index f5ea988e8..5cd1ef7e2 100644 --- a/src/render/framegraph/qsortpolicy.h +++ b/src/render/framegraph/qsortpolicy.h @@ -82,7 +82,6 @@ protected: private: Q_DECLARE_PRIVATE(QSortPolicy) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/framegraph/qsubtreeenabler.cpp b/src/render/framegraph/qsubtreeenabler.cpp index e5d182d00..d37cc37e8 100644 --- a/src/render/framegraph/qsubtreeenabler.cpp +++ b/src/render/framegraph/qsubtreeenabler.cpp @@ -38,7 +38,6 @@ ****************************************************************************/ #include "qsubtreeenabler_p.h" -#include QT_BEGIN_NAMESPACE @@ -171,15 +170,6 @@ void QSubtreeEnabler::requestUpdate() setEnabled(true); } -Qt3DCore::QNodeCreatedChangeBasePtr QSubtreeEnabler::createNodeCreationChange() const -{ - auto creationChange = QFrameGraphNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QSubtreeEnabler); - data.enablement = d->m_enablement; - return creationChange; -} - } //Qt3DRender QT_END_NAMESPACE diff --git a/src/render/framegraph/qsubtreeenabler.h b/src/render/framegraph/qsubtreeenabler.h index 558e3b8b7..a34bb7aa8 100644 --- a/src/render/framegraph/qsubtreeenabler.h +++ b/src/render/framegraph/qsubtreeenabler.h @@ -73,7 +73,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QSubtreeEnabler) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } //Qt3DRender diff --git a/src/render/framegraph/qtechniquefilter.cpp b/src/render/framegraph/qtechniquefilter.cpp index c22e83381..d00d04da9 100644 --- a/src/render/framegraph/qtechniquefilter.cpp +++ b/src/render/framegraph/qtechniquefilter.cpp @@ -41,7 +41,6 @@ #include "qtechniquefilter_p.h" #include #include -#include QT_BEGIN_NAMESPACE @@ -144,7 +143,7 @@ void QTechniqueFilter::addMatch(QFilterKey *filterKey) if (!filterKey->parent()) filterKey->setParent(this); - d->updateNode(filterKey, "matchAll", Qt3DCore::PropertyValueAdded); + d->update(); } } @@ -155,7 +154,7 @@ void QTechniqueFilter::removeMatch(QFilterKey *filterKey) { Q_ASSERT(filterKey); Q_D(QTechniqueFilter); - d->updateNode(filterKey, "matchAll", Qt3DCore::PropertyValueRemoved); + d->update(); d->m_matchList.removeOne(filterKey); // Remove bookkeeping connection d->unregisterDestructionHelper(filterKey); @@ -181,7 +180,7 @@ void QTechniqueFilter::addParameter(QParameter *parameter) if (!parameter->parent()) parameter->setParent(this); - d->updateNode(parameter, "parameter", Qt3DCore::PropertyValueAdded); + d->update(); } } @@ -192,7 +191,7 @@ void QTechniqueFilter::removeParameter(QParameter *parameter) { Q_ASSERT(parameter); Q_D(QTechniqueFilter); - d->updateNode(parameter, "parameter", Qt3DCore::PropertyValueRemoved); + d->update(); d->m_parameters.removeOne(parameter); // Remove bookkeeping connection d->unregisterDestructionHelper(parameter); @@ -207,16 +206,6 @@ QVector QTechniqueFilter::parameters() const return d->m_parameters; } -Qt3DCore::QNodeCreatedChangeBasePtr QTechniqueFilter::createNodeCreationChange() const -{ - auto creationChange = QFrameGraphNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QTechniqueFilter); - data.matchIds = qIdsForNodes(d->m_matchList); - data.parameterIds = qIdsForNodes(d->m_parameters); - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/framegraph/qtechniquefilter.h b/src/render/framegraph/qtechniquefilter.h index 9fe872915..1cf9abcd1 100644 --- a/src/render/framegraph/qtechniquefilter.h +++ b/src/render/framegraph/qtechniquefilter.h @@ -71,7 +71,6 @@ protected: private: Q_DECLARE_PRIVATE(QTechniqueFilter) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/framegraph/qviewport.cpp b/src/render/framegraph/qviewport.cpp index 34716c5b5..fa04c647a 100644 --- a/src/render/framegraph/qviewport.cpp +++ b/src/render/framegraph/qviewport.cpp @@ -40,8 +40,6 @@ #include "qviewport.h" #include "qviewport_p.h" -#include - QT_BEGIN_NAMESPACE namespace Qt3DRender { @@ -155,16 +153,6 @@ void QViewport::setGamma(float gamma) } } -Qt3DCore::QNodeCreatedChangeBasePtr QViewport::createNodeCreationChange() const -{ - auto creationChange = QFrameGraphNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QViewport); - data.normalizedRect = d->m_normalizedRect; - data.gamma = d->m_gamma; - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/framegraph/qviewport.h b/src/render/framegraph/qviewport.h index 01830be6a..bcff1dd1b 100644 --- a/src/render/framegraph/qviewport.h +++ b/src/render/framegraph/qviewport.h @@ -76,7 +76,6 @@ protected: private: Q_DECLARE_PRIVATE(QViewport) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/framegraph/qwaitfence.cpp b/src/render/framegraph/qwaitfence.cpp index 737f4e54d..4cd1bea61 100644 --- a/src/render/framegraph/qwaitfence.cpp +++ b/src/render/framegraph/qwaitfence.cpp @@ -40,7 +40,6 @@ #include "qwaitfence.h" #include "qwaitfence_p.h" #include -#include QT_BEGIN_NAMESPACE @@ -202,18 +201,6 @@ void QWaitFence::setHandle(QVariant handle) } } -Qt3DCore::QNodeCreatedChangeBasePtr QWaitFence::createNodeCreationChange() const -{ - auto creationChange = QFrameGraphNodeCreatedChangePtr::create(this); - QWaitFenceData &data = creationChange->data; - Q_D(const QWaitFence); - data.handleType = d->m_handleType; - data.handle = d->m_handle; - data.timeout = d->m_timeout; - data.waitOnCPU = d->m_waitOnCPU; - return creationChange; -} - } // Qt3DRender QT_END_NAMESPACE diff --git a/src/render/framegraph/qwaitfence.h b/src/render/framegraph/qwaitfence.h index 8148fde7d..bae5981db 100644 --- a/src/render/framegraph/qwaitfence.h +++ b/src/render/framegraph/qwaitfence.h @@ -88,7 +88,6 @@ protected: private: Q_DECLARE_PRIVATE(QWaitFence) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // Qt3DRender diff --git a/src/render/framegraph/rendercapture.cpp b/src/render/framegraph/rendercapture.cpp index 73d8770a7..4d8ad0591 100644 --- a/src/render/framegraph/rendercapture.cpp +++ b/src/render/framegraph/rendercapture.cpp @@ -36,7 +36,6 @@ #include #include -#include #include #include @@ -115,10 +114,6 @@ void RenderCapture::syncRenderCapturesToFrontend(Qt3DCore::QAspectManager *manag if (reply) { dfrontend->setImage(reply, data.data()->image); emit reply->completed(); -QT_WARNING_PUSH -QT_WARNING_DISABLE_DEPRECATED - emit reply->completeChanged(true); -QT_WARNING_POP } } m_renderCaptureData.clear(); diff --git a/src/render/framegraph/setfence.cpp b/src/render/framegraph/setfence.cpp index e0a0d8578..b2b772cb9 100644 --- a/src/render/framegraph/setfence.cpp +++ b/src/render/framegraph/setfence.cpp @@ -38,7 +38,6 @@ ****************************************************************************/ #include "setfence_p.h" -#include QT_BEGIN_NAMESPACE @@ -55,24 +54,6 @@ SetFence::~SetFence() { } -void SetFence::setHandle(const QVariant &handle) -{ - auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId()); - change->setDeliveryFlags(Qt3DCore::QSceneChange::Nodes); - change->setPropertyName("handle"); - change->setValue(handle); - notifyObservers(change); -} - -void SetFence::setHandleType(QSetFence::HandleType type) -{ - auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId()); - change->setDeliveryFlags(Qt3DCore::QSceneChange::Nodes); - change->setPropertyName("handleType"); - change->setValue(QVariant::fromValue(type)); - notifyObservers(change); -} - } // namespace Render } // namespace Qt3DRender diff --git a/src/render/framegraph/setfence_p.h b/src/render/framegraph/setfence_p.h index 0f54d65ee..6d874e523 100644 --- a/src/render/framegraph/setfence_p.h +++ b/src/render/framegraph/setfence_p.h @@ -65,10 +65,6 @@ class Q_3DRENDERSHARED_PRIVATE_EXPORT SetFence : public FrameGraphNode public: SetFence(); ~SetFence(); - - // Called by a job - void setHandle(const QVariant &handle); - void setHandleType(QSetFence::HandleType type); }; } // namespace Render diff --git a/src/render/framegraph/statesetnode.cpp b/src/render/framegraph/statesetnode.cpp index c494c572b..b3d8a95bb 100644 --- a/src/render/framegraph/statesetnode.cpp +++ b/src/render/framegraph/statesetnode.cpp @@ -43,6 +43,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/render/frontend/qcameralens.cpp b/src/render/frontend/qcameralens.cpp index 621b22778..a7b1d8be6 100644 --- a/src/render/frontend/qcameralens.cpp +++ b/src/render/frontend/qcameralens.cpp @@ -617,20 +617,6 @@ float QCameraLens::exposure() const return d->m_exposure; } -Qt3DCore::QNodeCreatedChangeBasePtr QCameraLens::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - data.projectionMatrix = d_func()->m_projectionMatrix; - data.exposure = d_func()->m_exposure; - return creationChange; -} - -void QCameraLens::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) -{ - Q_UNUSED(change) -} - } // Qt3DRender QT_END_NAMESPACE diff --git a/src/render/frontend/qcameralens.h b/src/render/frontend/qcameralens.h index da7b426e1..bc1121a67 100644 --- a/src/render/frontend/qcameralens.h +++ b/src/render/frontend/qcameralens.h @@ -140,8 +140,6 @@ protected: private: Q_DECLARE_PRIVATE(QCameraLens) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; }; } // Qt3DRender diff --git a/src/render/frontend/qcomputecommand.cpp b/src/render/frontend/qcomputecommand.cpp index dfd9c2033..9dda7f596 100644 --- a/src/render/frontend/qcomputecommand.cpp +++ b/src/render/frontend/qcomputecommand.cpp @@ -276,19 +276,6 @@ void QComputeCommand::trigger(int workGroupX, int workGroupY, int workGroupZ, in setEnabled(true); } -Qt3DCore::QNodeCreatedChangeBasePtr QComputeCommand::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QComputeCommand); - data.workGroupX = d->m_workGroupX; - data.workGroupY = d->m_workGroupY; - data.workGroupZ = d->m_workGroupZ; - data.runType = d->m_runType; - data.frameCount = d->m_frameCount; - return creationChange; -} - } // Render QT_END_NAMESPACE diff --git a/src/render/frontend/qcomputecommand.h b/src/render/frontend/qcomputecommand.h index b71007ba0..18572d98b 100644 --- a/src/render/frontend/qcomputecommand.h +++ b/src/render/frontend/qcomputecommand.h @@ -89,7 +89,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QComputeCommand) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // Qt3DRender diff --git a/src/render/frontend/qlayer.cpp b/src/render/frontend/qlayer.cpp index 416525360..61fdbf4b3 100644 --- a/src/render/frontend/qlayer.cpp +++ b/src/render/frontend/qlayer.cpp @@ -187,15 +187,6 @@ QLayer::QLayer(QLayerPrivate &dd, QNode *parent) { } -Qt3DCore::QNodeCreatedChangeBasePtr QLayer::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QLayer); - data.m_recursive = d->m_recursive; - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/frontend/qlayer.h b/src/render/frontend/qlayer.h index 4900f30e0..9ba3a1f20 100644 --- a/src/render/frontend/qlayer.h +++ b/src/render/frontend/qlayer.h @@ -69,7 +69,6 @@ protected: private: Q_DECLARE_PRIVATE(QLayer) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const; }; } // namespace Qt3DRender diff --git a/src/render/frontend/qlevelofdetail.cpp b/src/render/frontend/qlevelofdetail.cpp index ced0604c7..fcc826f66 100644 --- a/src/render/frontend/qlevelofdetail.cpp +++ b/src/render/frontend/qlevelofdetail.cpp @@ -308,28 +308,6 @@ QLevelOfDetail::QLevelOfDetail(QLevelOfDetailPrivate &dd, QNode *parent) { } -/*! \internal */ -Qt3DCore::QNodeCreatedChangeBasePtr QLevelOfDetail::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - - Q_D(const QLevelOfDetail); - if (d->m_camera) - data.camera = d->m_camera->id(); - data.currentIndex = d->m_currentIndex; - data.thresholdType = d->m_thresholdType; - data.thresholds = d->m_thresholds; - data.volumeOverride = d->m_volumeOverride; - - return creationChange; -} - -// TODO Unused remove in Qt6 -void QLevelOfDetail::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &) -{ -} - QCamera *QLevelOfDetail::camera() const { Q_D(const QLevelOfDetail); diff --git a/src/render/frontend/qlevelofdetail.h b/src/render/frontend/qlevelofdetail.h index 81fcf3235..1192ff1e8 100644 --- a/src/render/frontend/qlevelofdetail.h +++ b/src/render/frontend/qlevelofdetail.h @@ -96,9 +96,6 @@ Q_SIGNALS: protected: explicit QLevelOfDetail(QLevelOfDetailPrivate &dd, Qt3DCore::QNode *parent = nullptr); - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; - // TODO Unused remove in Qt6 - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; private: Q_DECLARE_PRIVATE(QLevelOfDetail) diff --git a/src/render/frontend/qlevelofdetailswitch.cpp b/src/render/frontend/qlevelofdetailswitch.cpp index c07d4c4b1..c0bbdc0f8 100644 --- a/src/render/frontend/qlevelofdetailswitch.cpp +++ b/src/render/frontend/qlevelofdetailswitch.cpp @@ -133,11 +133,6 @@ QLevelOfDetailSwitch::QLevelOfDetailSwitch(QLevelOfDetailPrivate &dd, QNode *par { } -// TODO Unused remove in Qt6 -void QLevelOfDetailSwitch::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &) -{ -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/frontend/qlevelofdetailswitch.h b/src/render/frontend/qlevelofdetailswitch.h index 325b885ed..90f4ee3e2 100644 --- a/src/render/frontend/qlevelofdetailswitch.h +++ b/src/render/frontend/qlevelofdetailswitch.h @@ -57,8 +57,6 @@ public: protected: explicit QLevelOfDetailSwitch(QLevelOfDetailPrivate &dd, Qt3DCore::QNode *parent = nullptr); - // TODO Unused remove in Qt6 - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; private: Q_DECLARE_PRIVATE(QLevelOfDetailSwitch) diff --git a/src/render/frontend/qrenderaspect.cpp b/src/render/frontend/qrenderaspect.cpp index fc366b891..acfa8a5bb 100644 --- a/src/render/frontend/qrenderaspect.cpp +++ b/src/render/frontend/qrenderaspect.cpp @@ -276,78 +276,78 @@ void QRenderAspectPrivate::registerBackendTypes() qRegisterMetaType(); qRegisterMetaType(); - q->registerBackendType(QSharedPointer::create(m_renderer, m_nodeManagers)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - - q->registerBackendType(QSharedPointer::create(m_renderer, q)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer::create(m_renderer, m_nodeManagers->sceneManager())); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer::create(m_renderer, m_nodeManagers)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + + q->registerBackendType(QSharedPointer::create(m_renderer, q)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer::create(m_renderer, m_nodeManagers->sceneManager())); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); // Geometry + Compute - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer::create(m_renderer, m_nodeManagers->bufferManager())); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer::create(m_renderer, m_nodeManagers->geometryRendererManager())); - q->registerBackendType(QSharedPointer>::create(m_renderer)); - q->registerBackendType(QSharedPointer::create(m_renderer, m_nodeManagers->skeletonManager(), m_nodeManagers->jointManager())); - q->registerBackendType(QSharedPointer::create(m_renderer, m_nodeManagers->jointManager(), m_nodeManagers->skeletonManager())); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer::create(m_renderer, m_nodeManagers->bufferManager())); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer::create(m_renderer, m_nodeManagers->geometryRendererManager())); + q->registerBackendType(QSharedPointer>::create(m_renderer)); + q->registerBackendType(QSharedPointer::create(m_renderer, m_nodeManagers->skeletonManager(), m_nodeManagers->jointManager())); + q->registerBackendType(QSharedPointer::create(m_renderer, m_nodeManagers->jointManager(), m_nodeManagers->skeletonManager())); // Textures - q->registerBackendType(QSharedPointer::create(m_renderer, m_nodeManagers->textureManager())); - q->registerBackendType(QSharedPointer::create(m_renderer, + q->registerBackendType(QSharedPointer::create(m_renderer, m_nodeManagers->textureManager())); + q->registerBackendType(QSharedPointer::create(m_renderer, m_nodeManagers->textureImageManager())); // Material system - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer::create(m_renderer, m_nodeManagers)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer::create(m_renderer, m_nodeManagers)); - q->registerBackendType(QSharedPointer::create(m_renderer, m_nodeManagers->shaderManager())); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer::create(m_renderer, m_nodeManagers)); - q->registerBackendType(QSharedPointer>::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer::create(m_renderer, m_nodeManagers)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer::create(m_renderer, m_nodeManagers)); + q->registerBackendType(QSharedPointer::create(m_renderer, m_nodeManagers->shaderManager())); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer::create(m_renderer, m_nodeManagers)); + q->registerBackendType(QSharedPointer>::create(m_renderer)); // Framegraph - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); // Picking - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); - q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); + q->registerBackendType(QSharedPointer >::create(m_renderer)); // Plugins for (const QString &plugin : qAsConst(m_pluginConfig)) diff --git a/src/render/frontend/qrenderplugin_p.h b/src/render/frontend/qrenderplugin_p.h index 110c8295a..c34dabefc 100644 --- a/src/render/frontend/qrenderplugin_p.h +++ b/src/render/frontend/qrenderplugin_p.h @@ -75,10 +75,6 @@ protected: { aspect->registerBackendType(obj, functor); } - void registerBackendType(QRenderAspect *aspect, const QMetaObject &obj, const Qt3DCore::QBackendNodeMapperPtr &functor, bool supportsSyncing) - { - aspect->registerBackendType(obj, functor, supportsSyncing); - } void unregisterBackendType(QRenderAspect *aspect, const QMetaObject &obj) { aspect->unregisterBackendType(obj); diff --git a/src/render/frontend/qrendersettings.cpp b/src/render/frontend/qrendersettings.cpp index 179df151a..0796b74f0 100644 --- a/src/render/frontend/qrendersettings.cpp +++ b/src/render/frontend/qrendersettings.cpp @@ -275,20 +275,6 @@ void QRenderSettings::setRenderPolicy(QRenderSettings::RenderPolicy renderPolicy emit renderPolicyChanged(renderPolicy); } -Qt3DCore::QNodeCreatedChangeBasePtr QRenderSettings::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QRenderSettings); - data.activeFrameGraphId = qIdForNode(d->m_activeFrameGraph); - data.renderPolicy = d->m_renderPolicy; - data.pickMethod = d->m_pickingSettings.pickMethod(); - data.pickResultMode = d->m_pickingSettings.pickResultMode(); - data.faceOrientationPickingMode = d->m_pickingSettings.faceOrientationPickingMode(); - data.pickWorldSpaceTolerance = d->m_pickingSettings.worldSpaceTolerance(); - return creationChange; -} - } // namespace Qt3Drender QT_END_NAMESPACE diff --git a/src/render/frontend/qrendersettings.h b/src/render/frontend/qrendersettings.h index 1b4d68de9..5e63b1183 100644 --- a/src/render/frontend/qrendersettings.h +++ b/src/render/frontend/qrendersettings.h @@ -93,7 +93,6 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_onPickResultModeChanged(QPickingSettings::PickResultMode)) Q_PRIVATE_SLOT(d_func(), void _q_onFaceOrientationPickingModeChanged(QPickingSettings::FaceOrientationPickingMode)) Q_PRIVATE_SLOT(d_func(), void _q_onWorldSpaceToleranceChanged(float)) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3Drender diff --git a/src/render/frontend/qrendertarget.cpp b/src/render/frontend/qrendertarget.cpp index 57eecd795..4471b31fa 100644 --- a/src/render/frontend/qrendertarget.cpp +++ b/src/render/frontend/qrendertarget.cpp @@ -123,7 +123,7 @@ void QRenderTarget::addOutput(QRenderTargetOutput *output) if (!output->parent()) output->setParent(this); - d->updateNode(output, "output", Qt3DCore::PropertyValueAdded); + d->update(); } } @@ -134,7 +134,7 @@ void QRenderTarget::removeOutput(QRenderTargetOutput *output) { Q_D(QRenderTarget); - d->updateNode(output, "output", Qt3DCore::PropertyValueRemoved); + d->update(); d->m_outputs.removeOne(output); // Remove bookkeeping connection d->unregisterDestructionHelper(output); @@ -149,14 +149,6 @@ QVector QRenderTarget::outputs() const return d->m_outputs; } -Qt3DCore::QNodeCreatedChangeBasePtr QRenderTarget::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - data.outputIds = qIdsForNodes(outputs()); - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/frontend/qrendertarget.h b/src/render/frontend/qrendertarget.h index 9faf113da..7c339d2c8 100644 --- a/src/render/frontend/qrendertarget.h +++ b/src/render/frontend/qrendertarget.h @@ -66,7 +66,6 @@ protected: private: Q_DECLARE_PRIVATE(QRenderTarget) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/frontend/qrendertargetoutput.cpp b/src/render/frontend/qrendertargetoutput.cpp index 8c0d86134..9d6600233 100644 --- a/src/render/frontend/qrendertargetoutput.cpp +++ b/src/render/frontend/qrendertargetoutput.cpp @@ -300,19 +300,6 @@ QAbstractTexture::CubeMapFace QRenderTargetOutput::face() const return d->m_face; } -Qt3DCore::QNodeCreatedChangeBasePtr QRenderTargetOutput::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QRenderTargetOutput); - data.textureId = qIdForNode(texture()); - data.attachmentPoint = d->m_attachmentPoint; - data.mipLevel = d->m_mipLevel; - data.layer = d->m_layer; - data.face = d->m_face; - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/frontend/qrendertargetoutput.h b/src/render/frontend/qrendertargetoutput.h index a582c26f0..a621ff93f 100644 --- a/src/render/frontend/qrendertargetoutput.h +++ b/src/render/frontend/qrendertargetoutput.h @@ -111,7 +111,6 @@ protected: explicit QRenderTargetOutput(QRenderTargetOutputPrivate &dd, Qt3DCore::QNode *parent = nullptr); private: - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; Q_DECLARE_PRIVATE(QRenderTargetOutput) }; diff --git a/src/render/geometry/buffer.cpp b/src/render/geometry/buffer.cpp index 6db3bab44..3ffcd25bc 100644 --- a/src/render/geometry/buffer.cpp +++ b/src/render/geometry/buffer.cpp @@ -38,7 +38,6 @@ ****************************************************************************/ #include "buffer_p.h" -#include #include #include @@ -179,9 +178,9 @@ BufferFunctor::BufferFunctor(AbstractRenderer *renderer, BufferManager *manager) { } -Qt3DCore::QBackendNode *BufferFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const +Qt3DCore::QBackendNode *BufferFunctor::create(Qt3DCore::QNodeId id) const { - Buffer *buffer = m_manager->getOrCreateResource(change->subjectId()); + Buffer *buffer = m_manager->getOrCreateResource(id); buffer->setManager(m_manager); buffer->setRenderer(m_renderer); return buffer; diff --git a/src/render/geometry/buffer_p.h b/src/render/geometry/buffer_p.h index 3490b7bc9..ed51c01d8 100644 --- a/src/render/geometry/buffer_p.h +++ b/src/render/geometry/buffer_p.h @@ -104,7 +104,7 @@ class BufferFunctor : public Qt3DCore::QBackendNodeMapper { public: explicit BufferFunctor(AbstractRenderer *renderer, BufferManager *manager); - Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const override; + Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const override; Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const override; void destroy(Qt3DCore::QNodeId id) const override; private: diff --git a/src/render/geometry/geometry.cpp b/src/render/geometry/geometry.cpp index 56ea936be..c70195ee0 100644 --- a/src/render/geometry/geometry.cpp +++ b/src/render/geometry/geometry.cpp @@ -41,7 +41,6 @@ #include #include #include -#include #include @@ -55,8 +54,6 @@ namespace Render { Geometry::Geometry() : BackendNode(ReadWrite) , m_geometryDirty(false) - , m_shouldNotifyMinExtentChanged(false) - , m_shouldNotifyMaxExtentChanged(false) { } @@ -72,8 +69,6 @@ void Geometry::cleanup() m_boundingPositionAttribute = Qt3DCore::QNodeId(); m_min = QVector3D(); m_max = QVector3D(); - m_shouldNotifyMinExtentChanged = false; - m_shouldNotifyMaxExtentChanged = false; } void Geometry::syncFromFrontEnd(const QNode *frontEnd, bool firstTime) @@ -113,27 +108,10 @@ void Geometry::updateExtent(const QVector3D &min, const QVector3D &max) // Send notification to frontend if (m_min != min) { m_min = min; - m_shouldNotifyMinExtentChanged = true; } if (m_max != max) { m_max = max; - m_shouldNotifyMaxExtentChanged = true; - } -} - -// Called from calcboundingvolumejob after all bounding volumes have been -// updated (in an aspect thread) -void Geometry::notifyExtentChanged() -{ - if (m_shouldNotifyMinExtentChanged || m_shouldNotifyMaxExtentChanged) { - auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId()); - change->setDeliveryFlags(Qt3DCore::QSceneChange::Nodes); - change->setPropertyName("extent"); - change->setValue(QVariant::fromValue(QPair(m_min, m_max))); - notifyObservers(change); - m_shouldNotifyMinExtentChanged = false; - m_shouldNotifyMaxExtentChanged = false; } } diff --git a/src/render/geometry/geometry_p.h b/src/render/geometry/geometry_p.h index fdad63286..8b8a1aa38 100644 --- a/src/render/geometry/geometry_p.h +++ b/src/render/geometry/geometry_p.h @@ -79,7 +79,6 @@ public: inline QVector3D max() const { return m_max; } void updateExtent(const QVector3D &min, const QVector3D &max); - void notifyExtentChanged(); private: QVector m_attributes; @@ -87,8 +86,6 @@ private: Qt3DCore::QNodeId m_boundingPositionAttribute; QVector3D m_min; QVector3D m_max; - bool m_shouldNotifyMinExtentChanged; - bool m_shouldNotifyMaxExtentChanged; }; } // namespace Render diff --git a/src/render/geometry/geometryrenderer.cpp b/src/render/geometry/geometryrenderer.cpp index 881c0f66b..65094e071 100644 --- a/src/render/geometry/geometryrenderer.cpp +++ b/src/render/geometry/geometryrenderer.cpp @@ -42,9 +42,7 @@ #include #include #include -#include #include -#include #include #include @@ -219,9 +217,9 @@ GeometryRendererFunctor::GeometryRendererFunctor(AbstractRenderer *renderer, Geo { } -Qt3DCore::QBackendNode *GeometryRendererFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const +Qt3DCore::QBackendNode *GeometryRendererFunctor::create(Qt3DCore::QNodeId id) const { - GeometryRenderer *geometryRenderer = m_manager->getOrCreateResource(change->subjectId()); + GeometryRenderer *geometryRenderer = m_manager->getOrCreateResource(id); geometryRenderer->setManager(m_manager); geometryRenderer->setRenderer(m_renderer); return geometryRenderer; diff --git a/src/render/geometry/geometryrenderer_p.h b/src/render/geometry/geometryrenderer_p.h index a38233d6c..b2ccf17c3 100644 --- a/src/render/geometry/geometryrenderer_p.h +++ b/src/render/geometry/geometryrenderer_p.h @@ -126,7 +126,7 @@ class GeometryRendererFunctor : public Qt3DCore::QBackendNodeMapper { public: explicit GeometryRendererFunctor(AbstractRenderer *renderer, GeometryRendererManager *manager); - Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const override; + Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const override; Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const override; void destroy(Qt3DCore::QNodeId id) const override; private: diff --git a/src/render/geometry/joint.cpp b/src/render/geometry/joint.cpp index 9791f6c52..ae1383558 100644 --- a/src/render/geometry/joint.cpp +++ b/src/render/geometry/joint.cpp @@ -127,9 +127,9 @@ JointFunctor::JointFunctor(AbstractRenderer *renderer, { } -Qt3DCore::QBackendNode *JointFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const +Qt3DCore::QBackendNode *JointFunctor::create(Qt3DCore::QNodeId id) const { - Joint *backend = m_jointManager->getOrCreateResource(change->subjectId()); + Joint *backend = m_jointManager->getOrCreateResource(id); backend->setRenderer(m_renderer); backend->setJointManager(m_jointManager); backend->setSkeletonManager(m_skeletonManager); diff --git a/src/render/geometry/joint_p.h b/src/render/geometry/joint_p.h index c178fdcf8..1283577d9 100644 --- a/src/render/geometry/joint_p.h +++ b/src/render/geometry/joint_p.h @@ -105,7 +105,7 @@ public: explicit JointFunctor(AbstractRenderer *renderer, JointManager *jointManager, SkeletonManager *skeletonManager); - Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const final; + Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const final; Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const final; void destroy(Qt3DCore::QNodeId id) const final; diff --git a/src/render/geometry/qattribute.cpp b/src/render/geometry/qattribute.cpp index 84d14cfe1..348695e45 100644 --- a/src/render/geometry/qattribute.cpp +++ b/src/render/geometry/qattribute.cpp @@ -348,16 +348,6 @@ void QAttribute::setVertexSize(uint size) emit dataSizeChanged(size); } -void QAttribute::setDataType(VertexBaseType type) -{ - setVertexBaseType(type); -} - -void QAttribute::setDataSize(uint size) -{ - setVertexSize(size); -} - void QAttribute::setCount(uint count) { Q_D(QAttribute); @@ -486,24 +476,6 @@ QString QAttribute::defaultTextureCoordinate2AttributeName() return QStringLiteral("vertexTexCoord2"); } -Qt3DCore::QNodeCreatedChangeBasePtr QAttribute::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QAttribute); - data.bufferId = qIdForNode(d->m_buffer); - data.name = d->m_name; - data.vertexBaseType = d->m_vertexBaseType; - data.vertexSize = d->m_vertexSize; - data.count = d->m_count; - data.byteStride = d->m_byteStride; - data.byteOffset = d->m_byteOffset; - data.divisor = d->m_divisor; - data.attributeType = d->m_attributeType; - return creationChange; -} - - /*! \fn Qt3DRender::QAttribute::dataSizeChanged(uint vertexSize) diff --git a/src/render/geometry/qattribute.h b/src/render/geometry/qattribute.h index 526a77a59..ec3b65f32 100644 --- a/src/render/geometry/qattribute.h +++ b/src/render/geometry/qattribute.h @@ -127,8 +127,6 @@ public Q_SLOTS: void setName(const QString &name); void setVertexBaseType(VertexBaseType type); void setVertexSize(uint size); - QT_DEPRECATED void setDataType(VertexBaseType type); - QT_DEPRECATED void setDataSize(uint size); void setCount(uint count); void setByteStride(uint byteStride); void setByteOffset(uint byteOffset); @@ -150,7 +148,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QAttribute) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // Qt3DRender diff --git a/src/render/geometry/qbuffer.cpp b/src/render/geometry/qbuffer.cpp index 8399bdd7c..646670ad1 100644 --- a/src/render/geometry/qbuffer.cpp +++ b/src/render/geometry/qbuffer.cpp @@ -40,8 +40,6 @@ #include "qbuffer.h" #include "qbuffer_p.h" #include -#include - QT_BEGIN_NAMESPACE @@ -433,13 +431,6 @@ void QBuffer::setAccessType(QBuffer::AccessType access) } } -/*! \internal */ -void QBuffer::sceneChangeEvent(const QSceneChangePtr &change) -{ - // TODO Unused remove in Qt6 - Q_UNUSED(change) -} - bool QBuffer::isSyncData() const { Q_D(const QBuffer); @@ -468,19 +459,6 @@ void QBuffer::setType(QBuffer::BufferType type) } } -Qt3DCore::QNodeCreatedChangeBasePtr QBuffer::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QBuffer); - data.data = d->m_data; - data.usage = d->m_usage; - data.functor = d->m_functor; - data.syncData = d->m_syncData; - data.access = d->m_access; - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/geometry/qbuffer.h b/src/render/geometry/qbuffer.h index f1ce110f0..6b18063ee 100644 --- a/src/render/geometry/qbuffer.h +++ b/src/render/geometry/qbuffer.h @@ -126,13 +126,8 @@ Q_SIGNALS: void accessTypeChanged(AccessType access); void dataAvailable(); -protected: - // TODO Unused remove in Qt6 - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; - private: Q_DECLARE_PRIVATE(QBuffer) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/geometry/qgeometry.cpp b/src/render/geometry/qgeometry.cpp index 48f054bce..5daaf5264 100644 --- a/src/render/geometry/qgeometry.cpp +++ b/src/render/geometry/qgeometry.cpp @@ -42,7 +42,6 @@ #include "qgeometry_p.h" #include #include -#include QT_BEGIN_NAMESPACE @@ -64,6 +63,20 @@ QGeometryPrivate::~QGeometryPrivate() { } +void QGeometryPrivate::setExtent(const QVector3D &minExtent, const QVector3D &maxExtent) +{ + Q_Q(QGeometry); + if (m_minExtent != minExtent) { + m_minExtent = minExtent; + emit q->minExtentChanged(minExtent); + } + + if (m_maxExtent != maxExtent) { + m_maxExtent = maxExtent; + emit q->maxExtentChanged(maxExtent); + } +} + /*! \qmltype Geometry \instantiates Qt3DRender::QGeometry @@ -151,28 +164,6 @@ QGeometry::QGeometry(QGeometryPrivate &dd, QNode *parent) { } -void QGeometry::sceneChangeEvent(const QSceneChangePtr &change) -{ - Q_D(QGeometry); - QPropertyUpdatedChangePtr e = qSharedPointerCast(change); - if (e->type() == PropertyUpdated) { - const bool blocked = blockNotifications(true); - if (e->propertyName() == QByteArrayLiteral("extent")) { - const QPair extent = e->value().value>(); - - if (extent.first != d->m_minExtent) { - d->m_minExtent = extent.first; - emit minExtentChanged(extent.first); - } - if (extent.second != d->m_maxExtent) { - d->m_maxExtent = extent.second; - emit maxExtentChanged(d->m_maxExtent); - } - } - blockNotifications(blocked); - } -} - /*! \fn void Qt3DRender::QGeometry::addAttribute(Qt3DRender::QAttribute *attribute) Adds an \a attribute to this geometry. @@ -194,7 +185,7 @@ void QGeometry::addAttribute(QAttribute *attribute) if (!attribute->parent()) attribute->setParent(this); - d->updateNode(attribute, "attribute", Qt3DCore::PropertyValueAdded); + d->update(); } } @@ -209,7 +200,7 @@ void QGeometry::removeAttribute(QAttribute *attribute) d->m_attributes.removeOne(attribute); // Remove bookkeeping connection d->unregisterDestructionHelper(attribute); - d->updateNode(attribute, "attribute", Qt3DCore::PropertyValueRemoved); + d->update(); } void QGeometry::setBoundingVolumePositionAttribute(QAttribute *boundingVolumePositionAttribute) @@ -270,16 +261,6 @@ QVector QGeometry::attributes() const return d->m_attributes; } -Qt3DCore::QNodeCreatedChangeBasePtr QGeometry::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QGeometry); - data.attributeIds = qIdsForNodes(d->m_attributes); - data.boundingVolumePositionAttributeId = qIdForNode(d->m_boundingVolumePositionAttribute); - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/geometry/qgeometry.h b/src/render/geometry/qgeometry.h index cae637f1f..442ec7d7a 100644 --- a/src/render/geometry/qgeometry.h +++ b/src/render/geometry/qgeometry.h @@ -77,11 +77,9 @@ Q_SIGNALS: Q_REVISION(13) void maxExtentChanged(const QVector3D &maxExtent); protected: explicit QGeometry(QGeometryPrivate &dd, Qt3DCore::QNode *parent = nullptr); - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; private: Q_DECLARE_PRIVATE(QGeometry) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/geometry/qgeometry_p.h b/src/render/geometry/qgeometry_p.h index 94f71d780..1332ea5d2 100644 --- a/src/render/geometry/qgeometry_p.h +++ b/src/render/geometry/qgeometry_p.h @@ -66,6 +66,8 @@ public: QGeometryPrivate(); ~QGeometryPrivate(); + void setExtent(const QVector3D &minExtent, const QVector3D &maxExtent); + QVector m_attributes; QAttribute *m_boundingVolumePositionAttribute; diff --git a/src/render/geometry/qgeometryrenderer.cpp b/src/render/geometry/qgeometryrenderer.cpp index 8720a5c00..e660d2ff7 100644 --- a/src/render/geometry/qgeometryrenderer.cpp +++ b/src/render/geometry/qgeometryrenderer.cpp @@ -218,11 +218,6 @@ QGeometryRenderer::QGeometryRenderer(QGeometryRendererPrivate &dd, QNode *parent { } -// TODO Unused remove in Qt6 -void QGeometryRenderer::sceneChangeEvent(const QSceneChangePtr &) -{ -} - /*! \property QGeometryRenderer::instanceCount @@ -485,26 +480,6 @@ void QGeometryRenderer::setGeometryFactory(const QGeometryFactoryPtr &factory) d->update(); } -Qt3DCore::QNodeCreatedChangeBasePtr QGeometryRenderer::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QGeometryRenderer); - data.instanceCount = d->m_instanceCount; - data.vertexCount = d->m_vertexCount; - data.indexOffset = d->m_indexOffset; - data.firstInstance = d->m_firstInstance; - data.firstVertex = d->m_firstVertex; - data.indexBufferByteOffset = d->m_indexBufferByteOffset; - data.restartIndexValue = d->m_restartIndexValue; - data.verticesPerPatch = d->m_verticesPerPatch; - data.primitiveRestart = d->m_primitiveRestart; - data.geometryId = qIdForNode(d->m_geometry); - data.primitiveType = d->m_primitiveType; - data.geometryFactory = d->m_geometryFactory; - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/geometry/qgeometryrenderer.h b/src/render/geometry/qgeometryrenderer.h index 3f0f9fab2..5466f7800 100644 --- a/src/render/geometry/qgeometryrenderer.h +++ b/src/render/geometry/qgeometryrenderer.h @@ -134,12 +134,9 @@ Q_SIGNALS: protected: explicit QGeometryRenderer(QGeometryRendererPrivate &dd, Qt3DCore::QNode *parent = nullptr); - // TODO Unused remove in Qt6 - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; private: Q_DECLARE_PRIVATE(QGeometryRenderer) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/geometry/qgeometryrenderer_p.h b/src/render/geometry/qgeometryrenderer_p.h index 32ca334e3..d47a096a7 100644 --- a/src/render/geometry/qgeometryrenderer_p.h +++ b/src/render/geometry/qgeometryrenderer_p.h @@ -55,7 +55,6 @@ #include #include #include -#include #include QT_BEGIN_NAMESPACE @@ -100,10 +99,6 @@ struct QGeometryRendererData QGeometryFactoryPtr geometryFactory; }; -class QGeometry; -typedef Qt3DCore::QTypedPropertyUpdatedChange> QGeometryChange; -typedef Qt3DCore::QTypedPropertyUpdatedChangePtr> QGeometryChangePtr; - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/geometry/qmesh.cpp b/src/render/geometry/qmesh.cpp index 1f05a71f6..a5c5148ae 100644 --- a/src/render/geometry/qmesh.cpp +++ b/src/render/geometry/qmesh.cpp @@ -50,7 +50,6 @@ #include #include #include -#include #include #include #include @@ -215,11 +214,6 @@ QMesh::QMesh(QMeshPrivate &dd, QNode *parent) { } -// TODO Unused remove in Qt6 -void QMesh::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &) -{ -} - void QMesh::setSource(const QUrl& source) { Q_D(QMesh); diff --git a/src/render/geometry/qmesh.h b/src/render/geometry/qmesh.h index e8ff52b35..04fdedc20 100644 --- a/src/render/geometry/qmesh.h +++ b/src/render/geometry/qmesh.h @@ -88,8 +88,6 @@ Q_SIGNALS: protected: explicit QMesh(QMeshPrivate &dd, Qt3DCore::QNode *parent = nullptr); - // TODO Unused remove in Qt6 - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; private: Q_DECLARE_PRIVATE(QMesh) diff --git a/src/render/geometry/skeleton.cpp b/src/render/geometry/skeleton.cpp index 0452c020b..828382cd0 100644 --- a/src/render/geometry/skeleton.cpp +++ b/src/render/geometry/skeleton.cpp @@ -45,7 +45,6 @@ #include #include #include -#include #include #include #include @@ -201,9 +200,9 @@ SkeletonFunctor::SkeletonFunctor(AbstractRenderer *renderer, { } -Qt3DCore::QBackendNode *SkeletonFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const +Qt3DCore::QBackendNode *SkeletonFunctor::create(Qt3DCore::QNodeId id) const { - Skeleton *backend = m_skeletonManager->getOrCreateResource(change->subjectId()); + Skeleton *backend = m_skeletonManager->getOrCreateResource(id); backend->setRenderer(m_renderer); backend->setSkeletonManager(m_skeletonManager); backend->setJointManager(m_jointManager); diff --git a/src/render/geometry/skeleton_p.h b/src/render/geometry/skeleton_p.h index ac475a3c0..4c6c038c7 100644 --- a/src/render/geometry/skeleton_p.h +++ b/src/render/geometry/skeleton_p.h @@ -163,7 +163,7 @@ public: explicit SkeletonFunctor(AbstractRenderer *renderer, SkeletonManager *skeletonManager, JointManager *jointManager); - Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const final; + Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const final; Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const final; void destroy(Qt3DCore::QNodeId id) const final; diff --git a/src/render/io/qsceneloader.cpp b/src/render/io/qsceneloader.cpp index 2d53702f6..eb0bcd155 100644 --- a/src/render/io/qsceneloader.cpp +++ b/src/render/io/qsceneloader.cpp @@ -252,11 +252,6 @@ QSceneLoader::~QSceneLoader() { } -// TODO Unused remove in Qt6 -void QSceneLoader::sceneChangeEvent(const QSceneChangePtr &) -{ -} - /*! \internal */ QSceneLoader::QSceneLoader(QSceneLoaderPrivate &dd, QNode *parent) : Qt3DCore::QComponent(dd, parent) @@ -373,21 +368,6 @@ QComponent *QSceneLoader::component(const QString &entityName, return nullptr; } -/*! \internal */ -void QSceneLoader::setStatus(QSceneLoader::Status status) -{ - Q_D(QSceneLoader); - d->setStatus(status); -} - -Qt3DCore::QNodeCreatedChangeBasePtr QSceneLoader::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - data.source = d_func()->m_source; - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/io/qsceneloader.h b/src/render/io/qsceneloader.h index 51ba42de7..32cbb7f60 100644 --- a/src/render/io/qsceneloader.h +++ b/src/render/io/qsceneloader.h @@ -41,7 +41,6 @@ #define QT3DRENDER_QSCENELOADER_H #include -#include #include #include @@ -60,8 +59,6 @@ public: explicit QSceneLoader(Qt3DCore::QNode *parent = nullptr); ~QSceneLoader(); - // TODO Unused remove in Qt6 - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; enum Status { None = 0, Loading, @@ -90,7 +87,6 @@ public: public Q_SLOTS: void setSource(const QUrl &arg); - QT_DEPRECATED void setStatus(Status status); Q_SIGNALS: void sourceChanged(const QUrl &source); @@ -101,7 +97,6 @@ protected: private: Q_DECLARE_PRIVATE(QSceneLoader) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/io/scene.cpp b/src/render/io/scene.cpp index 1a2000bbb..91f3ebc17 100644 --- a/src/render/io/scene.cpp +++ b/src/render/io/scene.cpp @@ -103,9 +103,9 @@ RenderSceneFunctor::RenderSceneFunctor(AbstractRenderer *renderer, SceneManager { } -Qt3DCore::QBackendNode *RenderSceneFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const +Qt3DCore::QBackendNode *RenderSceneFunctor::create(Qt3DCore::QNodeId id) const { - Scene *scene = m_sceneManager->getOrCreateResource(change->subjectId()); + Scene *scene = m_sceneManager->getOrCreateResource(id); scene->setSceneManager(m_sceneManager); scene->setRenderer(m_renderer); return scene; diff --git a/src/render/io/scene_p.h b/src/render/io/scene_p.h index cf927bc23..97f898de1 100644 --- a/src/render/io/scene_p.h +++ b/src/render/io/scene_p.h @@ -88,7 +88,7 @@ class RenderSceneFunctor : public Qt3DCore::QBackendNodeMapper { public: explicit RenderSceneFunctor(AbstractRenderer *renderer, SceneManager *sceneManager); - Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const override; + Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const override; Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const override; void destroy(Qt3DCore::QNodeId id) const override; diff --git a/src/render/jobs/calcboundingvolumejob.cpp b/src/render/jobs/calcboundingvolumejob.cpp index 172c4ddca..1e4656247 100644 --- a/src/render/jobs/calcboundingvolumejob.cpp +++ b/src/render/jobs/calcboundingvolumejob.cpp @@ -52,6 +52,8 @@ #include #include #include +#include +#include #include #if QT_CONFIG(concurrent) @@ -350,8 +352,29 @@ struct ReduceUpdateBoundFunctor } // anonymous +class CalculateBoundingVolumeJobPrivate : public Qt3DCore::QAspectJobPrivate +{ +public: + CalculateBoundingVolumeJobPrivate() { } + ~CalculateBoundingVolumeJobPrivate() override { } + + void postFrame(Qt3DCore::QAspectManager *manager) override + { + for (Geometry *backend : qAsConst(m_updatedGeometries)) { + QGeometry *node = qobject_cast(manager->lookupNode(backend->peerId())); + if (!node) + continue; + QGeometryPrivate *dNode = static_cast(Qt3DCore::QNodePrivate::get(node)); + dNode->setExtent(backend->min(), backend->max()); + } + } + + QVector m_updatedGeometries; +}; + CalculateBoundingVolumeJob::CalculateBoundingVolumeJob() - : m_manager(nullptr) + : Qt3DCore::QAspectJob(*new CalculateBoundingVolumeJobPrivate()) + , m_manager(nullptr) , m_node(nullptr) { SET_JOB_RUN_STAT_TYPE(this, JobTypes::CalcBoundingVolume, 0) @@ -380,9 +403,8 @@ void CalculateBoundingVolumeJob::run() updatedGeometries += calculateLocalBoundingVolume(m_manager, child); } - // Send extent updates to frontend - for (Geometry *geometry : updatedGeometries) - geometry->notifyExtentChanged(); + Q_D(CalculateBoundingVolumeJob); + d->m_updatedGeometries = std::move(updatedGeometries); } void CalculateBoundingVolumeJob::setRoot(Entity *node) diff --git a/src/render/jobs/calcboundingvolumejob_p.h b/src/render/jobs/calcboundingvolumejob_p.h index 3b62c83cd..3f7b8c09c 100644 --- a/src/render/jobs/calcboundingvolumejob_p.h +++ b/src/render/jobs/calcboundingvolumejob_p.h @@ -64,6 +64,7 @@ namespace Render { class NodeManagers; class Entity; +class CalculateBoundingVolumeJobPrivate; class Q_3DRENDERSHARED_PRIVATE_EXPORT CalculateBoundingVolumeJob : public Qt3DCore::QAspectJob { @@ -77,6 +78,7 @@ public: private: NodeManagers *m_manager; Entity *m_node; + Q_DECLARE_PRIVATE(CalculateBoundingVolumeJob) }; typedef QSharedPointer CalculateBoundingVolumeJobPtr; diff --git a/src/render/lights/light.cpp b/src/render/lights/light.cpp index 3bdab0457..96eea0b44 100644 --- a/src/render/lights/light.cpp +++ b/src/render/lights/light.cpp @@ -77,9 +77,9 @@ RenderLightFunctor::RenderLightFunctor(AbstractRenderer *renderer, NodeManagers { } -Qt3DCore::QBackendNode *RenderLightFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const +Qt3DCore::QBackendNode *RenderLightFunctor::create(Qt3DCore::QNodeId id) const { - Light *backend = m_managers->lightManager()->getOrCreateResource(change->subjectId()); + Light *backend = m_managers->lightManager()->getOrCreateResource(id); backend->setRenderer(m_renderer); return backend; } diff --git a/src/render/lights/light_p.h b/src/render/lights/light_p.h index d1497fddd..58d7f842d 100644 --- a/src/render/lights/light_p.h +++ b/src/render/lights/light_p.h @@ -77,7 +77,7 @@ class RenderLightFunctor : public Qt3DCore::QBackendNodeMapper public: explicit RenderLightFunctor(AbstractRenderer *renderer, NodeManagers *managers); - Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const override; + Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const override; Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const final; void destroy(Qt3DCore::QNodeId id) const final; diff --git a/src/render/lights/qabstractlight.cpp b/src/render/lights/qabstractlight.cpp index 5ad16d3b4..83ac9e28b 100644 --- a/src/render/lights/qabstractlight.cpp +++ b/src/render/lights/qabstractlight.cpp @@ -93,14 +93,6 @@ QAbstractLightPrivate::~QAbstractLightPrivate() \value DirectionalLight \value SpotLight */ -Qt3DCore::QNodeCreatedChangeBasePtr QAbstractLight::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QAbstractLight); - data.shaderDataId = qIdForNode(d->m_shaderData); - return creationChange; -} /*! \class Qt3DRender::QAbstractLight diff --git a/src/render/lights/qabstractlight.h b/src/render/lights/qabstractlight.h index e92a5ee1d..30b0a8465 100644 --- a/src/render/lights/qabstractlight.h +++ b/src/render/lights/qabstractlight.h @@ -86,7 +86,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QAbstractLight) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/lights/qenvironmentlight.cpp b/src/render/lights/qenvironmentlight.cpp index 977e117db..52ee30cb2 100644 --- a/src/render/lights/qenvironmentlight.cpp +++ b/src/render/lights/qenvironmentlight.cpp @@ -100,15 +100,6 @@ void QEnvironmentLightPrivate::_q_updateEnvMapsSize() m_shaderData->setProperty("specularSize", QVariant::fromValue(specularSize)); } -Qt3DCore::QNodeCreatedChangeBasePtr QEnvironmentLight::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QEnvironmentLight); - data.shaderDataId = qIdForNode(d->m_shaderData); - return creationChange; -} - /*! \class Qt3DRender::QEnvironmentLight \inmodule Qt3DRender diff --git a/src/render/lights/qenvironmentlight.h b/src/render/lights/qenvironmentlight.h index 3afc44f28..6fd3aa282 100644 --- a/src/render/lights/qenvironmentlight.h +++ b/src/render/lights/qenvironmentlight.h @@ -76,7 +76,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QEnvironmentLight) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; Q_PRIVATE_SLOT(d_func(), void _q_updateEnvMapsSize()) }; diff --git a/src/render/materialsystem/qeffect.cpp b/src/render/materialsystem/qeffect.cpp index 8637a92d4..ad3dde8f7 100644 --- a/src/render/materialsystem/qeffect.cpp +++ b/src/render/materialsystem/qeffect.cpp @@ -192,7 +192,7 @@ void QEffect::addParameter(QParameter *parameter) if (!parameter->parent()) parameter->setParent(this); - d->updateNode(parameter, "parameter", Qt3DCore::PropertyValueAdded); + d->update(); } } @@ -206,7 +206,7 @@ void QEffect::removeParameter(QParameter *parameter) d->m_parameters.removeOne(parameter); // Remove bookkeeping connection d->unregisterDestructionHelper(parameter); - d->updateNode(parameter, "parameter", Qt3DCore::PropertyValueRemoved); + d->update(); } /*! @@ -238,7 +238,7 @@ void QEffect::addTechnique(QTechnique *t) if (!t->parent()) t->setParent(this); - d->updateNode(t, "technique", Qt3DCore::PropertyValueAdded); + d->update(); } } @@ -248,8 +248,7 @@ void QEffect::addTechnique(QTechnique *t) void QEffect::removeTechnique(QTechnique *t) { Q_D(QEffect); - if (t) - d->updateNode(t, "technique", Qt3DCore::PropertyValueRemoved); + d->update(); d->m_techniques.removeOne(t); // Remove bookkeeping connection d->unregisterDestructionHelper(t); @@ -264,16 +263,6 @@ QVector QEffect::techniques() const return d->m_techniques; } -Qt3DCore::QNodeCreatedChangeBasePtr QEffect::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QEffect); - data.parameterIds = qIdsForNodes(d->m_parameters); - data.techniqueIds = qIdsForNodes(d->m_techniques); - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/materialsystem/qeffect.h b/src/render/materialsystem/qeffect.h index decae6f39..d265590e9 100644 --- a/src/render/materialsystem/qeffect.h +++ b/src/render/materialsystem/qeffect.h @@ -71,7 +71,6 @@ protected: private: Q_DECLARE_PRIVATE(QEffect) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/materialsystem/qfilterkey.cpp b/src/render/materialsystem/qfilterkey.cpp index 2105da987..a98dc2b4f 100644 --- a/src/render/materialsystem/qfilterkey.cpp +++ b/src/render/materialsystem/qfilterkey.cpp @@ -142,16 +142,6 @@ QString QFilterKey::name() const return d->m_name; } -Qt3DCore::QNodeCreatedChangeBasePtr QFilterKey::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QFilterKey); - data.name = d->m_name; - data.value = d->m_value; - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/materialsystem/qfilterkey.h b/src/render/materialsystem/qfilterkey.h index d7dd470db..addf125f7 100644 --- a/src/render/materialsystem/qfilterkey.h +++ b/src/render/materialsystem/qfilterkey.h @@ -72,7 +72,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QFilterKey) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/materialsystem/qmaterial.cpp b/src/render/materialsystem/qmaterial.cpp index edd227500..9026e55f1 100644 --- a/src/render/materialsystem/qmaterial.cpp +++ b/src/render/materialsystem/qmaterial.cpp @@ -272,7 +272,7 @@ void QMaterial::addParameter(QParameter *parameter) if (!parameter->parent()) parameter->setParent(this); - d->updateNode(parameter, "parameter", Qt3DCore::PropertyValueAdded); + d->update(); } } @@ -283,7 +283,7 @@ void QMaterial::removeParameter(QParameter *parameter) { Q_ASSERT(parameter); Q_D(QMaterial); - d->updateNode(parameter, "parameter", Qt3DCore::PropertyValueRemoved); + d->update(); d->m_parameters.removeOne(parameter); } @@ -296,16 +296,6 @@ QVector QMaterial::parameters() const return d->m_parameters; } -Qt3DCore::QNodeCreatedChangeBasePtr QMaterial::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QMaterial); - data.parameterIds = qIdsForNodes(d->m_parameters); - data.effectId = qIdForNode(d->m_effect); - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/materialsystem/qmaterial.h b/src/render/materialsystem/qmaterial.h index d7d40f138..74feb3675 100644 --- a/src/render/materialsystem/qmaterial.h +++ b/src/render/materialsystem/qmaterial.h @@ -80,7 +80,6 @@ protected: private: Q_DECLARE_PRIVATE(QMaterial) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } diff --git a/src/render/materialsystem/qparameter.cpp b/src/render/materialsystem/qparameter.cpp index 969882564..1cb13dc4e 100644 --- a/src/render/materialsystem/qparameter.cpp +++ b/src/render/materialsystem/qparameter.cpp @@ -316,16 +316,6 @@ QVariant QParameter::value() const return d->m_value; } -Qt3DCore::QNodeCreatedChangeBasePtr QParameter::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QParameter); - data.name = d->m_name; - data.backendValue = d->m_backendValue; - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/materialsystem/qparameter.h b/src/render/materialsystem/qparameter.h index 8d56bcbe7..ee2237352 100644 --- a/src/render/materialsystem/qparameter.h +++ b/src/render/materialsystem/qparameter.h @@ -79,7 +79,6 @@ protected: private: Q_DECLARE_PRIVATE(QParameter) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/materialsystem/qrenderpass.cpp b/src/render/materialsystem/qrenderpass.cpp index dcb831b13..83a6e8255 100644 --- a/src/render/materialsystem/qrenderpass.cpp +++ b/src/render/materialsystem/qrenderpass.cpp @@ -274,7 +274,7 @@ void QRenderPass::addFilterKey(QFilterKey *filterKey) if (!filterKey->parent()) filterKey->setParent(this); - d->updateNode(filterKey, "filterKeys", Qt3DCore::PropertyValueAdded); + d->update(); } } @@ -285,7 +285,7 @@ void QRenderPass::removeFilterKey(QFilterKey *filterKey) { Q_ASSERT(filterKey); Q_D(QRenderPass); - d->updateNode(filterKey, "filterKeys", Qt3DCore::PropertyValueRemoved); + d->update(); d->m_filterKeyList.removeOne(filterKey); // Remove bookkeeping connection d->unregisterDestructionHelper(filterKey); @@ -322,7 +322,7 @@ void QRenderPass::addRenderState(QRenderState *state) if (!state->parent()) state->setParent(this); - d->updateNode(state, "renderState", Qt3DCore::PropertyValueAdded); + d->update(); } } @@ -333,7 +333,7 @@ void QRenderPass::removeRenderState(QRenderState *state) { Q_ASSERT(state); Q_D(QRenderPass); - d->updateNode(state, "renderState", Qt3DCore::PropertyValueRemoved); + d->update(); d->m_renderStates.removeOne(state); // Remove bookkeeping connection d->unregisterDestructionHelper(state); @@ -369,7 +369,7 @@ void QRenderPass::addParameter(QParameter *parameter) if (!parameter->parent()) parameter->setParent(this); - d->updateNode(parameter, "parameter", Qt3DCore::PropertyValueAdded); + d->update(); } } @@ -380,7 +380,7 @@ void QRenderPass::removeParameter(QParameter *parameter) { Q_ASSERT(parameter); Q_D(QRenderPass); - d->updateNode(parameter, "parameter", Qt3DCore::PropertyValueRemoved); + d->update(); d->m_parameters.removeOne(parameter); // Remove bookkeeping connection d->unregisterDestructionHelper(parameter); @@ -395,18 +395,6 @@ ParameterList QRenderPass::parameters() const return d->m_parameters; } -Qt3DCore::QNodeCreatedChangeBasePtr QRenderPass::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QRenderPass); - data.filterKeyIds = qIdsForNodes(d->m_filterKeyList); - data.parameterIds = qIdsForNodes(d->m_parameters); - data.renderStateIds = qIdsForNodes(d->m_renderStates); - data.shaderId = qIdForNode(d->m_shader); - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/materialsystem/qrenderpass.h b/src/render/materialsystem/qrenderpass.h index b82a0d973..71cd9b989 100644 --- a/src/render/materialsystem/qrenderpass.h +++ b/src/render/materialsystem/qrenderpass.h @@ -93,7 +93,6 @@ protected: private: Q_DECLARE_PRIVATE(QRenderPass) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } diff --git a/src/render/materialsystem/qshaderdata.cpp b/src/render/materialsystem/qshaderdata.cpp index b70b99846..34aee02fb 100644 --- a/src/render/materialsystem/qshaderdata.cpp +++ b/src/render/materialsystem/qshaderdata.cpp @@ -131,38 +131,6 @@ bool QShaderData::event(QEvent *event) return QComponent::event(event); } -Qt3DCore::QNodeCreatedChangeBasePtr QShaderData::createNodeCreationChange() const -{ - Q_D(const QShaderData); - - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - QShaderDataData &data = creationChange->data; - - data.propertyReader = d->m_propertyReader; - - const QMetaObject *metaObj = metaObject(); - const int propertyOffset = QShaderData::staticMetaObject.propertyOffset(); - const int propertyCount = metaObj->propertyCount(); - - const auto propertyNames = dynamicPropertyNames(); - data.properties.reserve(propertyCount - propertyOffset + propertyNames.size()); - - for (int i = propertyOffset; i < propertyCount; ++i) { - const QMetaProperty pro = metaObj->property(i); - if (pro.isWritable()) { - data.properties.push_back(qMakePair(pro.name(), - propertyReader()->readProperty(property(pro.name())))); - } - } - - for (const QByteArray &propertyName : propertyNames) { - data.properties.push_back(qMakePair(propertyName, - propertyReader()->readProperty(property(propertyName)))); - } - - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/materialsystem/qshaderdata.h b/src/render/materialsystem/qshaderdata.h index eda009c6a..4a851172c 100644 --- a/src/render/materialsystem/qshaderdata.h +++ b/src/render/materialsystem/qshaderdata.h @@ -75,7 +75,6 @@ protected: private: Q_DECLARE_PRIVATE(QShaderData) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/materialsystem/qshaderimage.cpp b/src/render/materialsystem/qshaderimage.cpp index 508cf44f2..4b1f9bafc 100644 --- a/src/render/materialsystem/qshaderimage.cpp +++ b/src/render/materialsystem/qshaderimage.cpp @@ -971,21 +971,6 @@ void QShaderImage::setFormat(QShaderImage::ImageFormat format) Q_EMIT formatChanged(format); } -Qt3DCore::QNodeCreatedChangeBasePtr Qt3DRender::QShaderImage::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - QShaderImageData &data = creationChange->data; - Q_D(const QShaderImage); - data.textureId = Qt3DCore::qIdForNode(d->m_texture); - data.layer = d->m_layer; - data.mipLevel = d->m_mipLevel; - data.access = d->m_access; - data.format = d->m_format; - data.layered = d->m_layered; - return creationChange; - -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/materialsystem/qshaderimage.h b/src/render/materialsystem/qshaderimage.h index e1f5459d2..cc9d3c728 100644 --- a/src/render/materialsystem/qshaderimage.h +++ b/src/render/materialsystem/qshaderimage.h @@ -160,7 +160,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QShaderImage) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/materialsystem/qshaderprogram.cpp b/src/render/materialsystem/qshaderprogram.cpp index 49117dd98..8281d2707 100644 --- a/src/render/materialsystem/qshaderprogram.cpp +++ b/src/render/materialsystem/qshaderprogram.cpp @@ -39,7 +39,6 @@ #include "qshaderprogram.h" #include "qshaderprogram_p.h" -#include #include #include #include @@ -391,21 +390,6 @@ QShaderProgram::QShaderProgram(QShaderProgramPrivate &dd, QNode *parent) { } -/*! - Posts a scene change with parameter \a change. -*/ -void QShaderProgram::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) -{ - Q_D(QShaderProgram); - if (change->type() == Qt3DCore::PropertyUpdated) { - const Qt3DCore::QPropertyUpdatedChangePtr e = qSharedPointerCast(change); - if (e->propertyName() == QByteArrayLiteral("log")) - d->setLog(e->value().toString()); - else if (e->propertyName() == QByteArrayLiteral("status")) - d->setStatus(static_cast(e->value().toInt())); - } -} - /*! \qmlproperty string ShaderProgram::vertexShaderCode @@ -729,21 +713,6 @@ QByteArray QShaderProgram::loadSource(const QUrl &sourceUrl) return QShaderProgramPrivate::deincludify(Qt3DRender::QUrlHelper::urlToLocalFileOrQrc(sourceUrl)); } -Qt3DCore::QNodeCreatedChangeBasePtr QShaderProgram::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QShaderProgram); - data.vertexShaderCode = d->m_vertexShaderCode; - data.tessellationControlShaderCode = d->m_tessControlShaderCode; - data.tessellationEvaluationShaderCode = d->m_tessEvalShaderCode; - data.geometryShaderCode = d->m_geometryShaderCode; - data.fragmentShaderCode = d->m_fragmentShaderCode; - data.computeShaderCode = d->m_computeShaderCode; - data.format = d->m_format; - return creationChange; -} - } // of namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/materialsystem/qshaderprogram.h b/src/render/materialsystem/qshaderprogram.h index 1fc40a216..3468ba8d2 100644 --- a/src/render/materialsystem/qshaderprogram.h +++ b/src/render/materialsystem/qshaderprogram.h @@ -129,11 +129,9 @@ Q_SIGNALS: protected: explicit QShaderProgram(QShaderProgramPrivate &dd, Qt3DCore::QNode *parent = nullptr); - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; private: Q_DECLARE_PRIVATE(QShaderProgram) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } diff --git a/src/render/materialsystem/qshaderprogrambuilder.cpp b/src/render/materialsystem/qshaderprogrambuilder.cpp index 7f98fbf5e..60685d73c 100644 --- a/src/render/materialsystem/qshaderprogrambuilder.cpp +++ b/src/render/materialsystem/qshaderprogrambuilder.cpp @@ -40,7 +40,6 @@ #include "qshaderprogrambuilder.h" #include "qshaderprogrambuilder_p.h" #include "qshaderprogram.h" -#include #include #include #include @@ -135,11 +134,6 @@ QShaderProgramBuilder::QShaderProgramBuilder(QShaderProgramBuilderPrivate &dd, Q { } -// TODO Unused remove in Qt6 -void QShaderProgramBuilder::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &) -{ -} - /*! \qmlproperty string ShaderProgramBuilder::shaderProgram @@ -465,22 +459,6 @@ QByteArray QShaderProgramBuilder::computeShaderCode() const return d->m_computeShaderCode; } -Qt3DCore::QNodeCreatedChangeBasePtr QShaderProgramBuilder::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QShaderProgramBuilder); - data.shaderProgramId = d->m_shaderProgram ? d->m_shaderProgram->id() : Qt3DCore::QNodeId(); - data.enabledLayers = d->m_enabledLayers; - data.vertexShaderGraph = d->m_vertexShaderGraph; - data.tessellationControlShaderGraph = d->m_tessControlShaderGraph; - data.tessellationEvaluationShaderGraph = d->m_tessEvalShaderGraph; - data.geometryShaderGraph = d->m_geometryShaderGraph; - data.fragmentShaderGraph = d->m_fragmentShaderGraph; - data.computeShaderGraph = d->m_computeShaderGraph; - return creationChange; -} - } // of namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/materialsystem/qshaderprogrambuilder.h b/src/render/materialsystem/qshaderprogrambuilder.h index 48e189c8c..fa8f77ea0 100644 --- a/src/render/materialsystem/qshaderprogrambuilder.h +++ b/src/render/materialsystem/qshaderprogrambuilder.h @@ -117,12 +117,9 @@ Q_SIGNALS: protected: explicit QShaderProgramBuilder(QShaderProgramBuilderPrivate &dd, Qt3DCore::QNode *parent = nullptr); - // TODO Unused remove in Qt6 - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; private: Q_DECLARE_PRIVATE(QShaderProgramBuilder) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } diff --git a/src/render/materialsystem/qtechnique.cpp b/src/render/materialsystem/qtechnique.cpp index a9b7ca82b..088716fb9 100644 --- a/src/render/materialsystem/qtechnique.cpp +++ b/src/render/materialsystem/qtechnique.cpp @@ -258,7 +258,7 @@ void QTechnique::addFilterKey(QFilterKey *filterKey) if (!filterKey->parent()) filterKey->setParent(this); - d->updateNode(filterKey, "filterKeys", Qt3DCore::PropertyValueAdded); + d->update(); } } @@ -269,7 +269,7 @@ void QTechnique::removeFilterKey(QFilterKey *filterKey) { Q_ASSERT(filterKey); Q_D(QTechnique); - d->updateNode(filterKey, "filterKeys", Qt3DCore::PropertyValueRemoved); + d->update(); d->m_filterKeys.removeOne(filterKey); // Remove bookkeeping connection d->unregisterDestructionHelper(filterKey); @@ -305,7 +305,7 @@ void QTechnique::addParameter(QParameter *parameter) if (!parameter->parent()) parameter->setParent(this); - d->updateNode(parameter, "parameter", Qt3DCore::PropertyValueAdded); + d->update(); } } @@ -316,7 +316,7 @@ void QTechnique::removeParameter(QParameter *parameter) { Q_ASSERT(parameter); Q_D(QTechnique); - d->updateNode(parameter, "parameter", Qt3DCore::PropertyValueRemoved); + d->update(); d->m_parameters.removeOne(parameter); // Remove bookkeeping connection d->unregisterDestructionHelper(parameter); @@ -342,7 +342,7 @@ void QTechnique::addRenderPass(QRenderPass *pass) if (!pass->parent()) pass->setParent(this); - d->updateNode(pass, "pass", Qt3DCore::PropertyValueAdded); + d->update(); } } @@ -353,7 +353,7 @@ void QTechnique::removeRenderPass(QRenderPass *pass) { Q_ASSERT(pass); Q_D(QTechnique); - d->updateNode(pass, "pass", Qt3DCore::PropertyValueAdded); + d->update(); d->m_renderPasses.removeOne(pass); // Remove bookkeeping connection d->unregisterDestructionHelper(pass); @@ -389,20 +389,6 @@ const QGraphicsApiFilter *QTechnique::graphicsApiFilter() const return &d->m_graphicsApiFilter; } -Qt3DCore::QNodeCreatedChangeBasePtr QTechnique::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - QTechniqueData &data = creationChange->data; - - Q_D(const QTechnique); - data.graphicsApiFilterData = QGraphicsApiFilterPrivate::get(const_cast(&d->m_graphicsApiFilter))->m_data; - data.filterKeyIds = qIdsForNodes(d->m_filterKeys); - data.parameterIds = qIdsForNodes(d->m_parameters); - data.renderPassIds = qIdsForNodes(d->m_renderPasses); - - return creationChange; -} - } // of namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/materialsystem/qtechnique.h b/src/render/materialsystem/qtechnique.h index b9887b6a2..1246d79cf 100644 --- a/src/render/materialsystem/qtechnique.h +++ b/src/render/materialsystem/qtechnique.h @@ -85,7 +85,6 @@ protected: private: Q_DECLARE_PRIVATE(QTechnique) Q_PRIVATE_SLOT(d_func(), void _q_graphicsApiFilterChanged()) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } diff --git a/src/render/materialsystem/shader.cpp b/src/render/materialsystem/shader.cpp index 94e30a2c0..ff56a74e9 100644 --- a/src/render/materialsystem/shader.cpp +++ b/src/render/materialsystem/shader.cpp @@ -48,7 +48,6 @@ #include #include #include -#include #include QT_BEGIN_NAMESPACE @@ -83,8 +82,8 @@ const int Shader::skinningPaletteNameId = StringToInt::lookupId(QLatin1String("s Shader::Shader() : BackendNode(ReadWrite) - , m_requiresFrontendSync(false) , m_status(QShaderProgram::NotReady) + , m_requiresFrontendSync(false) , m_format(QShaderProgram::GLSL) , m_dirty(false) { @@ -190,9 +189,9 @@ ShaderFunctor::ShaderFunctor(AbstractRenderer *renderer, ShaderManager *manager) { } -QBackendNode *ShaderFunctor::create(const QNodeCreatedChangeBasePtr &change) const +QBackendNode *ShaderFunctor::create(const QNodeId id) const { - Shader *backend = m_shaderManager->getOrCreateResource(change->subjectId()); + Shader *backend = m_shaderManager->getOrCreateResource(id); backend->setRenderer(m_renderer); return backend; } diff --git a/src/render/materialsystem/shader_p.h b/src/render/materialsystem/shader_p.h index 5eccc7510..8f78163be 100644 --- a/src/render/materialsystem/shader_p.h +++ b/src/render/materialsystem/shader_p.h @@ -129,7 +129,6 @@ private: QShaderProgram::Status m_status; QShaderProgram::Format m_format; bool m_dirty; - }; #ifndef QT_NO_DEBUG_STREAM @@ -146,7 +145,7 @@ class ShaderFunctor : public Qt3DCore::QBackendNodeMapper public: explicit ShaderFunctor(AbstractRenderer *renderer, ShaderManager *manager); - Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const final; + Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const final; Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const final; void destroy(Qt3DCore::QNodeId id) const final; diff --git a/src/render/materialsystem/shaderbuilder.cpp b/src/render/materialsystem/shaderbuilder.cpp index 7434cd901..5c933759f 100644 --- a/src/render/materialsystem/shaderbuilder.cpp +++ b/src/render/materialsystem/shaderbuilder.cpp @@ -39,8 +39,6 @@ #include "shaderbuilder_p.h" -#include - #include #include #include diff --git a/src/render/materialsystem/shaderdata.cpp b/src/render/materialsystem/shaderdata.cpp index 67c8f35f7..44a41a240 100644 --- a/src/render/materialsystem/shaderdata.cpp +++ b/src/render/materialsystem/shaderdata.cpp @@ -42,8 +42,6 @@ #include "qshaderdata_p.h" #include #include -#include -#include #include #include #include @@ -220,9 +218,9 @@ RenderShaderDataFunctor::RenderShaderDataFunctor(AbstractRenderer *renderer, Nod { } -Qt3DCore::QBackendNode *RenderShaderDataFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const +Qt3DCore::QBackendNode *RenderShaderDataFunctor::create(Qt3DCore::QNodeId id) const { - ShaderData *backend = m_managers->shaderDataManager()->getOrCreateResource(change->subjectId()); + ShaderData *backend = m_managers->shaderDataManager()->getOrCreateResource(id); backend->setManagers(m_managers); backend->setRenderer(m_renderer); return backend; diff --git a/src/render/materialsystem/shaderdata_p.h b/src/render/materialsystem/shaderdata_p.h index 5c6352eba..6fe811566 100644 --- a/src/render/materialsystem/shaderdata_p.h +++ b/src/render/materialsystem/shaderdata_p.h @@ -124,7 +124,7 @@ class RenderShaderDataFunctor : public Qt3DCore::QBackendNodeMapper public: explicit RenderShaderDataFunctor(AbstractRenderer *renderer, NodeManagers *managers); - Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const final; + Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const final; Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const final; void destroy(Qt3DCore::QNodeId id) const final; diff --git a/src/render/materialsystem/technique.cpp b/src/render/materialsystem/technique.cpp index 440d7e49c..a81d3f4f5 100644 --- a/src/render/materialsystem/technique.cpp +++ b/src/render/materialsystem/technique.cpp @@ -222,9 +222,9 @@ TechniqueFunctor::TechniqueFunctor(AbstractRenderer *renderer, NodeManagers *man { } -QBackendNode *TechniqueFunctor::create(const QNodeCreatedChangeBasePtr &change) const +QBackendNode *TechniqueFunctor::create(Qt3DCore::QNodeId id) const { - Technique *technique = m_manager->techniqueManager()->getOrCreateResource(change->subjectId()); + Technique *technique = m_manager->techniqueManager()->getOrCreateResource(id); technique->setNodeManager(m_manager); technique->setRenderer(m_renderer); return technique; diff --git a/src/render/materialsystem/technique_p.h b/src/render/materialsystem/technique_p.h index 1d0d0a9dd..057ca8fef 100644 --- a/src/render/materialsystem/technique_p.h +++ b/src/render/materialsystem/technique_p.h @@ -116,7 +116,7 @@ class TechniqueFunctor : public Qt3DCore::QBackendNodeMapper { public: explicit TechniqueFunctor(AbstractRenderer *renderer, NodeManagers *manager); - Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const override; + Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const override; Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const override; void destroy(Qt3DCore::QNodeId id) const override; private: diff --git a/src/render/picking/qabstractraycaster.cpp b/src/render/picking/qabstractraycaster.cpp index f26c67e99..535c06f27 100644 --- a/src/render/picking/qabstractraycaster.cpp +++ b/src/render/picking/qabstractraycaster.cpp @@ -40,9 +40,6 @@ #include "qabstractraycaster.h" #include "qabstractraycaster_p.h" #include -#include -#include -#include #include #include #include @@ -337,7 +334,7 @@ void QAbstractRayCaster::addLayer(QLayer *layer) if (!layer->parent()) layer->setParent(this); - d->updateNode(layer, "layer", Qt3DCore::PropertyValueAdded); + d->update(); } } @@ -348,7 +345,7 @@ void QAbstractRayCaster::removeLayer(QLayer *layer) { Q_ASSERT(layer); Q_D(QAbstractRayCaster); - d->updateNode(layer, "layer", Qt3DCore::PropertyValueRemoved); + d->update(); d->m_layers.removeOne(layer); // Remove bookkeeping connection d->unregisterDestructionHelper(layer); @@ -363,39 +360,6 @@ QVector QAbstractRayCaster::layers() const return d->m_layers; } -/*! \internal */ -void QAbstractRayCaster::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) -{ - Q_D(QAbstractRayCaster); - Qt3DCore::QPropertyUpdatedChangePtr e = qSharedPointerCast(change); - if (e->type() == Qt3DCore::PropertyUpdated) { - const QByteArray propertyName = e->propertyName(); - if (propertyName == QByteArrayLiteral("hits")) { - Hits hits = e->value().value(); - d->dispatchHits(hits); - } - } - - QComponent::sceneChangeEvent(change); -} - -/*! \internal */ -Qt3DCore::QNodeCreatedChangeBasePtr QAbstractRayCaster::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QAbstractRayCaster); - data.casterType = d->m_rayCasterType; - data.runMode = d->m_runMode; - data.origin = d->m_origin; - data.direction = d->m_direction; - data.length = d->m_length; - data.position = d->m_position; - data.filterMode = d->m_filterMode; - data.layerIds = qIdsForNodes(d->m_layers); - return creationChange; -} - } // Qt3DRender QT_END_NAMESPACE diff --git a/src/render/picking/qabstractraycaster.h b/src/render/picking/qabstractraycaster.h index 592511786..a630b3723 100644 --- a/src/render/picking/qabstractraycaster.h +++ b/src/render/picking/qabstractraycaster.h @@ -98,8 +98,6 @@ Q_SIGNALS: protected: explicit QAbstractRayCaster(QAbstractRayCasterPrivate &dd, QNode *parent = nullptr); - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; private: Q_DECLARE_PRIVATE(QAbstractRayCaster) diff --git a/src/render/picking/qobjectpicker.cpp b/src/render/picking/qobjectpicker.cpp index 4f039b361..15dc70536 100644 --- a/src/render/picking/qobjectpicker.cpp +++ b/src/render/picking/qobjectpicker.cpp @@ -292,11 +292,6 @@ void QObjectPicker::setPriority(int priority) } } -// TODO Unused remove in Qt6 -void QObjectPicker::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &) -{ -} - /*! \qmlproperty bool Qt3D.Render::ObjectPicker::dragEnabled */ @@ -478,17 +473,6 @@ void QObjectPickerPrivate::releasedEvent(QPickEvent *event) } } -Qt3DCore::QNodeCreatedChangeBasePtr QObjectPicker::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QObjectPicker); - data.hoverEnabled = d->m_hoverEnabled; - data.dragEnabled = d->m_dragEnabled; - data.priority = d->m_priority; - return creationChange; -} - } // Qt3DRender QT_END_NAMESPACE diff --git a/src/render/picking/qobjectpicker.h b/src/render/picking/qobjectpicker.h index ea65040ba..98516db76 100644 --- a/src/render/picking/qobjectpicker.h +++ b/src/render/picking/qobjectpicker.h @@ -77,10 +77,6 @@ public Q_SLOTS: void setDragEnabled(bool dragEnabled); Q_REVISION(13) void setPriority(int priority); -protected: - // TODO Unused remove in Qt6 - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; - Q_SIGNALS: void pressed(Qt3DRender::QPickEvent *pick); void released(Qt3DRender::QPickEvent *pick); @@ -96,7 +92,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QObjectPicker) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // Qt3D diff --git a/src/render/renderstates/genericstate_p.h b/src/render/renderstates/genericstate_p.h index 1d363e4fe..5770d2ca4 100644 --- a/src/render/renderstates/genericstate_p.h +++ b/src/render/renderstates/genericstate_p.h @@ -53,7 +53,6 @@ // #include -#include #include #include #include diff --git a/src/render/renderstates/qalphatest.cpp b/src/render/renderstates/qalphatest.cpp index 1e6606c02..ebc455111 100644 --- a/src/render/renderstates/qalphatest.cpp +++ b/src/render/renderstates/qalphatest.cpp @@ -40,7 +40,6 @@ #include "qalphatest.h" #include "qalphatest_p.h" -#include QT_BEGIN_NAMESPACE @@ -160,16 +159,6 @@ void QAlphaTest::setReferenceValue(float referenceValue) } } -Qt3DCore::QNodeCreatedChangeBasePtr QAlphaTest::createNodeCreationChange() const -{ - auto creationChange = QRenderStateCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QAlphaTest); - data.alphaFunction = d->m_alphaFunction; - data.referenceValue = d->m_referenceValue; - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/renderstates/qalphatest.h b/src/render/renderstates/qalphatest.h index 7ec14eaee..f34a13703 100644 --- a/src/render/renderstates/qalphatest.h +++ b/src/render/renderstates/qalphatest.h @@ -84,7 +84,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QAlphaTest) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/renderstates/qblendequation.cpp b/src/render/renderstates/qblendequation.cpp index 1f3f56f92..de7cb4a25 100644 --- a/src/render/renderstates/qblendequation.cpp +++ b/src/render/renderstates/qblendequation.cpp @@ -66,7 +66,6 @@ #include "qblendequation.h" #include "qblendequation_p.h" -#include QT_BEGIN_NAMESPACE @@ -122,14 +121,6 @@ void QBlendEquation::setBlendFunction(QBlendEquation::BlendFunction blendFunctio } } -Qt3DCore::QNodeCreatedChangeBasePtr QBlendEquation::createNodeCreationChange() const -{ - auto creationChange = QRenderStateCreatedChangePtr::create(this); - auto &data = creationChange->data; - data.blendFunction = d_func()->m_blendFunction; - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/renderstates/qblendequation.h b/src/render/renderstates/qblendequation.h index 69a06768d..17dcbfecf 100644 --- a/src/render/renderstates/qblendequation.h +++ b/src/render/renderstates/qblendequation.h @@ -78,7 +78,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QBlendEquation) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/renderstates/qblendequationarguments.cpp b/src/render/renderstates/qblendequationarguments.cpp index 94693cab9..0e8b5d9aa 100644 --- a/src/render/renderstates/qblendequationarguments.cpp +++ b/src/render/renderstates/qblendequationarguments.cpp @@ -40,7 +40,6 @@ #include "qblendequationarguments.h" #include "qblendequationarguments_p.h" -#include QT_BEGIN_NAMESPACE @@ -291,19 +290,6 @@ void QBlendEquationArguments::setBufferIndex(int bufferIndex) } } -Qt3DCore::QNodeCreatedChangeBasePtr QBlendEquationArguments::createNodeCreationChange() const -{ - auto creationChange = QRenderStateCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QBlendEquationArguments); - data.sourceRgb = d->m_sourceRgb; - data.sourceAlpha = d->m_sourceAlpha; - data.destinationRgb = d->m_destinationRgb; - data.destinationAlpha = d->m_destinationAlpha; - data.bufferIndex = d->m_bufferIndex; - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/renderstates/qblendequationarguments.h b/src/render/renderstates/qblendequationarguments.h index e454dbae5..878534816 100644 --- a/src/render/renderstates/qblendequationarguments.h +++ b/src/render/renderstates/qblendequationarguments.h @@ -117,7 +117,6 @@ protected: private: Q_DECLARE_PRIVATE(QBlendEquationArguments) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/renderstates/qclipplane.cpp b/src/render/renderstates/qclipplane.cpp index 8f67ae11c..0771e01d5 100644 --- a/src/render/renderstates/qclipplane.cpp +++ b/src/render/renderstates/qclipplane.cpp @@ -39,7 +39,6 @@ #include "qclipplane.h" #include "qclipplane_p.h" -#include QT_BEGIN_NAMESPACE @@ -164,17 +163,6 @@ void QClipPlane::setDistance(float distance) } } -Qt3DCore::QNodeCreatedChangeBasePtr QClipPlane::createNodeCreationChange() const -{ - auto creationChange = QRenderStateCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QClipPlane); - data.normal = d->m_normal; - data.distance = d->m_distance; - data.planeIndex = d->m_planeIndex; - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/renderstates/qclipplane.h b/src/render/renderstates/qclipplane.h index 94bfaa57d..3c99050a0 100644 --- a/src/render/renderstates/qclipplane.h +++ b/src/render/renderstates/qclipplane.h @@ -75,7 +75,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QClipPlane) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/renderstates/qcolormask.cpp b/src/render/renderstates/qcolormask.cpp index fde09d7b0..0e1711671 100644 --- a/src/render/renderstates/qcolormask.cpp +++ b/src/render/renderstates/qcolormask.cpp @@ -39,7 +39,6 @@ #include "qcolormask.h" #include "qcolormask_p.h" -#include QT_BEGIN_NAMESPACE @@ -183,18 +182,6 @@ void QColorMask::setAlphaMasked(bool alphaMasked) } } -Qt3DCore::QNodeCreatedChangeBasePtr QColorMask::createNodeCreationChange() const -{ - auto creationChange = QRenderStateCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QColorMask); - data.redMasked = d->m_redMasked; - data.greenMasked = d->m_greenMasked; - data.blueMasked = d->m_blueMasked; - data.alphaMasked = d->m_alphaMasked; - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/renderstates/qcolormask.h b/src/render/renderstates/qcolormask.h index 980cde5ac..75c58fb13 100644 --- a/src/render/renderstates/qcolormask.h +++ b/src/render/renderstates/qcolormask.h @@ -79,7 +79,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QColorMask) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/renderstates/qcullface.cpp b/src/render/renderstates/qcullface.cpp index 4be395464..b5138e53a 100644 --- a/src/render/renderstates/qcullface.cpp +++ b/src/render/renderstates/qcullface.cpp @@ -41,7 +41,6 @@ #include "qcullface.h" #include "qcullface_p.h" -#include QT_BEGIN_NAMESPACE @@ -190,15 +189,6 @@ void QCullFace::setMode(QCullFace::CullingMode mode) } } -Qt3DCore::QNodeCreatedChangeBasePtr QCullFace::createNodeCreationChange() const -{ - auto creationChange = QRenderStateCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QCullFace); - data.mode = d->m_mode; - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/renderstates/qcullface.h b/src/render/renderstates/qcullface.h index 053e86215..bd7aef859 100644 --- a/src/render/renderstates/qcullface.h +++ b/src/render/renderstates/qcullface.h @@ -79,7 +79,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QCullFace) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/renderstates/qdepthrange.cpp b/src/render/renderstates/qdepthrange.cpp index ec5bbce9f..e2f1c5473 100644 --- a/src/render/renderstates/qdepthrange.cpp +++ b/src/render/renderstates/qdepthrange.cpp @@ -39,7 +39,6 @@ #include "qdepthrange.h" #include "qdepthrange_p.h" -#include QT_BEGIN_NAMESPACE @@ -141,16 +140,6 @@ void QDepthRange::setFarValue(double value) } } -Qt3DCore::QNodeCreatedChangeBasePtr QDepthRange::createNodeCreationChange() const -{ - auto creationChange = QRenderStateCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QDepthRange); - data.nearValue = d->m_nearValue; - data.farValue = d->m_farValue; - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/renderstates/qdepthrange.h b/src/render/renderstates/qdepthrange.h index 9352f5e3a..fec3d0aa4 100644 --- a/src/render/renderstates/qdepthrange.h +++ b/src/render/renderstates/qdepthrange.h @@ -71,7 +71,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QDepthRange) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/renderstates/qdepthtest.cpp b/src/render/renderstates/qdepthtest.cpp index 7e67ba5ba..16b7ad588 100644 --- a/src/render/renderstates/qdepthtest.cpp +++ b/src/render/renderstates/qdepthtest.cpp @@ -40,7 +40,6 @@ #include "qdepthtest.h" #include "qdepthtest_p.h" -#include QT_BEGIN_NAMESPACE @@ -146,15 +145,6 @@ void QDepthTest::setDepthFunction(QDepthTest::DepthFunction depthFunction) } } -Qt3DCore::QNodeCreatedChangeBasePtr QDepthTest::createNodeCreationChange() const -{ - auto creationChange = QRenderStateCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QDepthTest); - data.depthFunction = d->m_depthFunction; - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/renderstates/qdepthtest.h b/src/render/renderstates/qdepthtest.h index 419c36b57..f7b463dc9 100644 --- a/src/render/renderstates/qdepthtest.h +++ b/src/render/renderstates/qdepthtest.h @@ -80,7 +80,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QDepthTest) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/renderstates/qfrontface.cpp b/src/render/renderstates/qfrontface.cpp index a814be82f..b13f901d9 100644 --- a/src/render/renderstates/qfrontface.cpp +++ b/src/render/renderstates/qfrontface.cpp @@ -40,7 +40,6 @@ #include "qfrontface.h" #include "qfrontface_p.h" -#include QT_BEGIN_NAMESPACE @@ -119,15 +118,6 @@ void QFrontFace::setDirection(QFrontFace::WindingDirection direction) } } -Qt3DCore::QNodeCreatedChangeBasePtr QFrontFace::createNodeCreationChange() const -{ - auto creationChange = QRenderStateCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QFrontFace); - data.direction = d->m_direction; - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/renderstates/qfrontface.h b/src/render/renderstates/qfrontface.h index 10cc9b422..fa7d432f3 100644 --- a/src/render/renderstates/qfrontface.h +++ b/src/render/renderstates/qfrontface.h @@ -75,7 +75,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QFrontFace) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/renderstates/qlinewidth.cpp b/src/render/renderstates/qlinewidth.cpp index f5ef04ebb..abda5ef62 100644 --- a/src/render/renderstates/qlinewidth.cpp +++ b/src/render/renderstates/qlinewidth.cpp @@ -40,8 +40,6 @@ #include "qlinewidth.h" #include "qlinewidth_p.h" -#include - QT_BEGIN_NAMESPACE namespace Qt3DRender { @@ -110,16 +108,6 @@ void QLineWidth::setSmooth(bool enabled) } } -Qt3DCore::QNodeCreatedChangeBasePtr QLineWidth::createNodeCreationChange() const -{ - auto creationChange = QRenderStateCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QLineWidth); - data.value = d->m_value; - data.smooth = d->m_smooth; - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/renderstates/qlinewidth.h b/src/render/renderstates/qlinewidth.h index 3e53a5f29..0a4b0943c 100644 --- a/src/render/renderstates/qlinewidth.h +++ b/src/render/renderstates/qlinewidth.h @@ -70,7 +70,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QLineWidth) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/renderstates/qpointsize.cpp b/src/render/renderstates/qpointsize.cpp index 10687f8f2..7e085c723 100644 --- a/src/render/renderstates/qpointsize.cpp +++ b/src/render/renderstates/qpointsize.cpp @@ -39,7 +39,6 @@ #include "qpointsize.h" #include "qpointsize_p.h" -#include QT_BEGIN_NAMESPACE @@ -137,16 +136,6 @@ void QPointSize::setValue(float size) emit valueChanged(size); } -Qt3DCore::QNodeCreatedChangeBasePtr QPointSize::createNodeCreationChange() const -{ - auto creationChange = QRenderStateCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QPointSize); - data.sizeMode = d->m_sizeMode; - data.value = d->m_value; - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/renderstates/qpointsize.h b/src/render/renderstates/qpointsize.h index 49fdd5c9c..f4f4ca96a 100644 --- a/src/render/renderstates/qpointsize.h +++ b/src/render/renderstates/qpointsize.h @@ -76,7 +76,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QPointSize) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/renderstates/qpolygonoffset.cpp b/src/render/renderstates/qpolygonoffset.cpp index 0d397f159..d310c9c01 100644 --- a/src/render/renderstates/qpolygonoffset.cpp +++ b/src/render/renderstates/qpolygonoffset.cpp @@ -39,7 +39,6 @@ #include "qpolygonoffset.h" #include "qpolygonoffset_p.h" -#include QT_BEGIN_NAMESPACE @@ -139,16 +138,6 @@ void QPolygonOffset::setDepthSteps(float depthSteps) } } -Qt3DCore::QNodeCreatedChangeBasePtr QPolygonOffset::createNodeCreationChange() const -{ - auto creationChange = QRenderStateCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QPolygonOffset); - data.scaleFactor = d->m_scaleFactor; - data.depthSteps = d->m_depthSteps; - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/renderstates/qpolygonoffset.h b/src/render/renderstates/qpolygonoffset.h index 9ba18f2e4..acd1b7013 100644 --- a/src/render/renderstates/qpolygonoffset.h +++ b/src/render/renderstates/qpolygonoffset.h @@ -71,7 +71,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QPolygonOffset) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/renderstates/qrastermode.cpp b/src/render/renderstates/qrastermode.cpp index 648872a84..2ac14470c 100644 --- a/src/render/renderstates/qrastermode.cpp +++ b/src/render/renderstates/qrastermode.cpp @@ -39,7 +39,6 @@ #include "qrastermode.h" #include "qrastermode_p.h" -#include QT_BEGIN_NAMESPACE @@ -180,16 +179,6 @@ void QRasterMode::setFaceMode(QRasterMode::FaceMode faceMode) } } -Qt3DCore::QNodeCreatedChangeBasePtr QRasterMode::createNodeCreationChange() const -{ - auto creationChange = QRenderStateCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QRasterMode); - data.rasterMode = d->m_rasterMode; - data.faceMode = d->m_faceMode; - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/renderstates/qrastermode.h b/src/render/renderstates/qrastermode.h index d460fa10c..295f92ef4 100644 --- a/src/render/renderstates/qrastermode.h +++ b/src/render/renderstates/qrastermode.h @@ -86,7 +86,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QRasterMode) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/renderstates/qrenderstate.cpp b/src/render/renderstates/qrenderstate.cpp index cd5346710..c23c45319 100644 --- a/src/render/renderstates/qrenderstate.cpp +++ b/src/render/renderstates/qrenderstate.cpp @@ -40,7 +40,6 @@ #include "qrenderstate.h" #include "qrenderstate_p.h" -#include QT_BEGIN_NAMESPACE @@ -105,12 +104,6 @@ QRenderState::QRenderState(QRenderStatePrivate &dd, QNode *parent) { } -Qt3DCore::QNodeCreatedChangeBasePtr QRenderState::createNodeCreationChange() const -{ - auto creationChange = QRenderStateCreatedChangeBasePtr::create(this); - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/renderstates/qrenderstate.h b/src/render/renderstates/qrenderstate.h index 3b7ff03bc..644701dea 100644 --- a/src/render/renderstates/qrenderstate.h +++ b/src/render/renderstates/qrenderstate.h @@ -61,7 +61,6 @@ protected: private: Q_DECLARE_PRIVATE(QRenderState) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/renderstates/qrenderstatecreatedchange.cpp b/src/render/renderstates/qrenderstatecreatedchange.cpp deleted file mode 100644 index 02989a29e..000000000 --- a/src/render/renderstates/qrenderstatecreatedchange.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qrenderstatecreatedchange_p.h" -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { - -/*! - * \internal - * \class Qt3DRender::QRenderStateCreatedChange - * \inheaderfile Qt3DRender/QRenderStateCreatedChange - * \brief The QRenderStateCreatedChange class - * \since 5.7 - * \inmodule Qt3DRender - * \ingroup renderstates - */ - -/*! \internal */ -class QRenderStateCreatedChangeBasePrivate : public Qt3DCore::QNodeCreatedChangeBasePrivate -{ -public: - QRenderStateCreatedChangeBasePrivate(const QRenderState *renderState) - : Qt3DCore::QNodeCreatedChangeBasePrivate(renderState) - , m_type(QRenderStatePrivate::get(renderState)->m_type) - { - } - - Render::StateMask m_type; -}; - -/* - * The constructor creates a new QRenderStateCreatedChangeBase::QRenderStateCreatedChangeBase - * instance with the specified \a renderState. - */ -QRenderStateCreatedChangeBase::QRenderStateCreatedChangeBase(const QRenderState *renderState) - : QNodeCreatedChangeBase(*new QRenderStateCreatedChangeBasePrivate(renderState), renderState) -{ -} - -/* - * Returns the current render state type. - */ -Render::StateMask QRenderStateCreatedChangeBase::renderStateType() const -{ - Q_D(const QRenderStateCreatedChangeBase); - return d->m_type; -} - -QT_END_NAMESPACE - -} // namespace Qt3DRender diff --git a/src/render/renderstates/qrenderstatecreatedchange_p.h b/src/render/renderstates/qrenderstatecreatedchange_p.h deleted file mode 100644 index 32c307cc3..000000000 --- a/src/render/renderstates/qrenderstatecreatedchange_p.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** 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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later 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 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DRENDER_QRENDERSTATECREATIONCHANGEBASE_H -#define QT3DRENDER_QRENDERSTATECREATIONCHANGEBASE_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DRender { - -class QRenderState; -class QRenderStateCreatedChangeBasePrivate; - -class QRenderStateCreatedChangeBase : public Qt3DCore::QNodeCreatedChangeBase -{ -public: - explicit QRenderStateCreatedChangeBase(const QRenderState *renderState); - - Render::StateMask renderStateType() const; - -private: - Q_DECLARE_PRIVATE(QRenderStateCreatedChangeBase) -}; - -typedef QSharedPointer QRenderStateCreatedChangeBasePtr; - -template -class QRenderStateCreatedChange : public QRenderStateCreatedChangeBase -{ -public: - explicit QRenderStateCreatedChange(const QRenderState *_renderState) - : QRenderStateCreatedChangeBase(_renderState) - , data() - { - } - - T data; -}; - -template -using QRenderStateCreatedChangePtr = QSharedPointer>; - -} // namespace Qt3DRender - -QT_END_NAMESPACE - -#endif // QT3DRENDER_QRENDERSTATECREATIONCHANGEBASE_H diff --git a/src/render/renderstates/qscissortest.cpp b/src/render/renderstates/qscissortest.cpp index 718978b7a..ee12d0c71 100644 --- a/src/render/renderstates/qscissortest.cpp +++ b/src/render/renderstates/qscissortest.cpp @@ -40,7 +40,6 @@ #include "qscissortest.h" #include "qscissortest_p.h" -#include QT_BEGIN_NAMESPACE @@ -188,18 +187,6 @@ void QScissorTest::setHeight(int height) } } -Qt3DCore::QNodeCreatedChangeBasePtr QScissorTest::createNodeCreationChange() const -{ - auto creationChange = QRenderStateCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QScissorTest); - data.left = d->m_left; - data.bottom = d->m_bottom; - data.width = d->m_width; - data.height = d->m_height; - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/renderstates/qscissortest.h b/src/render/renderstates/qscissortest.h index c808dc1c6..283d49728 100644 --- a/src/render/renderstates/qscissortest.h +++ b/src/render/renderstates/qscissortest.h @@ -80,7 +80,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QScissorTest) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/renderstates/qstencilmask.cpp b/src/render/renderstates/qstencilmask.cpp index 1b9b2cd10..9e664ebe2 100644 --- a/src/render/renderstates/qstencilmask.cpp +++ b/src/render/renderstates/qstencilmask.cpp @@ -39,7 +39,6 @@ #include "qstencilmask.h" #include "qstencilmask_p.h" -#include QT_BEGIN_NAMESPACE @@ -142,16 +141,6 @@ uint QStencilMask::backOutputMask() const return d->m_backOutputMask; } -Qt3DCore::QNodeCreatedChangeBasePtr QStencilMask::createNodeCreationChange() const -{ - auto creationChange = QRenderStateCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QStencilMask); - data.frontOutputMask = d->m_frontOutputMask; - data.backOutputMask = d->m_backOutputMask; - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/renderstates/qstencilmask.h b/src/render/renderstates/qstencilmask.h index 08396a86f..a16e46c54 100644 --- a/src/render/renderstates/qstencilmask.h +++ b/src/render/renderstates/qstencilmask.h @@ -70,7 +70,6 @@ Q_SIGNALS: private: Q_DECLARE_PRIVATE(QStencilMask) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/renderstates/qstenciloperation.cpp b/src/render/renderstates/qstenciloperation.cpp index 34f95c03d..d0eef1f6c 100644 --- a/src/render/renderstates/qstenciloperation.cpp +++ b/src/render/renderstates/qstenciloperation.cpp @@ -40,7 +40,6 @@ #include "qstenciloperation.h" #include "qstenciloperation_p.h" #include "qstenciloperationarguments.h" -#include QT_BEGIN_NAMESPACE @@ -148,13 +147,6 @@ QStencilOperationArguments *QStencilOperation::back() const return d->m_back; } -Qt3DCore::QNodeCreatedChangeBasePtr QStencilOperation::createNodeCreationChange() const -{ - auto creationChange = QRenderStateCreatedChangePtr::create(this); - d_func()->fillData(creationChange->data); - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/renderstates/qstenciloperation.h b/src/render/renderstates/qstenciloperation.h index 90c7da7ba..3e2cbacea 100644 --- a/src/render/renderstates/qstenciloperation.h +++ b/src/render/renderstates/qstenciloperation.h @@ -64,7 +64,6 @@ public: private: Q_DECLARE_PRIVATE(QStencilOperation) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/renderstates/qstenciltest.cpp b/src/render/renderstates/qstenciltest.cpp index 7284af140..200d4461c 100644 --- a/src/render/renderstates/qstenciltest.cpp +++ b/src/render/renderstates/qstenciltest.cpp @@ -41,7 +41,6 @@ #include "qstenciltest.h" #include "qstenciltest_p.h" #include "qstenciltestarguments.h" -#include QT_BEGIN_NAMESPACE @@ -151,13 +150,6 @@ QStencilTestArguments *QStencilTest::back() const return d->m_back; } -Qt3DCore::QNodeCreatedChangeBasePtr QStencilTest::createNodeCreationChange() const -{ - auto creationChange = QRenderStateCreatedChangePtr::create(this); - d_func()->fillData(creationChange->data); - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/renderstates/qstenciltest.h b/src/render/renderstates/qstenciltest.h index f17baa23f..1faaa524c 100644 --- a/src/render/renderstates/qstenciltest.h +++ b/src/render/renderstates/qstenciltest.h @@ -64,7 +64,6 @@ public: private: Q_DECLARE_PRIVATE(QStencilTest) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/renderstates/renderstatenode.cpp b/src/render/renderstates/renderstatenode.cpp index 3040c5aaa..cda22760b 100644 --- a/src/render/renderstates/renderstatenode.cpp +++ b/src/render/renderstates/renderstatenode.cpp @@ -36,7 +36,6 @@ #include "renderstatenode_p.h" #include -#include #include #include diff --git a/src/render/renderstates/renderstates.pri b/src/render/renderstates/renderstates.pri index 867a8c299..e4ee4695c 100644 --- a/src/render/renderstates/renderstates.pri +++ b/src/render/renderstates/renderstates.pri @@ -20,7 +20,6 @@ HEADERS += \ $$PWD/qstenciloperationarguments.h \ $$PWD/qstenciltest.h \ $$PWD/qstenciltestarguments.h \ - $$PWD/qrenderstatecreatedchange_p.h \ $$PWD/renderstates_p.h \ $$PWD/qpointsize.h \ $$PWD/qseamlesscubemap.h \ @@ -79,7 +78,6 @@ SOURCES += \ $$PWD/qseamlesscubemap.cpp \ $$PWD/qnodepthmask.cpp \ $$PWD/qlinewidth.cpp \ - $$PWD/qrenderstatecreatedchange.cpp \ $$PWD/renderstatenode.cpp \ $$PWD/statevariant.cpp \ $$PWD/qmultisampleantialiasing.cpp \ diff --git a/src/render/texture/qabstracttexture.cpp b/src/render/texture/qabstracttexture.cpp index 2e7fd0f63..961c74cfc 100644 --- a/src/render/texture/qabstracttexture.cpp +++ b/src/render/texture/qabstracttexture.cpp @@ -40,9 +40,6 @@ #include "qabstracttexture.h" #include "qabstracttexture_p.h" #include -#include -#include -#include QT_BEGIN_NAMESPACE @@ -780,7 +777,7 @@ void QAbstractTexture::addTextureImage(QAbstractTextureImage *textureImage) if (!textureImage->parent()) textureImage->setParent(this); - d->updateNode(textureImage, "textureImage", PropertyValueAdded); + d->update(); } } @@ -791,7 +788,7 @@ void QAbstractTexture::removeTextureImage(QAbstractTextureImage *textureImage) { Q_ASSERT(textureImage); Q_D(QAbstractTexture); - d->updateNode(textureImage, "textureImage", PropertyValueRemoved); + d->update(); d->m_textureImages.removeOne(textureImage); // Remove bookkeeping connection d->unregisterDestructionHelper(textureImage); @@ -1112,80 +1109,6 @@ void QAbstractTexture::updateData(const QTextureDataUpdate &update) d->update(); } -Qt3DCore::QNodeCreatedChangeBasePtr QAbstractTexture::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QAbstractTexture); - data.target = d->m_target; - data.format = d->m_format; - data.width = d->m_width; - data.height = d->m_height; - data.depth = d->m_depth; - data.autoMipMap = d->m_autoMipMap; - data.minFilter = d->m_minFilter; - data.magFilter = d->m_magFilter; - data.wrapModeX = d->m_wrapMode.x(); - data.wrapModeY = d->m_wrapMode.y(); - data.wrapModeZ = d->m_wrapMode.z(); - data.maximumAnisotropy = d->m_maximumAnisotropy; - data.comparisonFunction = d->m_comparisonFunction; - data.comparisonMode = d->m_comparisonMode; - data.textureImageIds = qIdsForNodes(d->m_textureImages); - data.layers = d->m_layers; - data.samples = d->m_samples; - data.dataFunctor = d->m_dataFunctor; - data.sharedTextureId = d->m_sharedTextureId; - data.initialDataUpdates = d->m_pendingDataUpdates; - return creationChange; -} - -/*! - A function for receiving and processing a \a change. -*/ -void QAbstractTexture::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) -{ - switch (change->type()) { - case PropertyUpdated: { - Qt3DCore::QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast(change); - if (propertyChange->propertyName() == QByteArrayLiteral("width")) { - bool blocked = blockNotifications(true); - setWidth(propertyChange->value().toInt()); - blockNotifications(blocked); - } else if (propertyChange->propertyName() == QByteArrayLiteral("height")) { - bool blocked = blockNotifications(true); - setHeight(propertyChange->value().toInt()); - blockNotifications(blocked); - } else if (propertyChange->propertyName() == QByteArrayLiteral("depth")) { - bool blocked = blockNotifications(true); - setDepth(propertyChange->value().toInt()); - blockNotifications(blocked); - } else if (propertyChange->propertyName() == QByteArrayLiteral("layers")) { - bool blocked = blockNotifications(true); - setLayers(propertyChange->value().toInt()); - blockNotifications(blocked); - } else if (propertyChange->propertyName() == QByteArrayLiteral("format")) { - bool blocked = blockNotifications(true); - setFormat(static_cast(propertyChange->value().toInt())); - blockNotifications(blocked); - } else if (propertyChange->propertyName() == QByteArrayLiteral("status")) { - bool blocked = blockNotifications(true); - setStatus(static_cast(propertyChange->value().toInt())); - blockNotifications(blocked); - } else if (propertyChange->propertyName() == QByteArrayLiteral("handleType")) { - setHandleType(static_cast(propertyChange->value().toInt())); - } else if (propertyChange->propertyName() == QByteArrayLiteral("handle")) { - setHandle(propertyChange->value()); - } - // TODO handle target changes, it's a CONSTANT property but can be affected by loader - break; - } - default: - break; - } -} - - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/texture/qabstracttexture.h b/src/render/texture/qabstracttexture.h index 2512d0786..3080ec3dc 100644 --- a/src/render/texture/qabstracttexture.h +++ b/src/render/texture/qabstracttexture.h @@ -348,7 +348,6 @@ protected: explicit QAbstractTexture(Qt3DCore::QNode *parent = nullptr); explicit QAbstractTexture(Target target, Qt3DCore::QNode *parent = nullptr); explicit QAbstractTexture(QAbstractTexturePrivate &dd, Qt3DCore::QNode *parent = nullptr); - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; // TO DO Qt6, should be on private class void setStatus(Status status); @@ -357,7 +356,6 @@ protected: private: Q_DECLARE_PRIVATE(QAbstractTexture) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/texture/qabstracttextureimage.cpp b/src/render/texture/qabstracttextureimage.cpp index 6f68221fd..6ff84a6fc 100644 --- a/src/render/texture/qabstracttextureimage.cpp +++ b/src/render/texture/qabstracttextureimage.cpp @@ -269,18 +269,6 @@ QAbstractTextureImage::QAbstractTextureImage(QAbstractTextureImagePrivate &dd, Q { } -Qt3DCore::QNodeCreatedChangeBasePtr QAbstractTextureImage::createNodeCreationChange() const -{ - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - Q_D(const QAbstractTextureImage); - data.mipLevel = d->m_mipLevel; - data.layer = d->m_layer; - data.face = d->m_face; - data.generator = dataGenerator(); - return creationChange; -} - } // namespace Qt3DRender QT_END_NAMESPACE diff --git a/src/render/texture/qabstracttextureimage.h b/src/render/texture/qabstracttextureimage.h index e072a26dc..75fe6c12e 100644 --- a/src/render/texture/qabstracttextureimage.h +++ b/src/render/texture/qabstracttextureimage.h @@ -80,7 +80,6 @@ protected: private: Q_DECLARE_PRIVATE(QAbstractTextureImage) - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; }; } // namespace Qt3DRender diff --git a/src/render/texture/qtextureimage.cpp b/src/render/texture/qtextureimage.cpp index b4e9ed46f..c2d2308af 100644 --- a/src/render/texture/qtextureimage.cpp +++ b/src/render/texture/qtextureimage.cpp @@ -41,7 +41,6 @@ #include "qtextureimage_p.h" #include "qtexture_p.h" #include "qabstracttextureimage_p.h" -#include #include #include @@ -259,18 +258,6 @@ QTextureImageDataGeneratorPtr QTextureImage::dataGenerator() const return QTextureImageDataGeneratorPtr(new QImageTextureDataFunctor(source(), isMirrored())); } -/*! - Sets the scene change event to \a change. - \param change - */ -void QTextureImage::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) -{ - Qt3DCore::QPropertyUpdatedChangePtr e = qSharedPointerCast(change); - - if (e->propertyName() == QByteArrayLiteral("status")) - setStatus(static_cast(e->value().toInt())); -} - /* The constructor creates a new QImageTextureDataFunctor::QImageTextureDataFunctor instance with the specified \a url. diff --git a/src/render/texture/qtextureimage.h b/src/render/texture/qtextureimage.h index 7d08c8e6e..9097a54ab 100644 --- a/src/render/texture/qtextureimage.h +++ b/src/render/texture/qtextureimage.h @@ -82,7 +82,7 @@ Q_SIGNALS: void mirroredChanged(bool mirrored); protected: - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; + // TO DO Qt6 -> should be on private class void setStatus(Status status); private: diff --git a/src/render/texture/texture.cpp b/src/render/texture/texture.cpp index dab037568..db9758a97 100644 --- a/src/render/texture/texture.cpp +++ b/src/render/texture/texture.cpp @@ -42,9 +42,6 @@ #include #include #include -#include -#include -#include #include #include @@ -173,7 +170,7 @@ void Texture::syncFromFrontEnd(const QNode *frontEnd, bool firstTime) } } -// Called by sceneChangeEvent or TextureDownloadRequest (both in AspectThread context) +// Called by syncFromFrontend or TextureDownloadRequest (both in AspectThread context) void Texture::setDataGenerator(const QTextureGeneratorPtr &generator) { m_dataFunctor = generator; @@ -190,43 +187,6 @@ bool Texture::isValid(TextureImageManager *manager) const return true; } -void Texture::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) -{ - const auto typedChange = qSharedPointerCast>(change); - const auto &data = typedChange->data; - - m_properties.target = data.target; - m_properties.format = data.format; - m_properties.width = data.width; - m_properties.height = data.height; - m_properties.depth = data.depth; - m_properties.generateMipMaps = data.autoMipMap; - m_properties.layers = data.layers; - m_properties.samples = data.samples; - m_parameters.minificationFilter = data.minFilter; - m_parameters.magnificationFilter = data.magFilter; - m_parameters.wrapModeX = data.wrapModeX; - m_parameters.wrapModeY = data.wrapModeY; - m_parameters.wrapModeZ = data.wrapModeZ; - m_parameters.maximumAnisotropy = data.maximumAnisotropy; - m_parameters.comparisonFunction = data.comparisonFunction; - m_parameters.comparisonMode = data.comparisonMode; - m_dataFunctor = data.dataFunctor; - m_sharedTextureId = data.sharedTextureId; - - m_textureImageIds = data.textureImageIds; - if (m_textureImageIds.size()) - addDirtyFlag(DirtyImageGenerators); - - const QVector initialDataUpdates = data.initialDataUpdates; - for (const QTextureDataUpdate &initialUpdate : initialDataUpdates) - addTextureDataUpdate(initialUpdate); - - addDirtyFlag(DirtyFlags(DirtyImageGenerators|DirtyProperties|DirtyParameters)); - if (m_sharedTextureId > 0) - addDirtyFlag(DirtySharedTextureId); -} - void Texture::addTextureDataUpdate(const QTextureDataUpdate &update) { m_pendingTextureDataUpdates.push_back(update); @@ -241,14 +201,14 @@ TextureFunctor::TextureFunctor(AbstractRenderer *renderer, { } -Qt3DCore::QBackendNode *TextureFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const +Qt3DCore::QBackendNode *TextureFunctor::create(Qt3DCore::QNodeId id) const { - Texture *backend = m_textureNodeManager->getOrCreateResource(change->subjectId()); + Texture *backend = m_textureNodeManager->getOrCreateResource(id); backend->setRenderer(m_renderer); // Remove id from cleanupList if for some reason we were in the dirty list of texture // (Can happen when a node destroyed is followed by a node created change // in the same loop, when changing parent for instance) - m_textureNodeManager->removeTextureIdToCleanup(change->subjectId()); + m_textureNodeManager->removeTextureIdToCleanup(id); return backend; } diff --git a/src/render/texture/texture_p.h b/src/render/texture/texture_p.h index 61011bb68..125b67b83 100644 --- a/src/render/texture/texture_p.h +++ b/src/render/texture/texture_p.h @@ -172,8 +172,6 @@ public: void setDataGenerator(const QTextureGeneratorPtr &generator); bool isValid(TextureImageManager *manager) const; private: - void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) final; - DirtyFlags m_dirty; TextureProperties m_properties; TextureParameters m_parameters; @@ -191,7 +189,7 @@ class Q_AUTOTEST_EXPORT TextureFunctor : public Qt3DCore::QBackendNodeMapper public: explicit TextureFunctor(AbstractRenderer *renderer, TextureManager *textureNodeManager); - Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const final; + Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const final; Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const final; void destroy(Qt3DCore::QNodeId id) const final; diff --git a/src/render/texture/textureimage.cpp b/src/render/texture/textureimage.cpp index 25001b9df..ee28b34c4 100644 --- a/src/render/texture/textureimage.cpp +++ b/src/render/texture/textureimage.cpp @@ -118,9 +118,9 @@ TextureImageFunctor::TextureImageFunctor(AbstractRenderer *renderer, { } -Qt3DCore::QBackendNode *TextureImageFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const +Qt3DCore::QBackendNode *TextureImageFunctor::create(Qt3DCore::QNodeId id) const { - TextureImage *backend = m_textureImageManager->getOrCreateResource(change->subjectId()); + TextureImage *backend = m_textureImageManager->getOrCreateResource(id); backend->setRenderer(m_renderer); return backend; } diff --git a/src/render/texture/textureimage_p.h b/src/render/texture/textureimage_p.h index 42ef242a7..72b5e67b4 100644 --- a/src/render/texture/textureimage_p.h +++ b/src/render/texture/textureimage_p.h @@ -100,7 +100,7 @@ public: explicit TextureImageFunctor(AbstractRenderer *renderer, TextureImageManager *textureImageManager); - Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const final; + Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const final; Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const final; void destroy(Qt3DCore::QNodeId id) const final; diff --git a/tests/auto/animation/animationclip/tst_animationclip.cpp b/tests/auto/animation/animationclip/tst_animationclip.cpp index d28a8fc58..3860e7726 100644 --- a/tests/auto/animation/animationclip/tst_animationclip.cpp +++ b/tests/auto/animation/animationclip/tst_animationclip.cpp @@ -33,7 +33,6 @@ #include #include #include -#include using namespace Qt3DAnimation::Animation; diff --git a/tests/auto/animation/animationutils/tst_animationutils.cpp b/tests/auto/animation/animationutils/tst_animationutils.cpp index 05558192d..0ee455daf 100644 --- a/tests/auto/animation/animationutils/tst_animationutils.cpp +++ b/tests/auto/animation/animationutils/tst_animationutils.cpp @@ -46,7 +46,7 @@ #include #include -#include +#include using namespace Qt3DAnimation::Animation; diff --git a/tests/auto/animation/blendedclipanimator/tst_blendedclipanimator.cpp b/tests/auto/animation/blendedclipanimator/tst_blendedclipanimator.cpp index fb741050b..6c99579c2 100644 --- a/tests/auto/animation/blendedclipanimator/tst_blendedclipanimator.cpp +++ b/tests/auto/animation/blendedclipanimator/tst_blendedclipanimator.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include diff --git a/tests/auto/animation/channelmapper/tst_channelmapper.cpp b/tests/auto/animation/channelmapper/tst_channelmapper.cpp index ad9f3c423..8b75b0a52 100644 --- a/tests/auto/animation/channelmapper/tst_channelmapper.cpp +++ b/tests/auto/animation/channelmapper/tst_channelmapper.cpp @@ -38,7 +38,7 @@ #include #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_ChannelMapper : public Qt3DCore::QBackendNodeTester { diff --git a/tests/auto/animation/channelmapping/tst_channelmapping.cpp b/tests/auto/animation/channelmapping/tst_channelmapping.cpp index 26a57449d..9bee116d4 100644 --- a/tests/auto/animation/channelmapping/tst_channelmapping.cpp +++ b/tests/auto/animation/channelmapping/tst_channelmapping.cpp @@ -39,7 +39,7 @@ #include #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_TargetEntity : public Qt3DCore::QEntity { diff --git a/tests/auto/animation/clipanimator/tst_clipanimator.cpp b/tests/auto/animation/clipanimator/tst_clipanimator.cpp index 5eccb0432..ce39f6469 100644 --- a/tests/auto/animation/clipanimator/tst_clipanimator.cpp +++ b/tests/auto/animation/clipanimator/tst_clipanimator.cpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include class tst_ClipAnimator: public Qt3DCore::QBackendNodeTester { diff --git a/tests/auto/animation/clipblendnode/tst_clipblendnode.cpp b/tests/auto/animation/clipblendnode/tst_clipblendnode.cpp index c8649a692..62d57206d 100644 --- a/tests/auto/animation/clipblendnode/tst_clipblendnode.cpp +++ b/tests/auto/animation/clipblendnode/tst_clipblendnode.cpp @@ -131,7 +131,7 @@ private Q_SLOTS: ClipBlendNodeManager manager; TestClipBlendNode backendClipBlendNode; backendClipBlendNode.setClipBlendNodeManager(&manager); - simulateInitialization(&clipBlendNode, &backendClipBlendNode); + simulateInitializationSync(&clipBlendNode, &backendClipBlendNode); // THEN QCOMPARE(backendClipBlendNode.isEnabled(), true); @@ -146,7 +146,7 @@ private Q_SLOTS: TestClipBlendNode backendClipBlendNode; clipBlendNode.setEnabled(false); backendClipBlendNode.setClipBlendNodeManager(&manager); - simulateInitialization(&clipBlendNode, &backendClipBlendNode); + simulateInitializationSync(&clipBlendNode, &backendClipBlendNode); // THEN QCOMPARE(backendClipBlendNode.peerId(), clipBlendNode.id()); diff --git a/tests/auto/animation/clock/tst_clock.cpp b/tests/auto/animation/clock/tst_clock.cpp index 03be85613..4cc397661 100644 --- a/tests/auto/animation/clock/tst_clock.cpp +++ b/tests/auto/animation/clock/tst_clock.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include class tst_Clock: public Qt3DCore::QBackendNodeTester { diff --git a/tests/auto/animation/findrunningclipanimatorsjob/tst_findrunningclipanimatorsjob.cpp b/tests/auto/animation/findrunningclipanimatorsjob/tst_findrunningclipanimatorsjob.cpp index baebf8e46..bfcaae776 100644 --- a/tests/auto/animation/findrunningclipanimatorsjob/tst_findrunningclipanimatorsjob.cpp +++ b/tests/auto/animation/findrunningclipanimatorsjob/tst_findrunningclipanimatorsjob.cpp @@ -41,7 +41,7 @@ #include #include #include -#include +#include using namespace Qt3DAnimation::Animation; diff --git a/tests/auto/animation/qadditiveclipblend/tst_qadditiveclipblend.cpp b/tests/auto/animation/qadditiveclipblend/tst_qadditiveclipblend.cpp index 41f6b268a..edf147d88 100644 --- a/tests/auto/animation/qadditiveclipblend/tst_qadditiveclipblend.cpp +++ b/tests/auto/animation/qadditiveclipblend/tst_qadditiveclipblend.cpp @@ -33,10 +33,7 @@ #include #include #include -#include -#include -#include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QAdditiveClipBlend : public QObject { @@ -125,97 +122,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - Qt3DAnimation::QAdditiveClipBlend addBlend; - Qt3DAnimation::QAdditiveClipBlend baseClip; - Qt3DAnimation::QAdditiveClipBlend additiveClip; - - addBlend.setBaseClip(&baseClip); - addBlend.setAdditiveClip(&additiveClip); - addBlend.setAdditiveFactor(0.8f); - - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&addBlend); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 3); // 1 + 2 clips - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DAnimation::QAdditiveClipBlendData cloneData = creationChangeData->data; - - QCOMPARE(addBlend.additiveFactor(), cloneData.additiveFactor); - QCOMPARE(addBlend.id(), creationChangeData->subjectId()); - QCOMPARE(addBlend.isEnabled(), true); - QCOMPARE(addBlend.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(addBlend.metaObject(), creationChangeData->metaObject()); - QCOMPARE(cloneData.baseClipId, baseClip.id()); - QCOMPARE(cloneData.additiveClipId, additiveClip.id()); - } - - // WHEN - addBlend.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&addBlend); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 3); // 1 + 2 clips - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DAnimation::QAdditiveClipBlendData cloneData = creationChangeData->data; - - QCOMPARE(addBlend.additiveFactor(), cloneData.additiveFactor); - QCOMPARE(addBlend.id(), creationChangeData->subjectId()); - QCOMPARE(addBlend.isEnabled(), false); - QCOMPARE(addBlend.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(addBlend.metaObject(), creationChangeData->metaObject()); - QCOMPARE(cloneData.baseClipId, baseClip.id()); - QCOMPARE(cloneData.additiveClipId, additiveClip.id()); - } - } - - void checkAdditiveFactorUpdate() - { - // GIVEN - TestArbiter arbiter; - Qt3DAnimation::QAdditiveClipBlend addBlend; - arbiter.setArbiterOnNode(&addBlend); - - { - // WHEN - addBlend.setAdditiveFactor(0.4f); - - // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &addBlend); - - arbiter.dirtyNodes.clear(); - } - - { - // WHEN - addBlend.setAdditiveFactor(0.4f); - - // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); - } - - } - void checkBaseClipUpdate() { // GIVEN @@ -229,11 +135,10 @@ private Q_SLOTS: addBlend.setBaseClip(baseClip); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &addBlend); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &addBlend); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -241,8 +146,7 @@ private Q_SLOTS: addBlend.setBaseClip(baseClip); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -259,19 +163,16 @@ private Q_SLOTS: addBlend.setAdditiveClip(additiveClip); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &addBlend); - arbiter.dirtyNodes.clear(); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &addBlend); + arbiter.clear(); } { // WHEN addBlend.setAdditiveClip(additiveClip); - // - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } diff --git a/tests/auto/animation/qanimationcliploader/tst_qanimationcliploader.cpp b/tests/auto/animation/qanimationcliploader/tst_qanimationcliploader.cpp index 00130add3..140235505 100644 --- a/tests/auto/animation/qanimationcliploader/tst_qanimationcliploader.cpp +++ b/tests/auto/animation/qanimationcliploader/tst_qanimationcliploader.cpp @@ -30,11 +30,9 @@ #include #include #include -#include -#include #include #include -#include +#include class tst_QAnimationClipLoader : public Qt3DAnimation::QAnimationClipLoader { @@ -78,56 +76,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - Qt3DAnimation::QAnimationClipLoader clip; - - clip.setSource(QUrl(QStringLiteral("http://someRemoteURL.com"))); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&clip); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DAnimation::QAnimationClipLoaderData data = creationChangeData->data; - - QCOMPARE(clip.id(), creationChangeData->subjectId()); - QCOMPARE(clip.isEnabled(), true); - QCOMPARE(clip.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(clip.metaObject(), creationChangeData->metaObject()); - QCOMPARE(clip.source(), data.source); - } - - // WHEN - clip.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&clip); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - - QCOMPARE(clip.id(), creationChangeData->subjectId()); - QCOMPARE(clip.isEnabled(), false); - QCOMPARE(clip.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(clip.metaObject(), creationChangeData->metaObject()); - } - } - void checkSourceUpdate() { // GIVEN @@ -140,11 +88,10 @@ private Q_SLOTS: clip.setSource(QUrl(QStringLiteral("qrc:/toyplane.qlip"))); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &clip); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &clip); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -152,8 +99,7 @@ private Q_SLOTS: clip.setSource(QStringLiteral("qrc:/toyplane.qlip")); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } diff --git a/tests/auto/animation/qblendedclipanimator/tst_qblendedclipanimator.cpp b/tests/auto/animation/qblendedclipanimator/tst_qblendedclipanimator.cpp index 81222292f..9aed1bf15 100644 --- a/tests/auto/animation/qblendedclipanimator/tst_qblendedclipanimator.cpp +++ b/tests/auto/animation/qblendedclipanimator/tst_qblendedclipanimator.cpp @@ -32,11 +32,9 @@ #include #include #include -#include -#include #include #include -#include +#include class tst_QBlendedClipAnimator : public QObject { @@ -187,68 +185,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - Qt3DAnimation::QBlendedClipAnimator blendedClipAnimator; - Qt3DAnimation::QChannelMapper channelMapper; - Qt3DAnimation::QLerpClipBlend blendRoot; - - blendedClipAnimator.setBlendTree(&blendRoot); - blendedClipAnimator.setChannelMapper(&channelMapper); - blendedClipAnimator.setRunning(true); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&blendedClipAnimator); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 3); // 1 + mapper + blend tree root - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DAnimation::QBlendedClipAnimatorData cloneData = creationChangeData->data; - - QCOMPARE(blendedClipAnimator.blendTree()->id(), cloneData.blendTreeRootId); - QCOMPARE(blendedClipAnimator.channelMapper()->id(), cloneData.mapperId); - QCOMPARE(blendedClipAnimator.isRunning(), cloneData.running); - QCOMPARE(blendedClipAnimator.id(), creationChangeData->subjectId()); - QCOMPARE(blendedClipAnimator.isEnabled(), true); - QCOMPARE(blendedClipAnimator.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(blendedClipAnimator.metaObject(), creationChangeData->metaObject()); - QCOMPARE(blendedClipAnimator.loopCount(), cloneData.loops); - QCOMPARE(blendedClipAnimator.normalizedTime(), cloneData.normalizedTime); - } - - // WHEN - blendedClipAnimator.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&blendedClipAnimator); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 3); // 1 + mapper + blend tree root - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DAnimation::QBlendedClipAnimatorData cloneData = creationChangeData->data; - - QCOMPARE(blendedClipAnimator.blendTree()->id(), cloneData.blendTreeRootId); - QCOMPARE(blendedClipAnimator.channelMapper()->id(), cloneData.mapperId); - QCOMPARE(blendedClipAnimator.isRunning(), cloneData.running); - QCOMPARE(blendedClipAnimator.id(), creationChangeData->subjectId()); - QCOMPARE(blendedClipAnimator.isEnabled(), false); - QCOMPARE(blendedClipAnimator.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(blendedClipAnimator.metaObject(), creationChangeData->metaObject()); - } - } - void checkBlendTreeUpdate() { // GIVEN @@ -262,11 +198,10 @@ private Q_SLOTS: blendedClipAnimator.setBlendTree(&blendRoot); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &blendedClipAnimator); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &blendedClipAnimator); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -274,8 +209,7 @@ private Q_SLOTS: blendedClipAnimator.setBlendTree(&blendRoot); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -310,11 +244,10 @@ private Q_SLOTS: blendedClipAnimator.setChannelMapper(&channelMapper); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &blendedClipAnimator); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &blendedClipAnimator); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -322,8 +255,7 @@ private Q_SLOTS: blendedClipAnimator.setChannelMapper(&channelMapper); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -357,11 +289,10 @@ private Q_SLOTS: blendedClipAnimator.setRunning(true); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &blendedClipAnimator); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &blendedClipAnimator); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -369,8 +300,7 @@ private Q_SLOTS: blendedClipAnimator.setRunning(true); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -387,11 +317,10 @@ private Q_SLOTS: blendedClipAnimator.setLoopCount(1584); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &blendedClipAnimator); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &blendedClipAnimator); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -399,8 +328,7 @@ private Q_SLOTS: blendedClipAnimator.setLoopCount(1584); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -417,11 +345,10 @@ private Q_SLOTS: blendedClipAnimator.setNormalizedTime(0.5f); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &blendedClipAnimator); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &blendedClipAnimator); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -429,8 +356,7 @@ private Q_SLOTS: blendedClipAnimator.setNormalizedTime(0.5f); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } diff --git a/tests/auto/animation/qcallbackmapping/tst_qcallbackmapping.cpp b/tests/auto/animation/qcallbackmapping/tst_qcallbackmapping.cpp index fe1a2eda8..5037937a1 100644 --- a/tests/auto/animation/qcallbackmapping/tst_qcallbackmapping.cpp +++ b/tests/auto/animation/qcallbackmapping/tst_qcallbackmapping.cpp @@ -29,13 +29,10 @@ #include #include #include -#include #include -#include -#include #include #include -#include +#include class DummyCallback : public Qt3DAnimation::QAnimationCallback { @@ -93,66 +90,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - Qt3DAnimation::QCallbackMapping mapping; - auto callback = new DummyCallback(); - - mapping.setChannelName(QStringLiteral("Location")); - mapping.setCallback(QVariant::Vector3D, callback); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&mapping); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DAnimation::QCallbackMappingData data = creationChangeData->data; - - QCOMPARE(mapping.id(), creationChangeData->subjectId()); - QCOMPARE(mapping.isEnabled(), true); - QCOMPARE(mapping.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(mapping.metaObject(), creationChangeData->metaObject()); - QCOMPARE(creationChangeData->type(), Qt3DAnimation::QChannelMappingCreatedChangeBase::CallbackMapping); - QCOMPARE(mapping.channelName(), data.channelName); - QCOMPARE(mapping.callback(), data.callback); - QCOMPARE(int(QVariant::Vector3D), data.type); - } - - // WHEN - mapping.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&mapping); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DAnimation::QCallbackMappingData data = creationChangeData->data; - - QCOMPARE(mapping.id(), creationChangeData->subjectId()); - QCOMPARE(mapping.isEnabled(), false); - QCOMPARE(mapping.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(mapping.metaObject(), creationChangeData->metaObject()); - QCOMPARE(creationChangeData->type(), Qt3DAnimation::QChannelMappingCreatedChangeBase::CallbackMapping); - QCOMPARE(mapping.channelName(), data.channelName); - QCOMPARE(mapping.callback(), data.callback); - QCOMPARE(QVariant::Vector3D, data.type); - } - } - void checkPropertyUpdateChanges() { // GIVEN @@ -165,16 +102,16 @@ private Q_SLOTS: mapping.setChannelName(QStringLiteral("Scale")); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &mapping); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &mapping); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN mapping.setChannelName(QStringLiteral("Scale")); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } { @@ -184,19 +121,17 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &mapping); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &mapping); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN mapping.setCallback(QVariant::Vector3D, callback, Qt3DAnimation::QAnimationCallback::OnThreadPool); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } }; diff --git a/tests/auto/animation/qchannelmapper/tst_qchannelmapper.cpp b/tests/auto/animation/qchannelmapper/tst_qchannelmapper.cpp index a55a509b2..45c9c0f04 100644 --- a/tests/auto/animation/qchannelmapper/tst_qchannelmapper.cpp +++ b/tests/auto/animation/qchannelmapper/tst_qchannelmapper.cpp @@ -29,13 +29,12 @@ #include #include #include -#include #include #include #include -#include "testpostmanarbiter.h" +#include class tst_QChannelmapper : public Qt3DAnimation::QChannelMapper { @@ -47,47 +46,6 @@ public: } private Q_SLOTS: - void checkCreationChange_data() - { - QTest::addColumn("mapper"); - - Qt3DAnimation::QChannelMapper *defaultConstructed = new Qt3DAnimation::QChannelMapper; - QTest::newRow("defaultConstructed") << defaultConstructed; - - Qt3DAnimation::QChannelMapper *mapperWithMappings = new Qt3DAnimation::QChannelMapper; - mapperWithMappings->addMapping(new Qt3DAnimation::QChannelMapping); - mapperWithMappings->addMapping(new Qt3DAnimation::QChannelMapping); - mapperWithMappings->addMapping(new Qt3DAnimation::QChannelMapping); - QTest::newRow("mapperWithMappings") << mapperWithMappings; - } - - void checkCreationChange() - { - // GIVEN - QFETCH(Qt3DAnimation::QChannelMapper *, mapper); - - // WHEN - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(mapper); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - const int mappingCount = mapper->mappings().count(); - - // THEN - QCOMPARE(creationChanges.size(), 1 + mappingCount); - - const Qt3DCore::QNodeCreatedChangePtr creationChange = - qSharedPointerCast>(creationChanges.first()); - const Qt3DAnimation::QChannelMapperData &creationData = creationChange->data; - - // THEN - QCOMPARE(mapper->id(), creationChange->subjectId()); - QCOMPARE(mapper->isEnabled(), creationChange->isNodeEnabled()); - QCOMPARE(mapper->metaObject(), creationChange->metaObject()); - QCOMPARE(mappingCount, creationData.mappingIds.count()); - - for (int i = 0; i < mappingCount; ++i) - QCOMPARE(mapper->mappings().at(i)->id(), creationData.mappingIds.at(i)); - } void checkPropertyUpdates() { @@ -100,10 +58,10 @@ private Q_SLOTS: mapper->setEnabled(false); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), mapper.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), mapper.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } void checkMappingBookkeeping() diff --git a/tests/auto/animation/qchannelmapping/tst_qchannelmapping.cpp b/tests/auto/animation/qchannelmapping/tst_qchannelmapping.cpp index 749bc5ec7..714fbdd90 100644 --- a/tests/auto/animation/qchannelmapping/tst_qchannelmapping.cpp +++ b/tests/auto/animation/qchannelmapping/tst_qchannelmapping.cpp @@ -30,14 +30,11 @@ #include #include #include -#include #include -#include -#include #include #include #include -#include +#include class tst_QTargetEntity : public Qt3DCore::QEntity { @@ -169,71 +166,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - Qt3DAnimation::QChannelMapping mapping; - auto target = new tst_QTargetEntity; - - mapping.setChannelName(QStringLiteral("Location")); - mapping.setTarget(target); - mapping.setProperty(QStringLiteral("translation")); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&mapping); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 2); // 1 for mapping, 1 for target - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DAnimation::QChannelMappingData data = creationChangeData->data; - - QCOMPARE(mapping.id(), creationChangeData->subjectId()); - QCOMPARE(mapping.isEnabled(), true); - QCOMPARE(mapping.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(mapping.metaObject(), creationChangeData->metaObject()); - QCOMPARE(creationChangeData->type(), Qt3DAnimation::QChannelMappingCreatedChangeBase::ChannelMapping); - QCOMPARE(mapping.channelName(), data.channelName); - QCOMPARE(mapping.target()->id(), data.targetId); - QVERIFY(qstrcmp(mapping.property().toLatin1().constData(), data.propertyName) == 0); - QCOMPARE(data.type, static_cast(QVariant::Vector3D)); - QCOMPARE(data.componentCount, 3); - } - - // WHEN - mapping.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&mapping); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 2); // 1 for mapping, 1 for target - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DAnimation::QChannelMappingData data = creationChangeData->data; - - QCOMPARE(mapping.id(), creationChangeData->subjectId()); - QCOMPARE(mapping.isEnabled(), false); - QCOMPARE(mapping.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(mapping.metaObject(), creationChangeData->metaObject()); - QCOMPARE(creationChangeData->type(), Qt3DAnimation::QChannelMappingCreatedChangeBase::ChannelMapping); - QCOMPARE(mapping.channelName(), data.channelName); - QCOMPARE(mapping.target()->id(), data.targetId); - QVERIFY(qstrcmp(mapping.property().toLatin1().constData(), data.propertyName) == 0); - QCOMPARE(data.type, static_cast(QVariant::Vector3D)); - QCOMPARE(data.componentCount, 3); - } - } - void checkPropertyUpdateChanges() { // GIVEN @@ -247,16 +179,16 @@ private Q_SLOTS: mapping.setChannelName(QStringLiteral("Scale")); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &mapping); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &mapping); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN mapping.setChannelName(QStringLiteral("Scale")); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } { @@ -264,16 +196,16 @@ private Q_SLOTS: mapping.setTarget(target.data()); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &mapping); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &mapping); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN mapping.setTarget(target.data()); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } { @@ -283,19 +215,17 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &mapping); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &mapping); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN mapping.setProperty(QStringLiteral("scale")); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -341,16 +271,16 @@ private Q_SLOTS: target->setProperty(propertyName.constData(), value); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), target.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), target.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // THEN mapping.setProperty(QString::fromLatin1(propertyName)); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); + QCOMPARE(arbiter.dirtyNodes().size(), 1); } } diff --git a/tests/auto/animation/qclipanimator/tst_qclipanimator.cpp b/tests/auto/animation/qclipanimator/tst_qclipanimator.cpp index 174cd6bce..34544d04b 100644 --- a/tests/auto/animation/qclipanimator/tst_qclipanimator.cpp +++ b/tests/auto/animation/qclipanimator/tst_qclipanimator.cpp @@ -34,11 +34,9 @@ #include #include #include -#include -#include #include #include -#include +#include class tst_QClipAnimator : public QObject { @@ -181,61 +179,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - Qt3DAnimation::QClipAnimator animator; - auto clip = new Qt3DAnimation::QAnimationClipLoader(); - animator.setClip(clip); - auto mapper = new Qt3DAnimation::QChannelMapper(); - animator.setChannelMapper(mapper); - auto clock = new Qt3DAnimation::QClock(); - animator.setClock(clock); - - // WHEN - QVector creationChanges; - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&animator); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 4); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DAnimation::QClipAnimatorData data = creationChangeData->data; - - QCOMPARE(animator.id(), creationChangeData->subjectId()); - QCOMPARE(animator.isEnabled(), true); - QCOMPARE(animator.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(animator.metaObject(), creationChangeData->metaObject()); - QCOMPARE(animator.clip()->id(), data.clipId); - QCOMPARE(animator.channelMapper()->id(), data.mapperId); - QCOMPARE(animator.clock()->id(), data.clockId); - QCOMPARE(animator.loopCount(), data.loops); - } - - // WHEN - animator.setEnabled(false); - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&animator); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 4); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - - QCOMPARE(animator.id(), creationChangeData->subjectId()); - QCOMPARE(animator.isEnabled(), false); - QCOMPARE(animator.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(animator.metaObject(), creationChangeData->metaObject()); - } - } - void checkPropertyUpdate() { // GIVEN @@ -249,10 +192,10 @@ private Q_SLOTS: animator.setClip(clip); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &animator); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &animator); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -260,7 +203,7 @@ private Q_SLOTS: animator.setClip(clip); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } // GIVEN @@ -270,10 +213,10 @@ private Q_SLOTS: animator.setChannelMapper(mapper); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &animator); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &animator); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -281,7 +224,7 @@ private Q_SLOTS: animator.setChannelMapper(mapper); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } // GIVEN @@ -291,10 +234,10 @@ private Q_SLOTS: animator.setClock(clock); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &animator); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &animator); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -302,7 +245,7 @@ private Q_SLOTS: animator.setClock(clock); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } { @@ -310,10 +253,10 @@ private Q_SLOTS: animator.setLoopCount(10); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &animator); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &animator); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -321,7 +264,7 @@ private Q_SLOTS: animator.setLoopCount(10); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } diff --git a/tests/auto/animation/qclipblendvalue/tst_qclipblendvalue.cpp b/tests/auto/animation/qclipblendvalue/tst_qclipblendvalue.cpp index b7e4f453b..d34ee0d31 100644 --- a/tests/auto/animation/qclipblendvalue/tst_qclipblendvalue.cpp +++ b/tests/auto/animation/qclipblendvalue/tst_qclipblendvalue.cpp @@ -33,10 +33,7 @@ #include #include #include -#include -#include -#include -#include "testpostmanarbiter.h" +#include class tst_QClipBlendValue : public QObject { @@ -83,59 +80,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - Qt3DAnimation::QClipBlendValue clipBlendNode; - Qt3DAnimation::QAnimationClipLoader clip; - - clipBlendNode.setClip(&clip); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&clipBlendNode); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 2); // 1 + 1 clip - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DAnimation::QClipBlendValueData cloneData = creationChangeData->data; - - QCOMPARE(clipBlendNode.id(), creationChangeData->subjectId()); - QCOMPARE(clipBlendNode.isEnabled(), true); - QCOMPARE(clipBlendNode.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(clipBlendNode.metaObject(), creationChangeData->metaObject()); - QCOMPARE(cloneData.clipId, clip.id()); - } - - // WHEN - clipBlendNode.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&clipBlendNode); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 2); // 1 + 1 clip - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DAnimation::QClipBlendValueData cloneData = creationChangeData->data; - - QCOMPARE(clipBlendNode.id(), creationChangeData->subjectId()); - QCOMPARE(clipBlendNode.isEnabled(), false); - QCOMPARE(clipBlendNode.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(clipBlendNode.metaObject(), creationChangeData->metaObject()); - QCOMPARE(cloneData.clipId, clip.id()); - } - } - void checkClipUpdate() { // GIVEN @@ -149,10 +93,10 @@ private Q_SLOTS: clipBlendNode.setClip(clip); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &clipBlendNode); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &clipBlendNode); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -160,7 +104,7 @@ private Q_SLOTS: clipBlendNode.setClip(clip); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } diff --git a/tests/auto/animation/qclock/tst_qclock.cpp b/tests/auto/animation/qclock/tst_qclock.cpp index 65c485566..04e479774 100644 --- a/tests/auto/animation/qclock/tst_qclock.cpp +++ b/tests/auto/animation/qclock/tst_qclock.cpp @@ -30,11 +30,9 @@ #include #include #include -#include -#include #include #include -#include +#include class tst_QClock : public QObject { @@ -79,53 +77,6 @@ private Q_SLOTS: QCOMPARE(spy.count(), 0); } - void checkCreationData() - { - // GIVEN - Qt3DAnimation::QClock clock; - clock.setPlaybackRate(10.f); - - // WHEN - QVector creationChanges; - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&clock); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DAnimation::QClockData data = creationChangeData->data; - - QCOMPARE(clock.id(), creationChangeData->subjectId()); - QCOMPARE(clock.isEnabled(), true); - QCOMPARE(clock.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(clock.metaObject(), creationChangeData->metaObject()); - QCOMPARE(clock.playbackRate(), data.playbackRate); - } - - // WHEN - clock.setEnabled(false); - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&clock); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - - QCOMPARE(clock.id(), creationChangeData->subjectId()); - QCOMPARE(clock.isEnabled(), false); - QCOMPARE(clock.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(clock.metaObject(), creationChangeData->metaObject()); - } - } - void checkPropertyUpdate() { // GIVEN @@ -138,10 +89,10 @@ private Q_SLOTS: clock.setPlaybackRate(10.5f); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &clock); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &clock); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -149,7 +100,7 @@ private Q_SLOTS: clock.setPlaybackRate(10.5f); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } }; diff --git a/tests/auto/animation/qlerpclipblend/tst_qlerpclipblend.cpp b/tests/auto/animation/qlerpclipblend/tst_qlerpclipblend.cpp index 68970838c..11d094596 100644 --- a/tests/auto/animation/qlerpclipblend/tst_qlerpclipblend.cpp +++ b/tests/auto/animation/qlerpclipblend/tst_qlerpclipblend.cpp @@ -33,10 +33,7 @@ #include #include #include -#include -#include -#include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QLerpClipBlend : public QObject { @@ -125,67 +122,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - Qt3DAnimation::QLerpClipBlend lerpBlend; - Qt3DAnimation::QLerpClipBlend startClip; - Qt3DAnimation::QLerpClipBlend endClip; - - lerpBlend.setStartClip(&startClip); - lerpBlend.setEndClip(&endClip); - lerpBlend.setBlendFactor(0.8f); - - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&lerpBlend); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 3); // 1 + 2 clips - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DAnimation::QLerpClipBlendData cloneData = creationChangeData->data; - - QCOMPARE(lerpBlend.blendFactor(), cloneData.blendFactor); - QCOMPARE(lerpBlend.id(), creationChangeData->subjectId()); - QCOMPARE(lerpBlend.isEnabled(), true); - QCOMPARE(lerpBlend.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(lerpBlend.metaObject(), creationChangeData->metaObject()); - QCOMPARE(cloneData.startClipId, startClip.id()); - QCOMPARE(cloneData.endClipId, endClip.id()); - } - - // WHEN - lerpBlend.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&lerpBlend); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 3); // 1 + 2 clips - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DAnimation::QLerpClipBlendData cloneData = creationChangeData->data; - - QCOMPARE(lerpBlend.blendFactor(), cloneData.blendFactor); - QCOMPARE(lerpBlend.id(), creationChangeData->subjectId()); - QCOMPARE(lerpBlend.isEnabled(), false); - QCOMPARE(lerpBlend.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(lerpBlend.metaObject(), creationChangeData->metaObject()); - QCOMPARE(cloneData.startClipId, startClip.id()); - QCOMPARE(cloneData.endClipId, endClip.id()); - } - } - void checkBlendFactorUpdate() { // GIVEN @@ -198,10 +134,10 @@ private Q_SLOTS: lerpBlend.setBlendFactor(0.4f); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &lerpBlend); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &lerpBlend); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -209,7 +145,7 @@ private Q_SLOTS: lerpBlend.setBlendFactor(0.4f); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -227,10 +163,10 @@ private Q_SLOTS: lerpBlend.setStartClip(startClip); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &lerpBlend); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &lerpBlend); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -238,7 +174,7 @@ private Q_SLOTS: lerpBlend.setStartClip(startClip); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -255,10 +191,10 @@ private Q_SLOTS: lerpBlend.setEndClip(endClip); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &lerpBlend); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &lerpBlend); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -266,7 +202,7 @@ private Q_SLOTS: lerpBlend.setEndClip(endClip); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } diff --git a/tests/auto/animation/qskeletonmapping/tst_qskeletonmapping.cpp b/tests/auto/animation/qskeletonmapping/tst_qskeletonmapping.cpp index 1eff6a568..b1d0928d8 100644 --- a/tests/auto/animation/qskeletonmapping/tst_qskeletonmapping.cpp +++ b/tests/auto/animation/qskeletonmapping/tst_qskeletonmapping.cpp @@ -31,11 +31,9 @@ #include #include #include -#include -#include #include #include -#include +#include class tst_QSkeletonMapping : public QObject { @@ -82,61 +80,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - Qt3DAnimation::QSkeletonMapping mapping; - auto target = new Qt3DCore::QSkeleton; - - mapping.setSkeleton(target); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&mapping); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 2); // 1 for mapping, 1 for skeleton - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DAnimation::QSkeletonMappingData data = creationChangeData->data; - - QCOMPARE(mapping.id(), creationChangeData->subjectId()); - QCOMPARE(mapping.isEnabled(), true); - QCOMPARE(mapping.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(mapping.metaObject(), creationChangeData->metaObject()); - QCOMPARE(creationChangeData->type(), Qt3DAnimation::QChannelMappingCreatedChangeBase::SkeletonMapping); - QCOMPARE(mapping.skeleton()->id(), data.skeletonId); - } - - // WHEN - mapping.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&mapping); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 2); // 1 for mapping, 1 for skeleton - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DAnimation::QSkeletonMappingData data = creationChangeData->data; - - QCOMPARE(mapping.id(), creationChangeData->subjectId()); - QCOMPARE(mapping.isEnabled(), false); - QCOMPARE(mapping.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(mapping.metaObject(), creationChangeData->metaObject()); - QCOMPARE(creationChangeData->type(), Qt3DAnimation::QChannelMappingCreatedChangeBase::SkeletonMapping); - QCOMPARE(mapping.skeleton()->id(), data.skeletonId); - } - } - void checkPropertyUpdateChanges() { // GIVEN @@ -150,16 +93,16 @@ private Q_SLOTS: mapping.setSkeleton(target); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &mapping); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &mapping); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN mapping.setSkeleton(target); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } }; diff --git a/tests/auto/animation/skeleton/tst_skeleton.cpp b/tests/auto/animation/skeleton/tst_skeleton.cpp index d9b209194..3b4b0a429 100644 --- a/tests/auto/animation/skeleton/tst_skeleton.cpp +++ b/tests/auto/animation/skeleton/tst_skeleton.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include using namespace Qt3DCore; using namespace Qt3DAnimation; diff --git a/tests/auto/core/common/common.pri b/tests/auto/core/common/common.pri index 9b761b8e0..53d2b1ac2 100644 --- a/tests/auto/core/common/common.pri +++ b/tests/auto/core/common/common.pri @@ -1,9 +1,3 @@ -SOURCES += \ - $$PWD/testpostmanarbiter.cpp - -HEADERS += \ - $$PWD/testpostmanarbiter.h - INCLUDEPATH += $$PWD qtConfig(private_tests) { @@ -11,7 +5,8 @@ qtConfig(private_tests) { $$PWD/qbackendnodetester.cpp HEADERS += \ - $$PWD/qbackendnodetester.h + $$PWD/qbackendnodetester.h \ + $$PWD/testarbiter.h } QT += core-private 3dcore 3dcore-private diff --git a/tests/auto/core/common/qbackendnodetester.cpp b/tests/auto/core/common/qbackendnodetester.cpp index 13f4683d9..64bf21590 100644 --- a/tests/auto/core/common/qbackendnodetester.cpp +++ b/tests/auto/core/common/qbackendnodetester.cpp @@ -52,35 +52,6 @@ void QBackendNodeTester::setPeerId(QBackendNode *backend, QNodeId id) backend->setPeerId(id); } -void QBackendNodeTester::simulateInitialization(QNode *frontend, QBackendNode *backend) -{ - Q_ASSERT(frontend); - Q_ASSERT(backend); - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - const auto change = frontend->createNodeCreationChange(); - backend->setPeerId(change->subjectId()); - backend->setEnabled(change->isNodeEnabled()); - backend->initializeFromPeer(change); - QT_WARNING_POP -} - -void QBackendNodeTester::sceneChangeEvent(QBackendNode *backend, const Qt3DCore::QSceneChangePtr &e) -{ - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - backend->sceneChangeEvent(e); - QT_WARNING_POP -} - -QNodeCreatedChangeBasePtr QBackendNodeTester::creationChange(QNode *frontend) const -{ - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - return frontend->createNodeCreationChange(); - QT_WARNING_POP -} - } // namespace Qt3DCore QT_END_NAMESPACE diff --git a/tests/auto/core/common/qbackendnodetester.h b/tests/auto/core/common/qbackendnodetester.h index a0b89e503..c0f8481df 100644 --- a/tests/auto/core/common/qbackendnodetester.h +++ b/tests/auto/core/common/qbackendnodetester.h @@ -39,8 +39,6 @@ #include #include -#include -#include #include QT_BEGIN_NAMESPACE @@ -57,8 +55,6 @@ public: // Proxies to allow test classes to call private methods on QBackendNode void setPeerId(QBackendNode *backend, QNodeId id); - void sceneChangeEvent(QBackendNode *backend, const Qt3DCore::QSceneChangePtr &e); - Qt3DCore::QNodeCreatedChangeBasePtr creationChange(QNode *frontend) const; template void simulateInitializationSync(QNode *frontend, Backend *backend) @@ -70,8 +66,6 @@ public: backend->setEnabled(frontend->isEnabled()); backend->syncFromFrontEnd(frontend, true); } - - void simulateInitialization(QNode *frontend, QBackendNode *backend); }; } // namespace Qt3DCore diff --git a/tests/auto/core/common/testarbiter.h b/tests/auto/core/common/testarbiter.h new file mode 100644 index 000000000..1c1723fc1 --- /dev/null +++ b/tests/auto/core/common/testarbiter.h @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later 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 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +QT_BEGIN_NAMESPACE + +class TestArbiter : public Qt3DCore::QChangeArbiter +{ +public: + + void setArbiterOnNode(Qt3DCore::QNode *node) + { + Qt3DCore::QNodePrivate::get(node)->setArbiter(this); + const auto childNodes = node->childNodes(); + for (Qt3DCore::QNode *n : childNodes) + setArbiterOnNode(n); + } + + QVector dirtyNodes() const { return m_dirtyFrontEndNodes; } + QVector dirtyComponents() const { return m_dirtyEntityComponentNodeChanges; } + + void clear() + { + m_dirtyFrontEndNodes.clear(); + m_dirtyEntityComponentNodeChanges.clear(); + } +}; + +QT_END_NAMESPACE diff --git a/tests/auto/core/common/testpostmanarbiter.cpp b/tests/auto/core/common/testpostmanarbiter.cpp deleted file mode 100644 index f0c362744..000000000 --- a/tests/auto/core/common/testpostmanarbiter.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// TODO Remove in Qt6 -#include -QT_WARNING_DISABLE_DEPRECATED - -#include "testpostmanarbiter.h" -#include - -QT_BEGIN_NAMESPACE - -TestPostman::TestPostman(TestArbiter *arbiter) - : m_arbiter(arbiter) -{} - -void TestPostman::setScene(Qt3DCore::QScene *) -{} - -void TestPostman::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &) -{} - -void TestPostman::notifyBackend(const Qt3DCore::QSceneChangePtr &e) -{ - m_arbiter->sceneChangeEventWithLock(e); -} - -bool TestPostman::shouldNotifyFrontend(const Qt3DCore::QSceneChangePtr &) -{ - return false; -} - -TestArbiter::TestArbiter() - : m_postman(new TestPostman(this)) -{ -} - -TestArbiter::~TestArbiter() -{ -} - -void TestArbiter::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) -{ - events.push_back(e); -} - -void TestArbiter::sceneChangeEventWithLock(const Qt3DCore::QSceneChangePtr &e) -{ - events.push_back(e); -} - -void TestArbiter::sceneChangeEventWithLock(const Qt3DCore::QSceneChangeList &e) -{ - events += QVector(e.begin(), e.end()); -} - -Qt3DCore::QAbstractPostman *TestArbiter::postman() const -{ - return m_postman; -} - -void TestArbiter::setArbiterOnNode(Qt3DCore::QNode *node) -{ - Qt3DCore::QNodePrivate::get(node)->setArbiter(this); - const auto childNodes = node->childNodes(); - for (Qt3DCore::QNode *n : childNodes) - setArbiterOnNode(n); -} - -void TestArbiter::addDirtyFrontEndNode(Qt3DCore::QNode *node) -{ - if (!dirtyNodes.contains(node)) - dirtyNodes << node; -} - -void TestArbiter::addDirtyFrontEndNode(Qt3DCore::QNode *node, Qt3DCore::QNode *subNode, const char *property, Qt3DCore::ChangeFlag change) -{ - if (!dirtyNodes.contains(node)) - dirtyNodes << node; - dirtySubNodes.push_back({node, subNode, change, property}); -} - -void TestArbiter::removeDirtyFrontEndNode(Qt3DCore::QNode *node) -{ - dirtyNodes.removeOne(node); -} - -QT_END_NAMESPACE diff --git a/tests/auto/core/common/testpostmanarbiter.h b/tests/auto/core/common/testpostmanarbiter.h deleted file mode 100644 index e927c2489..000000000 --- a/tests/auto/core/common/testpostmanarbiter.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - class QNode; -} // Qt3D - -class TestArbiter; - -class TestPostman : public Qt3DCore::QAbstractPostman -{ -public: - explicit TestPostman(TestArbiter *arbiter); - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &) final; - void setScene(Qt3DCore::QScene *) final; - void notifyBackend(const Qt3DCore::QSceneChangePtr &e) final; - bool shouldNotifyFrontend(const Qt3DCore::QSceneChangePtr &e) final; - -private: - TestArbiter *m_arbiter; -}; - -class TestArbiter : public Qt3DCore::QAbstractArbiter -{ -public: - TestArbiter(); - ~TestArbiter(); - - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) final; - - void sceneChangeEventWithLock(const Qt3DCore::QSceneChangePtr &e) final; - - void sceneChangeEventWithLock(const Qt3DCore::QSceneChangeList &e) final; - - Qt3DCore::QAbstractPostman *postman() const final; - - QVector events; - QVector dirtyNodes; - QVector dirtySubNodes; - - void setArbiterOnNode(Qt3DCore::QNode *node); - void addDirtyFrontEndNode(Qt3DCore::QNode *node) final; - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - void addDirtyFrontEndNode(Qt3DCore::QNode *node, Qt3DCore::QNode *subNode, const char *property, Qt3DCore::ChangeFlag change) final; - QT_WARNING_POP - void removeDirtyFrontEndNode(Qt3DCore::QNode *node) final; - -private: - TestPostman *m_postman; -}; - -QT_END_NAMESPACE diff --git a/tests/auto/core/core.pro b/tests/auto/core/core.pro index 3e4a8479d..a22402c3e 100644 --- a/tests/auto/core/core.pro +++ b/tests/auto/core/core.pro @@ -20,7 +20,6 @@ qtConfig(private_tests) { qentity \ qtransform \ threadpooler \ - qpostman \ vector4d_base \ vector3d_base \ aspectcommanddebugger \ diff --git a/tests/auto/core/nodes/tst_nodes.cpp b/tests/auto/core/nodes/tst_nodes.cpp index c39638754..39560938a 100644 --- a/tests/auto/core/nodes/tst_nodes.cpp +++ b/tests/auto/core/nodes/tst_nodes.cpp @@ -26,10 +26,6 @@ ** ****************************************************************************/ -// TODO Remove in Qt6 -#include -QT_WARNING_DISABLE_DEPRECATED - #include #include #include @@ -37,22 +33,14 @@ QT_WARNING_DISABLE_DEPRECATED #include #include #include -#include -#include -#include -#include -#include -#include #include #include #include -#include -#include #include #include #include -#include "testpostmanarbiter.h" +#include class tst_Nodes : public QObject { @@ -110,7 +98,6 @@ private slots: void checkDefaultConstruction(); void checkPropertyChanges(); - void checkCreationData(); void checkEnabledUpdate(); void checkPropertyTrackModeUpdate(); void checkTrackedPropertyNamesUpdate(); @@ -118,100 +105,6 @@ private slots: void checkNodeRemovedFromDirtyListOnDestruction(); }; -class ObserverSpy; -class SimplePostman : public Qt3DCore::QAbstractPostman -{ -public: - SimplePostman(ObserverSpy *spy) - : m_spy(spy) - {} - - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &) final {} - void setScene(Qt3DCore::QScene *) final {} - void notifyBackend(const Qt3DCore::QSceneChangePtr &change) final; - bool shouldNotifyFrontend(const Qt3DCore::QSceneChangePtr &changee) final { Q_UNUSED(changee); return false; } - -private: - ObserverSpy *m_spy; -}; - -class ObserverSpy : public Qt3DCore::QAbstractArbiter -{ -public: - class ChangeRecord : public QPair - { - public: - ChangeRecord(const Qt3DCore::QSceneChangePtr &event, bool locked) - : QPair(event, locked) - {} - - Qt3DCore::QSceneChangePtr change() const { return first; } - - bool wasLocked() const { return second; } - }; - - ObserverSpy() - : Qt3DCore::QAbstractArbiter() - , m_postman(new SimplePostman(this)) - { - } - - ~ObserverSpy(); - - void sceneChangeEventWithLock(const Qt3DCore::QSceneChangePtr &e) override - { - events << ChangeRecord(e, true); - } - - void sceneChangeEventWithLock(const Qt3DCore::QSceneChangeList &e) override - { - for (size_t i = 0, m = e.size(); i < m; ++i) { - events << ChangeRecord(e.at(i), false); - } - } - - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) override - { - events << ChangeRecord(e, false); - } - - Qt3DCore::QAbstractPostman *postman() const final - { - return m_postman.data(); - } - - void addDirtyFrontEndNode(Qt3DCore::QNode *node) final { - if (!dirtyNodes.contains(node)) - dirtyNodes << node; - } - - void addDirtyFrontEndNode(Qt3DCore::QNode *node, Qt3DCore::QNode *subNode, const char *property, Qt3DCore::ChangeFlag change) final { - if (!dirtyNodes.contains(node)) - dirtyNodes << node; - dirtySubNodes.push_back({node, subNode, change, property}); - } - - void removeDirtyFrontEndNode(Qt3DCore::QNode *node) final { - dirtyNodes.removeOne(node); - } - - QVector dirtyNodes; - QVector dirtySubNodes; - QList events; - QScopedPointer m_postman; -}; - -ObserverSpy::~ObserverSpy() -{ -} - -void SimplePostman::notifyBackend(const Qt3DCore::QSceneChangePtr &change) -{ - m_spy->sceneChangeEventWithLock(change); -} - - - class MyQNode : public Qt3DCore::QNode { Q_OBJECT @@ -241,7 +134,7 @@ public: return m_customProperty; } - void setArbiterAndScene(Qt3DCore::QAbstractArbiter *arbiter, + void setArbiterAndScene(Qt3DCore::QChangeArbiter *arbiter, Qt3DCore::QScene *scene = nullptr) { Q_ASSERT(arbiter); @@ -296,14 +189,14 @@ public slots: if (!attribute->parent()) attribute->setParent(this); - d->updateNode(attribute, "attribute", Qt3DCore::PropertyValueAdded); + d->update(); } } void removeAttribute(MyQNode *attribute) { Qt3DCore::QNodePrivate *d = Qt3DCore::QNodePrivate::get(this); - d->updateNode(attribute, "attribute", Qt3DCore::PropertyValueRemoved); + d->update(); m_attributes.removeOne(attribute); // Remove bookkeeping connection @@ -333,7 +226,7 @@ public: { } - void setArbiterAndScene(Qt3DCore::QAbstractArbiter *arbiter, + void setArbiterAndScene(Qt3DCore::QChangeArbiter *arbiter, Qt3DCore::QScene *scene = nullptr) { Q_ASSERT(arbiter); @@ -343,7 +236,7 @@ public: Qt3DCore::QNodePrivate::get(this)->setArbiter(arbiter); } - void setArbiterAndEngine(Qt3DCore::QAbstractArbiter *arbiter, + void setArbiterAndEngine(Qt3DCore::QChangeArbiter *arbiter, Qt3DCore::QAspectEngine *engine) { Q_ASSERT(arbiter); @@ -383,7 +276,7 @@ public: if (!attribute->parent()) attribute->setParent(this); - d->updateNode(attribute, "attribute", Qt3DCore::PropertyValueRemoved); + d->update(); } } @@ -423,7 +316,7 @@ class MyQComponent : public Qt3DCore::QComponent public: explicit MyQComponent(Qt3DCore::QNode *parent = nullptr) : QComponent(parent) {} - void setArbiter(Qt3DCore::QAbstractArbiter *arbiter) + void setArbiter(Qt3DCore::QChangeArbiter *arbiter) { Q_ASSERT(arbiter); Qt3DCore::QComponentPrivate::get(this)->setArbiter(arbiter); @@ -442,7 +335,7 @@ public: { } - void setArbiter(Qt3DCore::QAbstractArbiter *arbiter) + void setArbiter(Qt3DCore::QChangeArbiter *arbiter) { Q_ASSERT(arbiter); Qt3DCore::QComponentPrivate::get(this)->setArbiter(arbiter); @@ -501,11 +394,11 @@ class TestFunctor : public Qt3DCore::QBackendNodeMapper public: TestFunctor(TestAspect *aspect) : m_aspect(aspect) {} - Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const override + Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const override { auto node = new Qt3DCore::QBackendNode; - m_Nodes.insert(change->subjectId(), node); - m_aspect->addEvent(change->subjectId(), TestAspect::Creation); + m_Nodes.insert(id, node); + m_aspect->addEvent(id, TestAspect::Creation); return node; } @@ -545,10 +438,10 @@ public: TestAspect::TestAspect(QObject *parent) : TestAspect(*new TestAspectPrivate, parent) { - registerBackendType(QSharedPointer::create(this)); - registerBackendType(QSharedPointer::create(this)); - registerBackendType(QSharedPointer::create(this)); - registerBackendType(QSharedPointer::create(this)); + registerBackendType(QSharedPointer::create(this)); + registerBackendType(QSharedPointer::create(this)); + registerBackendType(QSharedPointer::create(this)); + registerBackendType(QSharedPointer::create(this)); } TestAspect::TestAspect(TestAspectPrivate &dd, QObject *parent) @@ -625,9 +518,9 @@ void tst_Nodes::appendSingleChildNodeToNodeNoSceneExplicitParenting() { // Check nodes added when no scene is set // GIVEN - ObserverSpy spy; + TestArbiter arbiter; QScopedPointer node(new MyQNode()); - node->setArbiterAndScene(&spy); + node->setArbiterAndScene(&arbiter); // THEN QVERIFY(Qt3DCore::QNodePrivate::get(node.data())->scene() == nullptr); @@ -646,16 +539,16 @@ void tst_Nodes::appendSingleChildNodeToNodeNoSceneExplicitParenting() QCOMPARE(node->children().count(), 1); // Events are only sent when a scene is set on the root node - QCOMPARE(spy.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } void tst_Nodes::appendSingleChildNodeToNodeNoSceneImplicitParenting() { // Check nodes added when no scene is set // GIVEN - ObserverSpy spy; + TestArbiter arbiter; QScopedPointer node(new MyQNode()); - node->setArbiterAndScene(&spy); + node->setArbiterAndScene(&arbiter); // THEN QVERIFY(Qt3DCore::QNodePrivate::get(node.data())->scene() == nullptr); @@ -669,16 +562,16 @@ void tst_Nodes::appendSingleChildNodeToNodeNoSceneImplicitParenting() QCOMPARE(node->children().count(), 1); // Events are only sent when a scene is set on the root node - QCOMPARE(spy.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } void tst_Nodes::appendMultipleChildNodesToNodeNoScene() { // Check multiple nodes added with no scene set // GIVEN - ObserverSpy spy; + TestArbiter arbiter; QScopedPointer node(new MyQNode()); - node->setArbiterAndScene(&spy); + node->setArbiterAndScene(&arbiter); // THEN QVERIFY(Qt3DCore::QNodePrivate::get(node.data())->scene() == nullptr); @@ -701,7 +594,7 @@ void tst_Nodes::appendMultipleChildNodesToNodeNoScene() QCOMPARE(node->children().count(), 10); // Events are only sent when a scene is set on the root node - QCOMPARE(spy.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } void tst_Nodes::appendSingleChildNodeToNodeSceneExplicitParenting() @@ -709,10 +602,10 @@ void tst_Nodes::appendSingleChildNodeToNodeSceneExplicitParenting() // Check nodes added when scene is set // GIVEN Qt3DCore::QScene scene; - ObserverSpy spy; + TestArbiter arbiter; QScopedPointer node(new MyQNode()); // WHEN - node->setArbiterAndScene(&spy, &scene); + node->setArbiterAndScene(&arbiter, &scene); node->setSimulateBackendCreated(true); // THEN @@ -731,17 +624,9 @@ void tst_Nodes::appendSingleChildNodeToNodeSceneExplicitParenting() // THEN QVERIFY(child->parent() == node.data()); QVERIFY(child->parentNode() == node.data()); - QCOMPARE(spy.events.size(), 1); // Child Added + QCOMPARE(arbiter.dirtyNodes().size(), 1); // Child Added QCOMPARE(node->children().count(), 1); QVERIFY(Qt3DCore::QNodePrivate::get(child.data())->scene() != nullptr); - - // Node Added event - QVERIFY(spy.events.first().wasLocked()); - Qt3DCore::QPropertyNodeAddedChangePtr additionEvent = spy.events.takeFirst().change().dynamicCast(); - QVERIFY(additionEvent); - QCOMPARE(additionEvent->subjectId(), node->id()); - QCOMPARE(additionEvent->addedNodeId(), child->id()); - QCOMPARE(additionEvent->metaObject(), child->metaObject()); } void tst_Nodes::appendSingleChildNodeToNodeSceneImplicitParenting() @@ -749,11 +634,11 @@ void tst_Nodes::appendSingleChildNodeToNodeSceneImplicitParenting() // Check nodes added when scene is set // GIVEN Qt3DCore::QScene scene; - ObserverSpy spy; + TestArbiter arbiter; QScopedPointer node(new MyQNode()); // WHEN - node->setArbiterAndScene(&spy, &scene); + node->setArbiterAndScene(&arbiter, &scene); // THEN QVERIFY(Qt3DCore::QNodePrivate::get(node.data())->scene() != nullptr); @@ -766,17 +651,8 @@ void tst_Nodes::appendSingleChildNodeToNodeSceneImplicitParenting() QVERIFY(child->parentNode() == node.data()); QVERIFY(Qt3DCore::QNodePrivate::get(child.data())->scene() != nullptr); - QCOMPARE(spy.events.size(), 1); - QVERIFY(spy.events.first().wasLocked()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); QCOMPARE(node->children().count(), 1); - - // Node Added event - QVERIFY(spy.events.first().wasLocked()); - Qt3DCore::QPropertyNodeAddedChangePtr additionEvent = spy.events.takeFirst().change().dynamicCast(); - QVERIFY(additionEvent); - QCOMPARE(additionEvent->subjectId(), node->id()); - QCOMPARE(additionEvent->addedNodeId(), child->id()); - QCOMPARE(additionEvent->metaObject(), child->metaObject()); } void tst_Nodes::appendMultipleChildNodesToNodeScene() @@ -785,11 +661,11 @@ void tst_Nodes::appendMultipleChildNodesToNodeScene() // GIVEN Qt3DCore::QScene scene; - ObserverSpy spy; + TestArbiter arbiter; QScopedPointer node(new MyQNode()); // WHEN - node->setArbiterAndScene(&spy, &scene); + node->setArbiterAndScene(&arbiter, &scene); node->setSimulateBackendCreated(true); // THEN QVERIFY(Qt3DCore::QNodePrivate::get(node.data())->scene() != nullptr); @@ -816,89 +692,53 @@ void tst_Nodes::appendMultipleChildNodesToNodeScene() // WHEN QCoreApplication::processEvents(); - // THEN backend is notified after the event loop spins. The recorded events are a little - // tricky to understand and differs for children with the parent being set at construction - // time (even children and ids) and the children being created without a parent and then - // explicitly calling setParent() after (odd children and ids). - // - // Even children: - // child constructed - // notifications to backend scheduled via the event loop as object is not yet fully constructed - // - // Odd children: - // child constructed - // parent set - // notifications to backend sent immediately as object is fully constructed - // - // With this in mind, the recorded events should show: - // - // for each odd child: - // child addition to parent of odd child - // - // followed by: - // - // for each even child: - // child addition to parent of even child - // - const auto expectedEventCount = childCount; - QCOMPARE(spy.events.size(), 10); - - for (auto i = 0; i < expectedEventCount; ++i) { - const auto childIndex = i; - Qt3DCore::QNode *child = node->childNodes().at(childIndex); - - const auto recordIndex = (i % 2 == 0) ? expectedEventCount / 2 + i / 2 : i / 2; - const auto additionRecord = spy.events.at(recordIndex); - Qt3DCore::QPropertyNodeAddedChangePtr additionEvent = additionRecord.change().dynamicCast(); - QCOMPARE(additionEvent->subjectId(), node->id()); - QCOMPARE(additionEvent->addedNodeId(), child->id()); - QCOMPARE(additionEvent->metaObject(), child->metaObject()); - } + // THEN backend is notified after the event loop spins. Only the parent is notified + QCOMPARE(arbiter.dirtyNodes().size(), 1); } void tst_Nodes::checkParentChangeToNull() { // GIVEN Qt3DCore::QScene scene; - ObserverSpy spy; + TestArbiter arbiter; QScopedPointer root(new MyQNode()); // WHEN - root->setArbiterAndScene(&spy, &scene); + root->setArbiterAndScene(&arbiter, &scene); QScopedPointer child(new MyQNode(root.data())); QCoreApplication::processEvents(); // THEN QVERIFY(child->parent() == root.data()); - QCOMPARE(spy.events.size(), 1); + QCOMPARE(arbiter.dirtyNodes().size(), 1); QCOMPARE(root->children().size(), 1); // WHEN - spy.events.clear(); + arbiter.clear(); child->setParent(Q_NODE_NULLPTR); // THEN QVERIFY(child->parent() == nullptr); QCOMPARE(root->children().size(), 0); - QCOMPARE(spy.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } void tst_Nodes::checkParentChangeToOtherParent() { // GIVEN Qt3DCore::QScene scene; - ObserverSpy spy; + TestArbiter arbiter; QScopedPointer root(new MyQNode()); - root->setArbiterAndScene(&spy, &scene); + root->setArbiterAndScene(&arbiter, &scene); QScopedPointer parent1(new MyQNode(root.data())); QScopedPointer parent2(new MyQNode(root.data())); QCoreApplication::processEvents(); // THEN - QCOMPARE(spy.events.size(), 2); // 2 x (1 node added to children change) + QCOMPARE(arbiter.dirtyNodes().size(), 1); // only parent node has changed // WHEN - spy.events.clear(); + arbiter.clear(); QScopedPointer child(new MyQNode(parent1.data())); QCoreApplication::processEvents(); @@ -907,48 +747,32 @@ void tst_Nodes::checkParentChangeToOtherParent() QCOMPARE(parent1->children().size(), 1); QCOMPARE(parent2->children().size(), 0); QVERIFY(Qt3DCore::QNodePrivate::get(child.data())->scene() != nullptr); - QCOMPARE(spy.events.size(), 1); // 1 node added to children change + QCOMPARE(arbiter.dirtyNodes().size(), 1); // 1 node added to children change // WHEN - spy.events.clear(); + arbiter.clear(); child->setParent(parent2.data()); // THEN QVERIFY(child->parent() == parent2.data()); QCOMPARE(parent1->children().size(), 0); QCOMPARE(parent2->children().size(), 1); - QCOMPARE(spy.events.size(), 1); + QCOMPARE(arbiter.dirtyNodes().size(), 1); // CHECK event 1 is a Node Removed event // this no longer generated because nodes don't have backends yet QVERIFY(!Qt3DCore::QNodePrivate::get(child.data())->m_hasBackendNode); - - -// QVERIFY(spy.events.first().wasLocked()); -// const Qt3DCore::QPropertyNodeRemovedChangePtr event = spy.events.takeFirst().change().dynamicCast(); -// QCOMPARE(event->type(), Qt3DCore::PropertyValueRemoved); -// QCOMPARE(event->subjectId(), parent1->id()); -// QCOMPARE(event->removedNodeId(), child->id()); -// QCOMPARE(event->metaObject(), child->metaObject()); - - // CHECK event 2 is a Node Added event - QVERIFY(spy.events.last().wasLocked()); - const Qt3DCore::QPropertyNodeAddedChangePtr event2 = spy.events.last().change().dynamicCast(); - QCOMPARE(event2->type(), Qt3DCore::PropertyValueAdded); - QCOMPARE(event2->subjectId(), parent2->id()); - QCOMPARE(event2->addedNodeId(), child->id()); - QCOMPARE(event2->metaObject(), child->metaObject()); } void tst_Nodes::checkParentChangeFromExistingBackendParentToNewlyCreatedParent() { // GIVEN - ObserverSpy spy; + TestArbiter arbiter; Qt3DCore::QAspectEngine engine; engine.setRunMode(Qt3DCore::QAspectEngine::Manual); QScopedPointer root(new MyQEntity()); - root->setArbiterAndEngine(&spy, &engine); + root->setArbiterAndEngine(&arbiter, &engine); auto aspect = new TestAspect; engine.registerAspect(aspect); @@ -967,11 +791,11 @@ void tst_Nodes::checkParentChangeFromExistingBackendParentToNewlyCreatedParent() QCOMPARE(aspect->events[1].nodeId, child2->id()); // THEN - QCOMPARE(spy.events.size(), 2); // 2 x (1 child added to parent change) + QCOMPARE(arbiter.dirtyNodes().size(), 1); // only parent node has changed // WHEN -> Reparenting child with backend node to new parent with no backend yet aspect->clearNodes(); - spy.events.clear(); + arbiter.clear(); QScopedPointer newParent(new MyQNode(root.data())); child->setParent(newParent.data()); @@ -990,62 +814,17 @@ void tst_Nodes::checkParentChangeFromExistingBackendParentToNewlyCreatedParent() engine.processFrame(); // THEN - QCOMPARE(spy.events.size(), 2); - // 1 node removed change - // 1 node added to children change + QCOMPARE(arbiter.dirtyNodes().size(), 1); // only parent node has changed QVERIFY(Qt3DCore::QNodePrivate::get(newParent.data())->m_hasBackendNode == true); QVERIFY(Qt3DCore::QNodePrivate::get(child)->m_hasBackendNode == true); - { - // CHECK event 1 is a Node Removed event - QVERIFY(spy.events.first().wasLocked()); - const Qt3DCore::QPropertyNodeRemovedChangePtr event = spy.events.takeFirst().change().staticCast(); - QCOMPARE(event->type(), Qt3DCore::PropertyValueRemoved); - QCOMPARE(event->subjectId(), root->id()); - QCOMPARE(event->removedNodeId(), child->id()); - QCOMPARE(event->metaObject(), child->metaObject()); - - const Qt3DCore::QPropertyNodeAddedChangePtr event2 = spy.events.takeFirst().change().staticCast(); - QCOMPARE(event2->type(), Qt3DCore::PropertyValueAdded); - QCOMPARE(event2->addedNodeId(), newParent->id()); - QCOMPARE(event2->metaObject(), newParent->metaObject()); - QCOMPARE(event2->subjectId(), root->id()); - - QCOMPARE(aspect->events.count(), 3); - - // child backend is destroyed because it was reparented to node without backend (newParent) - QCOMPARE(aspect->events[0].type, TestAspect::Destruction); - QCOMPARE(aspect->events[0].nodeId, child->id()); - - // newParent and child both get backends created - QCOMPARE(aspect->events[1].type, TestAspect::Creation); - QCOMPARE(aspect->events[1].nodeId, newParent->id()); - QCOMPARE(aspect->events[2].type, TestAspect::Creation); - QCOMPARE(aspect->events[2].nodeId, child->id()); - } - // WHEN -> Changing parent to node with existing backend aspect->clearNodes(); child->setParent(child2); // THEN - QCOMPARE(spy.events.size(), 2); - - // 1 node removed change, 1 node added change - { - QVERIFY(spy.events.first().wasLocked()); - const Qt3DCore::QPropertyNodeRemovedChangePtr event = spy.events.takeFirst().change().staticCast(); - QCOMPARE(event->type(), Qt3DCore::PropertyValueRemoved); - QCOMPARE(event->subjectId(), newParent->id()); - QCOMPARE(event->removedNodeId(), child->id()); - QCOMPARE(event->metaObject(), child->metaObject()); - - const Qt3DCore::QPropertyNodeAddedChangePtr event2 = spy.events.takeFirst().change().staticCast(); - QCOMPARE(event2->type(), Qt3DCore::PropertyValueAdded); - QCOMPARE(event2->addedNodeId(), child->id()); - QCOMPARE(event2->metaObject(), child->metaObject()); - QCOMPARE(event2->subjectId(), child2->id()); - } + QCOMPARE(arbiter.dirtyNodes().size(), 3); // old parent, new parent, and child have all changed + arbiter.clear(); QVERIFY(Qt3DCore::QNodePrivate::get(child)->m_hasBackendNode == true); QCOMPARE(root->childNodes().size(), 2); @@ -1067,28 +846,7 @@ void tst_Nodes::checkParentChangeFromExistingBackendParentToNewlyCreatedParent() engine.processFrame(); // THEN - QCOMPARE(spy.events.size(), 2); - // 1 node removed change - // 1 node added to children change - { - // CHECK event 1 is a Node Removed event - QVERIFY(spy.events.first().wasLocked()); - const Qt3DCore::QPropertyNodeRemovedChangePtr event = spy.events.takeFirst().change().staticCast(); - QCOMPARE(event->type(), Qt3DCore::PropertyValueRemoved); - QCOMPARE(event->subjectId(), child2->id()); - QCOMPARE(event->removedNodeId(), child->id()); - QCOMPARE(event->metaObject(), child->metaObject()); - - const Qt3DCore::QPropertyNodeAddedChangePtr event2 = spy.events.takeFirst().change().staticCast(); - QCOMPARE(event2->type(), Qt3DCore::PropertyValueAdded); - QCOMPARE(event2->addedNodeId(), newParent2->id()); - QCOMPARE(event2->metaObject(), newParent2->metaObject()); - QCOMPARE(event2->subjectId(), root->id()); - - // child backend is destroyed because it was reparented to node without backend (newParent) - QCOMPARE(aspect->events[0].type, TestAspect::Destruction); - QCOMPARE(aspect->events[0].nodeId, child->id()); - } + QCOMPARE(arbiter.dirtyNodes().size(), 2); } //Test creation changes happen for an entire subtree at once, starting at the top @@ -1097,13 +855,13 @@ void tst_Nodes::checkParentChangeFromExistingBackendParentToNewlyCreatedParent() void tst_Nodes::checkBackendNodesCreatedFromTopDown() { // GIVEN - ObserverSpy spy; + TestArbiter arbiter; Qt3DCore::QAspectEngine engine; auto aspect = new TestAspect; engine.registerAspect(aspect); QScopedPointer root(new MyQEntity()); - root->setArbiterAndEngine(&spy, &engine); + root->setArbiterAndEngine(&arbiter, &engine); QScopedPointer parentWithBackend(new MyQNode(root.data())); // create parent backend node @@ -1112,14 +870,14 @@ void tst_Nodes::checkBackendNodesCreatedFromTopDown() // WHEN -> creating 3 nodes and setting one as a property on the other // child2 is set as property on child1, but is created AFTER child1 - spy.events.clear(); + arbiter.clear(); MyQNode *dummyParent(new MyQNode(parentWithBackend.data())); MyQNode *child1(new MyQNode(parentWithBackend.data())); MyQNode *child2(new MyQNode(dummyParent)); child1->setNodeProperty(child2); // THEN - we should have no events because the new nodes have no backend yet - QCOMPARE(spy.events.count(), 0); + QCOMPARE(arbiter.dirtyNodes().count(), 0); // WHEN - create the backend nodes QCoreApplication::processEvents(); @@ -1130,27 +888,13 @@ void tst_Nodes::checkBackendNodesCreatedFromTopDown() QVERIFY(child2->parent() == dummyParent); // THEN - QCOMPARE(spy.events.size(), 2); - // 1 node added to children change (dummyParent to parent) - // 1 node added to children change (child1 to parent) + QCOMPARE(arbiter.dirtyNodes().size(), 1); // only parent node has changed { QVERIFY(Qt3DCore::QNodePrivate::get(dummyParent)->m_hasBackendNode); QVERIFY(Qt3DCore::QNodePrivate::get(child1)->m_hasBackendNode); QVERIFY(Qt3DCore::QNodePrivate::get(child2)->m_hasBackendNode); - // 1st event: dummyParent added to parent - const auto event = spy.events.takeFirst().change().dynamicCast(); - QCOMPARE(event->type(), Qt3DCore::PropertyValueAdded); - QCOMPARE(event->addedNodeId(), dummyParent->id()); - QCOMPARE(event->subjectId(), parentWithBackend->id()); - - // 2nd event: child 1 added to parent - const auto event2 = spy.events.takeFirst().change().dynamicCast(); - QCOMPARE(event2->type(), Qt3DCore::PropertyValueAdded); - QCOMPARE(event2->addedNodeId(), child1->id()); - QCOMPARE(event2->subjectId(), parentWithBackend->id()); - verifyChildrenCreatedBeforeParents(root.get(), aspect); } @@ -1159,13 +903,13 @@ void tst_Nodes::checkBackendNodesCreatedFromTopDown() void tst_Nodes::checkBackendNodesCreatedFromTopDownWithReparenting() { // GIVEN - ObserverSpy spy; + TestArbiter arbiter; Qt3DCore::QAspectEngine engine; auto aspect = new TestAspect; engine.registerAspect(aspect); QScopedPointer root(new MyQEntity()); - root->setArbiterAndEngine(&spy, &engine); + root->setArbiterAndEngine(&arbiter, &engine); QScopedPointer parentWithBackend(new MyQNode(root.data())); // create parent backend node @@ -1175,7 +919,7 @@ void tst_Nodes::checkBackendNodesCreatedFromTopDownWithReparenting() // WHEN -> creating a node with a parent with backend, then reparenting it to another // parent with backend created after it. - spy.events.clear(); + arbiter.clear(); auto node1 = new MyQNode(parentWithBackend.data()); auto parent1 = new MyQNode(parentWithBackend.data()); node1->setParent(parent1); @@ -1205,18 +949,18 @@ void tst_Nodes::checkBackendNodesCreatedFromTopDownWithReparenting() void tst_Nodes::removingSingleChildNodeFromNode() { // GIVEN - ObserverSpy spy; + TestArbiter arbiter; Qt3DCore::QAspectEngine engine; QScopedPointer root(new MyQEntity()); QScopedPointer child(new MyQNode()); // WHEN - root->setArbiterAndEngine(&spy, &engine); + root->setArbiterAndEngine(&arbiter, &engine); root->setSimulateBackendCreated(true); child->setParent(root.data()); // Clear any creation event - spy.events.clear(); + arbiter.clear(); // THEN QVERIFY(root->children().count() == 1); @@ -1229,26 +973,20 @@ void tst_Nodes::removingSingleChildNodeFromNode() QVERIFY(child->parent() == nullptr); QVERIFY(root->children().count() == 0); - QCOMPARE(spy.events.size(), 1); - - QVERIFY(spy.events.first().wasLocked()); - const Qt3DCore::QPropertyNodeRemovedChangePtr removalEvent = spy.events.takeFirst().change().dynamicCast(); - QCOMPARE(removalEvent->subjectId(), root->id()); - QCOMPARE(removalEvent->removedNodeId(), child->id()); - QCOMPARE(removalEvent->metaObject(), child->metaObject()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); } void tst_Nodes::checkAllBackendCreationDoneInSingleFrame() { // GIVEN - ObserverSpy spy; + TestArbiter arbiter; Qt3DCore::QAspectEngine engine; engine.setRunMode(Qt3DCore::QAspectEngine::Manual); auto aspect = new TestAspect; engine.registerAspect(aspect); QScopedPointer root(new MyQEntity()); - root->setArbiterAndEngine(&spy, &engine); + root->setArbiterAndEngine(&arbiter, &engine); QCoreApplication::processEvents(); @@ -1289,12 +1027,12 @@ void tst_Nodes::checkAllBackendCreationDoneInSingleFrame() void tst_Nodes::removingMultipleChildNodesFromNode() { // GIVEN - ObserverSpy spy; + TestArbiter arbiter; Qt3DCore::QAspectEngine engine; QScopedPointer root(new MyQEntity()); // WHEN - root->setArbiterAndEngine(&spy, &engine); + root->setArbiterAndEngine(&arbiter, &engine); // THEN QVERIFY(Qt3DCore::QNodePrivate::get(root.data())->scene() != nullptr); @@ -1310,26 +1048,16 @@ void tst_Nodes::removingMultipleChildNodesFromNode() // THEN QCOMPARE(root->children().count(), 10); - QCOMPARE(spy.events.size(), 10); + QCOMPARE(arbiter.dirtyNodes().size(), 1); // WHEN - spy.events.clear(); + arbiter.clear(); auto cl = root->children(); qDeleteAll(cl); // THEN QVERIFY(root->children().count() == 0); - QCOMPARE(spy.events.size(), 10); - int i = 0; - for (const ObserverSpy::ChangeRecord &r : qAsConst(spy.events)) { - QVERIFY(r.wasLocked()); - const Qt3DCore::QNodeId childId = childIds.at(i); - Qt3DCore::QPropertyNodeRemovedChangePtr additionEvent = r.change().dynamicCast(); - QCOMPARE(additionEvent->subjectId(), root->id()); - QCOMPARE(additionEvent->removedNodeId(), childId); - QCOMPARE(additionEvent->metaObject(), &MyQNode::staticMetaObject); - ++i; - } + QCOMPARE(arbiter.dirtyNodes().size(), 0); // since all nodes are deleted, there's no backend to notify } void tst_Nodes::appendingChildEntitiesToNode() @@ -1373,14 +1101,14 @@ void tst_Nodes::removingChildEntitiesFromNode() void tst_Nodes::checkConstructionSetParentMix() { // GIVEN - ObserverSpy spy; + TestArbiter arbiter; Qt3DCore::QAspectEngine engine; auto aspect = new TestAspect; engine.registerAspect(aspect); QScopedPointer root(new MyQEntity()); // WHEN - root->setArbiterAndEngine(&spy, &engine); + root->setArbiterAndEngine(&arbiter, &engine); root->setSimulateBackendCreated(true); // THEN @@ -1398,27 +1126,21 @@ void tst_Nodes::checkConstructionSetParentMix() QCoreApplication::processEvents(); QCOMPARE(root->children().count(), 1); QCOMPARE(subTreeRoot->children().count(), 100); - QCOMPARE(spy.events.size(), 1); // 1 child added (subTree to root) + QCOMPARE(arbiter.dirtyNodes().size(), 1); // 1 child added (subTree to root) // Ensure first event is subTreeRoot verifyChildrenCreatedBeforeParents(root.data(), aspect); - - const Qt3DCore::QPropertyNodeAddedChangePtr lastEvent = spy.events.takeLast().change().dynamicCast(); - QVERIFY(!lastEvent.isNull()); - QCOMPARE(lastEvent->subjectId(), root->id()); - QCOMPARE(lastEvent->propertyName(), "children"); - QCOMPARE(lastEvent->addedNodeId(), subTreeRoot->id()); } void tst_Nodes::checkParentingQEntityToQNode() { // GIVEN - ObserverSpy spy; + TestArbiter arbiter; Qt3DCore::QAspectEngine engine; QScopedPointer root(new MyQEntity()); // WHEN - root->setArbiterAndEngine(&spy, &engine); + root->setArbiterAndEngine(&arbiter, &engine); root->setSimulateBackendCreated(true); // THEN @@ -1431,7 +1153,7 @@ void tst_Nodes::checkParentingQEntityToQNode() // THEN QCoreApplication::processEvents(); - QCOMPARE(spy.events.size(), 1); + QCOMPARE(arbiter.dirtyNodes().size(), 1); QVERIFY(Qt3DCore::QNodePrivate::get(root.data())->m_hasBackendNode); QVERIFY(Qt3DCore::QNodePrivate::get(subTreeRoot)->m_hasBackendNode); @@ -1439,43 +1161,23 @@ void tst_Nodes::checkParentingQEntityToQNode() QVERIFY(Qt3DCore::QNodePrivate::get(childNode)->m_hasBackendNode); // WHEN we reparent the childEntity to the childNode (QNode) - spy.events.clear(); + arbiter.clear(); childEntity->setParent(childNode); QCoreApplication::processEvents(); - // THEN we should get - // - one child removed change for childEntity->subTreeRoot, - // - one child added change for childEntity->childNode, - QCOMPARE(spy.events.size(), 2); - - const auto removedEvent = spy.events.takeFirst().change().dynamicCast(); - QVERIFY(!removedEvent.isNull()); - QCOMPARE(removedEvent->subjectId(), subTreeRoot->id()); - - const auto addedEvent = spy.events.takeFirst().change().dynamicCast(); - QVERIFY(!addedEvent.isNull()); - QCOMPARE(addedEvent->subjectId(), childNode->id()); - - // The arbiter's dirtyNodes should contain the childEntity and - // - the dirty node's parent should be childNode - // - the dirty node's parent entity should be the subTreeRoot - QCOMPARE(spy.dirtyNodes.size(), 1); - const auto dirtyEntity = qobject_cast(spy.dirtyNodes.takeFirst()); - QVERIFY(dirtyEntity); - QCOMPARE(dirtyEntity, childEntity); - QCOMPARE(dirtyEntity->parent(), childNode); - QCOMPARE(dirtyEntity->parentEntity(), subTreeRoot); + // THEN + QCOMPARE(arbiter.dirtyNodes().size(), 3); } void tst_Nodes::checkConstructionWithParent() { // GIVEN - ObserverSpy spy; + TestArbiter arbiter; Qt3DCore::QAspectEngine engine; QScopedPointer root(new MyQEntity()); // WHEN - root->setArbiterAndEngine(&spy, &engine); + root->setArbiterAndEngine(&arbiter, &engine); root->setSimulateBackendCreated(true); // THEN @@ -1488,29 +1190,19 @@ void tst_Nodes::checkConstructionWithParent() // THEN we should get one child added change QCoreApplication::processEvents(); QCOMPARE(root->children().count(), 1); - QCOMPARE(spy.events.size(), 1); // 1 child added change - - const auto newChildEvent = spy.events.takeFirst().change().dynamicCast(); - QVERIFY(!newChildEvent.isNull()); - QCOMPARE(newChildEvent->subjectId(), root->id()); - QCOMPARE(newChildEvent->propertyName(), "children"); - QCOMPARE(newChildEvent->addedNodeId(), node->id()); - - // Ensure the parent node is dirty - QCOMPARE(spy.events.size(), 0); - QCOMPARE(spy.dirtyNodes.size(), 1); - QCOMPARE(spy.dirtyNodes.front(), root.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); // 1 child added change + QCOMPARE(arbiter.dirtyNodes().front(), root.data()); } void tst_Nodes::checkConstructionWithNonRootParent() { // GIVEN - ObserverSpy spy; + TestArbiter arbiter; Qt3DCore::QAspectEngine engine; QScopedPointer root(new MyQEntity()); // WHEN - root->setArbiterAndEngine(&spy, &engine); + root->setArbiterAndEngine(&arbiter, &engine); root->setSimulateBackendCreated(true); QScopedPointer parent(new MyQNode(root.data())); @@ -1532,28 +1224,19 @@ void tst_Nodes::checkConstructionWithNonRootParent() QCOMPARE(root->children().count(), 1); QCOMPARE(parent->children().count(), 1); - QCOMPARE(spy.events.size(), 1); // 1 child added changes - - const auto parentNewChildEvent = spy.events.takeFirst().change().dynamicCast(); - QVERIFY(!parentNewChildEvent.isNull()); - QCOMPARE(parentNewChildEvent->subjectId(), root->id()); - QCOMPARE(parentNewChildEvent->propertyName(), "children"); - QCOMPARE(parentNewChildEvent->addedNodeId(), parent->id()); - - // Ensure second and last event is property set change - QCOMPARE(spy.dirtyNodes.size(), 1); - QCOMPARE(spy.dirtyNodes.front(), root.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); // 1 child added changes + QCOMPARE(arbiter.dirtyNodes().front(), root.data()); } void tst_Nodes::checkConstructionAsListElement() { // GIVEN - ObserverSpy spy; + TestArbiter arbiter; Qt3DCore::QAspectEngine engine; QScopedPointer root(new MyQEntity()); // WHEN - root->setArbiterAndEngine(&spy, &engine); + root->setArbiterAndEngine(&arbiter, &engine); root->setSimulateBackendCreated(true); // THEN @@ -1568,19 +1251,18 @@ void tst_Nodes::checkConstructionAsListElement() QCoreApplication::processEvents(); QCOMPARE(root->children().count(), 1); - QCOMPARE(spy.dirtyNodes.size(), 1); // 1 property change - QCOMPARE(spy.dirtySubNodes.size(), 1); // 1 child added change + QCOMPARE(arbiter.dirtyNodes().size(), 1); // 1 property change } void tst_Nodes::checkSceneIsSetOnConstructionWithParent() { // GIVEN - ObserverSpy spy; + TestArbiter arbiter; Qt3DCore::QScene scene; QScopedPointer root(new MyQNode()); // WHEN - root->setArbiterAndScene(&spy, &scene); + root->setArbiterAndScene(&arbiter, &scene); root->setSimulateBackendCreated(true); // THEN @@ -1603,9 +1285,9 @@ void tst_Nodes::checkSceneIsSetOnConstructionWithParent() QCoreApplication::processEvents(); QCOMPARE(root->children().count(), 1); QCOMPARE(subTreeRoot->children().count(), 5); - QCOMPARE(spy.events.size(), 1); // 1 child added (subTree to root) + QCOMPARE(arbiter.dirtyNodes().size(), 1); // 1 child added (subTree to root) - spy.events.clear(); + arbiter.clear(); // Add component in a separate loop to ensure components are added after // entities have been fully created @@ -1614,20 +1296,19 @@ void tst_Nodes::checkSceneIsSetOnConstructionWithParent() } // THEN - QCOMPARE(spy.events.size(), 0); - QCOMPARE(spy.dirtySubNodes.size(), 5); // 5 entities changed + QCOMPARE(arbiter.dirtyNodes().size(), 5); } void tst_Nodes::checkSubNodePostConstructIsCalledWhenReferincingNodeProperty() { // GIVEN - ObserverSpy spy; + TestArbiter arbiter; Qt3DCore::QAspectEngine engine; Qt3DCore::QScene scene(&engine); QScopedPointer root(new MyQNode()); // WHEN - root->setArbiterAndScene(&spy, &scene); + root->setArbiterAndScene(&arbiter, &scene); root->setSimulateBackendCreated(true); // THEN @@ -1649,33 +1330,19 @@ void tst_Nodes::checkSubNodePostConstructIsCalledWhenReferincingNodeProperty() QVERIFY(Qt3DCore::QNodePrivate::get(material->m_effect)->m_hasBackendNode); QVERIFY(Qt3DCore::QNodePrivate::get(material->m_technique)->m_hasBackendNode); QVERIFY(Qt3DCore::QNodePrivate::get(material->m_renderPass)->m_hasBackendNode); - - // WHEN - MyQNode *fakeRenderState = new MyQNode(material); - Qt3DCore::QNodePrivate *dPtr = Qt3DCore::QNodePrivate::get(fakeRenderState); - - // THEN - QVERIFY(!dPtr->m_hasBackendNode); - - // WHEN - material->m_renderPass->addAttribute(fakeRenderState); - - // THEN - QVERIFY(dPtr->m_hasBackendNode); } void tst_Nodes::appendingParentlessComponentToEntityWithoutScene() { // GIVEN - ObserverSpy entitySpy; - ObserverSpy componentSpy; + TestArbiter arbiter; { QScopedPointer entity(new MyQEntity()); - entity->setArbiterAndScene(&entitySpy); + entity->setArbiterAndScene(&arbiter); entity->setSimulateBackendCreated(true); MyQComponent *comp = new MyQComponent(); - comp->setArbiter(&componentSpy); + comp->setArbiter(&arbiter); // THEN QVERIFY(entity->parentNode() == nullptr); @@ -1690,15 +1357,7 @@ void tst_Nodes::appendingParentlessComponentToEntityWithoutScene() QVERIFY(entity->components().count() == 1); QVERIFY(entity->components().first() == comp); QVERIFY(comp->parentNode() == entity.data()); - QCOMPARE(entitySpy.events.size(), 0); - QCOMPARE(entitySpy.dirtyNodes.size(), 1); - QCOMPARE(entitySpy.dirtySubNodes.size(), 1); - - const auto event = entitySpy.dirtySubNodes.first(); - QCOMPARE(event.change, Qt3DCore::ComponentAdded); - QCOMPARE(event.node, entity.data()); - QCOMPARE(event.subNode, comp); - QCOMPARE(event.property, nullptr); + QCOMPARE(arbiter.dirtyNodes().size(), 1); // Note: since QEntity has no scene in this test case, we only have the // ComponentAdded event In theory we should also get the NodeCreated event @@ -1711,12 +1370,12 @@ void tst_Nodes::appendingParentlessComponentToEntityWithoutScene() void tst_Nodes::appendingParentlessComponentToNonRootEntity() { // GIVEN - ObserverSpy eventSpy; + TestArbiter arbiter; Qt3DCore::QAspectEngine engine; { QScopedPointer root(new MyQEntity()); - root->setArbiterAndEngine(&eventSpy, &engine); + root->setArbiterAndEngine(&arbiter, &engine); root->setSimulateBackendCreated(true); QCoreApplication::processEvents(); @@ -1742,33 +1401,24 @@ void tst_Nodes::appendingParentlessComponentToNonRootEntity() QVERIFY(entity->components().first() == comp); QVERIFY(comp->parentNode() == entity.data()); - QCOMPARE(eventSpy.events.size(), 1); - // - entity added as child to root - QVERIFY(eventSpy.events.first().wasLocked()); + QCOMPARE(arbiter.dirtyNodes().size(), 2); + QCOMPARE(arbiter.dirtyNodes().at(0), root.data()); + QCOMPARE(arbiter.dirtyNodes().at(1), entity.data()); QVERIFY(Qt3DCore::QNodePrivate::get(entity.data())->m_hasBackendNode); QVERIFY(Qt3DCore::QNodePrivate::get(comp)->m_hasBackendNode); - - { - const auto event = eventSpy.events.takeFirst().change().dynamicCast(); - QVERIFY(!event.isNull()); - QCOMPARE(event->type(), Qt3DCore::PropertyValueAdded); - QCOMPARE(event->subjectId(), root->id()); - QCOMPARE(event->propertyName(), QByteArrayLiteral("children")); - QCOMPARE(event->addedNodeId(), entity->id()); - } } } void tst_Nodes::appendingParentlessComponentToEntityWithScene() { // GIVEN - ObserverSpy eventSpy; + TestArbiter arbiter; Qt3DCore::QAspectEngine engine; { QScopedPointer entity(new MyQEntity()); - entity->setArbiterAndEngine(&eventSpy, &engine); + entity->setArbiterAndEngine(&arbiter, &engine); entity->setSimulateBackendCreated(true); QCoreApplication::processEvents(); @@ -1790,18 +1440,7 @@ void tst_Nodes::appendingParentlessComponentToEntityWithScene() QVERIFY(entity->components().first() == comp); QVERIFY(comp->parentNode() == entity.data()); - QCOMPARE(eventSpy.events.size(), 1); - // - child added - QVERIFY(eventSpy.events.first().wasLocked()); - - { - const auto event = eventSpy.events.takeFirst().change().dynamicCast(); - QVERIFY(!event.isNull()); - QCOMPARE(event->type(), Qt3DCore::PropertyValueAdded); - QCOMPARE(event->subjectId(), entity->id()); - QCOMPARE(event->propertyName(), QByteArrayLiteral("children")); - QCOMPARE(event->addedNodeId(), comp->id()); - } + QCOMPARE(arbiter.dirtyNodes().size(), 1); } } @@ -1809,13 +1448,12 @@ void tst_Nodes::appendingParentlessComponentToEntityWithScene() void tst_Nodes::appendingComponentToEntity() { // GIVEN - ObserverSpy entitySpy; - ObserverSpy componentSpy; + TestArbiter arbiter; { QScopedPointer entity(new MyQEntity()); - entity->setArbiterAndScene(&entitySpy); + entity->setArbiterAndScene(&arbiter); MyQComponent *comp = new MyQComponent(entity.data()); - comp->setArbiter(&componentSpy); + comp->setArbiter(&arbiter); QCoreApplication::processEvents(); // THEN @@ -1831,28 +1469,20 @@ void tst_Nodes::appendingComponentToEntity() QVERIFY(entity->components().count() == 1); QVERIFY(entity->components().first() == comp); QVERIFY(comp->parentNode() == entity.data()); - QCOMPARE(entitySpy.events.size(), 0); - QCOMPARE(entitySpy.dirtyNodes.size(), 1); - QCOMPARE(entitySpy.dirtySubNodes.size(), 1); - QCOMPARE(entitySpy.dirtyNodes.first(), entity.data()); - const auto event = entitySpy.dirtySubNodes.takeFirst(); - QCOMPARE(event.node, entity.data()); - QCOMPARE(event.subNode, comp); - QCOMPARE(event.change, Qt3DCore::ComponentAdded); - QCOMPARE(event.property, nullptr); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().first(), entity.data()); } } void tst_Nodes::removingComponentFromEntity() { // GIVEN - ObserverSpy entitySpy; - ObserverSpy componentSpy; + TestArbiter arbiter; { QScopedPointer entity(new MyQEntity()); - entity->setArbiterAndScene(&entitySpy); + entity->setArbiterAndScene(&arbiter); MyQComponent *comp = new MyQComponent(); - comp->setArbiter(&componentSpy); + comp->setArbiter(&arbiter); // WHEN entity->addComponent(comp); @@ -1863,42 +1493,28 @@ void tst_Nodes::removingComponentFromEntity() QVERIFY(comp->parent() == entity.data()); // WHEN - entitySpy.events.clear(); - entitySpy.dirtyNodes.clear(); - entitySpy.dirtySubNodes.clear(); - componentSpy.events.clear(); + arbiter.clear(); entity->removeComponent(comp); // THEN QVERIFY(entity->components().count() == 0); QVERIFY(comp->parent() == entity.data()); QVERIFY(entity->children().count() == 1); - QCOMPARE(entitySpy.events.size(), 0); - QCOMPARE(entitySpy.dirtyNodes.size(), 1); - QCOMPARE(entitySpy.dirtySubNodes.size(), 1); - QCOMPARE(componentSpy.events.size(), 0); - { - const auto event = entitySpy.dirtySubNodes.takeFirst(); - qDebug() << event.change; - QCOMPARE(event.change, Qt3DCore::ComponentRemoved); - QCOMPARE(event.node, entity.data()); - QCOMPARE(event.subNode, comp); - QCOMPARE(event.property, nullptr); - } + QCOMPARE(arbiter.dirtyNodes().size(), 1); } } void tst_Nodes::changeCustomProperty() { // GIVEN - ObserverSpy spy; + TestArbiter arbiter; QScopedPointer node(new MyQNode()); - node->setArbiterAndScene(&spy); + node->setArbiterAndScene(&arbiter); // WHEN node->setCustomProperty(QStringLiteral("foo")); // THEN - QCOMPARE(spy.dirtyNodes.size(), 1); - QCOMPARE(spy.dirtyNodes.front(), node.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), node.data()); } void tst_Nodes::checkDestruction() @@ -2018,59 +1634,6 @@ void tst_Nodes::checkPropertyChanges() } } -void tst_Nodes::checkCreationData() -{ - // GIVEN - Qt3DCore::QNode root; - Qt3DCore::QNode node; - - node.setParent(&root); - node.setEnabled(true); - const QString enabledPropertyName = QStringLiteral("enabled"); - node.setDefaultPropertyTrackingMode(Qt3DCore::QNode::DontTrackValues); - node.setPropertyTracking(enabledPropertyName, Qt3DCore::QNode::TrackAllValues); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&node); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast(creationChanges.first()); - - QCOMPARE(node.id(), creationChangeData->subjectId()); - QCOMPARE(node.isEnabled(), true); - QCOMPARE(node.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(node.metaObject(), creationChangeData->metaObject()); - } - - // WHEN - node.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&node); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast(creationChanges.first()); - - QCOMPARE(node.id(), creationChangeData->subjectId()); - QCOMPARE(node.isEnabled(), false); - QCOMPARE(node.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(node.metaObject(), creationChangeData->metaObject()); - } -} - void tst_Nodes::checkEnabledUpdate() { // GIVEN @@ -2083,11 +1646,10 @@ void tst_Nodes::checkEnabledUpdate() node.setEnabled(false); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &node); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &node); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -2095,8 +1657,7 @@ void tst_Nodes::checkEnabledUpdate() node.setEnabled(false); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -2114,7 +1675,7 @@ void tst_Nodes::checkPropertyTrackModeUpdate() QCoreApplication::processEvents(); // THEN -> this properties is non notifying - QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } { @@ -2123,7 +1684,7 @@ void tst_Nodes::checkPropertyTrackModeUpdate() QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -2141,7 +1702,7 @@ void tst_Nodes::checkTrackedPropertyNamesUpdate() QCoreApplication::processEvents(); // THEN -> this properties is non notifying - QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } { @@ -2150,7 +1711,7 @@ void tst_Nodes::checkTrackedPropertyNamesUpdate() QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -2170,17 +1731,15 @@ void tst_Nodes::checkNodeRemovedFromDirtyListOnDestruction() node->setEnabled(false); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), node.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), node.data()); // WHEN // scene should be unset and node removed from arbiter dirtyList node.reset(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } { // GIVEN @@ -2196,17 +1755,16 @@ void tst_Nodes::checkNodeRemovedFromDirtyListOnDestruction() child->setEnabled(false); // THEN - QCOMPARE(arbiter.events.size(), 1); // childAdded - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), child); + QCOMPARE(arbiter.dirtyNodes().size(), 2); + QCOMPARE(arbiter.dirtyNodes().at(0), node.data()); + QCOMPARE(arbiter.dirtyNodes().at(1), child); // WHEN // scene should be unset and child node removed from arbiter dirtyList node.reset(); // THEN - QCOMPARE(arbiter.events.size(), 1); // childRemoved (no destroyed change since we had no backend) - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } diff --git a/tests/auto/core/qarmature/tst_qarmature.cpp b/tests/auto/core/qarmature/tst_qarmature.cpp index 098efd1af..a8199276c 100644 --- a/tests/auto/core/qarmature/tst_qarmature.cpp +++ b/tests/auto/core/qarmature/tst_qarmature.cpp @@ -33,9 +33,7 @@ #include #include -#include - -#include "testpostmanarbiter.h" +#include using namespace Qt3DCore; @@ -50,44 +48,6 @@ public: private Q_SLOTS: - void checkCreationChange_data() - { - QTest::addColumn("armature"); - - QArmature *defaultConstructed = new QArmature(); - QTest::newRow("defaultConstructed") << defaultConstructed; - - QArmature *armatureWithSkeleton = new QArmature(); - armatureWithSkeleton->setSkeleton(new QSkeleton()); - QTest::newRow("skeletonWithOneJoint") << armatureWithSkeleton; - } - - void checkCreationChange() - { - // GIVEN - QFETCH(QArmature *, armature); - - // WHEN - QNodeCreatedChangeGenerator creationChangeGenerator(armature); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - const int skeletonCount = armature->skeleton() ? 1 : 0; - - // THEN - QCOMPARE(creationChanges.size(), 1 + skeletonCount); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const QArmatureData &data = creationChangeData->data; - - // THEN - QCOMPARE(armature->id(), creationChangeData->subjectId()); - QCOMPARE(armature->isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(armature->metaObject(), creationChangeData->metaObject()); - if (armature->skeleton()) { - QCOMPARE(armature->skeleton()->id(), data.skeletonId); - } - } - void checkPropertyUpdates() { // GIVEN @@ -100,19 +60,19 @@ private Q_SLOTS: armature->setSkeleton(skeleton); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), armature.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), armature.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN armature->setSkeleton(nullptr); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), armature.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), armature.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } void checkSkeletonBookkeeping() diff --git a/tests/auto/core/qchangearbiter/qchangearbiter.pro b/tests/auto/core/qchangearbiter/qchangearbiter.pro index 64a7b36e7..4628bf6cd 100644 --- a/tests/auto/core/qchangearbiter/qchangearbiter.pro +++ b/tests/auto/core/qchangearbiter/qchangearbiter.pro @@ -6,3 +6,5 @@ QT += testlib core core-private 3dcore 3dcore-private SOURCES += \ tst_qchangearbiter.cpp + +include(../common/common.pri) diff --git a/tests/auto/core/qchangearbiter/tst_qchangearbiter.cpp b/tests/auto/core/qchangearbiter/tst_qchangearbiter.cpp index 3e9b24408..fc77b0343 100644 --- a/tests/auto/core/qchangearbiter/tst_qchangearbiter.cpp +++ b/tests/auto/core/qchangearbiter/tst_qchangearbiter.cpp @@ -26,22 +26,8 @@ ** ****************************************************************************/ -// TODO Remove in Qt6 -#include -QT_WARNING_DISABLE_DEPRECATED - #include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include #include #include #include @@ -51,96 +37,16 @@ QT_WARNING_DISABLE_DEPRECATED #include #include #include +#include class tst_QChangeArbiter : public QObject { Q_OBJECT private slots: - void registerObservers(); - void registerSceneObserver(); - void unregisterObservers(); - void unregisterSceneObservers(); - void distributeFrontendChanges(); - void distributePropertyChanges(); - void distributeBackendChanges(); -}; - -class AllChangesChange : public Qt3DCore::QSceneChange -{ -public: - AllChangesChange(Qt3DCore::QNodeId subjectId) - : Qt3DCore::QSceneChange(Qt3DCore::AllChanges, subjectId) - { - } + void recordsDirtyNodes(); }; -class tst_Node : public Qt3DCore::QEntity -{ -public: - explicit tst_Node(Qt3DCore::QNode *parent = 0) : Qt3DCore::QEntity(parent) - {} - - void sendNodeAddedNotification(QNode *node) - { - Qt3DCore::QPropertyNodeAddedChangePtr e(new Qt3DCore::QPropertyNodeAddedChange(id(), node)); - e->setPropertyName("PropertyValueAdded"); - Qt3DCore::QNodePrivate::get(this)->notifyObservers(e); - } - - void sendNodeRemovedNotification(QNode *node) - { - Qt3DCore::QPropertyNodeRemovedChangePtr e(new Qt3DCore::QPropertyNodeRemovedChange(id(), node)); - e->setPropertyName("PropertyValueRemoved"); - Qt3DCore::QNodePrivate::get(this)->notifyObservers(e); - } - - void sendNodeUpdatedNotification() - { - Qt3DCore::QPropertyUpdatedChangePtr e(new Qt3DCore::QPropertyUpdatedChange(id())); - e->setPropertyName("PropertyUpdated"); - Qt3DCore::QNodePrivate::get(this)->notifyObservers(e); - } - - void sendComponentAddedNotification(Qt3DCore::QComponent *component) - { - Qt3DCore::QComponentAddedChangePtr e(new Qt3DCore::QComponentAddedChange(this, component)); - Qt3DCore::QNodePrivate::get(this)->notifyObservers(e); - } - - void sendComponentRemovedNotification(Qt3DCore::QComponent *component) - { - Qt3DCore::QComponentRemovedChangePtr e(new Qt3DCore::QComponentRemovedChange(this, component)); - Qt3DCore::QNodePrivate::get(this)->notifyObservers(e); - } - - void sendAllChangesNotification() - { - Qt3DCore::QSceneChangePtr e(new AllChangesChange(id())); - Qt3DCore::QNodePrivate::get(this)->notifyObservers(e); - } - - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override - { - QVERIFY(!change.isNull()); - m_lastChanges << change; - } - - Qt3DCore::QSceneChangePtr lastChange() const - { - if (m_lastChanges.isEmpty()) - return Qt3DCore::QSceneChangePtr(); - return m_lastChanges.last(); - } - - QList lastChanges() const - { - return m_lastChanges; - } - -private: - QList m_lastChanges; -}; // used to test property change notifications class PropertyTestNode : public Qt3DCore::QNode @@ -180,723 +86,53 @@ private: float m_prop2 = 0.0f; }; -class tst_SimpleObserver : public Qt3DCore::QObserverInterface -{ -public: - - // QObserverInterface interface - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) override - { - QVERIFY(!e.isNull()); - m_lastChanges.append(e); - } - - Qt3DCore::QSceneChangePtr lastChange() const - { - if (m_lastChanges.isEmpty()) - return Qt3DCore::QSceneChangePtr(); - return m_lastChanges.last(); - } - - QList lastChanges() const - { - return m_lastChanges; - } - - void clear() - { - m_lastChanges.clear(); - } - -private: - QList m_lastChanges; -}; - -class tst_BackendObserverObservable : public Qt3DCore::QBackendNode -{ -public: - - tst_BackendObserverObservable() - : Qt3DCore::QBackendNode(ReadWrite) - {} - - // QObserverInterface interface - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) override - { - QVERIFY(!e.isNull()); - m_lastChanges << e; - m_targetId = e->subjectId(); - } - - // should be called in thread - void sendReply() - { - Qt3DCore::QPropertyUpdatedChangePtr reply; - reply = QSharedPointer::create(m_targetId); - reply->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll); - reply->setPropertyName("Reply"); - notifyObservers(reply); - qDebug() << Q_FUNC_INFO; - } - - Qt3DCore::QSceneChangePtr lastChange() const - { - if (m_lastChanges.isEmpty()) - return Qt3DCore::QSceneChangePtr(); - return m_lastChanges.last(); - } - - QList lastChanges() const - { - return m_lastChanges; - } - - void clear() - { - m_lastChanges.clear(); - } - -private: - QList m_lastChanges; - Qt3DCore::QNodeId m_targetId; - -}; - -class ThreadedAnswer : public QThread -{ - Q_OBJECT -public: - ThreadedAnswer(Qt3DCore::QChangeArbiter *arbiter, tst_BackendObserverObservable *backend) - : QThread() - , m_arbiter(arbiter) - , m_backendObs(backend) - {} - - ~ThreadedAnswer() { qDebug() << this; } - - void run() override - { - // create backend change queue on QChangeArbiter - Qt3DCore::QChangeArbiter::createThreadLocalChangeQueue(m_arbiter); - m_backendObs->sendReply(); - // gives time for other threads to start waiting - QThread::currentThread()->sleep(1); - // wake waiting condition - m_waitingForReplyToBeSent.wakeOne(); - exec(); - Qt3DCore::QChangeArbiter::destroyThreadLocalChangeQueue(m_arbiter); - } - - QWaitCondition *waitingCondition() { return &m_waitingForReplyToBeSent; } - -private: - Qt3DCore::QChangeArbiter *m_arbiter; - tst_BackendObserverObservable *m_backendObs; - QWaitCondition m_waitingForReplyToBeSent; -}; - -class tst_PostManObserver : public Qt3DCore::QAbstractPostman -{ -public: - - tst_PostManObserver() - : m_sceneInterface(nullptr) - , m_allowFrontendNotifications(false) - {} - - void setScene(Qt3DCore::QScene *scene) final - { - m_sceneInterface = scene; - } - - void setAllowFrontendNotifications(bool allow) - { - m_allowFrontendNotifications = allow; - } - - // QObserverInterface interface - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) - { - QVERIFY(!e.isNull()); - Qt3DCore::QPropertyUpdatedChangePtr change = qSharedPointerDynamicCast(e); - QVERIFY(!change.isNull()); - Qt3DCore::QNode *targetNode = m_sceneInterface->lookupNode(change->subjectId()); - QVERIFY(targetNode != nullptr); - m_lastChanges << e; - } - - Qt3DCore::QSceneChangePtr lastChange() const - { - if (m_lastChanges.isEmpty()) - return Qt3DCore::QSceneChangePtr(); - return m_lastChanges.last(); - } - - QList lastChanges() const - { - return m_lastChanges; - } - - void notifyBackend(const Qt3DCore::QSceneChangePtr &e) final - { - m_sceneInterface->arbiter()->sceneChangeEventWithLock(e); - } - - bool shouldNotifyFrontend(const Qt3DCore::QSceneChangePtr &) - { - return m_allowFrontendNotifications; - } - -private: - Qt3DCore::QScene *m_sceneInterface; - QList m_lastChanges; - bool m_allowFrontendNotifications; -}; - -void tst_QChangeArbiter::registerObservers() +void tst_QChangeArbiter::recordsDirtyNodes() { // GIVEN - QScopedPointer arbiter(new Qt3DCore::QChangeArbiter()); + QScopedPointer arbiter(new TestArbiter()); QScopedPointer scene(new Qt3DCore::QScene()); - QScopedPointer postman(new tst_PostManObserver); - arbiter->setPostman(postman.data()); arbiter->setScene(scene.data()); - postman->setScene(scene.data()); scene->setArbiter(arbiter.data()); - // Replaces initialize as we have no JobManager in this case - Qt3DCore::QChangeArbiter::createThreadLocalChangeQueue(arbiter.data()); // WHEN - Qt3DCore::QNode *root = new tst_Node(); - Qt3DCore::QNode *child = new tst_Node(); - Qt3DCore::QNodePrivate::get(root)->setScene(scene.data()); - scene->addObservable(root); + auto *root = new PropertyTestNode(); + auto *child = new PropertyTestNode(root); - QList observers; - for (int i = 0; i < 5; i++) { - tst_SimpleObserver *s = new tst_SimpleObserver(); - arbiter->registerObserver(s, root->id()); - observers << s; - } - - arbiter->syncChanges(); + root->setProp1(883); + child->setProp2(1584); // THEN - for (tst_SimpleObserver *o : qAsConst(observers)) - QVERIFY(o->lastChange().isNull()); - - child->setParent(root); - arbiter->syncChanges(); - for (tst_SimpleObserver *o : qAsConst(observers)) { - QCOMPARE(o->lastChanges().size(), 1); - QVERIFY(o->lastChanges().last()->type() == Qt3DCore::PropertyValueAdded); - } - - Qt3DCore::QChangeArbiter::destroyThreadLocalChangeQueue(arbiter.data()); -} - -void tst_QChangeArbiter::registerSceneObserver() -{ - // GIVEN - Qt3DCore::QComponent dummyComponent; - QScopedPointer arbiter(new Qt3DCore::QChangeArbiter()); - QScopedPointer scene(new Qt3DCore::QScene()); - QScopedPointer postman(new tst_PostManObserver); - arbiter->setPostman(postman.data()); - arbiter->setScene(scene.data()); - postman->setScene(scene.data()); - scene->setArbiter(arbiter.data()); - // Replaces initialize as we have no JobManager in this case - Qt3DCore::QChangeArbiter::createThreadLocalChangeQueue(arbiter.data()); + QCOMPARE(arbiter->dirtyNodes().size(), 0); // WHEN - tst_Node *root = new tst_Node(); - Qt3DCore::QNode *child = new tst_Node(); - Qt3DCore::QNodePrivate::get(root)->setScene(scene.data()); - Qt3DCore::QNodePrivate::get(root)->m_hasBackendNode = true; - scene->addObservable(root); - - QList observers; - for (int i = 0; i < 5; i++) { - tst_SimpleObserver *s = new tst_SimpleObserver(); - arbiter->registerObserver(s, root->id()); - observers << s; - } - - arbiter->syncChanges(); + Qt3DCore::QNodePrivate::get(root)->setArbiter(arbiter.data()); + root->setProp1(884); + child->setProp2(1585); // THEN - for (tst_SimpleObserver *o : qAsConst(observers)) - QVERIFY(o->lastChange().isNull()); + QCOMPARE(arbiter->dirtyNodes().size(), 1); + QCOMPARE(arbiter->dirtyNodes().front(), root); - // WHEN - child->setParent(root); - arbiter->syncChanges(); - - // THEN - for (tst_SimpleObserver *o : qAsConst(observers)) { - QVERIFY(!o->lastChange().isNull()); - QVERIFY(o->lastChange()->type() == Qt3DCore::PropertyValueAdded); - } + arbiter->clear(); // WHEN - root->sendComponentAddedNotification(&dummyComponent); - arbiter->syncChanges(); + Qt3DCore::QNodePrivate::get(child)->setArbiter(arbiter.data()); + child->setProp2(1586); // THEN - for (tst_SimpleObserver *o : qAsConst(observers)) { - QVERIFY(!o->lastChange().isNull()); - QVERIFY(o->lastChange()->type() == Qt3DCore::ComponentAdded); - } + QCOMPARE(arbiter->dirtyNodes().size(), 1); + QCOMPARE(arbiter->dirtyNodes().front(), child); - Qt3DCore::QChangeArbiter::destroyThreadLocalChangeQueue(arbiter.data()); -} - -void tst_QChangeArbiter::unregisterObservers() -{ - // GIVEN - QScopedPointer arbiter(new Qt3DCore::QChangeArbiter()); - QScopedPointer scene(new Qt3DCore::QScene()); - QScopedPointer postman(new tst_PostManObserver); - arbiter->setPostman(postman.data()); - arbiter->setScene(scene.data()); - postman->setScene(scene.data()); - scene->setArbiter(arbiter.data()); - // Replaces initialize as we have no JobManager in this case - Qt3DCore::QChangeArbiter::createThreadLocalChangeQueue(arbiter.data()); + arbiter->clear(); // WHEN - tst_Node *root = new tst_Node(); - Qt3DCore::QNode *child = new tst_Node(); - Qt3DCore::QNodePrivate::get(root)->setScene(scene.data()); - scene->addObservable(root); - - QList observers; - for (int i = 0; i < 5; i++) { - tst_SimpleObserver *s = new tst_SimpleObserver(); - arbiter->registerObserver(s, root->id()); - observers << s; - } - - arbiter->syncChanges(); - - // THEN - for (tst_SimpleObserver *o : qAsConst(observers)) - QVERIFY(o->lastChange().isNull()); - - // WHEN - child->setParent(root); - arbiter->syncChanges(); - - // THEN - for (tst_SimpleObserver *o : qAsConst(observers)) { - QVERIFY(!o->lastChange().isNull()); - QVERIFY(o->lastChange()->type() == Qt3DCore::PropertyValueAdded); - } - - // WHEN - for (tst_SimpleObserver *o : qAsConst(observers)) - arbiter->unregisterObserver(o, root->id()); - - root->sendAllChangesNotification(); - arbiter->syncChanges(); - - // THEN - for (tst_SimpleObserver *o : qAsConst(observers)) { - QVERIFY(!o->lastChange().isNull()); - QVERIFY(o->lastChange()->type() == Qt3DCore::PropertyValueAdded); - } - - Qt3DCore::QChangeArbiter::destroyThreadLocalChangeQueue(arbiter.data()); -} - -void tst_QChangeArbiter::unregisterSceneObservers() -{ - // GIVEN - Qt3DCore::QComponent dummyComponent; - QScopedPointer arbiter(new Qt3DCore::QChangeArbiter()); - QScopedPointer scene(new Qt3DCore::QScene()); - QScopedPointer postman(new tst_PostManObserver); - arbiter->setPostman(postman.data()); - arbiter->setScene(scene.data()); - postman->setScene(scene.data()); - scene->setArbiter(arbiter.data()); - // Replaces initialize as we have no JobManager in this case - Qt3DCore::QChangeArbiter::createThreadLocalChangeQueue(arbiter.data()); - - // WHEN - tst_Node *root = new tst_Node(); - Qt3DCore::QNode *child = new tst_Node(); - Qt3DCore::QNodePrivate::get(root)->setScene(scene.data()); - Qt3DCore::QNodePrivate::get(root)->m_hasBackendNode = true; - Qt3DCore::QNodePrivate::get(child)->m_hasBackendNode = true; - scene->addObservable(root); - - QList observers; - for (int i = 0; i < 5; i++) { - tst_SimpleObserver *s = new tst_SimpleObserver(); - arbiter->registerObserver(s, root->id()); - observers << s; - } - - arbiter->syncChanges(); - - // THEN - for (tst_SimpleObserver *o : qAsConst(observers)) - QVERIFY(o->lastChange().isNull()); - - // WHEN - child->setParent(root); - arbiter->syncChanges(); - - // THEN - for (tst_SimpleObserver *o : qAsConst(observers)) { - QVERIFY(!o->lastChange().isNull()); - QVERIFY(o->lastChange()->type() == Qt3DCore::PropertyValueAdded); - } - - // WHEN - root->sendComponentAddedNotification(&dummyComponent); - arbiter->syncChanges(); - - // THEN - for (tst_SimpleObserver *o : qAsConst(observers)) { - QVERIFY(!o->lastChange().isNull()); - QVERIFY(o->lastChange()->type() == Qt3DCore::ComponentAdded); - } - - // WHEN - child->setParent(Q_NODE_NULLPTR); - arbiter->syncChanges(); - - // THEN - for (tst_SimpleObserver *o : qAsConst(observers)) { - QVERIFY(!o->lastChange().isNull()); - QVERIFY(o->lastChange()->type() == Qt3DCore::PropertyValueRemoved); - } - - // WHEN - child->setParent(root); - arbiter->syncChanges(); - - // THEN - for (tst_SimpleObserver *o : qAsConst(observers)) { - QVERIFY(!o->lastChange().isNull()); - QVERIFY(o->lastChange()->type() == Qt3DCore::PropertyValueAdded); - } - - Qt3DCore::QChangeArbiter::destroyThreadLocalChangeQueue(arbiter.data()); -} - -void tst_QChangeArbiter::distributeFrontendChanges() -{ - // GIVEN - Qt3DCore::QComponent dummyComponent; - Qt3DCore::QNode dummyNode; - QScopedPointer arbiter(new Qt3DCore::QChangeArbiter()); - QScopedPointer scene(new Qt3DCore::QScene()); - QScopedPointer postman(new tst_PostManObserver); - arbiter->setPostman(postman.data()); - arbiter->setScene(scene.data()); - postman->setScene(scene.data()); - scene->setArbiter(arbiter.data()); - // Replaces initialize as we have no JobManager in this case - Qt3DCore::QChangeArbiter::createThreadLocalChangeQueue(arbiter.data()); - - // WHEN - tst_Node *root = new tst_Node(); - Qt3DCore::QNodePrivate::get(root)->setScene(scene.data()); - scene->addObservable(root); - - tst_SimpleObserver *backendAllChangedObserver = new tst_SimpleObserver(); - tst_SimpleObserver *backendNodeAddedObserver = new tst_SimpleObserver(); - tst_SimpleObserver *backendNodeRemovedObserver = new tst_SimpleObserver(); - tst_SimpleObserver *backendNodeUpdatedObserver = new tst_SimpleObserver(); - tst_SimpleObserver *backendComponentAddedObserver = new tst_SimpleObserver(); - tst_SimpleObserver *backendComponentRemovedObserver = new tst_SimpleObserver(); - - arbiter->registerObserver(backendAllChangedObserver, root->id()); - arbiter->registerObserver(backendNodeAddedObserver, root->id(), Qt3DCore::PropertyValueAdded); - arbiter->registerObserver(backendNodeUpdatedObserver, root->id(), Qt3DCore::PropertyUpdated); - arbiter->registerObserver(backendNodeRemovedObserver, root->id(), Qt3DCore::PropertyValueRemoved); - arbiter->registerObserver(backendComponentAddedObserver, root->id(), Qt3DCore::ComponentAdded); - arbiter->registerObserver(backendComponentRemovedObserver, root->id(), Qt3DCore::ComponentRemoved); - - arbiter->syncChanges(); - - // THEN - QVERIFY(backendAllChangedObserver->lastChange().isNull()); - QVERIFY(backendNodeAddedObserver->lastChange().isNull()); - QVERIFY(backendNodeUpdatedObserver->lastChange().isNull()); - QVERIFY(backendNodeRemovedObserver->lastChange().isNull()); - QVERIFY(backendComponentAddedObserver->lastChange().isNull()); - QVERIFY(backendComponentRemovedObserver->lastChange().isNull()); - - // WHEN - root->sendNodeAddedNotification(&dummyNode); - arbiter->syncChanges(); - - // THEN - QCOMPARE(backendAllChangedObserver->lastChanges().count(), 1); - QCOMPARE(backendNodeAddedObserver->lastChanges().count(), 1); - QCOMPARE(backendNodeUpdatedObserver->lastChanges().count(), 0); - QCOMPARE(backendNodeRemovedObserver->lastChanges().count(), 0); - QCOMPARE(backendComponentAddedObserver->lastChanges().count(), 0); - QCOMPARE(backendComponentRemovedObserver->lastChanges().count(), 0); - - // WHEN - root->sendNodeUpdatedNotification(); - arbiter->syncChanges(); - - // THEN - QCOMPARE(backendAllChangedObserver->lastChanges().count(), 2); - QCOMPARE(backendNodeAddedObserver->lastChanges().count(), 1); - QCOMPARE(backendNodeUpdatedObserver->lastChanges().count(), 1); - QCOMPARE(backendNodeRemovedObserver->lastChanges().count(), 0); - QCOMPARE(backendComponentAddedObserver->lastChanges().count(), 0); - QCOMPARE(backendComponentRemovedObserver->lastChanges().count(), 0); - - // WHEN - root->sendNodeRemovedNotification(&dummyNode); - arbiter->syncChanges(); - - // THEN - QCOMPARE(backendAllChangedObserver->lastChanges().count(), 3); - QCOMPARE(backendNodeAddedObserver->lastChanges().count(), 1); - QCOMPARE(backendNodeUpdatedObserver->lastChanges().count(), 1); - QCOMPARE(backendNodeRemovedObserver->lastChanges().count(), 1); - QCOMPARE(backendComponentAddedObserver->lastChanges().count(), 0); - QCOMPARE(backendComponentRemovedObserver->lastChanges().count(), 0); - - // WHEN - root->sendComponentAddedNotification(&dummyComponent); - arbiter->syncChanges(); - - // THEN - QCOMPARE(backendAllChangedObserver->lastChanges().count(), 4); - QCOMPARE(backendNodeAddedObserver->lastChanges().count(), 1); - QCOMPARE(backendNodeUpdatedObserver->lastChanges().count(), 1); - QCOMPARE(backendNodeRemovedObserver->lastChanges().count(), 1); - QCOMPARE(backendComponentAddedObserver->lastChanges().count(), 1); - QCOMPARE(backendComponentRemovedObserver->lastChanges().count(), 0); - - // WHEN - root->sendComponentRemovedNotification(&dummyComponent); - arbiter->syncChanges(); - - // THEN - QCOMPARE(backendAllChangedObserver->lastChanges().count(), 5); - QCOMPARE(backendNodeAddedObserver->lastChanges().count(), 1); - QCOMPARE(backendNodeUpdatedObserver->lastChanges().count(), 1); - QCOMPARE(backendNodeRemovedObserver->lastChanges().count(), 1); - QCOMPARE(backendComponentAddedObserver->lastChanges().count(), 1); - QCOMPARE(backendComponentRemovedObserver->lastChanges().count(), 1); - - // WHEN - root->sendAllChangesNotification(); - arbiter->syncChanges(); - - // THEN - QCOMPARE(backendAllChangedObserver->lastChanges().count(), 6); - QCOMPARE(backendNodeAddedObserver->lastChanges().count(), 2); - QCOMPARE(backendNodeUpdatedObserver->lastChanges().count(), 2); - QCOMPARE(backendNodeRemovedObserver->lastChanges().count(), 2); - QCOMPARE(backendComponentAddedObserver->lastChanges().count(), 2); - QCOMPARE(backendComponentRemovedObserver->lastChanges().count(), 2); - - Qt3DCore::QChangeArbiter::destroyThreadLocalChangeQueue(arbiter.data()); -} - -void tst_QChangeArbiter::distributePropertyChanges() -{ - // GIVEN - QScopedPointer arbiter(new Qt3DCore::QChangeArbiter()); - QScopedPointer scene(new Qt3DCore::QScene()); - QScopedPointer postman(new tst_PostManObserver); - arbiter->setPostman(postman.data()); - arbiter->setScene(scene.data()); - postman->setScene(scene.data()); - scene->setArbiter(arbiter.data()); - // Replaces initialize as we have no JobManager in this case - Qt3DCore::QChangeArbiter::createThreadLocalChangeQueue(arbiter.data()); - - // Test change notifications made to the root node: - - // WHEN - PropertyTestNode *root = new PropertyTestNode(); - Qt3DCore::QNodePrivate::get(root)->setScene(scene.data()); - Qt3DCore::QNodePrivate::get(root)->m_hasBackendNode = true; - scene->addObservable(root); - - tst_SimpleObserver *rootObserver = new tst_SimpleObserver(); - arbiter->registerObserver(rootObserver, root->id()); - arbiter->syncChanges(); - - // THEN - QVERIFY(rootObserver->lastChange().isNull()); - - // WHEN - root->setProp1(root->prop1() + 1); - - // THEN - auto dirtyNodes = arbiter->takeDirtyFrontEndNodes(); - QCOMPARE(dirtyNodes.size(), 1); - QCOMPARE(dirtyNodes.front(), root); - - // WHEN - root->setProp2(root->prop2() + 1.f); - - // THEN - dirtyNodes = arbiter->takeDirtyFrontEndNodes(); - QCOMPARE(dirtyNodes.size(), 1); - QCOMPARE(dirtyNodes.front(), root); - - // Test change notifications made to an entity that was added to the scene - // via QNode::setParent() - - // WHEN - PropertyTestNode *setParentChild = new PropertyTestNode(); - setParentChild->setParent(root); - tst_SimpleObserver *setParentChildObserver = new tst_SimpleObserver(); - arbiter->registerObserver(setParentChildObserver, setParentChild->id()); - setParentChild->setProp2(setParentChild->prop2() + 1.f); - - // THEN - dirtyNodes = arbiter->takeDirtyFrontEndNodes(); - QCOMPARE(dirtyNodes.size(), 1); - QCOMPARE(dirtyNodes.front(), setParentChild); - - // Test change notifications made to an entity that was added to the scene - // via the QNode() constructor parent parameter - - // WHEN - PropertyTestNode *directChild = new PropertyTestNode(root); - QCoreApplication::processEvents(); // make sure the post-ctor initialization is executed for the node - tst_SimpleObserver *directChildObserver = new tst_SimpleObserver(); - arbiter->registerObserver(directChildObserver, directChild->id()); - directChild->setProp1(directChild->prop1() + 1); + root->setProp1(887); + child->setProp2(1587); // THEN - dirtyNodes = arbiter->takeDirtyFrontEndNodes(); - QCOMPARE(dirtyNodes.size(), 1); - QCOMPARE(dirtyNodes.front(), directChild); - - Qt3DCore::QChangeArbiter::destroyThreadLocalChangeQueue(arbiter.data()); + QCOMPARE(arbiter->dirtyNodes().size(), 2); } -void tst_QChangeArbiter::distributeBackendChanges() -{ - - // GIVEN - QScopedPointer arbiter(new Qt3DCore::QChangeArbiter()); - QScopedPointer scene(new Qt3DCore::QScene()); - QScopedPointer postman(new tst_PostManObserver); - arbiter->setPostman(postman.data()); - arbiter->setScene(scene.data()); - postman->setScene(scene.data()); - scene->setArbiter(arbiter.data()); - // Replaces initialize as we have no JobManager in this case - Qt3DCore::QChangeArbiter::createThreadLocalChangeQueue(arbiter.data()); - - // In order for backend -> frontend changes to work properly, - // the backend notification should only be sent - // from a worker thread which has a dedicated ChangeQueue in the - // ChangeArbiter different than the frontend ChangeQueue. In this - // test we will only check that the backend has received the frontend notification - - - // WHEN - tst_Node *root = new tst_Node(); - Qt3DCore::QNodePrivate::get(root)->setScene(scene.data()); - Qt3DCore::QNodePrivate::get(root)->m_hasBackendNode = true; - scene->addObservable(root); - - tst_BackendObserverObservable *backenObserverObservable = new tst_BackendObserverObservable(); - arbiter->registerObserver(Qt3DCore::QBackendNodePrivate::get(backenObserverObservable), root->id()); - arbiter->scene()->addObservable(Qt3DCore::QBackendNodePrivate::get(backenObserverObservable), root->id()); - Qt3DCore::QBackendNodePrivate::get(backenObserverObservable)->setArbiter(arbiter.data()); - - arbiter->syncChanges(); - - // THEN - QVERIFY(root->lastChange().isNull()); - QVERIFY(backenObserverObservable->lastChange().isNull()); - QCOMPARE(backenObserverObservable->lastChanges().count(), 0); - - // WHEN - root->sendAllChangesNotification(); - arbiter->syncChanges(); - - // THEN - // backend observer receives event from frontend node "root" - QCOMPARE(root->lastChanges().count(), 0); - QCOMPARE(postman->lastChanges().count(), 0); - QCOMPARE(backenObserverObservable->lastChanges().count(), 1); - - backenObserverObservable->clear(); - - { - // WHEN - // simulate a worker thread - QScopedPointer answer(new ThreadedAnswer(arbiter.data(), backenObserverObservable)); - postman->setAllowFrontendNotifications(false); - QWaitCondition *waitingForBackendReplyCondition = answer->waitingCondition(); - - QMutex mutex; - // sends reply from another thread (simulates job thread) - answer->start(); - mutex.lock(); - waitingForBackendReplyCondition->wait(&mutex); - mutex.unlock(); - - // To verify that backendObserver sent a reply - arbiter->syncChanges(); - - // THEN - // the repliers should receive it's reply - QCOMPARE(backenObserverObservable->lastChanges().count(), 1); - // verify that postMan has received the change - QCOMPARE(postman->lastChanges().count(), 0); - answer->exit(); - answer->wait(); - backenObserverObservable->clear(); - } - - { - // WHEN - // simulate a worker thread - QScopedPointer answer(new ThreadedAnswer(arbiter.data(), backenObserverObservable)); - postman->setAllowFrontendNotifications(true); - QWaitCondition *waitingForBackendReplyCondition = answer->waitingCondition(); - QMutex mutex; - // sends reply from another thread (simulates job thread) - answer->start(); - mutex.lock(); - waitingForBackendReplyCondition->wait(&mutex); - mutex.unlock(); - - // To verify that backendObserver sent a reply - arbiter->syncChanges(); - - // THEN - // the repliers should receive it's reply - QCOMPARE(backenObserverObservable->lastChanges().count(), 1); - // verify that postMan has received the change - QCOMPARE(postman->lastChanges().count(), 1); - - // verify correctness of the reply - Qt3DCore::QPropertyUpdatedChangePtr c = qSharedPointerDynamicCast(postman->lastChange()); - QVERIFY(!c.isNull()); - QVERIFY(c->subjectId() == root->id()); - qDebug() << c->propertyName(); - QVERIFY(strcmp(c->propertyName(), "Reply") == 0); - QVERIFY(c->type() == Qt3DCore::PropertyUpdated); - answer->exit(); - answer->wait(); - } - - Qt3DCore::QChangeArbiter::destroyThreadLocalChangeQueue(arbiter.data()); -} QTEST_MAIN(tst_QChangeArbiter) diff --git a/tests/auto/core/qentity/tst_qentity.cpp b/tests/auto/core/qentity/tst_qentity.cpp index 7b41c9783..4b32c5aac 100644 --- a/tests/auto/core/qentity/tst_qentity.cpp +++ b/tests/auto/core/qentity/tst_qentity.cpp @@ -26,14 +26,9 @@ ** ****************************************************************************/ -// TODO Remove in Qt6 -#include -QT_WARNING_DISABLE_DEPRECATED - #include #include #include -#include #include #include @@ -67,9 +62,6 @@ private slots: void addSeveralTimesSameComponent(); void removeSeveralTimesSameComponent(); - void checkCloning_data(); - void checkCloning(); - void checkComponentBookkeeping(); }; @@ -590,81 +582,6 @@ void tst_Entity::removeSeveralTimesSameComponent() QCOMPARE(comp->entities().size(), 0); } -void tst_Entity::checkCloning_data() -{ - QTest::addColumn("entity"); - QTest::addColumn>("childEntityIds"); - QTest::addColumn("creationChangeCount"); - - { - QTest::newRow("defaultConstructed") << new MyEntity() << QVector() << 1; - } - - { - Qt3DCore::QEntity *entityWithComponents = new MyEntity(); - Qt3DCore::QComponent *component1 = new MyQComponent(); - Qt3DCore::QComponent *component2 = new MyQComponent(); - Qt3DCore::QComponent *component3 = new MyQComponent(); - entityWithComponents->addComponent(component1); - entityWithComponents->addComponent(component2); - entityWithComponents->addComponent(component3); - QTest::newRow("entityWithComponents") << entityWithComponents << QVector() << 4; - } - - { - Qt3DCore::QEntity *entityWithChildren = new MyEntity(); - Qt3DCore::QEntity *child1 = new MyEntity(entityWithChildren); - Qt3DCore::QEntity *child2 = new MyEntity(entityWithChildren); - QVector childIds = {child1->id(), child2->id()}; - QTest::newRow("entityWithChildren") << entityWithChildren << childIds << 3; - } - - { - Qt3DCore::QEntity *entityWithNestedChildren = new MyEntity(); - Qt3DCore::QEntity *child = new MyEntity(entityWithNestedChildren); - Qt3DCore::QNode *dummy = new Qt3DCore::QNode(entityWithNestedChildren); - Qt3DCore::QEntity *grandChild = new MyEntity(entityWithNestedChildren); - QVector childIds = {child->id(), grandChild->id()}; - QTest::newRow("entityWithNestedChildren") << entityWithNestedChildren << childIds << 4; - - Q_UNUSED(dummy); - } -} - -void tst_Entity::checkCloning() -{ - // GIVEN - QFETCH(Qt3DCore::QEntity *, entity); - QFETCH(QVector, childEntityIds); - QFETCH(int, creationChangeCount); - - // WHEN - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(entity); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - // THEN - QCOMPARE(creationChanges.size(), creationChangeCount); - - const Qt3DCore::QNodeCreatedChangePtr creationChangeData = - qSharedPointerCast>(creationChanges.first()); - const Qt3DCore::QEntityData &cloneData = creationChangeData->data; - - // THEN - QCOMPARE(creationChangeData->subjectId(), entity->id()); - QCOMPARE(creationChangeData->isNodeEnabled(), entity->isEnabled()); - QCOMPARE(creationChangeData->metaObject(), entity->metaObject()); - QCOMPARE(creationChangeData->parentId(), entity->parentNode() ? entity->parentNode()->id() : Qt3DCore::QNodeId()); - QCOMPARE(cloneData.parentEntityId, entity->parentEntity() ? entity->parentEntity()->id() : Qt3DCore::QNodeId()); - QCOMPARE(cloneData.childEntityIds, childEntityIds); - QCOMPARE(cloneData.componentIdsAndTypes.size(), entity->components().size()); - - const QVector &components = entity->components(); - for (int i = 0, m = components.size(); i < m; ++i) { - QCOMPARE(cloneData.componentIdsAndTypes.at(i).id, components.at(i)->id()); - QCOMPARE(cloneData.componentIdsAndTypes.at(i).type, components.at(i)->metaObject()); - } -} - void tst_Entity::checkComponentBookkeeping() { // GIVEN diff --git a/tests/auto/core/qjoint/tst_qjoint.cpp b/tests/auto/core/qjoint/tst_qjoint.cpp index 2fff33b8f..6f72dc7af 100644 --- a/tests/auto/core/qjoint/tst_qjoint.cpp +++ b/tests/auto/core/qjoint/tst_qjoint.cpp @@ -29,11 +29,9 @@ #include #include #include -#include -#include #include #include -#include +#include using namespace Qt3DCore; @@ -241,71 +239,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - QJoint joint; - - joint.setScale(QVector3D(3.5f, 2.0f, 1.3f)); - joint.setRotation(QQuaternion::fromAxisAndAngle(0.0f, 1.0f, 0.0f, 30.0f)); - joint.setTranslation(QVector3D(3.0f, 2.0f, 1.0f)); - QMatrix4x4 ibm; - ibm.scale(5.2f); - joint.setInverseBindMatrix(ibm); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&joint); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData - = qSharedPointerCast>(creationChanges.first()); - const QJointData data = creationChangeData->data; - - QCOMPARE(joint.id(), creationChangeData->subjectId()); - QCOMPARE(joint.isEnabled(), true); - QCOMPARE(joint.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(joint.metaObject(), creationChangeData->metaObject()); - QCOMPARE(joint.scale(), data.scale); - QCOMPARE(joint.rotation(), data.rotation); - QCOMPARE(joint.translation(), data.translation); - QCOMPARE(joint.inverseBindMatrix(), data.inverseBindMatrix); - } - - // WHEN - joint.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&joint); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData - = qSharedPointerCast>(creationChanges.first()); - const QJointData data = creationChangeData->data; - - QCOMPARE(joint.id(), creationChangeData->subjectId()); - QCOMPARE(joint.isEnabled(), false); - QCOMPARE(joint.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(joint.metaObject(), creationChangeData->metaObject()); - QCOMPARE(joint.scale(), data.scale); - QCOMPARE(joint.rotation(), data.rotation); - QCOMPARE(joint.translation(), data.translation); - QCOMPARE(joint.inverseBindMatrix(), data.inverseBindMatrix); - } - } - void checkPropertyUpdateChanges() { // GIVEN @@ -318,16 +251,16 @@ private Q_SLOTS: joint.setScale(QVector3D(2.0f, 1.0f, 3.0f)); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &joint); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &joint); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN joint.setScale(QVector3D(2.0f, 1.0f, 3.0f)); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } { @@ -336,16 +269,16 @@ private Q_SLOTS: joint.setRotation(newValue); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &joint); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &joint); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN joint.setRotation(newValue); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } { @@ -354,16 +287,16 @@ private Q_SLOTS: joint.setTranslation(newValue); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &joint); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &joint); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN joint.setTranslation(newValue); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } { @@ -373,16 +306,16 @@ private Q_SLOTS: joint.setInverseBindMatrix(newValue); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &joint); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &joint); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN joint.setInverseBindMatrix(newValue); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } }; diff --git a/tests/auto/core/qpostman/qpostman.pro b/tests/auto/core/qpostman/qpostman.pro deleted file mode 100644 index fee342f74..000000000 --- a/tests/auto/core/qpostman/qpostman.pro +++ /dev/null @@ -1,11 +0,0 @@ -TEMPLATE = app - -TARGET = tst_qpostman - -QT += 3dcore 3dcore-private 3drender 3drender-private testlib - -CONFIG += testcase - -SOURCES += tst_qpostman.cpp - -include(../common/common.pri) diff --git a/tests/auto/core/qpostman/tst_qpostman.cpp b/tests/auto/core/qpostman/tst_qpostman.cpp deleted file mode 100644 index d0dfa0f49..000000000 --- a/tests/auto/core/qpostman/tst_qpostman.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "testpostmanarbiter.h" - -using namespace Qt3DCore; - -namespace { - -class NodeChangeReceiver: public QNode -{ -public: - NodeChangeReceiver(QNode *parent = nullptr) - : QNode(parent) - , m_hasReceivedChange(false) - {} - - inline bool hasReceivedChange() const { return m_hasReceivedChange; } - -protected: - void sceneChangeEvent(const QSceneChangePtr &) override - { - m_hasReceivedChange = true; - } - -private: - bool m_hasReceivedChange; -}; - -} // anonymous - -class tst_QPostman : public QObject -{ - Q_OBJECT - -private Q_SLOTS: - - void checkSetScene() - { - // GIVEN - QPostman postman; - - // THEN - QVERIFY(QPostmanPrivate::get(&postman)->m_scene == nullptr); - - // WHEN - QScene scene; - postman.setScene(&scene); - - // THEN - QCOMPARE(QPostmanPrivate::get(&postman)->m_scene, &scene); - } - -}; - -QTEST_MAIN(tst_QPostman) - -#include "tst_qpostman.moc" diff --git a/tests/auto/core/qscene/tst_qscene.cpp b/tests/auto/core/qscene/tst_qscene.cpp index eb6a8c5ec..5a23dab48 100644 --- a/tests/auto/core/qscene/tst_qscene.cpp +++ b/tests/auto/core/qscene/tst_qscene.cpp @@ -26,19 +26,13 @@ ** ****************************************************************************/ -// TODO Remove in Qt6 -#include -QT_WARNING_DISABLE_DEPRECATED - #include #include #include #include #include -#include -#include #include -#include "testpostmanarbiter.h" +#include class tst_QScene : public QObject { @@ -48,9 +42,7 @@ public: ~tst_QScene() {} private slots: - void addObservable(); void addNodeObservable(); - void removeObservable(); void removeNodeObservable(); void addChildNode(); void deleteChildNode(); @@ -65,21 +57,6 @@ private slots: void nodeUpdatePropertyTrackData(); }; -class tst_Observable : public Qt3DCore::QObservableInterface -{ -public: - void setArbiter(Qt3DCore::QLockableObserverInterface *observer) - { - m_arbiter = observer; - } - -protected: - void notifyObservers(const Qt3DCore::QSceneChangePtr &) {} - -private: - Qt3DCore::QLockableObserverInterface *m_arbiter; -}; - class tst_Node : public Qt3DCore::QNode { Q_OBJECT @@ -96,44 +73,6 @@ public: {} }; -void tst_QScene::addObservable() -{ - // GIVEN - Qt3DCore::QNode *node1 = new tst_Node(); - Qt3DCore::QNode *node2 = new tst_Node(); - - QList observables; - - for (int i = 0; i < 10; i++) - observables.append(new tst_Observable()); - - Qt3DCore::QScene *scene = new Qt3DCore::QScene; - scene->setArbiter(new TestArbiter); - - // WHEN - for (int i = 0; i < 5; i++) - scene->addObservable(observables.at(i), node1->id()); - - for (int i = 0; i < 5; i++) - scene->addObservable(observables.at(i + 5), node2->id()); - - const Qt3DCore::QObservableList obs1 = scene->lookupObservables(node1->id()); - const Qt3DCore::QObservableList obs2 = scene->lookupObservables(node2->id()); - - // THEN - QCOMPARE(obs1.count(), 5); - QCOMPARE(obs2.count(), obs1.count()); - - for (Qt3DCore::QObservableInterface *o : obs1) { - QVERIFY(scene->nodeIdFromObservable(o) == node1->id()); - QVERIFY(scene->lookupNode(node1->id()) == nullptr); - } - for (Qt3DCore::QObservableInterface *o : obs2) { - QVERIFY(scene->nodeIdFromObservable(o) == node2->id()); - QVERIFY(scene->lookupNode(node2->id()) == nullptr); - } -} - void tst_QScene::addNodeObservable() { // GIBEN @@ -152,72 +91,15 @@ void tst_QScene::addNodeObservable() // THEN for (Qt3DCore::QNode *n : qAsConst(nodes)) { QVERIFY(n == scene->lookupNode(n->id())); - QVERIFY(scene->lookupObservables(n->id()).isEmpty()); } } -void tst_QScene::removeObservable() -{ - // GIVEN - Qt3DCore::QNode *node1 = new tst_Node(); - Qt3DCore::QNode *node2 = new tst_Node(); - - QList observables; - - for (int i = 0; i < 10; i++) - observables.append(new tst_Observable()); - - Qt3DCore::QScene *scene = new Qt3DCore::QScene; - scene->setArbiter(new TestArbiter); - - // WHEN - for (int i = 0; i < 5; i++) - scene->addObservable(observables.at(i), node1->id()); - - for (int i = 0; i < 5; i++) - scene->addObservable(observables.at(i + 5), node2->id()); - - Qt3DCore::QObservableList obs1 = scene->lookupObservables(node1->id()); - Qt3DCore::QObservableList obs2 = scene->lookupObservables(node2->id()); - - // THEN - QCOMPARE(obs1.count(), 5); - QCOMPARE(obs2.count(), obs1.count()); - - // WHEN - scene->removeObservable(observables.at(0), node1->id()); - // THEN - QCOMPARE(scene->lookupObservables(node1->id()).count(), 4); - - // WHEN - scene->removeObservable(observables.at(0), node1->id()); - // THEN - QCOMPARE(scene->lookupObservables(node1->id()).count(), 4); - - // WHEN - scene->removeObservable(observables.at(6), node1->id()); - // THEN - QCOMPARE(scene->lookupObservables(node1->id()).count(), 4); - QCOMPARE(scene->lookupObservables(node2->id()).count(), 5); - - // WHEN - scene->removeObservable(observables.at(0), node2->id()); - // THEN - QCOMPARE(scene->lookupObservables(node2->id()).count(), 5); - QVERIFY(scene->nodeIdFromObservable(observables.at(0)) == Qt3DCore::QNodeId()); -} - void tst_QScene::removeNodeObservable() { // GIVEN Qt3DCore::QNode *node1 = new tst_Node(); Qt3DCore::QNode *node2 = new tst_Node(); - QList observables; - - for (int i = 0; i < 10; i++) - observables.append(new tst_Observable()); - Qt3DCore::QScene *scene = new Qt3DCore::QScene; scene->setArbiter(new TestArbiter); @@ -225,30 +107,12 @@ void tst_QScene::removeNodeObservable() scene->addObservable(node1); scene->addObservable(node2); - for (int i = 0; i < 5; i++) - scene->addObservable(observables.at(i), node1->id()); - - for (int i = 0; i < 5; i++) - scene->addObservable(observables.at(i + 5), node2->id()); - - // THEN - Qt3DCore::QObservableList obs1 = scene->lookupObservables(node1->id()); - Qt3DCore::QObservableList obs2 = scene->lookupObservables(node2->id()); - - QCOMPARE(obs1.count(), 5); - QCOMPARE(obs2.count(), obs1.count()); - // WHEN scene->removeObservable(node1); // THEN QVERIFY(scene->lookupNode(node1->id()) == nullptr); - QVERIFY(scene->lookupObservables(node1->id()).empty()); - QVERIFY(scene->nodeIdFromObservable(observables.at(0)) == Qt3DCore::QNodeId()); - QVERIFY(scene->lookupNode(node2->id()) == node2); - QCOMPARE(scene->lookupObservables(node2->id()).count(), 5); - QVERIFY(scene->nodeIdFromObservable(observables.at(9)) == node2->id()); } void tst_QScene::addChildNode() diff --git a/tests/auto/core/qskeleton/tst_qskeleton.cpp b/tests/auto/core/qskeleton/tst_qskeleton.cpp index 5c88bd754..151b2d1bf 100644 --- a/tests/auto/core/qskeleton/tst_qskeleton.cpp +++ b/tests/auto/core/qskeleton/tst_qskeleton.cpp @@ -33,10 +33,9 @@ #include #include -#include #include -#include +#include using namespace Qt3DCore; @@ -59,44 +58,6 @@ private Q_SLOTS: QCOMPARE(skeleton.jointCount(), 0); } - void checkCreationChange_data() - { - QTest::addColumn("skeleton"); - - QSkeleton *defaultConstructed = new QSkeleton(); - QTest::newRow("defaultConstructed") << defaultConstructed; - - QSkeleton *skeletonWithOneJoint = new QSkeleton(); - skeletonWithOneJoint->setRootJoint(new QJoint()); - QTest::newRow("skeletonWithOneJoint") << skeletonWithOneJoint; - } - - void checkCreationChange() - { - // GIVEN - QFETCH(QSkeleton *, skeleton); - - // WHEN - QNodeCreatedChangeGenerator creationChangeGenerator(skeleton); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - const int jointCount = skeleton->rootJoint() ? 1 : 0; - - // THEN - QCOMPARE(creationChanges.size(), 1 + jointCount); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const QSkeletonData &data = creationChangeData->data; - - // THEN - QCOMPARE(skeleton->id(), creationChangeData->subjectId()); - QCOMPARE(skeleton->isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(skeleton->metaObject(), creationChangeData->metaObject()); - if (skeleton->rootJoint()) { - QCOMPARE(skeleton->rootJoint()->id(), data.rootJointId); - } - } - void checkPropertyUpdates() { // GIVEN @@ -106,24 +67,24 @@ private Q_SLOTS: // WHEN QJoint *joint = new QJoint(skeleton.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); skeleton->setRootJoint(joint); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), skeleton.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), skeleton.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN skeleton->setRootJoint(nullptr); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), skeleton.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), skeleton.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } void checkRootJointBookkeeping() diff --git a/tests/auto/core/qskeletonloader/tst_qskeletonloader.cpp b/tests/auto/core/qskeletonloader/tst_qskeletonloader.cpp index f0f4c3872..0b01831a9 100644 --- a/tests/auto/core/qskeletonloader/tst_qskeletonloader.cpp +++ b/tests/auto/core/qskeletonloader/tst_qskeletonloader.cpp @@ -31,12 +31,9 @@ #include #include #include -#include -#include -#include #include #include -#include +#include using namespace Qt3DCore; @@ -102,60 +99,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - QSkeletonLoader skeleton; - - skeleton.setSource(QUrl(QStringLiteral("http://someRemoteURL.com/dem-bones.skel"))); - - // WHEN - QVector creationChanges; - - { - QNodeCreatedChangeGenerator creationChangeGenerator(&skeleton); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const QSkeletonLoaderData data = creationChangeData->data; - - QCOMPARE(skeleton.id(), creationChangeData->subjectId()); - QCOMPARE(skeleton.isEnabled(), true); - QCOMPARE(skeleton.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(skeleton.metaObject(), creationChangeData->metaObject()); - QCOMPARE(skeleton.source(), data.source); - QCOMPARE(skeleton.isCreateJointsEnabled(), data.createJoints); - } - - // WHEN - skeleton.setEnabled(false); - - { - QNodeCreatedChangeGenerator creationChangeGenerator(&skeleton); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const QSkeletonLoaderData data = creationChangeData->data; - - QCOMPARE(skeleton.id(), creationChangeData->subjectId()); - QCOMPARE(skeleton.isEnabled(), false); - QCOMPARE(skeleton.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(skeleton.metaObject(), creationChangeData->metaObject()); - QCOMPARE(skeleton.source(), data.source); - QCOMPARE(skeleton.isCreateJointsEnabled(), data.createJoints); - } - } - void checkPropertyUpdates() { // GIVEN @@ -169,11 +112,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes[0], &skeleton); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes()[0], &skeleton); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -182,8 +124,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } { @@ -192,11 +133,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes[0], &skeleton); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes()[0], &skeleton); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -205,8 +145,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } }; diff --git a/tests/auto/core/qtransform/tst_qtransform.cpp b/tests/auto/core/qtransform/tst_qtransform.cpp index 18a906e4c..4285eec6f 100644 --- a/tests/auto/core/qtransform/tst_qtransform.cpp +++ b/tests/auto/core/qtransform/tst_qtransform.cpp @@ -26,28 +26,18 @@ ** ****************************************************************************/ -// TODO Remove in Qt6 -#include -QT_WARNING_DISABLE_DEPRECATED - #include -#include #include #include #include -#include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" using namespace Qt3DCore; class FakeTransform : public Qt3DCore::QTransform { public: - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override - { - Qt3DCore::QTransform::sceneChangeEvent(change); - } }; class tst_QTransform : public QObject @@ -73,63 +63,6 @@ private Q_SLOTS: QCOMPARE(transform.translation(), QVector3D(0.0f, 0.0f, 0.0f)); } - void checkCloning_data() - { - QTest::addColumn("transform"); - - Qt3DCore::QTransform *defaultConstructed = new Qt3DCore::QTransform(); - QTest::newRow("defaultConstructed") << defaultConstructed; - - Qt3DCore::QTransform *matrixPropertySet = new Qt3DCore::QTransform(); - matrixPropertySet->setMatrix(Qt3DCore::QTransform::rotateAround(QVector3D(0.1877f, 0.6868f, 0.3884f), 45.0f, QVector3D(0.0f, 0.0f, 1.0f))); - QTest::newRow("matrixPropertySet") << matrixPropertySet; - - Qt3DCore::QTransform *translationSet = new Qt3DCore::QTransform(); - translationSet->setTranslation(QVector3D(0.1877f, 0.6868f, 0.3884f)); - QTest::newRow("translationSet") << translationSet; - - Qt3DCore::QTransform *scaleSet = new Qt3DCore::QTransform(); - scaleSet->setScale3D(QVector3D(0.1f, 0.6f, 0.3f)); - QTest::newRow("scaleSet") << scaleSet; - - Qt3DCore::QTransform *rotationSet = new Qt3DCore::QTransform(); - scaleSet->setRotation(Qt3DCore::QTransform::fromAxisAndAngle(0.0f, 0.0f, 1.0f, 30.0f)); - QTest::newRow("rotationSet") << rotationSet; - - Qt3DCore::QTransform *eulerRotationSet = new Qt3DCore::QTransform(); - eulerRotationSet->setRotationX(90.0f); - eulerRotationSet->setRotationY(10.0f); - eulerRotationSet->setRotationZ(1.0f); - QTest::newRow("eulerRotationSet") << eulerRotationSet; - } - - void checkCloning() - { - // GIVEN - QFETCH(Qt3DCore::QTransform *, transform); - - // WHEN - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(transform); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - // THEN - QCOMPARE(creationChanges.size(), 1); - - const Qt3DCore::QNodeCreatedChangePtr creationChangeData = - qSharedPointerCast>(creationChanges.first()); - const Qt3DCore::QTransformData &cloneData = creationChangeData->data; - - // THEN - QCOMPARE(creationChangeData->subjectId(), transform->id()); - QCOMPARE(creationChangeData->isNodeEnabled(), transform->isEnabled()); - QCOMPARE(creationChangeData->metaObject(), transform->metaObject()); - QCOMPARE(creationChangeData->parentId(), transform->parentNode() ? transform->parentNode()->id() : Qt3DCore::QNodeId()); - QCOMPARE(transform->translation(), cloneData.translation); - QCOMPARE(transform->scale3D(), cloneData.scale); - QCOMPARE(transform->rotation(), cloneData.rotation); - QCOMPARE(transform->worldMatrix(), QMatrix4x4()); - } - void checkPropertyUpdates() { // GIVEN @@ -141,30 +74,30 @@ private Q_SLOTS: transform->setTranslation(QVector3D(454.0f, 427.0f, 383.0f)); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), transform.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), transform.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN QQuaternion q = Qt3DCore::QTransform::fromAxisAndAngle(QVector3D(0.0f, 1.0f, 0.0f), 90.0f); transform->setRotation(q); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), transform.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), transform.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN transform->setScale3D(QVector3D(883.0f, 1200.0f, 1340.0f)); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), transform.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), transform.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN // Force the transform to update its matrix @@ -173,20 +106,20 @@ private Q_SLOTS: transform->setMatrix(QMatrix4x4()); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), transform.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), transform.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN transform->setRotationX(20.0f); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), transform.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), transform.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } void checkSignalEmittion() @@ -353,27 +286,26 @@ private Q_SLOTS: QVERIFY(spy.isValid()); // WHEN - Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - valueChange->setPropertyName("worldMatrix"); + QTransformPrivate *dT = static_cast(QNodePrivate::get(&t)); const QMatrix4x4 newValue(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f); - valueChange->setValue(newValue); - t.sceneChangeEvent(valueChange); + dT->setWorldMatrix(newValue); + // THEN QCOMPARE(spy.count(), 1); - QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); QCOMPARE(t.worldMatrix(), newValue); // WHEN spy.clear(); - t.sceneChangeEvent(valueChange); + dT->setWorldMatrix(newValue); // THEN QCOMPARE(spy.count(), 0); - QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); QCOMPARE(t.worldMatrix(), newValue); } }; diff --git a/tests/auto/coretest/coretest.pro b/tests/auto/coretest/coretest.pro index 9a96dcc6f..57c7a0f0b 100644 --- a/tests/auto/coretest/coretest.pro +++ b/tests/auto/coretest/coretest.pro @@ -6,12 +6,6 @@ DEFINES += QT_NO_CAST_FROM_ASCII PRECOMPILED_HEADER = INCLUDEPATH += $$PWD -SOURCES += \ - $$PWD/testpostmanarbiter.cpp - -HEADERS += \ - $$PWD/testpostmanarbiter_p.h - qtConfig(private_tests) { SOURCES += \ $$PWD/qbackendnodetester.cpp diff --git a/tests/auto/coretest/qbackendnodetester.cpp b/tests/auto/coretest/qbackendnodetester.cpp index bd5fb85d1..e0c2511fb 100644 --- a/tests/auto/coretest/qbackendnodetester.cpp +++ b/tests/auto/coretest/qbackendnodetester.cpp @@ -53,27 +53,6 @@ void QBackendNodeTester::setPeerId(QBackendNode *backend, QNodeId id) backend->setPeerId(id); } -void QBackendNodeTester::simulateInitialization(QNode *frontend, QBackendNode *backend) -{ - Q_ASSERT(frontend); - Q_ASSERT(backend); - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - const auto change = frontend->createNodeCreationChange(); - backend->setPeerId(change->subjectId()); - backend->setEnabled(change->isNodeEnabled()); - backend->initializeFromPeer(change); - QT_WARNING_POP -} - -void QBackendNodeTester::sceneChangeEvent(QBackendNode *backend, const Qt3DCore::QSceneChangePtr &e) -{ - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - backend->sceneChangeEvent(e); - QT_WARNING_POP -} - } // namespace Qt3DCore QT_END_NAMESPACE diff --git a/tests/auto/coretest/qbackendnodetester_p.h b/tests/auto/coretest/qbackendnodetester_p.h index 020cfcdf1..910b87b4a 100644 --- a/tests/auto/coretest/qbackendnodetester_p.h +++ b/tests/auto/coretest/qbackendnodetester_p.h @@ -50,7 +50,6 @@ #include #include -#include QT_BEGIN_NAMESPACE @@ -67,8 +66,6 @@ public: // Proxies to allow test classes to call private methods on QBackendNode void setPeerId(QBackendNode *backend, QNodeId id); - void simulateInitialization(QNode *frontend, QBackendNode *backend); - void sceneChangeEvent(QBackendNode *backend, const Qt3DCore::QSceneChangePtr &e); }; } // namespace Qt3DCore diff --git a/tests/auto/coretest/testpostmanarbiter.cpp b/tests/auto/coretest/testpostmanarbiter.cpp deleted file mode 100644 index d2e404809..000000000 --- a/tests/auto/coretest/testpostmanarbiter.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// TODO Remove in Qt6 -#include -QT_WARNING_DISABLE_DEPRECATED - -#include "testpostmanarbiter_p.h" -#include - -#include -#include - -QT_BEGIN_NAMESPACE - -TestPostman::TestPostman(TestArbiter *arbiter) - : m_arbiter(arbiter) -{} - -void TestPostman::setScene(Qt3DCore::QScene *) -{} - -void TestPostman::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &) -{} - -void TestPostman::notifyBackend(const Qt3DCore::QSceneChangePtr &e) -{ - m_arbiter->sceneChangeEventWithLock(e); -} - -bool TestPostman::shouldNotifyFrontend(const Qt3DCore::QSceneChangePtr &) -{ - return false; -} - -TestArbiter::TestArbiter() - : m_postman(new TestPostman(this)) -{ -} - -TestArbiter::~TestArbiter() -{ -} - -void TestArbiter::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) -{ - events.push_back(e); -} - -void TestArbiter::sceneChangeEventWithLock(const Qt3DCore::QSceneChangePtr &e) -{ - events.push_back(e); -} - -void TestArbiter::sceneChangeEventWithLock(const Qt3DCore::QSceneChangeList &e) -{ - std::copy(e.cbegin(), e.cend(), std::back_inserter(events)); -} - -Qt3DCore::QAbstractPostman *TestArbiter::postman() const -{ - return m_postman; -} - -void TestArbiter::setArbiterOnNode(Qt3DCore::QNode *node) -{ - Qt3DCore::QNodePrivate::get(node)->setArbiter(this); - for (Qt3DCore::QNode *n : node->childNodes()) - setArbiterOnNode(n); -} - -QT_END_NAMESPACE diff --git a/tests/auto/coretest/testpostmanarbiter_p.h b/tests/auto/coretest/testpostmanarbiter_p.h deleted file mode 100644 index 8954357fe..000000000 --- a/tests/auto/coretest/testpostmanarbiter_p.h +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QT3DCORE_TESTPOSTMANARBITER_P_H -#define QT3DCORE_TESTPOSTMANARBITER_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - class QNode; -} // Qt3D - -class TestArbiter; - -class TestPostman : public Qt3DCore::QAbstractPostman -{ -public: - explicit TestPostman(TestArbiter *arbiter); - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &) final; - void setScene(Qt3DCore::QScene *) final; - void notifyBackend(const Qt3DCore::QSceneChangePtr &e) final; - bool shouldNotifyFrontend(const Qt3DCore::QSceneChangePtr &e) final; - -private: - TestArbiter *m_arbiter; -}; - -class TestArbiter : public Qt3DCore::QAbstractArbiter -{ -public: - TestArbiter(); - ~TestArbiter(); - - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) final; - - void sceneChangeEventWithLock(const Qt3DCore::QSceneChangePtr &e) final; - - void sceneChangeEventWithLock(const Qt3DCore::QSceneChangeList &e) final; - - Qt3DCore::QAbstractPostman *postman() const final; - - QVector events; - - void setArbiterOnNode(Qt3DCore::QNode *node); - -private: - TestPostman *m_postman; -}; - -QT_END_NAMESPACE - -#endif // QT3DCORE_TESTPOSTMANARBITER_P_H diff --git a/tests/auto/input/abstractaxisinput/tst_abstractaxisinput.cpp b/tests/auto/input/abstractaxisinput/tst_abstractaxisinput.cpp index 94f02bc1e..691139075 100644 --- a/tests/auto/input/abstractaxisinput/tst_abstractaxisinput.cpp +++ b/tests/auto/input/abstractaxisinput/tst_abstractaxisinput.cpp @@ -43,15 +43,6 @@ public: : Qt3DInput::QAbstractAxisInput(*new Qt3DInput::QAbstractAxisInputPrivate, parent) { } - -private: - Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override - { - auto creationChange = Qt3DCore::QNodeCreatedChangePtr::create(this); - auto &data = creationChange->data; - data.sourceDeviceId = qIdForNode(sourceDevice()); - return creationChange; - } }; class DummyAxisInputBackend : public Qt3DInput::Input::AbstractAxisInput diff --git a/tests/auto/input/action/tst_action.cpp b/tests/auto/input/action/tst_action.cpp index cc40cef2f..b4a1b5331 100644 --- a/tests/auto/input/action/tst_action.cpp +++ b/tests/auto/input/action/tst_action.cpp @@ -30,13 +30,11 @@ #include #include #include -#include -#include #include #include #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class DummyActionInput : public Qt3DInput::QActionInput { @@ -140,17 +138,14 @@ private Q_SLOTS: void shouldNotActivateWhenDisabled() { // GIVEN - TestArbiter arbiter; Qt3DInput::Input::Action backendAction; backendAction.setEnabled(false); - Qt3DCore::QBackendNodePrivate::get(&backendAction)->setArbiter(&arbiter); // WHEN backendAction.setActionTriggered(true); // THEN QVERIFY(!backendAction.actionTriggered()); - QCOMPARE(arbiter.events.count(), 0); } }; diff --git a/tests/auto/input/axis/tst_axis.cpp b/tests/auto/input/axis/tst_axis.cpp index ddd59b395..2f4cab10f 100644 --- a/tests/auto/input/axis/tst_axis.cpp +++ b/tests/auto/input/axis/tst_axis.cpp @@ -30,14 +30,12 @@ #include #include #include -#include -#include #include #include #include #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class DummyAxisInput : public Qt3DInput::QAbstractAxisInput { @@ -141,9 +139,7 @@ private Q_SLOTS: void shouldNotChangeValueWhenDisabled() { // GIVEN - TestArbiter arbiter; Qt3DInput::Input::Axis backendAxis; - Qt3DCore::QBackendNodePrivate::get(&backendAxis)->setArbiter(&arbiter); backendAxis.setEnabled(false); // WHEN @@ -151,7 +147,6 @@ private Q_SLOTS: // THEN QCOMPARE(backendAxis.axisValue(), 0.0f); - QCOMPARE(arbiter.events.count(), 0); } }; diff --git a/tests/auto/input/axisaccumulator/tst_axisaccumulator.cpp b/tests/auto/input/axisaccumulator/tst_axisaccumulator.cpp index f8d4adcd2..dda68c56b 100644 --- a/tests/auto/input/axisaccumulator/tst_axisaccumulator.cpp +++ b/tests/auto/input/axisaccumulator/tst_axisaccumulator.cpp @@ -38,7 +38,7 @@ #include #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_AxisAccumulator: public Qt3DCore::QBackendNodeTester { @@ -147,7 +147,6 @@ private Q_SLOTS: // GIVEN TestArbiter arbiter; Qt3DInput::Input::AxisAccumulator backendAxisAccumulator; - Qt3DCore::QBackendNodePrivate::get(&backendAxisAccumulator)->setArbiter(&arbiter); backendAxisAccumulator.setEnabled(false); // WHEN @@ -155,7 +154,7 @@ private Q_SLOTS: // THEN QCOMPARE(backendAxisAccumulator.value(), 0.0f); - QCOMPARE(arbiter.events.count(), 0); + QCOMPARE(arbiter.dirtyNodes().count(), 0); } void checkIntegration_data() diff --git a/tests/auto/input/axisaccumulatorjob/tst_axisaccumulatorjob.cpp b/tests/auto/input/axisaccumulatorjob/tst_axisaccumulatorjob.cpp index 91085357a..9a016b8fe 100644 --- a/tests/auto/input/axisaccumulatorjob/tst_axisaccumulatorjob.cpp +++ b/tests/auto/input/axisaccumulatorjob/tst_axisaccumulatorjob.cpp @@ -39,7 +39,7 @@ #include #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_AxisAccumulatorJob : public Qt3DCore::QBackendNodeTester { diff --git a/tests/auto/input/commons/testdevice.h b/tests/auto/input/commons/testdevice.h index 936a0d1b2..61f39e4bf 100644 --- a/tests/auto/input/commons/testdevice.h +++ b/tests/auto/input/commons/testdevice.h @@ -60,7 +60,7 @@ public: explicit TestDeviceBackendNode(TestDevice *device) : Qt3DInput::QAbstractPhysicalDeviceBackendNode(ReadOnly) { - Qt3DCore::QBackendNodeTester().simulateInitialization(device, this); + Qt3DCore::QBackendNodeTester().simulateInitializationSync(device, this); } float axisValue(int axisIdentifier) const final diff --git a/tests/auto/input/loadproxydevicejob/tst_loadproxydevicejob.cpp b/tests/auto/input/loadproxydevicejob/tst_loadproxydevicejob.cpp index c5322eda6..de4875e0e 100644 --- a/tests/auto/input/loadproxydevicejob/tst_loadproxydevicejob.cpp +++ b/tests/auto/input/loadproxydevicejob/tst_loadproxydevicejob.cpp @@ -36,7 +36,7 @@ #include #include "qbackendnodetester.h" #include "testdeviceproxy.h" -#include "testpostmanarbiter.h" +#include "testarbiter.h" class FakeInputDeviceIntegration : public Qt3DInput::QInputDeviceIntegration { @@ -118,7 +118,6 @@ private Q_SLOTS: backendProxy->setManager(manager); Qt3DCore::QBackendNodeTester backendNodeCreator; backendNodeCreator.simulateInitializationSync(&proxy, backendProxy); - Qt3DCore::QBackendNodePrivate::get(backendProxy)->setArbiter(&arbiter); } // THEN @@ -152,7 +151,6 @@ private Q_SLOTS: backendProxy->setManager(manager); Qt3DCore::QBackendNodeTester backendNodeCreator; backendNodeCreator.simulateInitializationSync(&proxy, backendProxy); - Qt3DCore::QBackendNodePrivate::get(backendProxy)->setArbiter(&arbiter); } // THEN @@ -171,7 +169,7 @@ private Q_SLOTS: job.run(); // THEN -> PhysicalDeviceWrapper::setDevice should not have been called - QCOMPARE(arbiter.events.count(), 0); + QCOMPARE(arbiter.dirtyNodes().count(), 0); } } diff --git a/tests/auto/input/physicaldeviceproxy/tst_physicaldeviceproxy.cpp b/tests/auto/input/physicaldeviceproxy/tst_physicaldeviceproxy.cpp index bd5da8e3f..a6059f1f0 100644 --- a/tests/auto/input/physicaldeviceproxy/tst_physicaldeviceproxy.cpp +++ b/tests/auto/input/physicaldeviceproxy/tst_physicaldeviceproxy.cpp @@ -35,7 +35,7 @@ #include #include "qbackendnodetester.h" #include "testdeviceproxy.h" -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_PhysicalDeviceProxy : public Qt3DCore::QBackendNodeTester diff --git a/tests/auto/input/qabstractaxisinput/tst_qabstractaxisinput.cpp b/tests/auto/input/qabstractaxisinput/tst_qabstractaxisinput.cpp index 4e9f609c4..5b59a8de0 100644 --- a/tests/auto/input/qabstractaxisinput/tst_qabstractaxisinput.cpp +++ b/tests/auto/input/qabstractaxisinput/tst_qabstractaxisinput.cpp @@ -34,8 +34,8 @@ #include #include -#include "testpostmanarbiter.h" #include "testdevice.h" +#include class DummyAxisInput : public Qt3DInput::QAbstractAxisInput { @@ -68,15 +68,15 @@ private Q_SLOTS: // WHEN TestDevice *device = new TestDevice(axisInput.data()); QCoreApplication::processEvents(); - arbiter.events.clear(); + arbiter.clear(); axisInput->setSourceDevice(device); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), axisInput.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), axisInput.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } void checkSourceDeviceBookkeeping() diff --git a/tests/auto/input/qabstractphysicaldevicebackendnode/tst_qabstractphysicaldevicebackendnode.cpp b/tests/auto/input/qabstractphysicaldevicebackendnode/tst_qabstractphysicaldevicebackendnode.cpp index 247a881ad..0add25778 100644 --- a/tests/auto/input/qabstractphysicaldevicebackendnode/tst_qabstractphysicaldevicebackendnode.cpp +++ b/tests/auto/input/qabstractphysicaldevicebackendnode/tst_qabstractphysicaldevicebackendnode.cpp @@ -36,7 +36,6 @@ #include #include #include -#include #include "testdevice.h" class TestPhysicalDeviceBackendNode : public Qt3DInput::QAbstractPhysicalDeviceBackendNode diff --git a/tests/auto/input/qabstractphysicaldeviceproxy/tst_qabstractphysicaldeviceproxy.cpp b/tests/auto/input/qabstractphysicaldeviceproxy/tst_qabstractphysicaldeviceproxy.cpp index bbe184e0e..f17fba297 100644 --- a/tests/auto/input/qabstractphysicaldeviceproxy/tst_qabstractphysicaldeviceproxy.cpp +++ b/tests/auto/input/qabstractphysicaldeviceproxy/tst_qabstractphysicaldeviceproxy.cpp @@ -29,8 +29,6 @@ #include -#include -#include #include "testdeviceproxy.h" class tst_QAbstractPhysicalDeviceProxy : public QObject @@ -72,58 +70,6 @@ private Q_SLOTS: // THEN -> should not crash QVERIFY(abstractPhysicalDeviceProxy->device() == nullptr); } - - void checkCreationData() - { - // GIVEN - TestProxy abstractPhysicalDeviceProxy; - - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&abstractPhysicalDeviceProxy); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DInput::QAbstractPhysicalDeviceProxyData cloneData = creationChangeData->data; - - QCOMPARE(abstractPhysicalDeviceProxy.deviceName(), cloneData.deviceName); - QCOMPARE(abstractPhysicalDeviceProxy.id(), creationChangeData->subjectId()); - QCOMPARE(abstractPhysicalDeviceProxy.isEnabled(), true); - QCOMPARE(abstractPhysicalDeviceProxy.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(abstractPhysicalDeviceProxy.metaObject(), creationChangeData->metaObject()); - } - - // WHEN - abstractPhysicalDeviceProxy.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&abstractPhysicalDeviceProxy); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DInput::QAbstractPhysicalDeviceProxyData cloneData = creationChangeData->data; - - QCOMPARE(abstractPhysicalDeviceProxy.deviceName(), cloneData.deviceName); - QCOMPARE(abstractPhysicalDeviceProxy.id(), creationChangeData->subjectId()); - QCOMPARE(abstractPhysicalDeviceProxy.isEnabled(), false); - QCOMPARE(abstractPhysicalDeviceProxy.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(abstractPhysicalDeviceProxy.metaObject(), creationChangeData->metaObject()); - } - } - }; QTEST_MAIN(tst_QAbstractPhysicalDeviceProxy) diff --git a/tests/auto/input/qaction/tst_qaction.cpp b/tests/auto/input/qaction/tst_qaction.cpp index 13c4a2d83..dc8f5cbc7 100644 --- a/tests/auto/input/qaction/tst_qaction.cpp +++ b/tests/auto/input/qaction/tst_qaction.cpp @@ -29,14 +29,12 @@ #include #include #include -#include #include #include #include #include - -#include "testpostmanarbiter.h" +#include // We need to call QNode::clone which is protected // We need to call QAction::sceneChangeEvent which is protected @@ -51,53 +49,7 @@ public: private Q_SLOTS: - void checkCloning_data() - { - QTest::addColumn("action"); - - Qt3DInput::QAction *defaultConstructed = new Qt3DInput::QAction(); - QTest::newRow("defaultConstructed") << defaultConstructed; - - Qt3DInput::QAction *namedaction = new Qt3DInput::QAction(); - QTest::newRow("namedAction") << namedaction; - - Qt3DInput::QAction *namedactionWithInputs = new Qt3DInput::QAction(); - Qt3DInput::QActionInput *actionInput1 = new Qt3DInput::QActionInput(); - Qt3DInput::QActionInput *actionInput2 = new Qt3DInput::QActionInput(); - Qt3DInput::QActionInput *actionInput3 = new Qt3DInput::QActionInput(); - namedactionWithInputs->addInput(actionInput1); - namedactionWithInputs->addInput(actionInput2); - namedactionWithInputs->addInput(actionInput3); - QTest::newRow("namedActionWithInputs") << namedactionWithInputs; - } - - void checkCloning() - { - // GIVEN - QFETCH(Qt3DInput::QAction *, action); - - // WHEN - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(action); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - // THEN - QCOMPARE(creationChanges.size(), 1 + action->inputs().size()); - const Qt3DCore::QNodeCreatedChangePtr creationChangeData = - qSharedPointerCast>(creationChanges.first()); - const Qt3DInput::QActionData &cloneActionData = creationChangeData->data; - - // THEN - QCOMPARE(creationChangeData->subjectId(), action->id()); - QCOMPARE(creationChangeData->isNodeEnabled(), action->isEnabled()); - QCOMPARE(creationChangeData->metaObject(), action->metaObject()); - QCOMPARE(creationChangeData->parentId(), action->parentNode() ? action->parentNode()->id() : Qt3DCore::QNodeId()); - QCOMPARE(cloneActionData.inputIds.size(), action->inputs().size()); - - const QVector &inputs = action->inputs(); - for (int i = 0, m = inputs.size(); i < m; ++i) - QCOMPARE(cloneActionData.inputIds.at(i), inputs.at(i)->id()); - } void checkPropertyUpdates() { @@ -112,22 +64,18 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), action.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), action.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN action->removeInput(input); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), action.data()); - - arbiter.events.clear(); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), action.data()); } void checkActionInputBookkeeping() diff --git a/tests/auto/input/qactioninput/tst_qactioninput.cpp b/tests/auto/input/qactioninput/tst_qactioninput.cpp index be06cd8b2..985efb534 100644 --- a/tests/auto/input/qactioninput/tst_qactioninput.cpp +++ b/tests/auto/input/qactioninput/tst_qactioninput.cpp @@ -30,14 +30,13 @@ #include #include #include -#include #include #include #include -#include "testpostmanarbiter.h" #include "testdevice.h" +#include class tst_QActionInput: public QObject { @@ -49,47 +48,6 @@ public: } private Q_SLOTS: - void checkCloning_data() - { - QTest::addColumn("actionInput"); - - Qt3DInput::QActionInput *defaultConstructed = new Qt3DInput::QActionInput(); - QTest::newRow("defaultConstructed") << defaultConstructed; - - Qt3DInput::QActionInput *actionInputWithKeys = new Qt3DInput::QActionInput(); - actionInputWithKeys->setButtons(QVector() << ((1 << 1) | (1 << 5))); - QTest::newRow("actionInputWithKeys") << actionInputWithKeys; - - Qt3DInput::QActionInput *actionInputWithKeysAndSourceDevice = new Qt3DInput::QActionInput(); - TestDevice *device = new TestDevice(); - actionInputWithKeysAndSourceDevice->setButtons(QVector() << ((1 << 1) | (1 << 5))); - actionInputWithKeysAndSourceDevice->setSourceDevice(device); - QTest::newRow("actionInputWithKeysAndSourceDevice") << actionInputWithKeysAndSourceDevice; - } - - void checkCloning() - { - // GIVEN - QFETCH(Qt3DInput::QActionInput *, actionInput); - - // WHEN - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(actionInput); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - // THEN - QCOMPARE(creationChanges.size(), 1 + (actionInput->sourceDevice() ? 1 : 0)); - - const Qt3DCore::QNodeCreatedChangePtr creationChangeData = - qSharedPointerCast>(creationChanges.first()); - const Qt3DInput::QActionInputData &cloneData = creationChangeData->data; - - // THEN - QCOMPARE(actionInput->id(), creationChangeData->subjectId()); - QCOMPARE(actionInput->isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(actionInput->metaObject(), creationChangeData->metaObject()); - QCOMPARE(actionInput->buttons(), cloneData.buttons); - QCOMPARE(actionInput->sourceDevice() ? actionInput->sourceDevice()->id() : Qt3DCore::QNodeId(), cloneData.sourceDeviceId); - } void checkPropertyUpdates() { @@ -103,23 +61,22 @@ private Q_SLOTS: actionInput->setButtons(buttons); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), actionInput.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), actionInput.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN TestDevice *device = new TestDevice(actionInput.data()); QCoreApplication::processEvents(); - arbiter.events.clear(); actionInput->setSourceDevice(device); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), actionInput.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), actionInput.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } void checkSourceDeviceBookkeeping() diff --git a/tests/auto/input/qanalogaxisinput/tst_qanalogaxisinput.cpp b/tests/auto/input/qanalogaxisinput/tst_qanalogaxisinput.cpp index c9abd0f4b..07149afef 100644 --- a/tests/auto/input/qanalogaxisinput/tst_qanalogaxisinput.cpp +++ b/tests/auto/input/qanalogaxisinput/tst_qanalogaxisinput.cpp @@ -29,14 +29,13 @@ #include #include #include -#include #include #include #include -#include "testpostmanarbiter.h" #include "testdevice.h" +#include class tst_QAnalogAxisInput: public QObject { @@ -48,45 +47,6 @@ public: } private Q_SLOTS: - void checkCloning_data() - { - QTest::addColumn("axisInput"); - - Qt3DInput::QAnalogAxisInput *defaultConstructed = new Qt3DInput::QAnalogAxisInput(); - QTest::newRow("defaultConstructed") << defaultConstructed; - - Qt3DInput::QAnalogAxisInput *axisInputWithAxis = new Qt3DInput::QAnalogAxisInput(); - axisInputWithAxis->setAxis(383); - QTest::newRow("axisInputWithAxis") << axisInputWithAxis; - - Qt3DInput::QAnalogAxisInput *axisInputWithAxisAndSourceDevice = new Qt3DInput::QAnalogAxisInput(); - TestDevice *device = new TestDevice(); - axisInputWithAxisAndSourceDevice->setSourceDevice(device); - axisInputWithAxisAndSourceDevice->setAxis(427); - QTest::newRow("axisInputWithAxisAndSourceDevice") << axisInputWithAxisAndSourceDevice; - } - - void checkCloning() - { - // GIVEN - QFETCH(Qt3DInput::QAnalogAxisInput *, axisInput); - - // WHEN - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(axisInput); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - // THEN - QCOMPARE(creationChanges.size(), 1 + (axisInput->sourceDevice() ? 1 : 0)); - - const Qt3DCore::QNodeCreatedChangePtr creationChangeData = - qSharedPointerCast>(creationChanges.first()); - const Qt3DInput::QAnalogAxisInputData &cloneData = creationChangeData->data; - QCOMPARE(axisInput->id(), creationChangeData->subjectId()); - QCOMPARE(axisInput->isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(axisInput->metaObject(), creationChangeData->metaObject()); - QCOMPARE(axisInput->axis(), cloneData.axis); - QCOMPARE(axisInput->sourceDevice() ? axisInput->sourceDevice()->id() : Qt3DCore::QNodeId(), cloneData.sourceDeviceId); - } void checkPropertyUpdates() { @@ -99,23 +59,22 @@ private Q_SLOTS: axisInput->setAxis(350); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), axisInput.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), axisInput.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN TestDevice *device = new TestDevice(axisInput.data()); QCoreApplication::processEvents(); - arbiter.events.clear(); axisInput->setSourceDevice(device); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), axisInput.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), axisInput.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } }; diff --git a/tests/auto/input/qaxis/tst_qaxis.cpp b/tests/auto/input/qaxis/tst_qaxis.cpp index 9b3068442..e57b02bb3 100644 --- a/tests/auto/input/qaxis/tst_qaxis.cpp +++ b/tests/auto/input/qaxis/tst_qaxis.cpp @@ -29,13 +29,11 @@ #include #include #include -#include #include #include #include - -#include "testpostmanarbiter.h" +#include class tst_QAxis: public QObject { @@ -47,52 +45,6 @@ public: private Q_SLOTS: - void checkCloning_data() - { - QTest::addColumn("axis"); - - Qt3DInput::QAxis *defaultConstructed = new Qt3DInput::QAxis(); - QTest::newRow("defaultConstructed") << defaultConstructed; - - Qt3DInput::QAxis *namedAxis = new Qt3DInput::QAxis(); - QTest::newRow("namedAxis") << namedAxis; - - Qt3DInput::QAxis *namedAxisWithInputs = new Qt3DInput::QAxis(); - Qt3DInput::QAbstractAxisInput *axisInput1 = new Qt3DInput::QAnalogAxisInput(); - Qt3DInput::QAbstractAxisInput *axisInput2 = new Qt3DInput::QAnalogAxisInput(); - Qt3DInput::QAbstractAxisInput *axisInput3 = new Qt3DInput::QAnalogAxisInput(); - namedAxisWithInputs->addInput(axisInput1); - namedAxisWithInputs->addInput(axisInput2); - namedAxisWithInputs->addInput(axisInput3); - QTest::newRow("namedAxisWithInputs") << namedAxisWithInputs; - } - - void checkCloning() - { - // GIVEN - QFETCH(Qt3DInput::QAxis *, axis); - - // WHEN - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(axis); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - // THEN - QCOMPARE(creationChanges.size(), 1 + axis->inputs().size()); - - const Qt3DCore::QNodeCreatedChangePtr creationChangeData = - qSharedPointerCast>(creationChanges.first()); - const Qt3DInput::QAxisData &cloneData = creationChangeData->data; - - // THEN - QCOMPARE(axis->id(), creationChangeData->subjectId()); - QCOMPARE(axis->isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(axis->metaObject(), creationChangeData->metaObject()); - QCOMPARE(axis->inputs().count(), cloneData.inputIds.count()); - - for (int i = 0, m = axis->inputs().count(); i < m; ++i) - QCOMPARE(axis->inputs().at(i)->id(), cloneData.inputIds.at(i)); - } - void checkPropertyUpdates() { // GIVEN @@ -106,22 +58,20 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), axis.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), axis.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN axis->removeInput(input); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), axis.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), axis.data()); - arbiter.events.clear(); + arbiter.clear(); } void checkAxisInputBookkeeping() diff --git a/tests/auto/input/qaxisaccumulator/tst_qaxisaccumulator.cpp b/tests/auto/input/qaxisaccumulator/tst_qaxisaccumulator.cpp index 9f96cd845..fea5d925a 100644 --- a/tests/auto/input/qaxisaccumulator/tst_qaxisaccumulator.cpp +++ b/tests/auto/input/qaxisaccumulator/tst_qaxisaccumulator.cpp @@ -29,13 +29,12 @@ #include #include #include -#include #include #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QAxisAccumulator: public Qt3DInput::QAxisAccumulator { @@ -47,76 +46,6 @@ public: private Q_SLOTS: - void checkCreationChange_data() - { - QTest::addColumn>("accumulator"); - QTest::addColumn("sourceAxis"); - QTest::addColumn("sourceAxisType"); - QTest::addColumn("scale"); - - { - auto accumulator = QSharedPointer::create(); - QTest::newRow("defaultConstructed") - << accumulator - << static_cast(nullptr) - << Qt3DInput::QAxisAccumulator::Velocity - << 1.0f; - } - - { - auto accumulator = QSharedPointer::create(); - Qt3DInput::QAxis *axis = new Qt3DInput::QAxis(); - accumulator->setSourceAxis(axis); - QTest::newRow("withSourceAxis") - << accumulator - << axis - << Qt3DInput::QAxisAccumulator::Velocity - << 1.0f; - } - - { - auto accumulator = QSharedPointer::create(); - accumulator->setSourceAxisType(Qt3DInput::QAxisAccumulator::Acceleration); - accumulator->setScale(2.5f); - Qt3DInput::QAxis *axis = new Qt3DInput::QAxis(); - accumulator->setSourceAxis(axis); - QTest::newRow("accelerationNonUniformScale") - << accumulator - << axis - << Qt3DInput::QAxisAccumulator::Acceleration - << 2.5f; - } - } - - void checkCreationChange() - { - // GIVEN - QFETCH(QSharedPointer, accumulator); - QFETCH(Qt3DInput::QAxis *, sourceAxis); - QFETCH(Qt3DInput::QAxisAccumulator::SourceAxisType, sourceAxisType); - QFETCH(float, scale); - - // WHEN - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(accumulator.data()); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - // THEN - QCOMPARE(creationChanges.size(), sourceAxis ? 2 : 1); - - const auto creationChangeData = - qSharedPointerCast>(creationChanges.first()); - const Qt3DInput::QAxisAccumulatorData &creationData = creationChangeData->data; - - // THEN - QCOMPARE(accumulator->id(), creationChangeData->subjectId()); - QCOMPARE(accumulator->isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(accumulator->metaObject(), creationChangeData->metaObject()); - if (sourceAxis) - QCOMPARE(sourceAxis->id(), creationData.sourceAxisId); - QCOMPARE(sourceAxisType, creationData.sourceAxisType); - QCOMPARE(scale, creationData.scale); - } - void checkPropertyUpdates() { // GIVEN @@ -129,29 +58,29 @@ private Q_SLOTS: accumulator->setSourceAxis(axis); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), accumulator.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), accumulator.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN accumulator->setScale(2.0f); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), accumulator.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), accumulator.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN accumulator->setSourceAxisType(Qt3DInput::QAxisAccumulator::Acceleration); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), accumulator.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), accumulator.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } void checkAxisInputBookkeeping() diff --git a/tests/auto/input/qbuttonaxisinput/tst_qbuttonaxisinput.cpp b/tests/auto/input/qbuttonaxisinput/tst_qbuttonaxisinput.cpp index e8ab3e172..6a53c1b89 100644 --- a/tests/auto/input/qbuttonaxisinput/tst_qbuttonaxisinput.cpp +++ b/tests/auto/input/qbuttonaxisinput/tst_qbuttonaxisinput.cpp @@ -29,13 +29,12 @@ #include #include #include -#include #include #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" #include "testdevice.h" class tst_QButtonAxisInput: public QObject @@ -60,56 +59,6 @@ private Q_SLOTS: QCOMPARE(axisInput.deceleration(), -1.0f); } - void checkCloning_data() - { - QTest::addColumn("axisInput"); - - Qt3DInput::QButtonAxisInput *defaultConstructed = new Qt3DInput::QButtonAxisInput(); - QTest::newRow("defaultConstructed") << defaultConstructed; - - Qt3DInput::QButtonAxisInput *axisInputWithKeys = new Qt3DInput::QButtonAxisInput(); - axisInputWithKeys->setButtons(QVector() << ((1 << 1) | (1 << 5))); - axisInputWithKeys->setScale(327.0f); - QTest::newRow("axisInputWithKeys") << axisInputWithKeys; - - Qt3DInput::QButtonAxisInput *axisInputWithKeysAndSourceDevice = new Qt3DInput::QButtonAxisInput(); - TestDevice *device = new TestDevice(); - axisInputWithKeysAndSourceDevice->setButtons(QVector() << ((1 << 1) | (1 << 5))); - axisInputWithKeysAndSourceDevice->setSourceDevice(device); - axisInputWithKeysAndSourceDevice->setScale(355.0f); - QTest::newRow("axisInputWithKeysAndSourceDevice") << axisInputWithKeysAndSourceDevice; - - Qt3DInput::QButtonAxisInput *axisInputWithAcceleration = new Qt3DInput::QButtonAxisInput(); - axisInputWithAcceleration->setAcceleration(41.0f); - axisInputWithAcceleration->setDeceleration(42.0f); - QTest::newRow("axisInputWithAcceleration") << axisInputWithAcceleration; - } - - void checkCloning() - { - // GIVEN - QFETCH(Qt3DInput::QButtonAxisInput *, axisInput); - - // WHEN - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(axisInput); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - // THEN - QCOMPARE(creationChanges.size(), 1 + (axisInput->sourceDevice() ? 1 : 0)); - - const Qt3DCore::QNodeCreatedChangePtr creationChangeData = - qSharedPointerCast>(creationChanges.first()); - const Qt3DInput::QButtonAxisInputData &cloneData = creationChangeData->data; - QCOMPARE(axisInput->id(), creationChangeData->subjectId()); - QCOMPARE(axisInput->isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(axisInput->metaObject(), creationChangeData->metaObject()); - QCOMPARE(axisInput->buttons(), cloneData.buttons); - QCOMPARE(axisInput->scale(), cloneData.scale); - QCOMPARE(axisInput->acceleration(), cloneData.acceleration); - QCOMPARE(axisInput->deceleration(), cloneData.deceleration); - QCOMPARE(axisInput->sourceDevice() ? axisInput->sourceDevice()->id() : Qt3DCore::QNodeId(), cloneData.sourceDeviceId); - } - void checkPropertyUpdates() { // GIVEN @@ -122,19 +71,19 @@ private Q_SLOTS: axisInput->setButtons(buttons); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), axisInput.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), axisInput.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN axisInput->setScale(1340.0f); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), axisInput.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), axisInput.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN TestDevice *device = new TestDevice(axisInput.data()); @@ -142,28 +91,28 @@ private Q_SLOTS: axisInput->setSourceDevice(device); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), axisInput.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), axisInput.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN axisInput->setAcceleration(42.0f); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), axisInput.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), axisInput.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN axisInput->setDeceleration(43.0f); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), axisInput.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), axisInput.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } }; diff --git a/tests/auto/input/qkeyboardhandler/tst_qkeyboardhandler.cpp b/tests/auto/input/qkeyboardhandler/tst_qkeyboardhandler.cpp index 3f1e7fd09..7f1b7af62 100644 --- a/tests/auto/input/qkeyboardhandler/tst_qkeyboardhandler.cpp +++ b/tests/auto/input/qkeyboardhandler/tst_qkeyboardhandler.cpp @@ -29,13 +29,11 @@ #include #include #include -#include #include #include #include - -#include "testpostmanarbiter.h" +#include class tst_QKeyboardHandler : public QObject { @@ -47,44 +45,6 @@ public: } private Q_SLOTS: - void checkCloning_data() - { - QTest::addColumn("keyboardHandler"); - - auto defaultConstructed = new Qt3DInput::QKeyboardHandler; - QTest::newRow("defaultConstructed") << defaultConstructed; - - auto handlerWithDevice = new Qt3DInput::QKeyboardHandler; - handlerWithDevice->setSourceDevice(new Qt3DInput::QKeyboardDevice); - QTest::newRow("handlerWithDevice") << handlerWithDevice; - - auto handlerWithDeviceAndFocus = new Qt3DInput::QKeyboardHandler; - handlerWithDeviceAndFocus->setSourceDevice(new Qt3DInput::QKeyboardDevice); - handlerWithDeviceAndFocus->setFocus(true); - QTest::newRow("handlerWithDeviceAndFocus") << handlerWithDeviceAndFocus; - } - - void checkCloning() - { - // GIVEN - QFETCH(Qt3DInput::QKeyboardHandler *, keyboardHandler); - - // WHEN - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(keyboardHandler); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - // THEN - QCOMPARE(creationChanges.size(), 1 + (keyboardHandler->sourceDevice() ? 1 : 0)); - - auto creationChangeData = - qSharedPointerCast>(creationChanges.first()); - const Qt3DInput::QKeyboardHandlerData &cloneData = creationChangeData->data; - QCOMPARE(keyboardHandler->id(), creationChangeData->subjectId()); - QCOMPARE(keyboardHandler->isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(keyboardHandler->metaObject(), creationChangeData->metaObject()); - QCOMPARE(keyboardHandler->focus(), cloneData.focus); - QCOMPARE(keyboardHandler->sourceDevice() ? keyboardHandler->sourceDevice()->id() : Qt3DCore::QNodeId(), cloneData.keyboardDeviceId); - } void checkPropertyUpdates() { @@ -97,23 +57,23 @@ private Q_SLOTS: keyboardHandler->setFocus(true); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), keyboardHandler.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), keyboardHandler.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN auto device = new Qt3DInput::QKeyboardDevice(keyboardHandler.data()); QCoreApplication::processEvents(); - arbiter.events.clear(); + arbiter.clear(); keyboardHandler->setSourceDevice(device); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), keyboardHandler.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), keyboardHandler.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } void checkSourceDeviceBookkeeping() diff --git a/tests/auto/input/qlogicaldevice/tst_qlogicaldevice.cpp b/tests/auto/input/qlogicaldevice/tst_qlogicaldevice.cpp index c7236ac7d..6e3616368 100644 --- a/tests/auto/input/qlogicaldevice/tst_qlogicaldevice.cpp +++ b/tests/auto/input/qlogicaldevice/tst_qlogicaldevice.cpp @@ -29,14 +29,13 @@ #include #include #include -#include #include #include #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QLogicalDevice: public QObject { @@ -49,59 +48,6 @@ public: private Q_SLOTS: - void checkCloning_data() - { - QTest::addColumn("logicalDevice"); - - Qt3DInput::QLogicalDevice *defaultConstructed = new Qt3DInput::QLogicalDevice(); - QTest::newRow("defaultConstructed") << defaultConstructed; - - Qt3DInput::QLogicalDevice *logicalDeviceWithActions = new Qt3DInput::QLogicalDevice(); - logicalDeviceWithActions->addAction(new Qt3DInput::QAction()); - logicalDeviceWithActions->addAction(new Qt3DInput::QAction()); - logicalDeviceWithActions->addAction(new Qt3DInput::QAction()); - QTest::newRow("logicalDeviceWithActions") << logicalDeviceWithActions; - - Qt3DInput::QLogicalDevice *logicalDeviceWithAxes = new Qt3DInput::QLogicalDevice(); - logicalDeviceWithAxes->addAxis(new Qt3DInput::QAxis()); - logicalDeviceWithAxes->addAxis(new Qt3DInput::QAxis()); - logicalDeviceWithAxes->addAxis(new Qt3DInput::QAxis()); - QTest::newRow("logicalDeviceWithAxes") << logicalDeviceWithAxes; - } - - void checkCloning() - { - // GIVEN - QFETCH(Qt3DInput::QLogicalDevice *, logicalDevice); - - // WHEN - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(logicalDevice); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - const int axesCount = logicalDevice->axes().count(); - const int actionsCount = logicalDevice->actions().count(); - - // THEN - QCOMPARE(creationChanges.size(), 1 + axesCount + actionsCount); - - const Qt3DCore::QNodeCreatedChangePtr creationChangeData = - qSharedPointerCast>(creationChanges.first()); - const Qt3DInput::QLogicalDeviceData &cloneData = creationChangeData->data; - - // THEN - QCOMPARE(logicalDevice->id(), creationChangeData->subjectId()); - QCOMPARE(logicalDevice->isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(logicalDevice->metaObject(), creationChangeData->metaObject()); - QCOMPARE(axesCount, cloneData.axisIds.count()); - QCOMPARE(actionsCount, cloneData.actionIds.count()); - - for (int i = 0; i < axesCount; ++i) - QCOMPARE(logicalDevice->axes().at(i)->id(), cloneData.axisIds.at(i)); - - for (int i = 0; i < actionsCount; ++i) - QCOMPARE(logicalDevice->actions().at(i)->id(), cloneData.actionIds.at(i)); - } - void checkPropertyUpdates() { // GIVEN @@ -112,54 +58,50 @@ private Q_SLOTS: // WHEN Qt3DInput::QAction *action = new Qt3DInput::QAction(logicalDevice.data()); QCoreApplication::processEvents(); - arbiter.events.clear(); + arbiter.clear(); logicalDevice->addAction(action); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), logicalDevice.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), logicalDevice.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN logicalDevice->removeAction(action); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), logicalDevice.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), logicalDevice.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN Qt3DInput::QAxis *axis = new Qt3DInput::QAxis(logicalDevice.data()); QCoreApplication::processEvents(); - arbiter.dirtyNodes.clear(); + arbiter.clear(); logicalDevice->addAxis(axis); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), logicalDevice.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), logicalDevice.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN logicalDevice->removeAxis(axis); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), logicalDevice.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), logicalDevice.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } void checkAxisBookkeeping() diff --git a/tests/auto/input/qmousedevice/tst_qmousedevice.cpp b/tests/auto/input/qmousedevice/tst_qmousedevice.cpp index 6a8f39c71..cd899d661 100644 --- a/tests/auto/input/qmousedevice/tst_qmousedevice.cpp +++ b/tests/auto/input/qmousedevice/tst_qmousedevice.cpp @@ -33,9 +33,7 @@ #include #include #include -#include -#include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QMouseDevice : public QObject { @@ -118,58 +116,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - Qt3DInput::QMouseDevice mouseDevice; - - mouseDevice.setSensitivity(0.8f); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&mouseDevice); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DInput::QMouseDeviceData cloneData = creationChangeData->data; - - QCOMPARE(mouseDevice.sensitivity(), cloneData.sensitivity); - QCOMPARE(mouseDevice.id(), creationChangeData->subjectId()); - QCOMPARE(mouseDevice.isEnabled(), true); - QCOMPARE(mouseDevice.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(mouseDevice.metaObject(), creationChangeData->metaObject()); - } - - // WHEN - mouseDevice.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&mouseDevice); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DInput::QMouseDeviceData cloneData = creationChangeData->data; - - QCOMPARE(mouseDevice.sensitivity(), cloneData.sensitivity); - QCOMPARE(mouseDevice.id(), creationChangeData->subjectId()); - QCOMPARE(mouseDevice.isEnabled(), false); - QCOMPARE(mouseDevice.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(mouseDevice.metaObject(), creationChangeData->metaObject()); - } - } - void checkSensitivityUpdate() { // GIVEN @@ -181,16 +127,16 @@ private Q_SLOTS: // WHEN mouseDevice.setSensitivity(0.7f); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &mouseDevice); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &mouseDevice); } { // WHEN mouseDevice.setSensitivity(0.7f); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &mouseDevice); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &mouseDevice); } } @@ -206,16 +152,16 @@ private Q_SLOTS: // WHEN mouseDevice.setUpdateAxesContinuously(true); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &mouseDevice); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &mouseDevice); } { // WHEN mouseDevice.setSensitivity(true); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &mouseDevice); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &mouseDevice); } } diff --git a/tests/auto/input/utils/tst_utils.cpp b/tests/auto/input/utils/tst_utils.cpp index 14a289556..daa03efd9 100644 --- a/tests/auto/input/utils/tst_utils.cpp +++ b/tests/auto/input/utils/tst_utils.cpp @@ -133,7 +133,7 @@ private Q_SLOTS: // WHEN -> Create backend PhysicalProxiDevice Qt3DInput::Input::PhysicalDeviceProxy *backendProxyDevice = handler.physicalDeviceProxyManager()->getOrCreateResource(testProxyPhysicalDevice.id()); backendProxyDevice->setManager(handler.physicalDeviceProxyManager()); - simulateInitialization(&testProxyPhysicalDevice, backendProxyDevice); + simulateInitializationSync(&testProxyPhysicalDevice, backendProxyDevice); backendProxyDevice->setDevice(&testPhysicalDevice); // THEN @@ -204,7 +204,7 @@ private Q_SLOTS: // WHEN -> Create backend PhysicalProxiDevice Qt3DInput::Input::PhysicalDeviceProxy *backendProxyDevice = handler.physicalDeviceProxyManager()->getOrCreateResource(testProxyPhysicalDevice.id()); backendProxyDevice->setManager(handler.physicalDeviceProxyManager()); - simulateInitialization(&testProxyPhysicalDevice, backendProxyDevice); + simulateInitializationSync(&testProxyPhysicalDevice, backendProxyDevice); backendProxyDevice->setDevice(&testPhysicalDevice2); // THEN diff --git a/tests/auto/render/armature/tst_armature.cpp b/tests/auto/render/armature/tst_armature.cpp index 99b9aa7a5..055013850 100644 --- a/tests/auto/render/armature/tst_armature.cpp +++ b/tests/auto/render/armature/tst_armature.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include using namespace Qt3DCore; using namespace Qt3DRender; diff --git a/tests/auto/render/boundingsphere/tst_boundingsphere.cpp b/tests/auto/render/boundingsphere/tst_boundingsphere.cpp index 34d195221..cec48c066 100644 --- a/tests/auto/render/boundingsphere/tst_boundingsphere.cpp +++ b/tests/auto/render/boundingsphere/tst_boundingsphere.cpp @@ -27,7 +27,7 @@ ****************************************************************************/ #include "qmlscenereader.h" -#include "testpostmanarbiter.h" +#include "testarbiter.h" #include diff --git a/tests/auto/render/buffer/tst_buffer.cpp b/tests/auto/render/buffer/tst_buffer.cpp index 5c2ae296d..c021ea805 100644 --- a/tests/auto/render/buffer/tst_buffer.cpp +++ b/tests/auto/render/buffer/tst_buffer.cpp @@ -35,9 +35,8 @@ QT_WARNING_DISABLE_DEPRECATED #include #include #include -#include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" #include "testrenderer.h" class TestFunctor : public Qt3DRender::QBufferDataGenerator @@ -292,15 +291,13 @@ private Q_SLOTS: // WHEN TestArbiter arbiter; - Qt3DCore::QBackendNodePrivate::get(&backendBuffer)->setArbiter(&arbiter); backendBuffer.executeFunctor(); // THEN - QCOMPARE(arbiter.events.count(), 0); QCOMPARE(backendBuffer.pendingBufferUpdates().size(), 1); QCOMPARE(backendBuffer.pendingBufferUpdates().first().offset, -1); - arbiter.events.clear(); + arbiter.clear(); backendBuffer.pendingBufferUpdates().clear(); // WHEN diff --git a/tests/auto/render/computecommand/tst_computecommand.cpp b/tests/auto/render/computecommand/tst_computecommand.cpp index d6fa1d579..34a03b068 100644 --- a/tests/auto/render/computecommand/tst_computecommand.cpp +++ b/tests/auto/render/computecommand/tst_computecommand.cpp @@ -36,10 +36,9 @@ #include #include #include -#include #include "qbackendnodetester.h" #include "testrenderer.h" -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_ComputeCommand : public Qt3DCore::QBackendNodeTester @@ -201,7 +200,6 @@ private Q_SLOTS: { // GIVEN TestRenderer renderer; - TestArbiter arbiter; Qt3DRender::QComputeCommand computeCommand; Qt3DRender::Render::ComputeCommand backendComputeCommand; @@ -213,8 +211,6 @@ private Q_SLOTS: computeCommand.trigger(6); - Qt3DCore::QBackendNodePrivate::get(&backendComputeCommand)->setArbiter(&arbiter); - backendComputeCommand.setRenderer(&renderer); simulateInitializationSync(&computeCommand, &backendComputeCommand); @@ -226,7 +222,6 @@ private Q_SLOTS: QCOMPARE(backendComputeCommand.frameCount(), 6 - (i + 1)); QCOMPARE(backendComputeCommand.isEnabled(), true); QCOMPARE(backendComputeCommand.hasReachedFrameCount(), false); - QCOMPARE(arbiter.events.size(), 0); } // WHEN diff --git a/tests/auto/render/entity/tst_entity.cpp b/tests/auto/render/entity/tst_entity.cpp index a762330dd..2408cac5b 100644 --- a/tests/auto/render/entity/tst_entity.cpp +++ b/tests/auto/render/entity/tst_entity.cpp @@ -26,10 +26,6 @@ ** ****************************************************************************/ -// TODO Remove in Qt6 -#include -QT_WARNING_DISABLE_DEPRECATED - #include #include #include diff --git a/tests/auto/render/framegraphnode/tst_framegraphnode.cpp b/tests/auto/render/framegraphnode/tst_framegraphnode.cpp index a7cea2ef2..4aa7615be 100644 --- a/tests/auto/render/framegraphnode/tst_framegraphnode.cpp +++ b/tests/auto/render/framegraphnode/tst_framegraphnode.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include "testrenderer.h" #include "qbackendnodetester.h" diff --git a/tests/auto/render/geometry/tst_geometry.cpp b/tests/auto/render/geometry/tst_geometry.cpp index a13f6fa40..9355f8339 100644 --- a/tests/auto/render/geometry/tst_geometry.cpp +++ b/tests/auto/render/geometry/tst_geometry.cpp @@ -35,10 +35,9 @@ QT_WARNING_DISABLE_DEPRECATED #include #include #include -#include #include #include "testrenderer.h" -#include "testpostmanarbiter.h" +#include "testarbiter.h" class DummyAttribute : public Qt3DRender::QAttribute { @@ -199,23 +198,16 @@ private Q_SLOTS: TestArbiter arbiter; Qt3DRender::Render::Geometry renderGeometry; - Qt3DCore::QBackendNodePrivate::get(&renderGeometry)->setArbiter(&arbiter); renderGeometry.setRenderer(&renderer); // WHEN renderGeometry.updateExtent(QVector3D(-1.0f, -1.0f, -1.0f), QVector3D(1.0f, 1.0f, 1.0f)); - renderGeometry.notifyExtentChanged(); // THEN - QCOMPARE(arbiter.events.count(), 1); + QCOMPARE(arbiter.dirtyNodes().count(), 0); - Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast(); - QCOMPARE(change->propertyName(), "extent"); - const QPair v = change->value().value>(); - QCOMPARE(v.first, QVector3D(-1.0f, -1.0f, -1.0f)); - QCOMPARE(v.second, QVector3D(1.0f, 1.0f, 1.0f)); - - arbiter.events.clear(); + QCOMPARE(renderGeometry.min(), QVector3D(-1.0f, -1.0f, -1.0f)); + QCOMPARE(renderGeometry.max(), QVector3D(1.0f, 1.0f, 1.0f)); } }; diff --git a/tests/auto/render/joint/tst_joint.cpp b/tests/auto/render/joint/tst_joint.cpp index 0388f4a80..c0b4a7a3b 100644 --- a/tests/auto/render/joint/tst_joint.cpp +++ b/tests/auto/render/joint/tst_joint.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include using namespace Qt3DCore; diff --git a/tests/auto/render/levelofdetail/tst_levelofdetail.cpp b/tests/auto/render/levelofdetail/tst_levelofdetail.cpp index 5005ca2d1..c0c06975a 100644 --- a/tests/auto/render/levelofdetail/tst_levelofdetail.cpp +++ b/tests/auto/render/levelofdetail/tst_levelofdetail.cpp @@ -33,7 +33,7 @@ #include #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" #include "testrenderer.h" class tst_LevelOfDetail : public Qt3DCore::QBackendNodeTester diff --git a/tests/auto/render/loadscenejob/tst_loadscenejob.cpp b/tests/auto/render/loadscenejob/tst_loadscenejob.cpp index 044c3e0f4..7e75f1d69 100644 --- a/tests/auto/render/loadscenejob/tst_loadscenejob.cpp +++ b/tests/auto/render/loadscenejob/tst_loadscenejob.cpp @@ -32,10 +32,9 @@ #include #include #include -#include #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class TestSceneImporter : public Qt3DRender::QSceneImporter { @@ -139,7 +138,6 @@ private Q_SLOTS: // THEN QVERIFY(scene != nullptr); - Qt3DCore::QBackendNodePrivate::get(scene)->setArbiter(&arbiter); // WHEN Qt3DRender::Render::LoadSceneJob loadSceneJob(url, sceneId); @@ -165,7 +163,6 @@ private Q_SLOTS: // THEN QVERIFY(scene != nullptr); - Qt3DCore::QBackendNodePrivate::get(scene)->setArbiter(&arbiter); // WHEN Qt3DRender::Render::LoadSceneJob loadSceneJob(url, sceneId); @@ -194,7 +191,6 @@ private Q_SLOTS: // THEN QVERIFY(scene != nullptr); - Qt3DCore::QBackendNodePrivate::get(scene)->setArbiter(&arbiter); // WHEN Qt3DRender::Render::LoadSceneJob loadSceneJob(url, sceneId); @@ -212,7 +208,6 @@ private Q_SLOTS: { // GIVEN const QUrl url(QStringLiteral("file:///URL")); - TestArbiter arbiter; Qt3DRender::Render::NodeManagers nodeManagers; TestSceneImporter fakeImporter(true, true); Qt3DCore::QNodeId sceneId = Qt3DCore::QNodeId::createId(); @@ -220,7 +215,6 @@ private Q_SLOTS: // THEN QVERIFY(scene != nullptr); - Qt3DCore::QBackendNodePrivate::get(scene)->setArbiter(&arbiter); // WHEN Qt3DRender::Render::LoadSceneJob loadSceneJob(url, sceneId); diff --git a/tests/auto/render/objectpicker/tst_objectpicker.cpp b/tests/auto/render/objectpicker/tst_objectpicker.cpp index 24fa2159d..0bbaffa84 100644 --- a/tests/auto/render/objectpicker/tst_objectpicker.cpp +++ b/tests/auto/render/objectpicker/tst_objectpicker.cpp @@ -32,7 +32,7 @@ #include #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" #include "testrenderer.h" class tst_ObjectPicker : public Qt3DCore::QBackendNodeTester diff --git a/tests/auto/render/opengl/computecommand/tst_computecommand.cpp b/tests/auto/render/opengl/computecommand/tst_computecommand.cpp index 3caf11c8f..bbe999ce8 100644 --- a/tests/auto/render/opengl/computecommand/tst_computecommand.cpp +++ b/tests/auto/render/opengl/computecommand/tst_computecommand.cpp @@ -36,11 +36,10 @@ #include #include #include -#include #include #include "qbackendnodetester.h" #include "testrenderer.h" -#include "testpostmanarbiter.h" +#include "testarbiter.h" // tst_Renderer is a friend class of Renderer @@ -68,7 +67,6 @@ private Q_SLOTS: // GIVEN Qt3DRender::Render::NodeManagers nodeManager; tst_Renderer renderer; - TestArbiter arbiter; Qt3DCore::QAspectManager manager; Qt3DCore::QScene scene; @@ -100,7 +98,6 @@ private Q_SLOTS: computeCommand.setRunType(Qt3DRender::QComputeCommand::Manual); computeCommand.trigger(1); - Qt3DCore::QBackendNodePrivate::get(backendComputeCommand)->setArbiter(&arbiter); backendComputeCommand->setRenderer(&renderer); simulateInitializationSync(&computeCommand, backendComputeCommand); diff --git a/tests/auto/render/opengl/glshadermanager/tst_glshadermanager.cpp b/tests/auto/render/opengl/glshadermanager/tst_glshadermanager.cpp index 6a5bc87ea..c514cea82 100644 --- a/tests/auto/render/opengl/glshadermanager/tst_glshadermanager.cpp +++ b/tests/auto/render/opengl/glshadermanager/tst_glshadermanager.cpp @@ -55,8 +55,8 @@ void tst_GLShaderManager::adopt() backendShaderNode1.setRenderer(&renderer); backendShaderNode2.setRenderer(&renderer); - simulateInitialization(&frontendShader1, &backendShaderNode1); - simulateInitialization(&frontendShader2, &backendShaderNode2); + simulateInitializationSync(&frontendShader1, &backendShaderNode1); + simulateInitializationSync(&frontendShader2, &backendShaderNode2); // THEN QVERIFY(cache.lookupResource(backendShaderNode1.peerId()) == nullptr); @@ -96,8 +96,8 @@ void tst_GLShaderManager::lookupResource() backendShaderNode1.setRenderer(&renderer); backendShaderNode2.setRenderer(&renderer); - simulateInitialization(&frontendShader1, &backendShaderNode1); - simulateInitialization(&frontendShader2, &backendShaderNode2); + simulateInitializationSync(&frontendShader1, &backendShaderNode1); + simulateInitializationSync(&frontendShader2, &backendShaderNode2); // WHEN cache.createOrAdoptExisting(&backendShaderNode1); @@ -126,8 +126,8 @@ void tst_GLShaderManager::abandon() backendShaderNode1.setRenderer(&renderer); backendShaderNode2.setRenderer(&renderer); - simulateInitialization(&frontendShader1, &backendShaderNode1); - simulateInitialization(&frontendShader2, &backendShaderNode2); + simulateInitializationSync(&frontendShader1, &backendShaderNode1); + simulateInitializationSync(&frontendShader2, &backendShaderNode2); cache.createOrAdoptExisting(&backendShaderNode1); cache.createOrAdoptExisting(&backendShaderNode2); @@ -162,7 +162,7 @@ void tst_GLShaderManager::insertAfterRemoval() backendShaderNode.setRenderer(&renderer); - simulateInitialization(&frontendShader, &backendShaderNode); + simulateInitializationSync(&frontendShader, &backendShaderNode); // WHEN Qt3DRender::Render::OpenGL::GLShader *apiShader1 = cache.createOrAdoptExisting(&backendShaderNode); diff --git a/tests/auto/render/opengl/renderer/tst_renderer.cpp b/tests/auto/render/opengl/renderer/tst_renderer.cpp index db7a37af1..c602e7cf8 100644 --- a/tests/auto/render/opengl/renderer/tst_renderer.cpp +++ b/tests/auto/render/opengl/renderer/tst_renderer.cpp @@ -95,8 +95,7 @@ private Q_SLOTS: QCOMPARE(jobs.size(), 1 + // PickBoundingVolumeJob 1 + // RayCastingJob - 1 + // SendBufferCaptureJob - 1); // SendSetFenceHandlesJob + 1); // SendBufferCaptureJob´ // Note: pending set fence handles are only cleared when the job is run // Properly shutdown command thread diff --git a/tests/auto/render/opengl/renderviews/tst_renderviews.cpp b/tests/auto/render/opengl/renderviews/tst_renderviews.cpp index 6d01122d1..270034e1b 100644 --- a/tests/auto/render/opengl/renderviews/tst_renderviews.cpp +++ b/tests/auto/render/opengl/renderviews/tst_renderviews.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tests/auto/render/opengl/renderviewutils/tst_renderviewutils.cpp b/tests/auto/render/opengl/renderviewutils/tst_renderviewutils.cpp index 6b714b9e1..add519b91 100644 --- a/tests/auto/render/opengl/renderviewutils/tst_renderviewutils.cpp +++ b/tests/auto/render/opengl/renderviewutils/tst_renderviewutils.cpp @@ -28,7 +28,6 @@ #include #include -#include #include #include #include @@ -36,7 +35,7 @@ #include #include #include "testrenderer.h" -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_RenderViewUtils : public Qt3DCore::QBackendNodeTester { @@ -79,7 +78,7 @@ private: // Create backend element for frontend one Qt3DRender::Render::Texture *backend = manager->getOrCreateResource(frontend->id()); // Init the backend element - simulateInitialization(frontend, backend); + simulateInitializationSync(frontend, backend); } }; @@ -780,20 +779,18 @@ void tst_RenderViewUtils::shouldNotifyDynamicPropertyChanges() shaderData->setProperty("scalar", 883.0f); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), shaderData.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), shaderData.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN QScopedPointer texture(new Qt3DRender::QTexture2D); shaderData->setProperty("texture", QVariant::fromValue(texture.data())); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), shaderData.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), shaderData.data()); } QTEST_MAIN(tst_RenderViewUtils) diff --git a/tests/auto/render/opengl/textures/tst_textures.cpp b/tests/auto/render/opengl/textures/tst_textures.cpp index 5343a6fde..5fb00f23d 100644 --- a/tests/auto/render/opengl/textures/tst_textures.cpp +++ b/tests/auto/render/opengl/textures/tst_textures.cpp @@ -644,7 +644,7 @@ private Q_SLOTS: // GIVEN Qt3DRender::QAbstractTexture* frontendTexture = createQTexture(1, {1}, true); - Qt3DRender::Render::Texture *backendTexture = static_cast(textureBackendNodeMapper.create(creationChange(frontendTexture))); + Qt3DRender::Render::Texture *backendTexture = static_cast(textureBackendNodeMapper.create(frontendTexture->id())); backendTexture->setRenderer(&renderer); simulateInitializationSync(frontendTexture, backendTexture); @@ -678,7 +678,7 @@ private Q_SLOTS: // GIVEN Qt3DRender::QAbstractTexture* frontendTexture = createQTexture(1, {1}, true); - Qt3DRender::Render::Texture *backendTexture = static_cast(textureBackendNodeMapper.create(creationChange(frontendTexture))); + Qt3DRender::Render::Texture *backendTexture = static_cast(textureBackendNodeMapper.create(frontendTexture->id())); backendTexture->setRenderer(&renderer); simulateInitializationSync(frontendTexture, backendTexture); @@ -691,7 +691,7 @@ private Q_SLOTS: QVERIFY(texMgr->lookupResource(frontendTexture->id()) == nullptr); // WHEN - backendTexture = static_cast(textureBackendNodeMapper.create(creationChange(frontendTexture))); + backendTexture = static_cast(textureBackendNodeMapper.create(frontendTexture->id())); backendTexture->setRenderer(&renderer); simulateInitializationSync(frontendTexture, backendTexture); diff --git a/tests/auto/render/pickboundingvolumejob/tst_pickboundingvolumejob.cpp b/tests/auto/render/pickboundingvolumejob/tst_pickboundingvolumejob.cpp index f1587c27c..c1ba2d981 100644 --- a/tests/auto/render/pickboundingvolumejob/tst_pickboundingvolumejob.cpp +++ b/tests/auto/render/pickboundingvolumejob/tst_pickboundingvolumejob.cpp @@ -27,7 +27,7 @@ ****************************************************************************/ #include "qmlscenereader.h" -#include "testpostmanarbiter.h" +#include "testarbiter.h" #include #include @@ -797,7 +797,6 @@ private Q_SLOTS: Qt3DRender::Render::ObjectPicker *backendPicker1 = test->nodeManagers()->objectPickerManager()->lookupResource(picker1->id()); QVERIFY(backendPicker1); - Qt3DCore::QBackendNodePrivate::get(backendPicker1)->setArbiter(test->arbiter()); QCOMPARE(test->renderSettings()->pickMethod(), pickMethod); QCOMPARE(test->renderSettings()->pickResultMode(), pickResultMode); @@ -929,7 +928,6 @@ private Q_SLOTS: Qt3DRender::Render::ObjectPicker *backendPicker1 = test->nodeManagers()->objectPickerManager()->lookupResource(picker1->id()); QVERIFY(backendPicker1); - Qt3DCore::QBackendNodePrivate::get(backendPicker1)->setArbiter(&arbiter); QSignalSpy mouseButtonPressedSpy(picker1, &Qt3DRender::QObjectPicker::pressed); QSignalSpy mouseMovedSpy(picker1, &Qt3DRender::QObjectPicker::moved); @@ -1038,7 +1036,6 @@ private Q_SLOTS: Qt3DRender::Render::ObjectPicker *backendPicker1 = test->nodeManagers()->objectPickerManager()->lookupResource(picker1->id()); QVERIFY(backendPicker1); - Qt3DCore::QBackendNodePrivate::get(backendPicker1)->setArbiter(&arbiter); QCOMPARE(test->renderSettings()->pickMethod(), pickMethod); QCOMPARE(test->renderSettings()->pickResultMode(), pickResultMode); @@ -1142,7 +1139,6 @@ private Q_SLOTS: Qt3DRender::Render::ObjectPicker *backendPicker = test->nodeManagers()->objectPickerManager()->lookupResource(picker->id()); QVERIFY(backendPicker); - Qt3DCore::QBackendNodePrivate::get(backendPicker)->setArbiter(&arbiter); QCOMPARE(test->renderSettings()->pickMethod(), pickMethod); QCOMPARE(test->renderSettings()->pickResultMode(), pickResultMode); @@ -1294,11 +1290,9 @@ private Q_SLOTS: Qt3DRender::Render::ObjectPicker *backendPicker1 = test->nodeManagers()->objectPickerManager()->lookupResource(picker1->id()); QVERIFY(backendPicker1); - Qt3DCore::QBackendNodePrivate::get(backendPicker1)->setArbiter(&arbiter1); Qt3DRender::Render::ObjectPicker *backendPicker2 = test->nodeManagers()->objectPickerManager()->lookupResource(picker2->id()); QVERIFY(backendPicker2); - Qt3DCore::QBackendNodePrivate::get(backendPicker2)->setArbiter(&arbiter2); QCOMPARE(test->renderSettings()->pickMethod(), pickMethod); QCOMPARE(test->renderSettings()->pickResultMode(), pickResultMode); @@ -1416,7 +1410,6 @@ private Q_SLOTS: Qt3DRender::Render::ObjectPicker *backendPicker = test->nodeManagers()->objectPickerManager()->lookupResource(picker->id()); QVERIFY(backendPicker); - Qt3DCore::QBackendNodePrivate::get(backendPicker)->setArbiter(&arbiter); QSignalSpy mouseEntered(picker, &Qt3DRender::QObjectPicker::entered); QSignalSpy mouseExited(picker, &Qt3DRender::QObjectPicker::exited); @@ -1486,7 +1479,6 @@ private Q_SLOTS: Qt3DRender::Render::ObjectPicker *backendPicker = test->nodeManagers()->objectPickerManager()->lookupResource(picker->id()); QVERIFY(backendPicker); - Qt3DCore::QBackendNodePrivate::get(backendPicker)->setArbiter(&arbiter); QSignalSpy mouseEntered(picker, &Qt3DRender::QObjectPicker::entered); QSignalSpy mouseExited(picker, &Qt3DRender::QObjectPicker::exited); @@ -1605,7 +1597,6 @@ private Q_SLOTS: Qt3DRender::Render::ObjectPicker *backendPicker = test->nodeManagers()->objectPickerManager()->lookupResource(picker->id()); QVERIFY(backendPicker); - Qt3DCore::QBackendNodePrivate::get(backendPicker)->setArbiter(&arbiter); QSignalSpy mouseEntered(picker, &Qt3DRender::QObjectPicker::entered); QSignalSpy mouseExited(picker, &Qt3DRender::QObjectPicker::exited); @@ -1674,11 +1665,9 @@ private Q_SLOTS: Qt3DRender::Render::ObjectPicker *backendPicker1 = test->nodeManagers()->objectPickerManager()->lookupResource(picker1->id()); QVERIFY(backendPicker1); - Qt3DCore::QBackendNodePrivate::get(backendPicker1)->setArbiter(&arbiter1); Qt3DRender::Render::ObjectPicker *backendPicker2 = test->nodeManagers()->objectPickerManager()->lookupResource(picker2->id()); QVERIFY(backendPicker2); - Qt3DCore::QBackendNodePrivate::get(backendPicker2)->setArbiter(&arbiter2); QSignalSpy mouseEntered1(picker1, &Qt3DRender::QObjectPicker::entered); QSignalSpy mouseExited1(picker1, &Qt3DRender::QObjectPicker::exited); diff --git a/tests/auto/render/picking/tst_picking.cpp b/tests/auto/render/picking/tst_picking.cpp index b281eb6cb..d9800c24f 100644 --- a/tests/auto/render/picking/tst_picking.cpp +++ b/tests/auto/render/picking/tst_picking.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -55,11 +54,6 @@ public: MyObjectPicker(Qt3DCore::QNode *parent = nullptr) : Qt3DRender::QObjectPicker(parent) {} - - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) final - { - Qt3DRender::QObjectPicker::sceneChangeEvent(change); - } }; class PickableEntity : public QEntity diff --git a/tests/auto/render/qabstractlight/tst_qabstractlight.cpp b/tests/auto/render/qabstractlight/tst_qabstractlight.cpp index 011ad1036..7c2162ecf 100644 --- a/tests/auto/render/qabstractlight/tst_qabstractlight.cpp +++ b/tests/auto/render/qabstractlight/tst_qabstractlight.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include @@ -40,7 +39,7 @@ #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class DummyLight : public Qt3DRender::QAbstractLight { @@ -60,87 +59,6 @@ class tst_QAbstractLight: public Qt3DCore::QNode Q_OBJECT private Q_SLOTS: - // TO DO: Test should be rewritten to query the properties from the attached QShaderData - -// void checkLightCloning() -// { -// // GIVEN -// DummyLight light; -// light.setColor(Qt::red); -// light.setIntensity(0.5f); - -// // WHEN -// Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(material); -// QVector creationChanges = creationChangeGenerator.creationChanges(); - -// // THEN -// QVERIFY(creationChanges.size() >= 1); - -// const Qt3DCore::QNodeCreatedChangePtr creationChangeData = -// qSharedPointerCast>(creationChanges.first()); -// const Qt3DRender::QMaterialData &cloneData = creationChangeData->data; - - -// QScopedPointer lightClone(static_cast(QNode::clone(&light))); -// QVERIFY(lightClone.data()); -// QCOMPARE(light.color(), lightClone->color()); -// QCOMPARE(light.intensity(), lightClone->intensity()); -// } - -// void checkPointLightCloning() -// { -// Qt3DRender::QPointLight pointLight; -// QCOMPARE(pointLight.type(), Qt3DRender::QAbstractLight::PointLight); -// pointLight.setColor(Qt::green); -// pointLight.setIntensity(0.5f); -// pointLight.setConstantAttenuation(0.5f); -// pointLight.setLinearAttenuation(0.0f); // No actual event triggered as 0.0f is default -// pointLight.setQuadraticAttenuation(1.0f); - -// QScopedPointer pointLightClone(static_cast(QNode::clone(&pointLight))); -// QVERIFY(pointLightClone.data()); -// QCOMPARE(pointLightClone->type(), Qt3DRender::QAbstractLight::PointLight); -// QCOMPARE(pointLight.color(), pointLightClone->color()); -// QCOMPARE(pointLight.intensity(), pointLightClone->intensity()); -// QCOMPARE(pointLight.constantAttenuation(), pointLightClone->constantAttenuation()); -// QCOMPARE(pointLight.linearAttenuation(), pointLightClone->linearAttenuation()); -// QCOMPARE(pointLight.quadraticAttenuation(), pointLightClone->quadraticAttenuation()); -// } - -// void checkDirectionalLightCloning() -// { -// Qt3DRender::QDirectionalLight dirLight; -// QCOMPARE(dirLight.type(), Qt3DRender::QAbstractLight::DirectionalLight); -// dirLight.setColor(Qt::blue); -// dirLight.setIntensity(0.5f); -// dirLight.setWorldDirection(QVector3D(0, 0, -1)); - -// QScopedPointer dirLightClone(static_cast(QNode::clone(&dirLight))); -// QVERIFY(dirLightClone.data()); -// QCOMPARE(dirLightClone->type(), Qt3DRender::QAbstractLight::DirectionalLight); -// QCOMPARE(dirLight.color(), dirLightClone->color()); -// QCOMPARE(dirLight.intensity(), dirLightClone->intensity()); -// QCOMPARE(dirLight.worldDirection(), dirLightClone->worldDirection()); -// } - -// void checkSpotLightCloning() -// { -// Qt3DRender::QSpotLight spotLight; -// QCOMPARE(spotLight.type(), Qt3DRender::QAbstractLight::SpotLight); -// spotLight.setColor(Qt::lightGray); -// spotLight.setIntensity(0.5f); -// spotLight.setLocalDirection(QVector3D(0, 0, -1)); -// spotLight.setCutOffAngle(0.75f); - -// QScopedPointer spotLightClone(static_cast(QNode::clone(&spotLight))); -// QVERIFY(spotLightClone.data()); -// QCOMPARE(spotLightClone->type(), Qt3DRender::QAbstractLight::SpotLight); -// QCOMPARE(spotLight.color(), spotLightClone->color()); -// QCOMPARE(spotLight.intensity(), spotLightClone->intensity()); -// QCOMPARE(spotLight.localDirection(), spotLightClone->localDirection()); -// QCOMPARE(spotLight.cutOffAngle(), spotLightClone->cutOffAngle()); -// } - void checkLightPropertyUpdates() { TestArbiter arbiter; @@ -150,16 +68,11 @@ private Q_SLOTS: light->setColor(Qt::red); light->setIntensity(0.8f); // change from the default of 0.5f - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 2); - QVERIFY(arbiter.dirtyNodes[0]->metaObject()->inherits(&Qt3DRender::QShaderData::staticMetaObject)); - QCOMPARE(arbiter.dirtyNodes[1], light.data()); - - arbiter.dirtyNodes.clear(); - - QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 2); + QVERIFY(arbiter.dirtyNodes()[0]->metaObject()->inherits(&Qt3DRender::QShaderData::staticMetaObject)); + QCOMPARE(arbiter.dirtyNodes()[1], light.data()); - arbiter.events.clear(); + arbiter.clear(); } void checkPointLightPropertyUpdates() @@ -174,12 +87,11 @@ private Q_SLOTS: pointLight->setLinearAttenuation(0.0f); // No actual event triggered as 0.0f is default pointLight->setQuadraticAttenuation(1.0f); - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 2); - QVERIFY(arbiter.dirtyNodes[0]->metaObject()->inherits(&Qt3DRender::QShaderData::staticMetaObject)); - QCOMPARE(arbiter.dirtyNodes[1], pointLight.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 2); + QVERIFY(arbiter.dirtyNodes()[0]->metaObject()->inherits(&Qt3DRender::QShaderData::staticMetaObject)); + QCOMPARE(arbiter.dirtyNodes()[1], pointLight.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } void checkDirectionalLightPropertyUpdates() @@ -192,11 +104,11 @@ private Q_SLOTS: dirLight->setIntensity(0.8f); dirLight->setWorldDirection(QVector3D(0.5f, 0.0f, -1.0f)); - QCOMPARE(arbiter.dirtyNodes.size(), 2); - QVERIFY(arbiter.dirtyNodes[0]->metaObject()->inherits(&Qt3DRender::QShaderData::staticMetaObject)); - QCOMPARE(arbiter.dirtyNodes[1], dirLight.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 2); + QVERIFY(arbiter.dirtyNodes()[0]->metaObject()->inherits(&Qt3DRender::QShaderData::staticMetaObject)); + QCOMPARE(arbiter.dirtyNodes()[1], dirLight.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } void checkSpotLightPropertyUpdates() @@ -210,11 +122,11 @@ private Q_SLOTS: spotLight->setLocalDirection(QVector3D(0.5f, 0.0f, -1.0f)); spotLight->setCutOffAngle(0.75f); - QCOMPARE(arbiter.dirtyNodes.size(), 2); - QVERIFY(arbiter.dirtyNodes[0]->metaObject()->inherits(&Qt3DRender::QShaderData::staticMetaObject)); - QCOMPARE(arbiter.dirtyNodes[1], spotLight.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 2); + QVERIFY(arbiter.dirtyNodes()[0]->metaObject()->inherits(&Qt3DRender::QShaderData::staticMetaObject)); + QCOMPARE(arbiter.dirtyNodes()[1], spotLight.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } }; diff --git a/tests/auto/render/qabstracttexture/tst_qabstracttexture.cpp b/tests/auto/render/qabstracttexture/tst_qabstracttexture.cpp index 6fad09a0d..99048fbc2 100644 --- a/tests/auto/render/qabstracttexture/tst_qabstracttexture.cpp +++ b/tests/auto/render/qabstracttexture/tst_qabstracttexture.cpp @@ -26,23 +26,14 @@ ** ****************************************************************************/ -// TODO Remove in Qt6 -#include -QT_WARNING_DISABLE_DEPRECATED - #include #include #include #include #include #include -#include -#include -#include -#include #include -#include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class FakeTexture : public Qt3DRender::QAbstractTexture { @@ -51,12 +42,6 @@ public: { return static_cast(d_ptr.get())->m_sharedTextureId; } - - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override - { - Qt3DRender::QAbstractTexture::sceneChangeEvent(change); - } - }; class FakeTextureImage : public Qt3DRender::QAbstractTextureImage @@ -347,117 +332,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - FakeTexture abstractTexture; - - abstractTexture.setFormat(Qt3DRender::QAbstractTexture::RG3B2); - abstractTexture.setGenerateMipMaps(true); - abstractTexture.setWidth(350); - abstractTexture.setHeight(383); - abstractTexture.setDepth(396); - abstractTexture.setMagnificationFilter(Qt3DRender::QAbstractTexture::NearestMipMapLinear); - abstractTexture.setMinificationFilter(Qt3DRender::QAbstractTexture::NearestMipMapNearest); - abstractTexture.setMaximumAnisotropy(12.0f); - abstractTexture.setComparisonFunction(Qt3DRender::QAbstractTexture::CommpareNotEqual); - abstractTexture.setComparisonMode(Qt3DRender::QAbstractTexture::CompareRefToTexture); - abstractTexture.setLayers(128); - abstractTexture.setSamples(256); - abstractTexture.setWrapMode(Qt3DRender::QTextureWrapMode(Qt3DRender::QTextureWrapMode::ClampToBorder)); - - FakeTextureImage image; - FakeTextureImage image2; - abstractTexture.addTextureImage(&image); - abstractTexture.addTextureImage(&image2); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&abstractTexture); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 3); // Texture + Images - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QAbstractTextureData cloneData = creationChangeData->data; - - QCOMPARE(abstractTexture.target(), cloneData.target); - QCOMPARE(abstractTexture.format(), cloneData.format); - QCOMPARE(abstractTexture.generateMipMaps(), cloneData.autoMipMap); - QCOMPARE(abstractTexture.wrapMode()->x(), cloneData.wrapModeX); - QCOMPARE(abstractTexture.wrapMode()->x(), cloneData.wrapModeY); - QCOMPARE(abstractTexture.wrapMode()->x(), cloneData.wrapModeZ); - QCOMPARE(abstractTexture.width(), cloneData.width); - QCOMPARE(abstractTexture.height(), cloneData.height); - QCOMPARE(abstractTexture.depth(), cloneData.depth); - QCOMPARE(abstractTexture.magnificationFilter(), cloneData.magFilter); - QCOMPARE(abstractTexture.minificationFilter(), cloneData.minFilter); - QCOMPARE(abstractTexture.maximumAnisotropy(), cloneData.maximumAnisotropy); - QCOMPARE(abstractTexture.comparisonFunction(), cloneData.comparisonFunction); - QCOMPARE(abstractTexture.comparisonMode(), cloneData.comparisonMode); - QCOMPARE(abstractTexture.layers(), cloneData.layers); - QCOMPARE(abstractTexture.samples(), cloneData.samples); - QCOMPARE(abstractTexture.sharedTextureId(), cloneData.sharedTextureId); - QCOMPARE(abstractTexture.textureImages().size(), cloneData.textureImageIds.size()); - - for (int i = 0, m = abstractTexture.textureImages().size(); i < m; ++i) - QCOMPARE(abstractTexture.textureImages().at(i)->id(), cloneData.textureImageIds.at(i)); - - QCOMPARE(abstractTexture.id(), creationChangeData->subjectId()); - QCOMPARE(abstractTexture.isEnabled(), true); - QCOMPARE(abstractTexture.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(abstractTexture.metaObject(), creationChangeData->metaObject()); - } - - // WHEN - abstractTexture.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&abstractTexture); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 3); // Texture + Images - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QAbstractTextureData cloneData = creationChangeData->data; - - QCOMPARE(abstractTexture.target(), cloneData.target); - QCOMPARE(abstractTexture.format(), cloneData.format); - QCOMPARE(abstractTexture.generateMipMaps(), cloneData.autoMipMap); - QCOMPARE(abstractTexture.wrapMode()->x(), cloneData.wrapModeX); - QCOMPARE(abstractTexture.wrapMode()->x(), cloneData.wrapModeY); - QCOMPARE(abstractTexture.wrapMode()->x(), cloneData.wrapModeZ); - QCOMPARE(abstractTexture.width(), cloneData.width); - QCOMPARE(abstractTexture.height(), cloneData.height); - QCOMPARE(abstractTexture.depth(), cloneData.depth); - QCOMPARE(abstractTexture.magnificationFilter(), cloneData.magFilter); - QCOMPARE(abstractTexture.minificationFilter(), cloneData.minFilter); - QCOMPARE(abstractTexture.maximumAnisotropy(), cloneData.maximumAnisotropy); - QCOMPARE(abstractTexture.comparisonFunction(), cloneData.comparisonFunction); - QCOMPARE(abstractTexture.comparisonMode(), cloneData.comparisonMode); - QCOMPARE(abstractTexture.layers(), cloneData.layers); - QCOMPARE(abstractTexture.samples(), cloneData.samples); - QCOMPARE(abstractTexture.sharedTextureId(), cloneData.sharedTextureId); - QCOMPARE(abstractTexture.textureImages().size(), cloneData.textureImageIds.size()); - - for (int i = 0, m = abstractTexture.textureImages().size(); i < m; ++i) - QCOMPARE(abstractTexture.textureImages().at(i)->id(), cloneData.textureImageIds.at(i)); - - QCOMPARE(abstractTexture.id(), creationChangeData->subjectId()); - QCOMPARE(abstractTexture.isEnabled(), false); - QCOMPARE(abstractTexture.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(abstractTexture.metaObject(), creationChangeData->metaObject()); - } - } - void checkFormatUpdate() { // GIVEN @@ -470,11 +344,10 @@ private Q_SLOTS: abstractTexture.setFormat(Qt3DRender::QAbstractTexture::RG8_UNorm); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &abstractTexture); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &abstractTexture); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -482,8 +355,7 @@ private Q_SLOTS: abstractTexture.setFormat(Qt3DRender::QAbstractTexture::RG8_UNorm); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -500,11 +372,10 @@ private Q_SLOTS: abstractTexture.setGenerateMipMaps(true); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &abstractTexture); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &abstractTexture); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -512,8 +383,7 @@ private Q_SLOTS: abstractTexture.setGenerateMipMaps(true); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -530,11 +400,10 @@ private Q_SLOTS: abstractTexture.setWidth(1024); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &abstractTexture); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &abstractTexture); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -542,8 +411,7 @@ private Q_SLOTS: abstractTexture.setWidth(1024); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -560,11 +428,10 @@ private Q_SLOTS: abstractTexture.setHeight(256); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &abstractTexture); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &abstractTexture); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -572,8 +439,7 @@ private Q_SLOTS: abstractTexture.setHeight(256); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -590,11 +456,10 @@ private Q_SLOTS: abstractTexture.setDepth(512); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &abstractTexture); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &abstractTexture); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -602,8 +467,7 @@ private Q_SLOTS: abstractTexture.setDepth(512); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -620,11 +484,10 @@ private Q_SLOTS: abstractTexture.setMagnificationFilter(Qt3DRender::QAbstractTexture::NearestMipMapLinear); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &abstractTexture); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &abstractTexture); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -632,8 +495,7 @@ private Q_SLOTS: abstractTexture.setMagnificationFilter(Qt3DRender::QAbstractTexture::NearestMipMapLinear); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -650,11 +512,10 @@ private Q_SLOTS: abstractTexture.setMinificationFilter(Qt3DRender::QAbstractTexture::NearestMipMapLinear); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &abstractTexture); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &abstractTexture); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -662,8 +523,7 @@ private Q_SLOTS: abstractTexture.setMinificationFilter(Qt3DRender::QAbstractTexture::NearestMipMapLinear); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -680,11 +540,10 @@ private Q_SLOTS: abstractTexture.setMaximumAnisotropy(327.0f); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &abstractTexture); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &abstractTexture); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -692,8 +551,7 @@ private Q_SLOTS: abstractTexture.setMaximumAnisotropy(327.0f); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -710,11 +568,10 @@ private Q_SLOTS: abstractTexture.setComparisonFunction(Qt3DRender::QAbstractTexture::CompareAlways); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &abstractTexture); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &abstractTexture); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -722,8 +579,7 @@ private Q_SLOTS: abstractTexture.setComparisonFunction(Qt3DRender::QAbstractTexture::CompareAlways); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -740,11 +596,10 @@ private Q_SLOTS: abstractTexture.setComparisonMode(Qt3DRender::QAbstractTexture::CompareRefToTexture); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &abstractTexture); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &abstractTexture); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -752,8 +607,7 @@ private Q_SLOTS: abstractTexture.setComparisonMode(Qt3DRender::QAbstractTexture::CompareRefToTexture); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -770,11 +624,10 @@ private Q_SLOTS: abstractTexture.setLayers(64); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &abstractTexture); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &abstractTexture); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -782,8 +635,7 @@ private Q_SLOTS: abstractTexture.setLayers(64); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -800,11 +652,10 @@ private Q_SLOTS: abstractTexture.setSamples(16); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &abstractTexture); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &abstractTexture); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -812,8 +663,7 @@ private Q_SLOTS: abstractTexture.setSamples(16); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -832,11 +682,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &abstractTexture); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &abstractTexture); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } } @@ -855,11 +704,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &abstractTexture); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &abstractTexture); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } } @@ -874,143 +722,6 @@ private Q_SLOTS: qRegisterMetaType("TextureFormat"); qRegisterMetaType("HandleType"); - - { - QSignalSpy spy(&abstractTexture, SIGNAL(widthChanged(int))); - - // THEN - QVERIFY(spy.isValid()); - - // WHEN - Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - valueChange->setPropertyName("width"); - valueChange->setValue(883); - abstractTexture.sceneChangeEvent(valueChange); - - // THEN - QCOMPARE(spy.count(), 1); - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(abstractTexture.width(), 883); - - // WHEN - spy.clear(); - abstractTexture.sceneChangeEvent(valueChange); - - // THEN - QCOMPARE(spy.count(), 0); - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(abstractTexture.width(), 883); - } - - { - QSignalSpy spy(&abstractTexture, SIGNAL(heightChanged(int))); - - // THEN - QVERIFY(spy.isValid()); - - // WHEN - Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - valueChange->setPropertyName("height"); - valueChange->setValue(1584); - abstractTexture.sceneChangeEvent(valueChange); - - // THEN - QCOMPARE(spy.count(), 1); - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(abstractTexture.height(), 1584); - - // WHEN - spy.clear(); - abstractTexture.sceneChangeEvent(valueChange); - - // THEN - QCOMPARE(spy.count(), 0); - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(abstractTexture.height(), 1584); - } - - { - QSignalSpy spy(&abstractTexture, SIGNAL(depthChanged(int))); - - // THEN - QVERIFY(spy.isValid()); - - // WHEN - Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - valueChange->setPropertyName("depth"); - valueChange->setValue(8); - abstractTexture.sceneChangeEvent(valueChange); - - // THEN - QCOMPARE(spy.count(), 1); - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(abstractTexture.depth(), 8); - - // WHEN - spy.clear(); - abstractTexture.sceneChangeEvent(valueChange); - - // THEN - QCOMPARE(spy.count(), 0); - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(abstractTexture.depth(), 8); - } - - { - QSignalSpy spy(&abstractTexture, SIGNAL(layersChanged(int))); - - // THEN - QVERIFY(spy.isValid()); - - // WHEN - Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - valueChange->setPropertyName("layers"); - valueChange->setValue(256); - abstractTexture.sceneChangeEvent(valueChange); - - // THEN - QCOMPARE(spy.count(), 1); - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(abstractTexture.layers(), 256); - - // WHEN - spy.clear(); - abstractTexture.sceneChangeEvent(valueChange); - - // THEN - QCOMPARE(spy.count(), 0); - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(abstractTexture.layers(), 256); - } - - { - QSignalSpy spy(&abstractTexture, SIGNAL(formatChanged(TextureFormat))); - - // THEN - QVERIFY(spy.isValid()); - - // WHEN - Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - valueChange->setPropertyName("format"); - const auto newFormat = Qt3DRender::QAbstractTexture::R8I; - valueChange->setValue(QVariant::fromValue(newFormat)); - abstractTexture.sceneChangeEvent(valueChange); - - // THEN - QCOMPARE(spy.count(), 1); - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(abstractTexture.format(), newFormat); - - // WHEN - spy.clear(); - abstractTexture.sceneChangeEvent(valueChange); - - // THEN - QCOMPARE(spy.count(), 0); - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(abstractTexture.format(), newFormat); - } - { QSignalSpy spy(&abstractTexture, SIGNAL(statusChanged(Status))); @@ -1018,24 +729,23 @@ private Q_SLOTS: QVERIFY(spy.isValid()); // WHEN - Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - valueChange->setPropertyName("status"); + auto *dTexture = static_cast(Qt3DCore::QNodePrivate::get(&abstractTexture)); const auto newStatus = Qt3DRender::QAbstractTexture::Error; - valueChange->setValue(QVariant::fromValue(newStatus)); - abstractTexture.sceneChangeEvent(valueChange); + dTexture->setStatus(newStatus); // THEN QCOMPARE(spy.count(), 1); - QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); QCOMPARE(abstractTexture.status(), newStatus); // WHEN spy.clear(); - abstractTexture.sceneChangeEvent(valueChange); + arbiter.clear(); + dTexture->setStatus(newStatus); // THEN QCOMPARE(spy.count(), 0); - QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); QCOMPARE(abstractTexture.status(), newStatus); } @@ -1046,24 +756,23 @@ private Q_SLOTS: QVERIFY(spy.isValid()); // WHEN - Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - valueChange->setPropertyName("handleType"); + auto *dTexture = static_cast(Qt3DCore::QNodePrivate::get(&abstractTexture)); const auto newType = Qt3DRender::QAbstractTexture::OpenGLTextureId; - valueChange->setValue(QVariant::fromValue(newType)); - abstractTexture.sceneChangeEvent(valueChange); + dTexture->setHandleType(newType); // THEN QCOMPARE(spy.count(), 1); - QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); QCOMPARE(abstractTexture.handleType(), newType); // WHEN spy.clear(); - abstractTexture.sceneChangeEvent(valueChange); + arbiter.clear(); + dTexture->setHandleType(newType); // THEN QCOMPARE(spy.count(), 0); - QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); QCOMPARE(abstractTexture.handleType(), newType); } @@ -1074,23 +783,21 @@ private Q_SLOTS: QVERIFY(spy.isValid()); // WHEN - Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - valueChange->setPropertyName("handle"); - valueChange->setValue(QVariant(1)); - abstractTexture.sceneChangeEvent(valueChange); + auto *dTexture = static_cast(Qt3DCore::QNodePrivate::get(&abstractTexture)); + dTexture->setHandle(QVariant(1)); // THEN QCOMPARE(spy.count(), 1); - QCOMPARE(arbiter.events.size(), 0); QCOMPARE(abstractTexture.handle(), QVariant(1)); // WHEN spy.clear(); - abstractTexture.sceneChangeEvent(valueChange); + arbiter.clear(); + dTexture->setHandle(QVariant(1)); // THEN QCOMPARE(spy.count(), 0); - QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); QCOMPARE(abstractTexture.handle(), QVariant(1)); } } @@ -1111,8 +818,8 @@ private Q_SLOTS: // THEN (arbiter -> should not be stored in the initial changes but only send as a property change) auto d = static_cast(Qt3DRender::QAbstractTexturePrivate::get(&abstractTexture)); QCOMPARE(d->m_pendingDataUpdates.size(), 1); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &abstractTexture); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &abstractTexture); } } diff --git a/tests/auto/render/qabstracttextureimage/tst_qabstracttextureimage.cpp b/tests/auto/render/qabstracttextureimage/tst_qabstracttextureimage.cpp index 6bd742dad..8ea482ceb 100644 --- a/tests/auto/render/qabstracttextureimage/tst_qabstracttextureimage.cpp +++ b/tests/auto/render/qabstracttextureimage/tst_qabstracttextureimage.cpp @@ -32,9 +32,7 @@ #include #include #include -#include -#include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class FakeTextureImage : public Qt3DRender::QAbstractTextureImage { @@ -131,64 +129,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - FakeTextureImage abstractTextureImage; - - abstractTextureImage.setMipLevel(32); - abstractTextureImage.setLayer(56); - abstractTextureImage.setFace(Qt3DRender::QAbstractTexture::CubeMapNegativeY); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&abstractTextureImage); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QAbstractTextureImageData cloneData = creationChangeData->data; - - QCOMPARE(abstractTextureImage.mipLevel(), cloneData.mipLevel); - QCOMPARE(abstractTextureImage.layer(), cloneData.layer); - QCOMPARE(abstractTextureImage.face(), cloneData.face); - QCOMPARE(abstractTextureImage.id(), creationChangeData->subjectId()); - QCOMPARE(abstractTextureImage.isEnabled(), true); - QCOMPARE(abstractTextureImage.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(abstractTextureImage.metaObject(), creationChangeData->metaObject()); - } - - // WHEN - abstractTextureImage.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&abstractTextureImage); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QAbstractTextureImageData cloneData = creationChangeData->data; - - QCOMPARE(abstractTextureImage.mipLevel(), cloneData.mipLevel); - QCOMPARE(abstractTextureImage.layer(), cloneData.layer); - QCOMPARE(abstractTextureImage.face(), cloneData.face); - QCOMPARE(abstractTextureImage.id(), creationChangeData->subjectId()); - QCOMPARE(abstractTextureImage.isEnabled(), false); - QCOMPARE(abstractTextureImage.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(abstractTextureImage.metaObject(), creationChangeData->metaObject()); - } - } - void checkMipLevelUpdate() { // GIVEN @@ -201,10 +141,10 @@ private Q_SLOTS: abstractTextureImage.setMipLevel(9); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &abstractTextureImage); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &abstractTextureImage); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -212,7 +152,7 @@ private Q_SLOTS: abstractTextureImage.setMipLevel(9); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -229,11 +169,10 @@ private Q_SLOTS: abstractTextureImage.setLayer(12); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &abstractTextureImage); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &abstractTextureImage); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -241,8 +180,7 @@ private Q_SLOTS: abstractTextureImage.setLayer(12); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -259,11 +197,10 @@ private Q_SLOTS: abstractTextureImage.setFace(Qt3DRender::QAbstractTexture::CubeMapPositiveY); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &abstractTextureImage); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &abstractTextureImage); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -271,8 +208,7 @@ private Q_SLOTS: abstractTextureImage.setFace(Qt3DRender::QAbstractTexture::CubeMapPositiveY); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } diff --git a/tests/auto/render/qattribute/tst_qattribute.cpp b/tests/auto/render/qattribute/tst_qattribute.cpp index 588ce40db..44793ce9f 100644 --- a/tests/auto/render/qattribute/tst_qattribute.cpp +++ b/tests/auto/render/qattribute/tst_qattribute.cpp @@ -29,13 +29,12 @@ #include #include #include -#include #include #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QAttribute: public QObject { @@ -77,80 +76,6 @@ private Q_SLOTS: Qt3DRender::QAttribute::defaultJointWeightsAttributeName()); } - void checkCloning_data() - { - QTest::addColumn("attribute"); - - Qt3DRender::QAttribute *defaultConstructed = new Qt3DRender::QAttribute(); - QTest::newRow("defaultConstructed") << defaultConstructed; - - Qt3DRender::QAttribute *customVertex = new Qt3DRender::QAttribute(); - Qt3DRender::QBuffer *buffer = new Qt3DRender::QBuffer(); - customVertex->setBuffer(buffer); - customVertex->setAttributeType(Qt3DRender::QAttribute::VertexAttribute); - customVertex->setCount(454); - customVertex->setByteStride(427); - customVertex->setByteOffset(305); - customVertex->setDivisor(235); - customVertex->setName("BB"); - customVertex->setVertexBaseType(Qt3DRender::QAttribute::Float); - customVertex->setVertexSize(4); - QTest::newRow("vertex") << customVertex; - - Qt3DRender::QAttribute *customIndex = new Qt3DRender::QAttribute(); - Qt3DRender::QBuffer *indexBuffer = new Qt3DRender::QBuffer(); - customIndex->setBuffer(indexBuffer); - customIndex->setAttributeType(Qt3DRender::QAttribute::IndexAttribute); - customIndex->setCount(383); - customIndex->setByteStride(350); - customIndex->setByteOffset(327); - customIndex->setDivisor(355); - customIndex->setName("SB"); - customIndex->setVertexBaseType(Qt3DRender::QAttribute::Float); - customIndex->setVertexSize(3); - QTest::newRow("index") << customIndex; - - Qt3DRender::QAttribute *customIndirect = new Qt3DRender::QAttribute(); - Qt3DRender::QBuffer *indirectBuffer = new Qt3DRender::QBuffer(); - customIndirect->setBuffer(indirectBuffer); - customIndirect->setAttributeType(Qt3DRender::QAttribute::DrawIndirectAttribute); - customIndirect->setCount(1); - customIndirect->setByteStride(12); - customIndirect->setByteOffset(0); - customIndirect->setName("DrawIndirect"); - QTest::newRow("index") << customIndirect; - } - - void checkCloning() - { - // GIVEN - QFETCH(Qt3DRender::QAttribute *, attribute); - - // WHEN - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(attribute); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - // THEN - QCOMPARE(creationChanges.size(), 1 + (attribute->buffer() ? 1 : 0)); - - const Qt3DCore::QNodeCreatedChangePtr creationChangeData = - qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QAttributeData &cloneData = creationChangeData->data; - - QCOMPARE(attribute->id(), creationChangeData->subjectId()); - QCOMPARE(attribute->isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(attribute->metaObject(), creationChangeData->metaObject()); - QCOMPARE(attribute->name(), cloneData.name); - QCOMPARE(attribute->count(), cloneData.count); - QCOMPARE(attribute->byteStride(), cloneData.byteStride); - QCOMPARE(attribute->byteOffset(), cloneData.byteOffset); - QCOMPARE(attribute->divisor(), cloneData.divisor); - QCOMPARE(attribute->vertexBaseType(), cloneData.vertexBaseType); - QCOMPARE(attribute->vertexSize(), cloneData.vertexSize); - QVERIFY(attribute->attributeType() == cloneData.attributeType); - QCOMPARE(attribute->buffer() ? attribute->buffer()->id() : Qt3DCore::QNodeId(), cloneData.bufferId); - } - void checkPropertyUpdates() { // GIVEN @@ -162,93 +87,93 @@ private Q_SLOTS: attribute->setVertexBaseType(Qt3DRender::QAttribute::Double); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), attribute.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), attribute.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN attribute->setVertexSize(4); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), attribute.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), attribute.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN attribute->setName(QStringLiteral("Duntov")); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), attribute.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), attribute.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN attribute->setCount(883); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), attribute.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), attribute.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN attribute->setByteStride(1340); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), attribute.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), attribute.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN attribute->setByteOffset(1584); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), attribute.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), attribute.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN attribute->setDivisor(1450); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), attribute.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), attribute.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN attribute->setAttributeType(Qt3DRender::QAttribute::IndexAttribute); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), attribute.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), attribute.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN Qt3DRender::QBuffer buf; attribute->setBuffer(&buf); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), attribute.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), attribute.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN Qt3DRender::QBuffer buf2; attribute->setBuffer(&buf2); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), attribute.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), attribute.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } void checkBufferBookkeeping() diff --git a/tests/auto/render/qblitframebuffer/tst_qblitframebuffer.cpp b/tests/auto/render/qblitframebuffer/tst_qblitframebuffer.cpp index a53650945..2ff8a35ee 100644 --- a/tests/auto/render/qblitframebuffer/tst_qblitframebuffer.cpp +++ b/tests/auto/render/qblitframebuffer/tst_qblitframebuffer.cpp @@ -29,12 +29,11 @@ #include #include #include -#include #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QBlitFrameBuffer: public QObject { @@ -75,37 +74,6 @@ private Q_SLOTS: QCOMPARE(blitFramebuffer.interpolationMethod(), Qt3DRender::QBlitFramebuffer::Linear); } - void checkCreationData() - { - // GIVEN - QFETCH(Qt3DRender::QBlitFramebuffer *, blitFramebuffer); - - // WHEN - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(blitFramebuffer); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - // THEN - QCOMPARE(creationChanges.size(), 3); // 3 due to automatic parenting - - const Qt3DCore::QNodeCreatedChangePtr creationChangeData = - qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QBlitFramebufferData &cloneData = creationChangeData->data; - - // THEN - QCOMPARE(blitFramebuffer->id(), creationChangeData->subjectId()); - QCOMPARE(blitFramebuffer->isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(blitFramebuffer->metaObject(), creationChangeData->metaObject()); - QCOMPARE(blitFramebuffer->source()->id(), cloneData.m_sourceRenderTargetId); - QCOMPARE(blitFramebuffer->destination()->id(), cloneData.m_destinationRenderTargetId); - QCOMPARE(blitFramebuffer->sourceRect(), cloneData.m_sourceRect); - QCOMPARE(blitFramebuffer->destinationRect(), cloneData.m_destinationRect); - QCOMPARE(blitFramebuffer->sourceAttachmentPoint(), cloneData.m_sourceAttachmentPoint); - QCOMPARE(blitFramebuffer->destinationAttachmentPoint(), cloneData.m_destinationAttachmentPoint); - - - delete blitFramebuffer; - } - void checkPropertyUpdate() { // GIVEN @@ -121,167 +89,149 @@ private Q_SLOTS: blitFramebuffer->setSource(sourceRenderTarget); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), blitFramebuffer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), blitFramebuffer.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN blitFramebuffer->setSource(sourceRenderTarget); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); // WHEN blitFramebuffer->setSource(nullptr); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), blitFramebuffer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), blitFramebuffer.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // destinationRenderTarget // WHEN blitFramebuffer->setDestination(destinationRenderTarget); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), blitFramebuffer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), blitFramebuffer.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN blitFramebuffer->setDestination(destinationRenderTarget); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); // WHEN blitFramebuffer->setDestination(nullptr); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), blitFramebuffer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), blitFramebuffer.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // sourceRect // WHEN blitFramebuffer->setSourceRect(QRect(0,0,1,1)); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), blitFramebuffer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), blitFramebuffer.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN blitFramebuffer->setSourceRect(QRect(0,0,1,1)); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); // WHEN blitFramebuffer->setSourceRect(QRect()); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), blitFramebuffer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), blitFramebuffer.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // destinationRect blitFramebuffer->setDestinationRect(QRect(0,0,1,1)); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), blitFramebuffer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), blitFramebuffer.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN blitFramebuffer->setDestinationRect(QRect(0,0,1,1)); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); // WHEN blitFramebuffer->setDestinationRect(QRect()); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), blitFramebuffer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), blitFramebuffer.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // sourceAttachmentPoint // WHEN blitFramebuffer->setSourceAttachmentPoint(Qt3DRender::QRenderTargetOutput::Color1); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), blitFramebuffer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), blitFramebuffer.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN blitFramebuffer->setSourceAttachmentPoint(Qt3DRender::QRenderTargetOutput::Color1); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); // WHEN blitFramebuffer->setSourceAttachmentPoint(Qt3DRender::QRenderTargetOutput::Color0); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), blitFramebuffer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), blitFramebuffer.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // destinationAttachmentPoint // WHEN blitFramebuffer->setDestinationAttachmentPoint(Qt3DRender::QRenderTargetOutput::Color1); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), blitFramebuffer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), blitFramebuffer.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN blitFramebuffer->setDestinationAttachmentPoint(Qt3DRender::QRenderTargetOutput::Color1); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); // WHEN blitFramebuffer->setDestinationAttachmentPoint(Qt3DRender::QRenderTargetOutput::Color0); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), blitFramebuffer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), blitFramebuffer.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } void checkSourceDestReset() diff --git a/tests/auto/render/qbuffer/tst_qbuffer.cpp b/tests/auto/render/qbuffer/tst_qbuffer.cpp index fd96bf1c2..cbb141d2e 100644 --- a/tests/auto/render/qbuffer/tst_qbuffer.cpp +++ b/tests/auto/render/qbuffer/tst_qbuffer.cpp @@ -33,13 +33,12 @@ QT_WARNING_DISABLE_DEPRECATED #include #include #include -#include #include #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class TestFunctor : public Qt3DRender::QBufferDataGenerator { @@ -73,58 +72,6 @@ class tst_QBuffer: public QObject private Q_SLOTS: - void checkCloning_data() - { - QTest::addColumn("buffer"); - - Qt3DRender::QBuffer *defaultConstructed = new Qt3DRender::QBuffer(); - QTest::newRow("defaultConstructed") << defaultConstructed; - - auto buffer = new Qt3DRender::QBuffer; - buffer->setUsage(Qt3DRender::QBuffer::DynamicRead); - buffer->setData(QByteArrayLiteral("There's no replacement")); - buffer->setDataGenerator(Qt3DRender::QBufferDataGeneratorPtr(new TestFunctor(883))); - QTest::newRow("vertex") << buffer; - - auto indexBuffer = new Qt3DRender::QBuffer; - indexBuffer->setUsage(Qt3DRender::QBuffer::StaticCopy); - indexBuffer->setData(QByteArrayLiteral("For displacement")); - indexBuffer->setDataGenerator(Qt3DRender::QBufferDataGeneratorPtr(new TestFunctor(1340))); - indexBuffer->setSyncData(true); - QTest::newRow("index") << indexBuffer; - } - - void checkCloning() - { - // GIVEN - QFETCH(Qt3DRender::QBuffer *, buffer); - - // WHEN - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(buffer); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - // THEN - QCOMPARE(creationChanges.size(), 1); - - const Qt3DCore::QNodeCreatedChangePtr creationChangeData = - qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QBufferData &cloneData = creationChangeData->data; - - - QCOMPARE(buffer->id(), creationChangeData->subjectId()); - QCOMPARE(buffer->isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(buffer->metaObject(), creationChangeData->metaObject()); - QCOMPARE(buffer->data(), cloneData.data); - QCOMPARE(buffer->usage(), cloneData.usage); - QCOMPARE(buffer->dataGenerator(), cloneData.functor); - QCOMPARE(buffer->isSyncData(), cloneData.syncData); - if (buffer->dataGenerator()) { - QVERIFY(cloneData.functor); - QVERIFY(*cloneData.functor == *buffer->dataGenerator()); - QCOMPARE((*cloneData.functor)(), (*buffer->dataGenerator())()); - } - } - void checkPropertyUpdates() { // GIVEN @@ -136,21 +83,19 @@ private Q_SLOTS: buffer->setUsage(Qt3DRender::QBuffer::DynamicCopy); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), buffer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), buffer.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN buffer->setData(QByteArrayLiteral("Z28")); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), buffer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), buffer.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN Qt3DRender::QBufferDataGeneratorPtr functor(new TestFunctor(355)); @@ -158,28 +103,27 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), buffer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), buffer.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN buffer->setSyncData(true); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), buffer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), buffer.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN buffer->updateData(1, QByteArrayLiteral("L1")); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), buffer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), buffer.data()); } }; diff --git a/tests/auto/render/qcamera/tst_qcamera.cpp b/tests/auto/render/qcamera/tst_qcamera.cpp index fae8aa14e..ee217d38c 100644 --- a/tests/auto/render/qcamera/tst_qcamera.cpp +++ b/tests/auto/render/qcamera/tst_qcamera.cpp @@ -36,7 +36,6 @@ #include #include #include -#include #include #include diff --git a/tests/auto/render/qcameralens/tst_qcameralens.cpp b/tests/auto/render/qcameralens/tst_qcameralens.cpp index 131c3a9d5..241515d7b 100644 --- a/tests/auto/render/qcameralens/tst_qcameralens.cpp +++ b/tests/auto/render/qcameralens/tst_qcameralens.cpp @@ -32,9 +32,7 @@ #include #include #include -#include -#include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QCameraLens : public QObject { @@ -351,64 +349,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - Qt3DRender::QCameraLens cameraLens; - - cameraLens.setNearPlane(0.5); - cameraLens.setFarPlane(1005.0f); - cameraLens.setFieldOfView(35.0f); - cameraLens.setAspectRatio(16.0f/9.0f); - cameraLens.setExposure(1.0f); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&cameraLens); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QCameraLensData cloneData = creationChangeData->data; - - QCOMPARE(cameraLens.projectionMatrix(), cloneData.projectionMatrix); - QCOMPARE(cameraLens.exposure(), cloneData.exposure); - QCOMPARE(cameraLens.id(), creationChangeData->subjectId()); - QCOMPARE(cameraLens.isEnabled(), true); - QCOMPARE(cameraLens.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(cameraLens.metaObject(), creationChangeData->metaObject()); - } - - // WHEN - cameraLens.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&cameraLens); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QCameraLensData cloneData = creationChangeData->data; - - QCOMPARE(cameraLens.projectionMatrix(), cloneData.projectionMatrix); - QCOMPARE(cameraLens.exposure(), cloneData.exposure); - QCOMPARE(cameraLens.id(), creationChangeData->subjectId()); - QCOMPARE(cameraLens.isEnabled(), false); - QCOMPARE(cameraLens.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(cameraLens.metaObject(), creationChangeData->metaObject()); - } - } - void checkProjectionTypeUpdate() { // GIVEN @@ -422,11 +362,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &cameraLens); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &cameraLens); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -435,8 +374,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -453,11 +391,10 @@ private Q_SLOTS: cameraLens.setNearPlane(5.0f); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &cameraLens); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &cameraLens); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -465,8 +402,7 @@ private Q_SLOTS: cameraLens.setNearPlane(5.0f); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -483,11 +419,10 @@ private Q_SLOTS: cameraLens.setFarPlane(5.0f); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &cameraLens); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &cameraLens); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -495,8 +430,7 @@ private Q_SLOTS: cameraLens.setFarPlane(5.0f); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -513,11 +447,10 @@ private Q_SLOTS: cameraLens.setFieldOfView(5.0f); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &cameraLens); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &cameraLens); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -525,8 +458,7 @@ private Q_SLOTS: cameraLens.setFieldOfView(5.0f); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -543,11 +475,10 @@ private Q_SLOTS: cameraLens.setAspectRatio(9.0f); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &cameraLens); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &cameraLens); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -555,8 +486,7 @@ private Q_SLOTS: cameraLens.setAspectRatio(9.0f); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -573,11 +503,10 @@ private Q_SLOTS: cameraLens.setLeft(0.0f); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &cameraLens); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &cameraLens); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -585,8 +514,7 @@ private Q_SLOTS: cameraLens.setLeft(0.0f); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -603,11 +531,10 @@ private Q_SLOTS: cameraLens.setRight(24.0f); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &cameraLens); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &cameraLens); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -615,8 +542,7 @@ private Q_SLOTS: cameraLens.setRight(24.0f); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -633,11 +559,10 @@ private Q_SLOTS: cameraLens.setBottom(-12.0f); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &cameraLens); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &cameraLens); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -645,8 +570,7 @@ private Q_SLOTS: cameraLens.setBottom(-12.0f); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -663,11 +587,10 @@ private Q_SLOTS: cameraLens.setTop(12.0f); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &cameraLens); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &cameraLens); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -675,8 +598,7 @@ private Q_SLOTS: cameraLens.setTop(12.0f); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -693,11 +615,10 @@ private Q_SLOTS: cameraLens.setExposure(2.0f); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &cameraLens); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &cameraLens); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -705,8 +626,7 @@ private Q_SLOTS: cameraLens.setExposure(2.0f); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -726,11 +646,10 @@ private Q_SLOTS: cameraLens.setProjectionMatrix(m); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &cameraLens); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &cameraLens); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -738,8 +657,7 @@ private Q_SLOTS: cameraLens.setProjectionMatrix(m); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } diff --git a/tests/auto/render/qcameraselector/tst_qcameraselector.cpp b/tests/auto/render/qcameraselector/tst_qcameraselector.cpp index 650e531c2..9b70887fe 100644 --- a/tests/auto/render/qcameraselector/tst_qcameraselector.cpp +++ b/tests/auto/render/qcameraselector/tst_qcameraselector.cpp @@ -29,13 +29,11 @@ #include #include #include -#include #include #include #include - -#include "testpostmanarbiter.h" +#include class tst_QCameraSelector: public QObject { @@ -43,45 +41,6 @@ class tst_QCameraSelector: public QObject private Q_SLOTS: - void checkCloning_data() - { - QTest::addColumn("cameraSelector"); - QTest::addColumn("camera"); - - Qt3DRender::QCameraSelector *defaultConstructed = new Qt3DRender::QCameraSelector(); - QTest::newRow("defaultConstructed") << defaultConstructed << static_cast(nullptr); - - Qt3DRender::QCameraSelector *selector1 = new Qt3DRender::QCameraSelector(); - Qt3DCore::QEntity *camera1 = new Qt3DCore::QEntity(); - QTest::newRow("valid camera") << selector1 << camera1; - selector1->setCamera(camera1); - } - - void checkCloning() - { - // GIVEN - QFETCH(Qt3DRender::QCameraSelector *, cameraSelector); - QFETCH(Qt3DCore::QEntity *, camera); - - // WHEN - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(cameraSelector); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - // THEN - QCOMPARE(creationChanges.size(), 1 + (camera ? 1 : 0)); - - const Qt3DCore::QNodeCreatedChangePtr creationChangeData = - qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QCameraSelectorData &cloneData = creationChangeData->data; - - QCOMPARE(cameraSelector->id(), creationChangeData->subjectId()); - QCOMPARE(cameraSelector->isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(cameraSelector->metaObject(), creationChangeData->metaObject()); - QCOMPARE(cameraSelector->camera() ? cameraSelector->camera()->id() : Qt3DCore::QNodeId(), cloneData.cameraId); - - delete cameraSelector; - } - void checkPropertyUpdates() { // GIVEN @@ -94,39 +53,35 @@ private Q_SLOTS: cameraSelector->setCamera(camera); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), cameraSelector.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), cameraSelector.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN cameraSelector->setCamera(camera); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); // WHEN Qt3DCore::QEntity *camera2 = new Qt3DCore::QEntity(); cameraSelector->setCamera(camera2); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), cameraSelector.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), cameraSelector.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN cameraSelector->setCamera(nullptr); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), cameraSelector.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), cameraSelector.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } void checkCameraBookkeeping() diff --git a/tests/auto/render/qclearbuffers/tst_qclearbuffers.cpp b/tests/auto/render/qclearbuffers/tst_qclearbuffers.cpp index d2407229d..787b6540a 100644 --- a/tests/auto/render/qclearbuffers/tst_qclearbuffers.cpp +++ b/tests/auto/render/qclearbuffers/tst_qclearbuffers.cpp @@ -29,12 +29,10 @@ #include #include #include -#include #include #include - -#include "testpostmanarbiter.h" +#include class tst_QClearBuffers: public QObject { @@ -42,59 +40,6 @@ class tst_QClearBuffers: public QObject private Q_SLOTS: - void checkCloning_data() - { - QTest::addColumn("clearBuffers"); - QTest::addColumn("bufferType"); - - Qt3DRender::QClearBuffers *defaultConstructed = new Qt3DRender::QClearBuffers(); - QTest::newRow("defaultConstructed") << defaultConstructed << Qt3DRender::QClearBuffers::None; - - Qt3DRender::QClearBuffers *allBuffers = new Qt3DRender::QClearBuffers(); - allBuffers->setBuffers(Qt3DRender::QClearBuffers::AllBuffers); - QTest::newRow("allBuffers") << allBuffers << Qt3DRender::QClearBuffers::AllBuffers; - - Qt3DRender::QClearBuffers *depthBuffer = new Qt3DRender::QClearBuffers(); - depthBuffer->setBuffers(Qt3DRender::QClearBuffers::DepthBuffer); - QTest::newRow("depthBuffer") << depthBuffer << Qt3DRender::QClearBuffers::DepthBuffer; - - Qt3DRender::QClearBuffers *colorDepthBuffer = new Qt3DRender::QClearBuffers(); - colorDepthBuffer->setBuffers(Qt3DRender::QClearBuffers::ColorDepthBuffer); - QTest::newRow("colorDepthBuffer") << colorDepthBuffer << Qt3DRender::QClearBuffers::ColorDepthBuffer; - } - - void checkCloning() - { - // GIVEN - QFETCH(Qt3DRender::QClearBuffers *, clearBuffers); - QFETCH(Qt3DRender::QClearBuffers::BufferType, bufferType); - - // THEN - QCOMPARE(clearBuffers->buffers(), bufferType); - - // WHEN - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(clearBuffers); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - // THEN - QCOMPARE(creationChanges.size(), 1); - - const Qt3DCore::QNodeCreatedChangePtr creationChangeData = - qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QClearBuffersData &cloneData = creationChangeData->data; - - // THEN - QCOMPARE(clearBuffers->id(), creationChangeData->subjectId()); - QCOMPARE(clearBuffers->isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(clearBuffers->metaObject(), creationChangeData->metaObject()); - QCOMPARE(clearBuffers->buffers(), cloneData.buffersType); - QCOMPARE(clearBuffers->clearColor(), cloneData.clearColor); - QCOMPARE(clearBuffers->clearDepthValue(), cloneData.clearDepthValue); - QCOMPARE(clearBuffers->clearStencilValue(), cloneData.clearStencilValue); - - delete clearBuffers; - } - void checkPropertyUpdates() { // GIVEN @@ -106,28 +51,25 @@ private Q_SLOTS: clearBuffer->setBuffers(Qt3DRender::QClearBuffers::AllBuffers); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), clearBuffer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), clearBuffer.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN clearBuffer->setBuffers(Qt3DRender::QClearBuffers::AllBuffers); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); // WHEN clearBuffer->setBuffers(Qt3DRender::QClearBuffers::ColorDepthBuffer); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), clearBuffer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), clearBuffer.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } }; diff --git a/tests/auto/render/qcomputecommand/tst_qcomputecommand.cpp b/tests/auto/render/qcomputecommand/tst_qcomputecommand.cpp index 505229d5c..202cbbf5e 100644 --- a/tests/auto/render/qcomputecommand/tst_qcomputecommand.cpp +++ b/tests/auto/render/qcomputecommand/tst_qcomputecommand.cpp @@ -32,9 +32,7 @@ #include #include #include -#include -#include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QComputeCommand : public QObject { @@ -137,69 +135,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - Qt3DRender::QComputeCommand computeCommand; - - computeCommand.setWorkGroupX(128); - computeCommand.setWorkGroupY(512); - computeCommand.setWorkGroupZ(1024); - computeCommand.setRunType(Qt3DRender::QComputeCommand::Manual); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&computeCommand); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QComputeCommandData cloneData = creationChangeData->data; - - QCOMPARE(computeCommand.workGroupX(), cloneData.workGroupX); - QCOMPARE(computeCommand.workGroupY(), cloneData.workGroupY); - QCOMPARE(computeCommand.workGroupZ(), cloneData.workGroupZ); - QCOMPARE(computeCommand.runType(), cloneData.runType); - QCOMPARE(0, cloneData.frameCount); - QCOMPARE(computeCommand.id(), creationChangeData->subjectId()); - QCOMPARE(computeCommand.isEnabled(), true); - QCOMPARE(computeCommand.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(computeCommand.metaObject(), creationChangeData->metaObject()); - } - - // WHEN - computeCommand.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&computeCommand); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QComputeCommandData cloneData = creationChangeData->data; - - QCOMPARE(computeCommand.workGroupX(), cloneData.workGroupX); - QCOMPARE(computeCommand.workGroupY(), cloneData.workGroupY); - QCOMPARE(computeCommand.workGroupZ(), cloneData.workGroupZ); - QCOMPARE(computeCommand.id(), creationChangeData->subjectId()); - QCOMPARE(computeCommand.isEnabled(), false); - QCOMPARE(computeCommand.runType(), cloneData.runType); - QCOMPARE(0, cloneData.frameCount); - QCOMPARE(computeCommand.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(computeCommand.metaObject(), creationChangeData->metaObject()); - } - } - void checkWorkGroupXUpdate() { // GIVEN @@ -213,11 +148,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &computeCommand); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &computeCommand); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -226,7 +160,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -243,11 +177,10 @@ private Q_SLOTS: computeCommand.setWorkGroupY(512); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &computeCommand); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &computeCommand); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -255,8 +188,7 @@ private Q_SLOTS: computeCommand.setWorkGroupY(512); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -274,11 +206,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &computeCommand); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &computeCommand); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -287,8 +218,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -306,11 +236,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &computeCommand); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &computeCommand); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -319,8 +248,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -333,7 +261,7 @@ private Q_SLOTS: computeCommand.setRunType(Qt3DRender::QComputeCommand::Manual); computeCommand.setEnabled(false); QCoreApplication::processEvents(); - arbiter.events.clear(); + arbiter.clear(); { // WHEN @@ -341,14 +269,13 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &computeCommand); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &computeCommand); QCOMPARE(computeCommand.isEnabled(), true); computeCommand.setEnabled(false); QCoreApplication::processEvents(); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -357,15 +284,13 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &computeCommand); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &computeCommand); QCOMPARE(computeCommand.isEnabled(), true); computeCommand.setEnabled(false); QCoreApplication::processEvents(); - arbiter.events.clear(); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -374,16 +299,15 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &computeCommand); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &computeCommand); QCOMPARE(computeCommand.isEnabled(), true); QCOMPARE(computeCommand.workGroupX(), 10); QCOMPARE(computeCommand.workGroupY(), 11); QCOMPARE(computeCommand.workGroupZ(), 12); computeCommand.setEnabled(false); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } } diff --git a/tests/auto/render/qdefaultmeshes/qdefaultmeshes.pro b/tests/auto/render/qdefaultmeshes/qdefaultmeshes.pro deleted file mode 100644 index aaf49b892..000000000 --- a/tests/auto/render/qdefaultmeshes/qdefaultmeshes.pro +++ /dev/null @@ -1,12 +0,0 @@ -TEMPLATE = app - -TARGET = tst_qdefaultmeshes - -QT += core-private 3dcore 3dcore-private 3drender 3drender-private testlib 3dextras - -CONFIG += testcase - -SOURCES += \ - tst_qdefaultmeshes.cpp - -include(../commons/commons.pri) diff --git a/tests/auto/render/qdefaultmeshes/tst_qdefaultmeshes.cpp b/tests/auto/render/qdefaultmeshes/tst_qdefaultmeshes.cpp deleted file mode 100644 index 8c64a005a..000000000 --- a/tests/auto/render/qdefaultmeshes/tst_qdefaultmeshes.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// TODO Remove in Qt6 -#include -QT_WARNING_DISABLE_DEPRECATED - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - - -class tst_QDefaultMeshes: public QObject -{ - Q_OBJECT - -public: - tst_QDefaultMeshes() - { - qRegisterMetaType(); - } - -private Q_SLOTS: - - void checkCloning_data() - { - QTest::addColumn("geomRenderer"); - QTest::newRow("QSphereMesh") << static_cast(new Qt3DExtras::QSphereMesh); - QTest::newRow("QCylinderMesh") << static_cast(new Qt3DExtras::QCylinderMesh); - QTest::newRow("QTorusMesh") << static_cast(new Qt3DExtras::QTorusMesh); - QTest::newRow("QCuboidMesh") << static_cast(new Qt3DExtras::QCuboidMesh); - QTest::newRow("QPlaneMesh") << static_cast(new Qt3DExtras::QPlaneMesh); - } - - void checkCloning() - { - // GIVEN - QFETCH(Qt3DRender::QGeometryRenderer *, geomRenderer); - - // WHEN - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(geomRenderer); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - // THEN - QVERIFY(creationChanges.size() >= 1); - - const Qt3DCore::QNodeCreatedChangePtr creationChangeData = - qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QGeometryRendererData &cloneData = creationChangeData->data; - - QCOMPARE(creationChangeData->subjectId(), geomRenderer->id()); - QCOMPARE(cloneData.instanceCount, geomRenderer->instanceCount()); - QCOMPARE(cloneData.vertexCount, geomRenderer->vertexCount()); - QCOMPARE(cloneData.indexOffset, geomRenderer->indexOffset()); - QCOMPARE(cloneData.firstInstance, geomRenderer->firstInstance()); - QCOMPARE(cloneData.restartIndexValue, geomRenderer->restartIndexValue()); - QCOMPARE(cloneData.primitiveRestart, geomRenderer->primitiveRestartEnabled()); - QCOMPARE(cloneData.primitiveType, geomRenderer->primitiveType()); - QCOMPARE(cloneData.geometryFactory, geomRenderer->geometryFactory()); - - if (geomRenderer->geometryFactory()) { - QVERIFY(cloneData.geometryFactory); - QVERIFY(*cloneData.geometryFactory == *geomRenderer->geometryFactory()); - } - } -}; - -QTEST_MAIN(tst_QDefaultMeshes) - -#include "tst_qdefaultmeshes.moc" diff --git a/tests/auto/render/qdispatchcompute/tst_qdispatchcompute.cpp b/tests/auto/render/qdispatchcompute/tst_qdispatchcompute.cpp index c4bed3a83..f54edf8c2 100644 --- a/tests/auto/render/qdispatchcompute/tst_qdispatchcompute.cpp +++ b/tests/auto/render/qdispatchcompute/tst_qdispatchcompute.cpp @@ -32,9 +32,7 @@ #include #include #include -#include -#include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QDispatchCompute : public QObject { @@ -117,64 +115,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - Qt3DRender::QDispatchCompute dispatchCompute; - - dispatchCompute.setWorkGroupX(427); - dispatchCompute.setWorkGroupY(454); - dispatchCompute.setWorkGroupZ(383); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&dispatchCompute); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QDispatchComputeData cloneData = creationChangeData->data; - - QCOMPARE(dispatchCompute.workGroupX(), cloneData.workGroupX); - QCOMPARE(dispatchCompute.workGroupY(), cloneData.workGroupY); - QCOMPARE(dispatchCompute.workGroupZ(), cloneData.workGroupZ); - QCOMPARE(dispatchCompute.id(), creationChangeData->subjectId()); - QCOMPARE(dispatchCompute.isEnabled(), true); - QCOMPARE(dispatchCompute.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(dispatchCompute.metaObject(), creationChangeData->metaObject()); - } - - // WHEN - dispatchCompute.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&dispatchCompute); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QDispatchComputeData cloneData = creationChangeData->data; - - QCOMPARE(dispatchCompute.workGroupX(), cloneData.workGroupX); - QCOMPARE(dispatchCompute.workGroupY(), cloneData.workGroupY); - QCOMPARE(dispatchCompute.workGroupZ(), cloneData.workGroupZ); - QCOMPARE(dispatchCompute.id(), creationChangeData->subjectId()); - QCOMPARE(dispatchCompute.isEnabled(), false); - QCOMPARE(dispatchCompute.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(dispatchCompute.metaObject(), creationChangeData->metaObject()); - } - } - void checkWorkGroupXUpdate() { // GIVEN @@ -188,11 +128,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &dispatchCompute); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &dispatchCompute); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -201,8 +140,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -220,11 +158,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &dispatchCompute); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &dispatchCompute); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -233,8 +170,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -252,11 +188,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &dispatchCompute); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &dispatchCompute); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -265,8 +200,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } diff --git a/tests/auto/render/qeffect/tst_qeffect.cpp b/tests/auto/render/qeffect/tst_qeffect.cpp index cc4889b8f..f7e43186d 100644 --- a/tests/auto/render/qeffect/tst_qeffect.cpp +++ b/tests/auto/render/qeffect/tst_qeffect.cpp @@ -34,9 +34,7 @@ #include #include #include -#include -#include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QEffect : public QObject { @@ -101,67 +99,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - Qt3DRender::QEffect effect; - - Qt3DRender::QParameter parameter; - effect.addParameter(¶meter); - Qt3DRender::QTechnique technique; - effect.addTechnique(&technique); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&effect); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 3); // Effect + Parameter + Technique - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QEffectData cloneData = creationChangeData->data; - - QCOMPARE(cloneData.parameterIds.size(), 1); - QCOMPARE(parameter.id(), cloneData.parameterIds.first()); - QCOMPARE(cloneData.techniqueIds.size(), 1); - QCOMPARE(technique.id(), cloneData.techniqueIds.first()); - QCOMPARE(effect.id(), creationChangeData->subjectId()); - QCOMPARE(effect.isEnabled(), true); - QCOMPARE(effect.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(effect.metaObject(), creationChangeData->metaObject()); - } - - // WHEN - effect.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&effect); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 3); // Effect + Parameter + Technique - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QEffectData cloneData = creationChangeData->data; - - QCOMPARE(cloneData.parameterIds.size(), 1); - QCOMPARE(parameter.id(), cloneData.parameterIds.first()); - QCOMPARE(cloneData.techniqueIds.size(), 1); - QCOMPARE(technique.id(), cloneData.techniqueIds.first()); - QCOMPARE(effect.id(), creationChangeData->subjectId()); - QCOMPARE(effect.isEnabled(), false); - QCOMPARE(effect.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(effect.metaObject(), creationChangeData->metaObject()); - } - } - void checkParameterBookkeeping() { // GIVEN @@ -214,8 +151,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &effect); QVERIFY(effect.parameters().contains(¶meter)); + arbiter.clear(); } { @@ -224,8 +163,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &effect); QVERIFY(!effect.parameters().contains(¶meter)); + arbiter.clear(); } } @@ -244,10 +185,9 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &effect); - arbiter.dirtyNodes.clear(); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &effect); + arbiter.clear(); } { @@ -256,10 +196,9 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &effect); - arbiter.dirtyNodes.clear(); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &effect); + arbiter.clear(); } } diff --git a/tests/auto/render/qenvironmentlight/tst_qenvironmentlight.cpp b/tests/auto/render/qenvironmentlight/tst_qenvironmentlight.cpp index 97375b647..5eab3a005 100644 --- a/tests/auto/render/qenvironmentlight/tst_qenvironmentlight.cpp +++ b/tests/auto/render/qenvironmentlight/tst_qenvironmentlight.cpp @@ -34,9 +34,7 @@ #include #include -#include -#include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QEnvironmentLight: public QObject { @@ -341,57 +339,6 @@ private Q_SLOTS: QVector3D()); } } - - void checkCreationData() - { - // GIVEN - Qt3DRender::QEnvironmentLight light; - auto shaderData = light.findChild(); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&light); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 2); // EnvironmentLight + ShaderData - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QEnvironmentLightData cloneData = creationChangeData->data; - - QCOMPARE(cloneData.shaderDataId, shaderData->id()); - QCOMPARE(light.id(), creationChangeData->subjectId()); - QCOMPARE(light.isEnabled(), true); - QCOMPARE(light.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(light.metaObject(), creationChangeData->metaObject()); - } - - // WHEN - light.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&light); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 2); // EnvironmentLight + ShaderData - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QEnvironmentLightData cloneData = creationChangeData->data; - - QCOMPARE(cloneData.shaderDataId, shaderData->id()); - QCOMPARE(light.id(), creationChangeData->subjectId()); - QCOMPARE(light.isEnabled(), false); - QCOMPARE(light.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(light.metaObject(), creationChangeData->metaObject()); - } - } }; QTEST_MAIN(tst_QEnvironmentLight) diff --git a/tests/auto/render/qfilterkey/tst_qfilterkey.cpp b/tests/auto/render/qfilterkey/tst_qfilterkey.cpp index f4c31c89e..4e7fe581a 100644 --- a/tests/auto/render/qfilterkey/tst_qfilterkey.cpp +++ b/tests/auto/render/qfilterkey/tst_qfilterkey.cpp @@ -32,9 +32,7 @@ #include #include #include -#include -#include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QFilterKey : public QObject { @@ -97,61 +95,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - Qt3DRender::QFilterKey filterKey; - - filterKey.setValue(QVariant(QStringLiteral("Taylor"))); - filterKey.setName(QStringLiteral("Craig")); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&filterKey); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QFilterKeyData cloneData = creationChangeData->data; - - QCOMPARE(filterKey.value(), cloneData.value); - QCOMPARE(filterKey.name(), cloneData.name); - QCOMPARE(filterKey.id(), creationChangeData->subjectId()); - QCOMPARE(filterKey.isEnabled(), true); - QCOMPARE(filterKey.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(filterKey.metaObject(), creationChangeData->metaObject()); - } - - // WHEN - filterKey.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&filterKey); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QFilterKeyData cloneData = creationChangeData->data; - - QCOMPARE(filterKey.value(), cloneData.value); - QCOMPARE(filterKey.name(), cloneData.name); - QCOMPARE(filterKey.id(), creationChangeData->subjectId()); - QCOMPARE(filterKey.isEnabled(), false); - QCOMPARE(filterKey.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(filterKey.metaObject(), creationChangeData->metaObject()); - } - } - void checkValueUpdate() { // GIVEN @@ -165,11 +108,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &filterKey); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &filterKey); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -178,8 +120,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -197,11 +138,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &filterKey); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &filterKey); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -210,8 +150,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } diff --git a/tests/auto/render/qframegraphnode/tst_qframegraphnode.cpp b/tests/auto/render/qframegraphnode/tst_qframegraphnode.cpp index 6116e031e..4c11a9258 100644 --- a/tests/auto/render/qframegraphnode/tst_qframegraphnode.cpp +++ b/tests/auto/render/qframegraphnode/tst_qframegraphnode.cpp @@ -30,14 +30,11 @@ #include #include #include -#include #include #include -#include -#include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class MyFrameGraphNode : public Qt3DRender::QFrameGraphNode { @@ -63,112 +60,6 @@ private Q_SLOTS: QVERIFY(defaultFrameGraphNode->parentFrameGraphNode() == nullptr); } - void checkCloning_data() - { - QTest::addColumn("frameGraphNode"); - QTest::addColumn>("childFrameGraphNodeIds"); - QTest::addColumn("enabled"); - QTest::addColumn("creationChangeCount"); - - QVector noChildIds; - - { - Qt3DRender::QFrameGraphNode *defaultConstructed = new MyFrameGraphNode(); - QTest::newRow("defaultConstructed") << defaultConstructed << noChildIds << true << 1; - } - - { - Qt3DRender::QFrameGraphNode *disabledFrameGraphNode = new MyFrameGraphNode(); - disabledFrameGraphNode->setEnabled(false); - QTest::newRow("allBuffers") << disabledFrameGraphNode << noChildIds << false << 1; - } - - { - Qt3DRender::QFrameGraphNode *nodeWithChildren = new MyFrameGraphNode(); - Qt3DRender::QFrameGraphNode *child1 = new MyFrameGraphNode(nodeWithChildren); - Qt3DRender::QFrameGraphNode *child2 = new MyFrameGraphNode(nodeWithChildren); - QVector childIds = {child1->id(), child2->id()}; - QTest::newRow("nodeWithChildren") << nodeWithChildren << childIds << true << 3; - } - - { - Qt3DRender::QFrameGraphNode *nodeWithNestedChildren = new MyFrameGraphNode(); - Qt3DRender::QFrameGraphNode *child = new MyFrameGraphNode(nodeWithNestedChildren); - new Qt3DCore::QNode(nodeWithNestedChildren); - Qt3DRender::QFrameGraphNode *grandChild = new MyFrameGraphNode(nodeWithNestedChildren); - QVector childIds = {child->id(), grandChild->id()}; - QTest::newRow("nodeWithNestedChildren") << nodeWithNestedChildren << childIds << true << 4; - } - } - - void checkCloning() - { - // GIVEN - QFETCH(Qt3DRender::QFrameGraphNode *, frameGraphNode); - QFETCH(QVector, childFrameGraphNodeIds); - QFETCH(bool, enabled); - QFETCH(int, creationChangeCount); - - // THEN - QCOMPARE(frameGraphNode->isEnabled(), enabled); - - // WHEN - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(frameGraphNode); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - // THEN - QCOMPARE(creationChanges.size(), creationChangeCount); - const Qt3DCore::QNodeCreatedChangeBasePtr creationChangeData = creationChanges.first(); - - // THEN - QCOMPARE(frameGraphNode->id(), creationChangeData->subjectId()); - QCOMPARE(frameGraphNode->isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(frameGraphNode->metaObject(), creationChangeData->metaObject()); - - // THEN - Qt3DRender::QFrameGraphNodeCreatedChangeBasePtr frameGraphNodeCreatedChange = qSharedPointerCast(creationChangeData); - Qt3DRender::QFrameGraphNodeCreatedChangeBasePrivate *creationChangeDataPrivate = Qt3DRender::QFrameGraphNodeCreatedChangeBasePrivate::get(frameGraphNodeCreatedChange.get()); - QCOMPARE(creationChangeDataPrivate->m_parentFrameGraphNodeId, frameGraphNode->parentNode() ? frameGraphNode->parentNode()->id() : Qt3DCore::QNodeId()); - QCOMPARE(creationChangeDataPrivate->m_childFrameGraphNodeIds, childFrameGraphNodeIds); - - delete frameGraphNode; - } - - void checkCreationData() - { - // GIVEN - Qt3DRender::QFrameGraphNode *parentFrameGraphNode = new MyFrameGraphNode(); - Qt3DRender::QFrameGraphNode *childFrameGraphNode = new MyFrameGraphNode(parentFrameGraphNode); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(parentFrameGraphNode); - creationChanges = creationChangeGenerator.creationChanges(); - } - - { - // THEN - QCOMPARE(creationChanges.size(), 2); - { - - const auto creationChangeData = qSharedPointerCast(creationChanges.first()); - QCOMPARE(parentFrameGraphNode->isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(parentFrameGraphNode->metaObject(), creationChangeData->metaObject()); - QCOMPARE(Qt3DCore::qIdForNode(parentFrameGraphNode->parentFrameGraphNode()), creationChangeData->parentFrameGraphNodeId()); - } - // THEN - { - const auto creationChangeData = qSharedPointerCast(creationChanges.last()); - QCOMPARE(childFrameGraphNode->isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(childFrameGraphNode->metaObject(), creationChangeData->metaObject()); - QCOMPARE(Qt3DCore::qIdForNode(childFrameGraphNode->parentFrameGraphNode()), parentFrameGraphNode->id()); - QCOMPARE(Qt3DCore::qIdForNode(childFrameGraphNode->parentFrameGraphNode()), creationChangeData->parentFrameGraphNodeId()); - } - } - } - void checkPropertyUpdates() { // GIVEN @@ -181,30 +72,27 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), frameGraphNode.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), frameGraphNode.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN frameGraphNode->setEnabled(false); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); // WHEN frameGraphNode->setEnabled(true); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), frameGraphNode.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), frameGraphNode.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } void checkParentFrameNodeRetrieval() diff --git a/tests/auto/render/qgeometry/tst_qgeometry.cpp b/tests/auto/render/qgeometry/tst_qgeometry.cpp index e790ba9cc..30092b204 100644 --- a/tests/auto/render/qgeometry/tst_qgeometry.cpp +++ b/tests/auto/render/qgeometry/tst_qgeometry.cpp @@ -26,15 +26,9 @@ ** ****************************************************************************/ -// TODO Remove in Qt6 -#include -QT_WARNING_DISABLE_DEPRECATED - #include -#include #include #include -#include #include #include @@ -43,17 +37,11 @@ QT_WARNING_DISABLE_DEPRECATED #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class FakeGeometry : public Qt3DRender::QGeometry { Q_OBJECT - -public: - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override - { - Qt3DRender::QGeometry::sceneChangeEvent(change); - } }; class tst_QGeometry: public QObject @@ -62,63 +50,6 @@ class tst_QGeometry: public QObject private Q_SLOTS: - void checkCloning_data() - { - QTest::addColumn("geometry"); - QTest::addColumn("attributeCount"); - - Qt3DRender::QGeometry *defaultConstructed = new Qt3DRender::QGeometry(); - QTest::newRow("defaultConstructed") << defaultConstructed << 0; - - Qt3DRender::QGeometry *geometry1 = new Qt3DRender::QGeometry(); - Qt3DRender::QAttribute *attribute = new Qt3DRender::QAttribute(nullptr, QStringLiteral("Attr1"), Qt3DRender::QAttribute::Float, 4, 454); - geometry1->addAttribute(attribute); - geometry1->addAttribute(new Qt3DRender::QAttribute(nullptr, QStringLiteral("Attr2"), Qt3DRender::QAttribute::Float, 4, 555)); - geometry1->setBoundingVolumePositionAttribute(attribute); - QTest::newRow("2 attributes") << geometry1 << 2; - - - Qt3DRender::QGeometry *geometry2 = new Qt3DRender::QGeometry(); - attribute = new Qt3DRender::QAttribute(nullptr, QStringLiteral("Attr2"), Qt3DRender::QAttribute::Float, 4, 383); - geometry2->addAttribute(new Qt3DRender::QAttribute(nullptr, QStringLiteral("Attr1"), Qt3DRender::QAttribute::Float, 3, 427)); - geometry2->addAttribute(attribute); - geometry2->addAttribute(new Qt3DRender::QAttribute(nullptr, QStringLiteral("Attr3"), Qt3DRender::QAttribute::Float, 2, 327)); - geometry2->removeAttribute(attribute); - QTest::newRow("3 - 1 attributes") << geometry2 << 2; - } - - void checkCloning() - { - // GIVEN - QFETCH(Qt3DRender::QGeometry *, geometry); - QFETCH(int, attributeCount); - - // WHEN - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(geometry); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - // THEN - QCOMPARE(creationChanges.size(), 1 + geometry->childNodes().size()); - - const Qt3DCore::QNodeCreatedChangePtr creationChangeData = - qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QGeometryData &cloneData = creationChangeData->data; - - QCOMPARE(geometry->id(), creationChangeData->subjectId()); - QCOMPARE(geometry->isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(geometry->metaObject(), creationChangeData->metaObject()); - - QCOMPARE(attributeCount, geometry->attributes().count()); - QCOMPARE(attributeCount, cloneData.attributeIds.count()); - if (geometry->boundingVolumePositionAttribute()) - QCOMPARE(geometry->boundingVolumePositionAttribute()->id(), cloneData.boundingVolumePositionAttributeId); - - for (int i = 0; i < attributeCount; ++i) { - Qt3DRender::QAttribute *originalAttribute = static_cast(geometry->attributes()[i]); - QCOMPARE(originalAttribute->id(), cloneData.attributeIds.at(i)); - } - } - void checkPropertyUpdates() { // GIVEN @@ -132,30 +63,25 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), geometry.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), geometry.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN geometry->addAttribute(&attr); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); // WHEN geometry->removeAttribute(&attr); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), geometry.data()); - - arbiter.events.clear(); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), geometry.data()); } void checkAttributeBookkeeping() @@ -208,31 +134,26 @@ private Q_SLOTS: QCOMPARE(geometry->maxExtent(), QVector3D()); // WHEN - Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - valueChange->setPropertyName("extent"); - valueChange->setValue(QVariant::fromValue(QPair(QVector3D(10.0f, 10.f, 10.0f), - QVector3D()))); - geometry->sceneChangeEvent(valueChange); + auto dNode = static_cast(Qt3DCore::QNodePrivate::get(geometry.data())); + const QVector3D minExt(-1.0f, -1.0f, -1.0f); + const QVector3D maxExt(1.0f, 1.0f, 1.0f); + dNode->setExtent(minExt, maxExt); // THEN QCOMPARE(spyMinExtent.count(), 1); - QCOMPARE(spyMaxExtent.count(), 0); - QCOMPARE(geometry->minExtent(), QVector3D(10.0f, 10.0f, 10.0f)); + QCOMPARE(spyMaxExtent.count(), 1); + QCOMPARE(geometry->minExtent(), minExt); + QCOMPARE(geometry->maxExtent(), maxExt); + spyMaxExtent.clear(); spyMinExtent.clear(); // WHEN - valueChange->setPropertyName("extent"); - valueChange->setValue(QVariant::fromValue(QPair(QVector3D(10.0f, 10.f, 10.0f), - QVector3D(11.0f, 11.f, 11.0f)))); - geometry->sceneChangeEvent(valueChange); + dNode->setExtent(minExt, maxExt); // THEN QCOMPARE(spyMinExtent.count(), 0); - QCOMPARE(spyMaxExtent.count(), 1); - QCOMPARE(geometry->maxExtent(), QVector3D(11.0f, 11.0f, 11.0f)); - - spyMaxExtent.clear(); + QCOMPARE(spyMaxExtent.count(), 0); } }; diff --git a/tests/auto/render/qgeometryrenderer/tst_qgeometryrenderer.cpp b/tests/auto/render/qgeometryrenderer/tst_qgeometryrenderer.cpp index 8cfbc0d23..1c2d30b49 100644 --- a/tests/auto/render/qgeometryrenderer/tst_qgeometryrenderer.cpp +++ b/tests/auto/render/qgeometryrenderer/tst_qgeometryrenderer.cpp @@ -33,7 +33,6 @@ QT_WARNING_DISABLE_DEPRECATED #include #include #include -#include #include #include @@ -42,7 +41,7 @@ QT_WARNING_DISABLE_DEPRECATED #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class TestFactory : public Qt3DRender::QGeometryFactory { @@ -76,80 +75,6 @@ class tst_QGeometryRenderer: public QObject private Q_SLOTS: - void checkCloning_data() - { - QTest::addColumn("geometryRenderer"); - - Qt3DRender::QGeometryRenderer *defaultConstructed = new Qt3DRender::QGeometryRenderer(); - QTest::newRow("defaultConstructed") << defaultConstructed ; - - Qt3DRender::QGeometryRenderer *geometry1 = new Qt3DRender::QGeometryRenderer(); - geometry1->setGeometry(new Qt3DRender::QGeometry()); - geometry1->setInstanceCount(1); - geometry1->setIndexOffset(0); - geometry1->setFirstInstance(55); - geometry1->setIndexBufferByteOffset(48); - geometry1->setRestartIndexValue(-1); - geometry1->setPrimitiveRestartEnabled(false); - geometry1->setPrimitiveType(Qt3DRender::QGeometryRenderer::Triangles); - geometry1->setVertexCount(15); - geometry1->setVerticesPerPatch(2); - geometry1->setGeometryFactory(Qt3DRender::QGeometryFactoryPtr(new TestFactory(383))); - QTest::newRow("triangle") << geometry1; - - Qt3DRender::QGeometryRenderer *geometry2 = new Qt3DRender::QGeometryRenderer(); - geometry2->setGeometry(new Qt3DRender::QGeometry()); - geometry2->setInstanceCount(200); - geometry2->setIndexOffset(58); - geometry2->setFirstInstance(10); - geometry2->setIndexBufferByteOffset(96); - geometry2->setRestartIndexValue(65535); - geometry2->setVertexCount(2056); - geometry2->setPrimitiveRestartEnabled(true); - geometry2->setVerticesPerPatch(3); - geometry2->setPrimitiveType(Qt3DRender::QGeometryRenderer::Lines); - geometry2->setGeometryFactory(Qt3DRender::QGeometryFactoryPtr(new TestFactory(305))); - QTest::newRow("lines with restart") << geometry2; - } - - void checkCloning() - { - // GIVEN - QFETCH(Qt3DRender::QGeometryRenderer *, geometryRenderer); - - // WHEN - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(geometryRenderer); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - // THEN - QCOMPARE(creationChanges.size(), 1 + (geometryRenderer->geometry() ? 1 : 0)); - - const Qt3DCore::QNodeCreatedChangePtr creationChangeData = - qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QGeometryRendererData &cloneData = creationChangeData->data; - - QCOMPARE(geometryRenderer->id(), creationChangeData->subjectId()); - QCOMPARE(geometryRenderer->isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(geometryRenderer->metaObject(), creationChangeData->metaObject()); - - QCOMPARE(cloneData.instanceCount, geometryRenderer->instanceCount()); - QCOMPARE(cloneData.vertexCount, geometryRenderer->vertexCount()); - QCOMPARE(cloneData.indexOffset, geometryRenderer->indexOffset()); - QCOMPARE(cloneData.firstInstance, geometryRenderer->firstInstance()); - QCOMPARE(cloneData.indexBufferByteOffset, geometryRenderer->indexBufferByteOffset()); - QCOMPARE(cloneData.restartIndexValue, geometryRenderer->restartIndexValue()); - QCOMPARE(cloneData.primitiveRestart, geometryRenderer->primitiveRestartEnabled()); - QCOMPARE(cloneData.primitiveType, geometryRenderer->primitiveType()); - QCOMPARE(cloneData.verticesPerPatch, geometryRenderer->verticesPerPatch()); - - if (geometryRenderer->geometry() != nullptr) - QCOMPARE(cloneData.geometryId, geometryRenderer->geometry()->id()); - - QCOMPARE(cloneData.geometryFactory, geometryRenderer->geometryFactory()); - if (geometryRenderer->geometryFactory()) - QVERIFY(*cloneData.geometryFactory == *geometryRenderer->geometryFactory()); - } - void checkPropertyUpdates() { // GIVEN @@ -162,99 +87,90 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), geometryRenderer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), geometryRenderer.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN geometryRenderer->setVertexCount(1340); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), geometryRenderer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), geometryRenderer.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN geometryRenderer->setIndexOffset(883); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), geometryRenderer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), geometryRenderer.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN geometryRenderer->setFirstInstance(1200); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), geometryRenderer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), geometryRenderer.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN geometryRenderer->setIndexBufferByteOffset(91); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), geometryRenderer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), geometryRenderer.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN geometryRenderer->setRestartIndexValue(65535); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), geometryRenderer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), geometryRenderer.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN geometryRenderer->setVerticesPerPatch(2); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), geometryRenderer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), geometryRenderer.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN geometryRenderer->setPrimitiveRestartEnabled(true); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), geometryRenderer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), geometryRenderer.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN geometryRenderer->setPrimitiveType(Qt3DRender::QGeometryRenderer::Patches); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), geometryRenderer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), geometryRenderer.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN Qt3DRender::QGeometryFactoryPtr factory(new TestFactory(555)); @@ -262,11 +178,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), geometryRenderer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), geometryRenderer.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN Qt3DRender::QGeometry geom; @@ -274,11 +189,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), geometryRenderer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), geometryRenderer.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN Qt3DRender::QGeometry geom2; @@ -286,11 +200,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), geometryRenderer.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), geometryRenderer.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } void checkGeometryBookkeeping() diff --git a/tests/auto/render/qlayerfilter/tst_qlayerfilter.cpp b/tests/auto/render/qlayerfilter/tst_qlayerfilter.cpp index 648a1d104..da31944f7 100644 --- a/tests/auto/render/qlayerfilter/tst_qlayerfilter.cpp +++ b/tests/auto/render/qlayerfilter/tst_qlayerfilter.cpp @@ -29,13 +29,12 @@ #include #include #include -#include #include #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QLayerFilter: public QObject { @@ -49,60 +48,6 @@ public: private Q_SLOTS: - void checkCloning_data() - { - QTest::addColumn("layerFilter"); - QTest::addColumn>("layers"); - - - Qt3DRender::QLayerFilter *defaultConstructed = new Qt3DRender::QLayerFilter(); - QTest::newRow("defaultConstructed") << defaultConstructed << QVector(); - - Qt3DRender::QLayerFilter *singleLayer = new Qt3DRender::QLayerFilter(); - auto layer = QVector() << new Qt3DRender::QLayer(); - QCoreApplication::processEvents(); - singleLayer->addLayer(layer.first()); - QTest::newRow("single layer") << singleLayer << layer; - - Qt3DRender::QLayerFilter *multiLayers = new Qt3DRender::QLayerFilter(); - auto layers = QVector() << new Qt3DRender::QLayer() - << new Qt3DRender::QLayer() - << new Qt3DRender::QLayer(); - QCoreApplication::processEvents(); - for (Qt3DRender::QLayer *layer : qAsConst(layers)) - multiLayers->addLayer(layer); - QTest::newRow("multi layers") << multiLayers << layers; - } - - void checkCloning() - { - // GIVEN - QFETCH(Qt3DRender::QLayerFilter *, layerFilter); - QFETCH(QVector, layers); - - // THEN - QCOMPARE(layerFilter->layers(), layers); - - // WHEN - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(layerFilter); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - // THEN - QCOMPARE(creationChanges.size(), layers.size() + 1); - - const Qt3DCore::QNodeCreatedChangePtr creationChangeData = - qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QLayerFilterData &cloneData = creationChangeData->data; - - // THEN - QCOMPARE(layerFilter->id(), creationChangeData->subjectId()); - QCOMPARE(layerFilter->isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(layerFilter->metaObject(), creationChangeData->metaObject()); - QCOMPARE(Qt3DCore::qIdsForNodes(layerFilter->layers()), cloneData.layerIds); - - delete layerFilter; - } - void checkPropertyUpdates() { // GIVEN @@ -117,11 +62,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QVERIFY(arbiter.dirtyNodes.contains(layerFilter.data())); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QVERIFY(arbiter.dirtyNodes().contains(layerFilter.data())); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN layer = new Qt3DRender::QLayer(layerFilter.data()); @@ -130,11 +74,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QVERIFY(arbiter.dirtyNodes.contains(layerFilter.data())); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QVERIFY(arbiter.dirtyNodes().contains(layerFilter.data())); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN layer = layerFilter->layers().at(0); @@ -142,11 +85,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QVERIFY(arbiter.dirtyNodes.contains(layerFilter.data())); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QVERIFY(arbiter.dirtyNodes().contains(layerFilter.data())); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } void checkLayerBookkeeping() diff --git a/tests/auto/render/qlevelofdetail/tst_qlevelofdetail.cpp b/tests/auto/render/qlevelofdetail/tst_qlevelofdetail.cpp index 7d4e5d45d..0c68cf42c 100644 --- a/tests/auto/render/qlevelofdetail/tst_qlevelofdetail.cpp +++ b/tests/auto/render/qlevelofdetail/tst_qlevelofdetail.cpp @@ -29,12 +29,11 @@ #include #include #include -#include #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QLevelOfDetail: public QObject { @@ -42,44 +41,6 @@ class tst_QLevelOfDetail: public QObject private Q_SLOTS: - void checkCloning_data() - { - QTest::addColumn("lod"); - - Qt3DRender::QLevelOfDetail *defaultConstructed = new Qt3DRender::QLevelOfDetail(); - QTest::newRow("defaultConstructed") << defaultConstructed; - - Qt3DRender::QLevelOfDetail *lodDst = new Qt3DRender::QLevelOfDetail(); - QTest::newRow("distLod") << lodDst; - - Qt3DRender::QLevelOfDetail *lodPx = new Qt3DRender::QLevelOfDetail(); - QTest::newRow("pxLod") << lodPx; - } - - void checkCloning() - { - // GIVEN - QFETCH(Qt3DRender::QLevelOfDetail *, lod); - - // WHEN - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(lod); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - // THEN - QCOMPARE(creationChanges.size(), 1); - - const Qt3DCore::QNodeCreatedChangePtr creationChangeData = - qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QLevelOfDetailData &cloneData = creationChangeData->data; - - QCOMPARE(lod->id(), creationChangeData->subjectId()); - QCOMPARE(lod->isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(lod->metaObject(), creationChangeData->metaObject()); - QCOMPARE(lod->currentIndex(), cloneData.currentIndex); - QCOMPARE(lod->thresholdType(), cloneData.thresholdType); - QCOMPARE(lod->thresholds(), cloneData.thresholds); - } - void checkPropertyUpdates() { // GIVEN @@ -93,11 +54,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), lod.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), lod.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -107,11 +67,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), lod.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), lod.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } } }; diff --git a/tests/auto/render/qmaterial/tst_qmaterial.cpp b/tests/auto/render/qmaterial/tst_qmaterial.cpp index 994b11d43..50e2d9989 100644 --- a/tests/auto/render/qmaterial/tst_qmaterial.cpp +++ b/tests/auto/render/qmaterial/tst_qmaterial.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include #include @@ -47,7 +46,7 @@ #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class TestMaterial : public Qt3DRender::QMaterial { @@ -185,61 +184,6 @@ private: private Q_SLOTS: - void checkCloning_data() - { - QTest::addColumn("material"); - - Qt3DRender::QMaterial *material = new Qt3DRender::QMaterial(); - QTest::newRow("empty material") << material; - material = new TestMaterial(); - QTest::newRow("test material") << material; - material = new Qt3DExtras::QPhongMaterial(); - QTest::newRow("QPhongMaterial") << material; - material = new Qt3DExtras::QDiffuseMapMaterial(); - QTest::newRow("QDiffuseMapMaterial") << material; - material = new Qt3DExtras::QDiffuseSpecularMapMaterial(); - QTest::newRow("QDiffuseMapSpecularMaterial") << material; - material = new Qt3DExtras::QPerVertexColorMaterial(); - QTest::newRow("QPerVertexColorMaterial") << material; - material = new Qt3DExtras::QNormalDiffuseMapMaterial(); - QTest::newRow("QNormalDiffuseMapMaterial") << material; - material = new Qt3DExtras::QNormalDiffuseMapAlphaMaterial(); - QTest::newRow("QNormalDiffuseMapAlphaMaterial") << material; - material = new Qt3DExtras::QNormalDiffuseSpecularMapMaterial(); - QTest::newRow("QNormalDiffuseSpecularMapMaterial") << material; - } - - void checkCloning() - { - // GIVEN - QFETCH(Qt3DRender::QMaterial *, material); - - // WHEN - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(material); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - // THEN - QVERIFY(creationChanges.size() >= 1); - - const Qt3DCore::QNodeCreatedChangePtr creationChangeData = - qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QMaterialData &cloneData = creationChangeData->data; - - // THEN - QCOMPARE(material->id(), creationChangeData->subjectId()); - QCOMPARE(material->isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(material->metaObject(), creationChangeData->metaObject()); - QCOMPARE(material->effect() ? material->effect()->id() : Qt3DCore::QNodeId(), cloneData.effectId); - QCOMPARE(material->parameters().size(), cloneData.parameterIds.size()); - - for (int i = 0, m = material->parameters().size(); i < m; ++i) - QCOMPARE(material->parameters().at(i)->id(), cloneData.parameterIds.at(i)); - - // TO DO: Add unit tests for parameter and effect that do check this - // compareParameters(material->parameters(), clone->parameters()); - // compareEffects(material->effect(), clone->effect()); - } - void checkEffectUpdate() { // GIVEN @@ -252,10 +196,10 @@ private Q_SLOTS: material->setEffect(&effect); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), material.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), material.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // GIVEN TestArbiter arbiter2; @@ -266,10 +210,10 @@ private Q_SLOTS: material2->setEffect(&effect); // THEN - QCOMPARE(arbiter2.dirtyNodes.size(), 1); - QCOMPARE(arbiter2.dirtyNodes.front(), material2.data()); + QCOMPARE(arbiter2.dirtyNodes().size(), 1); + QCOMPARE(arbiter2.dirtyNodes().front(), material2.data()); - arbiter2.dirtyNodes.clear(); + arbiter2.clear(); } void checkDynamicParametersAddedUpdates() @@ -281,7 +225,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // Clear events trigger by child generation of TestMnterial - arbiter.events.clear(); + arbiter.clear(); // WHEN (add parameter to material) Qt3DRender::QParameter *param = new Qt3DRender::QParameter("testParamMaterial", QVariant::fromValue(383.0f)); @@ -292,8 +236,7 @@ private Q_SLOTS: QCOMPARE(param->parent(), material); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); + QCOMPARE(arbiter.dirtyNodes().size(), 1); QVERIFY(material->parameters().contains(param)); // WHEN (add parameter to effect) @@ -302,8 +245,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 2); + QCOMPARE(arbiter.dirtyNodes().size(), 2); QVERIFY(material->effect()->parameters().contains(param)); // WHEN (add parameter to technique) @@ -312,8 +254,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 3); + QCOMPARE(arbiter.dirtyNodes().size(), 3); QVERIFY(material->m_technique->parameters().contains(param)); @@ -323,8 +264,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 4); + QCOMPARE(arbiter.dirtyNodes().size(), 4); QVERIFY(material->m_renderPass->parameters().contains(param)); } @@ -340,59 +280,59 @@ private Q_SLOTS: material->m_shaderProgram->setVertexShaderCode(vertexCode); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), material->m_shaderProgram); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), material->m_shaderProgram); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN const QByteArray fragmentCode = QByteArrayLiteral("new fragment shader code"); material->m_shaderProgram->setFragmentShaderCode(fragmentCode); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), material->m_shaderProgram); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), material->m_shaderProgram); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN const QByteArray geometryCode = QByteArrayLiteral("new geometry shader code"); material->m_shaderProgram->setGeometryShaderCode(geometryCode); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), material->m_shaderProgram); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), material->m_shaderProgram); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN const QByteArray computeCode = QByteArrayLiteral("new compute shader code"); material->m_shaderProgram->setComputeShaderCode(computeCode); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), material->m_shaderProgram); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), material->m_shaderProgram); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN const QByteArray tesselControlCode = QByteArrayLiteral("new tessellation control shader code"); material->m_shaderProgram->setTessellationControlShaderCode(tesselControlCode); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), material->m_shaderProgram); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), material->m_shaderProgram); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN const QByteArray tesselEvalCode = QByteArrayLiteral("new tessellation eval shader code"); material->m_shaderProgram->setTessellationEvaluationShaderCode(tesselEvalCode); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), material->m_shaderProgram); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), material->m_shaderProgram); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } void checkEffectBookkeeping() diff --git a/tests/auto/render/qmemorybarrier/tst_qmemorybarrier.cpp b/tests/auto/render/qmemorybarrier/tst_qmemorybarrier.cpp index 41fdd8428..ae1d3360c 100644 --- a/tests/auto/render/qmemorybarrier/tst_qmemorybarrier.cpp +++ b/tests/auto/render/qmemorybarrier/tst_qmemorybarrier.cpp @@ -32,9 +32,7 @@ #include #include #include -#include -#include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QMemoryBarrier : public QObject { @@ -82,58 +80,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - Qt3DRender::QMemoryBarrier memoryBarrier; - - memoryBarrier.setWaitOperations(Qt3DRender::QMemoryBarrier::Command); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&memoryBarrier); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QMemoryBarrierData cloneData = creationChangeData->data; - - QCOMPARE(memoryBarrier.waitOperations(), cloneData.waitOperations); - QCOMPARE(memoryBarrier.id(), creationChangeData->subjectId()); - QCOMPARE(memoryBarrier.isEnabled(), true); - QCOMPARE(memoryBarrier.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(memoryBarrier.metaObject(), creationChangeData->metaObject()); - } - - // WHEN - memoryBarrier.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&memoryBarrier); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QMemoryBarrierData cloneData = creationChangeData->data; - - QCOMPARE(memoryBarrier.waitOperations(), cloneData.waitOperations); - QCOMPARE(memoryBarrier.id(), creationChangeData->subjectId()); - QCOMPARE(memoryBarrier.isEnabled(), false); - QCOMPARE(memoryBarrier.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(memoryBarrier.metaObject(), creationChangeData->metaObject()); - } - } - void checkTypesUpdate() { // GIVEN @@ -147,11 +93,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &memoryBarrier); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &memoryBarrier); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -160,8 +105,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } diff --git a/tests/auto/render/qmesh/tst_qmesh.cpp b/tests/auto/render/qmesh/tst_qmesh.cpp index d77005dfa..cc66316ae 100644 --- a/tests/auto/render/qmesh/tst_qmesh.cpp +++ b/tests/auto/render/qmesh/tst_qmesh.cpp @@ -35,11 +35,8 @@ QT_WARNING_DISABLE_DEPRECATED #include #include #include -#include -#include #include -#include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class MyQMesh : public Qt3DRender::QMesh { @@ -48,11 +45,6 @@ public: explicit MyQMesh(Qt3DCore::QNode *parent = nullptr) : Qt3DRender::QMesh(parent) {} - - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) final - { - Qt3DRender::QMesh::sceneChangeEvent(change); - } }; class tst_QMesh : public QObject @@ -117,58 +109,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - Qt3DRender::QMesh mesh; - - mesh.setSource(QUrl(QStringLiteral("http://someRemoteURL.com"))); - mesh.setMeshName(QStringLiteral("RearPropeller")); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&mesh); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QGeometryRendererData cloneData = creationChangeData->data; - - // Geometry factory shouldn't be null - QVERIFY(cloneData.geometryFactory != nullptr); - QCOMPARE(mesh.id(), creationChangeData->subjectId()); - QCOMPARE(mesh.isEnabled(), true); - QCOMPARE(mesh.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(mesh.metaObject(), creationChangeData->metaObject()); - } - - // WHEN - mesh.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&mesh); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - - QCOMPARE(mesh.id(), creationChangeData->subjectId()); - QCOMPARE(mesh.isEnabled(), false); - QCOMPARE(mesh.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(mesh.metaObject(), creationChangeData->metaObject()); - } - } - void checkSourceUpdate() { // GIVEN @@ -181,7 +121,7 @@ private Q_SLOTS: Qt3DCore::QNodePrivate *meshd = Qt3DCore::QNodePrivate::get(&mesh); meshd->setScene(scene); QCoreApplication::processEvents(); - arbiter.events.clear(); + arbiter.clear(); { // WHEN @@ -189,10 +129,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &mesh); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &mesh); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -201,7 +141,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -218,7 +158,7 @@ private Q_SLOTS: Qt3DCore::QNodePrivate *meshd = Qt3DCore::QNodePrivate::get(&mesh); meshd->setScene(scene); QCoreApplication::processEvents(); - arbiter.events.clear(); + arbiter.clear(); { // WHEN @@ -226,10 +166,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &mesh); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &mesh); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -238,7 +178,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } diff --git a/tests/auto/render/qobjectpicker/tst_qobjectpicker.cpp b/tests/auto/render/qobjectpicker/tst_qobjectpicker.cpp index 5977829a6..81b0110b1 100644 --- a/tests/auto/render/qobjectpicker/tst_qobjectpicker.cpp +++ b/tests/auto/render/qobjectpicker/tst_qobjectpicker.cpp @@ -33,9 +33,7 @@ #include #include #include -#include -#include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class MyObjectPicker : public Qt3DRender::QObjectPicker { @@ -45,11 +43,6 @@ public: : Qt3DRender::QObjectPicker(parent) {} - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) final - { - Qt3DRender::QObjectPicker::sceneChangeEvent(change); - } - private: friend class tst_ObjectPicker; @@ -84,64 +77,6 @@ private Q_SLOTS: QCOMPARE(picker.isHoverEnabled(), false); } - void checkCreationData() - { - // GIVEN - Qt3DRender::QObjectPicker picker; - - picker.setPriority(1584); - picker.setDragEnabled(true); - picker.setHoverEnabled(true); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&picker); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QObjectPickerData cloneData = creationChangeData->data; - - QCOMPARE(cloneData.priority, 1584); - QCOMPARE(cloneData.hoverEnabled, true); - QCOMPARE(cloneData.dragEnabled, true); - QCOMPARE(picker.id(), creationChangeData->subjectId()); - QCOMPARE(picker.isEnabled(), true); - QCOMPARE(picker.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(picker.metaObject(), creationChangeData->metaObject()); - } - - // WHEN - picker.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&picker); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QObjectPickerData cloneData = creationChangeData->data; - - QCOMPARE(cloneData.priority, 1584); - QCOMPARE(cloneData.hoverEnabled, true); - QCOMPARE(cloneData.dragEnabled, true); - QCOMPARE(picker.id(), creationChangeData->subjectId()); - QCOMPARE(picker.isEnabled(), false); - QCOMPARE(picker.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(picker.metaObject(), creationChangeData->metaObject()); - } - } - void checkPropertyUpdate() { // GIVEN @@ -156,11 +91,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &picker); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &picker); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -169,8 +103,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } { @@ -180,11 +113,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &picker); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &picker); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -193,8 +125,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } { @@ -204,11 +135,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &picker); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &picker); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -217,8 +147,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } } @@ -248,11 +177,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), objectPicker.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), objectPicker.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } }; diff --git a/tests/auto/render/qparameter/tst_qparameter.cpp b/tests/auto/render/qparameter/tst_qparameter.cpp index 3df09cff4..b4c307dc6 100644 --- a/tests/auto/render/qparameter/tst_qparameter.cpp +++ b/tests/auto/render/qparameter/tst_qparameter.cpp @@ -31,10 +31,8 @@ #include #include #include -#include -#include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QParameter : public QObject { @@ -97,61 +95,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - Qt3DRender::QParameter parameter; - - parameter.setName(QStringLiteral("TwinCam")); - parameter.setValue(QVariant(427)); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(¶meter); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QParameterData cloneData = creationChangeData->data; - - QCOMPARE(parameter.name(), cloneData.name); - QCOMPARE(parameter.value(), cloneData.backendValue); - QCOMPARE(parameter.id(), creationChangeData->subjectId()); - QCOMPARE(parameter.isEnabled(), true); - QCOMPARE(parameter.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(parameter.metaObject(), creationChangeData->metaObject()); - } - - // WHEN - parameter.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(¶meter); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QParameterData cloneData = creationChangeData->data; - - QCOMPARE(parameter.name(), cloneData.name); - QCOMPARE(parameter.value(), cloneData.backendValue); - QCOMPARE(parameter.id(), creationChangeData->subjectId()); - QCOMPARE(parameter.isEnabled(), false); - QCOMPARE(parameter.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(parameter.metaObject(), creationChangeData->metaObject()); - } - } - void checkNameUpdate() { // GIVEN @@ -165,11 +108,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), ¶meter); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), ¶meter); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -178,8 +120,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -197,11 +138,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), ¶meter); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), ¶meter); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -210,8 +150,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } // WHEN -> QNode -> QNodeId @@ -224,11 +163,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), ¶meter); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), ¶meter); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -237,8 +175,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } diff --git a/tests/auto/render/qproximityfilter/tst_qproximityfilter.cpp b/tests/auto/render/qproximityfilter/tst_qproximityfilter.cpp index 10a532454..3336d757e 100644 --- a/tests/auto/render/qproximityfilter/tst_qproximityfilter.cpp +++ b/tests/auto/render/qproximityfilter/tst_qproximityfilter.cpp @@ -31,10 +31,8 @@ #include #include #include -#include -#include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QProximityFilter : public QObject { @@ -105,62 +103,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - Qt3DRender::QProximityFilter proximityFilter; - Qt3DCore::QEntity entity; - - proximityFilter.setEntity(&entity); - proximityFilter.setDistanceThreshold(1584.0f); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&proximityFilter); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 2); // Entity creation change is the second change - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QProximityFilterData cloneData = creationChangeData->data; - - QCOMPARE(proximityFilter.entity()->id(), cloneData.entityId); - QCOMPARE(proximityFilter.distanceThreshold(), cloneData.distanceThreshold); - QCOMPARE(proximityFilter.id(), creationChangeData->subjectId()); - QCOMPARE(proximityFilter.isEnabled(), true); - QCOMPARE(proximityFilter.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(proximityFilter.metaObject(), creationChangeData->metaObject()); - } - - // WHEN - proximityFilter.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&proximityFilter); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 2); // Entity creation change is the second change - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QProximityFilterData cloneData = creationChangeData->data; - - QCOMPARE(proximityFilter.entity()->id(), cloneData.entityId); - QCOMPARE(proximityFilter.distanceThreshold(), cloneData.distanceThreshold); - QCOMPARE(proximityFilter.id(), creationChangeData->subjectId()); - QCOMPARE(proximityFilter.isEnabled(), false); - QCOMPARE(proximityFilter.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(proximityFilter.metaObject(), creationChangeData->metaObject()); - } - } - void checkEntityUpdate() { // GIVEN @@ -175,11 +117,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &proximityFilter); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &proximityFilter); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -188,8 +129,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -207,11 +147,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &proximityFilter); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &proximityFilter); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -220,8 +159,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } diff --git a/tests/auto/render/qraycaster/tst_qraycaster.cpp b/tests/auto/render/qraycaster/tst_qraycaster.cpp index 8ac084545..96f6d92eb 100644 --- a/tests/auto/render/qraycaster/tst_qraycaster.cpp +++ b/tests/auto/render/qraycaster/tst_qraycaster.cpp @@ -30,13 +30,11 @@ #include #include #include -#include -#include -#include #include +#include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class MyRayCaster : public Qt3DRender::QRayCaster { @@ -48,11 +46,6 @@ public: qRegisterMetaType("Hits"); } - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) final - { - Qt3DRender::QRayCaster::sceneChangeEvent(change); - } - private: friend class tst_RayCaster; }; @@ -112,11 +105,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), rayCaster.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), rayCaster.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN auto layer = new Qt3DRender::QLayer(rayCaster.data()); @@ -125,12 +117,9 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), rayCaster.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); - arbiter.dirtyNodes.clear(); - arbiter.events.clear(); + arbiter.clear(); // WHEN layer = new Qt3DRender::QLayer(rayCaster.data()); @@ -139,12 +128,9 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), rayCaster.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); - arbiter.dirtyNodes.clear(); - arbiter.events.clear(); + arbiter.clear(); // WHEN layer = rayCaster->layers().at(0); @@ -152,12 +138,9 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), rayCaster.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); - arbiter.dirtyNodes.clear(); - arbiter.events.clear(); + arbiter.clear(); } void checkLayerBookkeeping() @@ -194,14 +177,23 @@ private Q_SLOTS: } } - void checkBackendUpdates_data() + + void checkBackendUpdates() { - QTest::addColumn("signalPrototype"); - QTest::addColumn("propertyName"); + // GIVEN + QScopedPointer rayCaster(new MyRayCaster()); + QSignalSpy spy(rayCaster.data(), SIGNAL(hitsChanged(const Hits &))); + Qt3DRender::QRayCaster::Hits hits; - QTest::newRow("hits") - << QByteArray(SIGNAL(hitsChanged(const Hits &))) - << QByteArrayLiteral("hits"); + QVERIFY(spy.isValid()); + + // WHEN + Qt3DRender::QAbstractRayCasterPrivate *d = Qt3DRender::QAbstractRayCasterPrivate::get(rayCaster.data()); + d->dispatchHits(hits); + + // THEN + // Check that the QRayCaster triggers the expected signal + QCOMPARE(spy.count(), 1); } }; diff --git a/tests/auto/render/qrendercapture/tst_qrendercapture.cpp b/tests/auto/render/qrendercapture/tst_qrendercapture.cpp index 35c645d41..2b4fcec6b 100644 --- a/tests/auto/render/qrendercapture/tst_qrendercapture.cpp +++ b/tests/auto/render/qrendercapture/tst_qrendercapture.cpp @@ -26,13 +26,8 @@ ** ****************************************************************************/ -// TODO Remove in Qt6 -#include -QT_WARNING_DISABLE_DEPRECATED - #include #include -#include #include #include #include @@ -40,7 +35,7 @@ QT_WARNING_DISABLE_DEPRECATED #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class MyRenderCapture : public Qt3DRender::QRenderCapture { @@ -50,11 +45,6 @@ public: : Qt3DRender::QRenderCapture(parent) {} - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) final - { - Qt3DRender::QRenderCapture::sceneChangeEvent(change); - } - private: friend class tst_QRenderCapture; }; @@ -76,58 +66,10 @@ private Q_SLOTS: QScopedPointer reply(renderCapture->requestCapture(QRect(10, 15, 20, 50))); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), renderCapture.data()); - - arbiter.dirtyNodes.clear(); - } - - void checkRenderCaptureReply() - { - // GIVEN - QScopedPointer renderCapture(new MyRenderCapture()); - QScopedPointer reply(renderCapture->requestCapture()); - QImage img = QImage(20, 20, QImage::Format_ARGB32); - - // WHEN - Qt3DRender::RenderCaptureDataPtr data = Qt3DRender::RenderCaptureDataPtr::create(); - data.data()->captureId = 2; - data.data()->image = img; - - auto e = Qt3DCore::QPropertyUpdatedChangePtr::create(renderCapture->id()); - e->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll); - e->setPropertyName("renderCaptureData"); - e->setValue(QVariant::fromValue(data)); - - renderCapture->sceneChangeEvent(e); - - // THEN - QCOMPARE(reply->isComplete(), true); - QCOMPARE(reply->image().width(), 20); - QCOMPARE(reply->image().height(), 20); - QCOMPARE(reply->image().format(), QImage::Format_ARGB32); - } + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), renderCapture.data()); - void checkRenderCaptureDestroy() - { - // GIVEN - QScopedPointer renderCapture(new MyRenderCapture()); - QScopedPointer reply(renderCapture->requestCapture()); - QImage img = QImage(20, 20, QImage::Format_ARGB32); - Qt3DRender::RenderCaptureDataPtr data = Qt3DRender::RenderCaptureDataPtr::create(); - data.data()->captureId = 2; - data.data()->image = img; - auto e = Qt3DCore::QPropertyUpdatedChangePtr::create(renderCapture->id()); - e->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll); - e->setPropertyName("renderCaptureData"); - e->setValue(QVariant::fromValue(data)); - - // WHEN - reply.reset(); - - // THEN - renderCapture->sceneChangeEvent(e); // Should not reset + arbiter.clear(); } void crashOnRenderCaptureDeletion() diff --git a/tests/auto/render/qrenderpass/tst_qrenderpass.cpp b/tests/auto/render/qrenderpass/tst_qrenderpass.cpp index 81f949064..479fffa29 100644 --- a/tests/auto/render/qrenderpass/tst_qrenderpass.cpp +++ b/tests/auto/render/qrenderpass/tst_qrenderpass.cpp @@ -36,11 +36,7 @@ #include #include #include -#include -#include -#include -#include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QRenderPass : public QObject { @@ -151,77 +147,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - Qt3DRender::QRenderPass renderPass; - - Qt3DRender::QShaderProgram shader; - renderPass.setShaderProgram(&shader); - Qt3DRender::QFilterKey filterKey; - renderPass.addFilterKey(&filterKey); - Qt3DRender::QDepthTest renderState; - renderPass.addRenderState(&renderState); - Qt3DRender::QParameter parameter; - renderPass.addParameter(¶meter); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&renderPass); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 5); // RenderPass + Shader + FilterKey + Parameter + State - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QRenderPassData cloneData = creationChangeData->data; - - QCOMPARE(renderPass.shaderProgram()->id(), cloneData.shaderId); - QCOMPARE(cloneData.filterKeyIds.size(), 1); - QCOMPARE(filterKey.id(), cloneData.filterKeyIds.first()); - QCOMPARE(cloneData.renderStateIds.size(), 1); - QCOMPARE(renderState.id(), cloneData.renderStateIds.first()); - QCOMPARE(cloneData.parameterIds.size(), 1); - QCOMPARE(parameter.id(), cloneData.parameterIds.first()); - QCOMPARE(renderPass.id(), creationChangeData->subjectId()); - QCOMPARE(renderPass.isEnabled(), true); - QCOMPARE(renderPass.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(renderPass.metaObject(), creationChangeData->metaObject()); - } - - // WHEN - renderPass.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&renderPass); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 5); // RenderPass + Shader + FilterKey + Parameter + State - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QRenderPassData cloneData = creationChangeData->data; - - QCOMPARE(renderPass.shaderProgram()->id(), cloneData.shaderId); - QCOMPARE(cloneData.filterKeyIds.size(), 1); - QCOMPARE(filterKey.id(), cloneData.filterKeyIds.first()); - QCOMPARE(cloneData.renderStateIds.size(), 1); - QCOMPARE(renderState.id(), cloneData.renderStateIds.first()); - QCOMPARE(cloneData.parameterIds.size(), 1); - QCOMPARE(parameter.id(), cloneData.parameterIds.first()); - QCOMPARE(renderPass.id(), creationChangeData->subjectId()); - QCOMPARE(renderPass.isEnabled(), false); - QCOMPARE(renderPass.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(renderPass.metaObject(), creationChangeData->metaObject()); - } - } - void checkShaderProgramBookkeeping() { // GIVEN @@ -304,11 +229,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &renderPass); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &renderPass); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -317,8 +241,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -337,11 +260,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &renderPass); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &renderPass); - arbiter.events.clear(); + arbiter.clear(); } { @@ -350,11 +272,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &renderPass); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &renderPass); - arbiter.events.clear(); + arbiter.clear(); } } @@ -373,11 +294,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &renderPass); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &renderPass); - arbiter.events.clear(); + arbiter.clear(); } { @@ -386,11 +306,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &renderPass); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &renderPass); - arbiter.events.clear(); + arbiter.clear(); } } @@ -409,11 +328,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &renderPass); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &renderPass); - arbiter.events.clear(); + arbiter.clear(); } { @@ -422,11 +340,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &renderPass); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &renderPass); - arbiter.events.clear(); + arbiter.clear(); } } diff --git a/tests/auto/render/qrenderpassfilter/tst_qrenderpassfilter.cpp b/tests/auto/render/qrenderpassfilter/tst_qrenderpassfilter.cpp index d12f04e33..6441119f2 100644 --- a/tests/auto/render/qrenderpassfilter/tst_qrenderpassfilter.cpp +++ b/tests/auto/render/qrenderpassfilter/tst_qrenderpassfilter.cpp @@ -30,14 +30,13 @@ #include #include #include -#include #include #include #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QRenderPassFilter: public QObject { @@ -53,90 +52,6 @@ private Q_SLOTS: QCOMPARE(defaultRenderPassFilter->parameters().count(), 0); } - void checkCloning_data() - { - QTest::addColumn("renderPassFilter"); - QTest::addColumn >("parameters"); - QTest::addColumn >("filterKeys"); - - Qt3DRender::QRenderPassFilter *defaultConstructed = new Qt3DRender::QRenderPassFilter(); - QTest::newRow("defaultConstructed") << defaultConstructed << QVector() << QVector(); - - Qt3DRender::QRenderPassFilter *renderPassFilterWithParams = new Qt3DRender::QRenderPassFilter(); - Qt3DRender::QParameter *parameter1 = new Qt3DRender::QParameter(QStringLiteral("displacement"), 454.0f); - Qt3DRender::QParameter *parameter2 = new Qt3DRender::QParameter(QStringLiteral("torque"), 650); - QVector params1 = QVector() << parameter1 << parameter2; - renderPassFilterWithParams->addParameter(parameter1); - renderPassFilterWithParams->addParameter(parameter2); - QTest::newRow("renderPassFilterWithParams") << renderPassFilterWithParams << params1 << QVector(); - - Qt3DRender::QRenderPassFilter *renderPassFilterWithAnnotations = new Qt3DRender::QRenderPassFilter(); - Qt3DRender::QFilterKey *filterKey1 = new Qt3DRender::QFilterKey(); - Qt3DRender::QFilterKey *filterKey2 = new Qt3DRender::QFilterKey(); - filterKey1->setName(QStringLiteral("hasSuperCharger")); - filterKey1->setValue(true); - filterKey1->setName(QStringLiteral("hasNitroKit")); - filterKey1->setValue(false); - QVector filterKeys1 = QVector() << filterKey1 << filterKey2; - renderPassFilterWithAnnotations->addMatch(filterKey1); - renderPassFilterWithAnnotations->addMatch(filterKey2); - QTest::newRow("renderPassFilterWithAnnotations") << renderPassFilterWithAnnotations << QVector() << filterKeys1; - - Qt3DRender::QRenderPassFilter *renderPassFilterWithParamsAndAnnotations = new Qt3DRender::QRenderPassFilter(); - Qt3DRender::QParameter *parameter3 = new Qt3DRender::QParameter(QStringLiteral("displacement"), 383.0f); - Qt3DRender::QParameter *parameter4 = new Qt3DRender::QParameter(QStringLiteral("torque"), 555); - Qt3DRender::QFilterKey *filterKey3 = new Qt3DRender::QFilterKey(); - Qt3DRender::QFilterKey *filterKey4 = new Qt3DRender::QFilterKey(); - filterKey3->setName(QStringLiteral("hasSuperCharger")); - filterKey3->setValue(false); - filterKey4->setName(QStringLiteral("hasNitroKit")); - filterKey4->setValue(true); - QVector params2 = QVector() << parameter3 << parameter4; - QVector filterKeys2 = QVector() << filterKey3 << filterKey4; - renderPassFilterWithParamsAndAnnotations->addParameter(parameter3); - renderPassFilterWithParamsAndAnnotations->addParameter(parameter4); - renderPassFilterWithParamsAndAnnotations->addMatch(filterKey3); - renderPassFilterWithParamsAndAnnotations->addMatch(filterKey4); - QTest::newRow("renderPassFilterWithParamsAndAnnotations") << renderPassFilterWithParamsAndAnnotations << params2 << filterKeys2 ; - } - - // TODO: Avoid cloning here - void checkCloning() - { - // GIVEN - QFETCH(Qt3DRender::QRenderPassFilter*, renderPassFilter); - QFETCH(QVector, parameters); - QFETCH(QVector, filterKeys); - - // THEN - QCOMPARE(renderPassFilter->parameters(), parameters); - QCOMPARE(renderPassFilter->matchAny(), filterKeys); - - // WHEN - // WHEN - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(renderPassFilter); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - // THEN - QCOMPARE(creationChanges.size(), 1 + renderPassFilter->parameters().size() + renderPassFilter->matchAny().size()); - - const Qt3DCore::QNodeCreatedChangePtr creationChangeData = - qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QRenderPassFilterData &cloneData = creationChangeData->data; - - // THEN - QCOMPARE(renderPassFilter->id(), creationChangeData->subjectId()); - QCOMPARE(renderPassFilter->isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(renderPassFilter->metaObject(), creationChangeData->metaObject()); - - QCOMPARE(renderPassFilter->matchAny().count(), cloneData.matchIds.count()); - QCOMPARE(renderPassFilter->parameters().count(), cloneData.parameterIds.count()); - - // TO DO: Add unit tests for QParameter / QFilterKey - - delete renderPassFilter; - } - void checkPropertyUpdates() { // GIVEN @@ -150,30 +65,27 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QVERIFY(arbiter.dirtyNodes.contains(renderPassFilter.data())); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QVERIFY(arbiter.dirtyNodes().contains(renderPassFilter.data())); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN renderPassFilter->addParameter(param1); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); // WHEN renderPassFilter->removeParameter(param1); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QVERIFY(arbiter.dirtyNodes.contains(renderPassFilter.data())); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QVERIFY(arbiter.dirtyNodes().contains(renderPassFilter.data())); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN Qt3DRender::QFilterKey *filterKey1 = new Qt3DRender::QFilterKey(); @@ -181,30 +93,27 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QVERIFY(arbiter.dirtyNodes.contains(renderPassFilter.data())); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QVERIFY(arbiter.dirtyNodes().contains(renderPassFilter.data())); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN renderPassFilter->addMatch(filterKey1); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); // WHEN renderPassFilter->removeMatch(filterKey1); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QVERIFY(arbiter.dirtyNodes.contains(renderPassFilter.data())); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QVERIFY(arbiter.dirtyNodes().contains(renderPassFilter.data())); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } void checkParameterBookkeeping() diff --git a/tests/auto/render/qrendersettings/tst_qrendersettings.cpp b/tests/auto/render/qrendersettings/tst_qrendersettings.cpp index b58ab0947..51c53610e 100644 --- a/tests/auto/render/qrendersettings/tst_qrendersettings.cpp +++ b/tests/auto/render/qrendersettings/tst_qrendersettings.cpp @@ -33,9 +33,7 @@ #include #include #include -#include -#include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QRenderSettings : public QObject { @@ -171,74 +169,6 @@ private Q_SLOTS: } - void checkCreationData() - { - // GIVEN - Qt3DRender::QRenderSettings renderSettings; - Qt3DRender::QPickingSettings *pickingSettings = renderSettings.pickingSettings(); - Qt3DRender::QViewport frameGraphRoot; - - renderSettings.setRenderPolicy(Qt3DRender::QRenderSettings::OnDemand); - renderSettings.setActiveFrameGraph(&frameGraphRoot); - pickingSettings->setPickMethod(Qt3DRender::QPickingSettings::TrianglePicking); - pickingSettings->setPickResultMode(Qt3DRender::QPickingSettings::AllPicks); - pickingSettings->setFaceOrientationPickingMode(Qt3DRender::QPickingSettings::FrontAndBackFace); - pickingSettings->setWorldSpaceTolerance(5.f); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&renderSettings); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 2); // RenderSettings + PickingSettings (because it's a QNode) - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QRenderSettingsData cloneData = creationChangeData->data; - - QCOMPARE(renderSettings.pickingSettings()->pickMethod(), cloneData.pickMethod); - QCOMPARE(renderSettings.pickingSettings()->pickResultMode(), cloneData.pickResultMode); - QCOMPARE(renderSettings.pickingSettings()->faceOrientationPickingMode(), cloneData.faceOrientationPickingMode); - QCOMPARE(renderSettings.pickingSettings()->worldSpaceTolerance(), cloneData.pickWorldSpaceTolerance); - QCOMPARE(renderSettings.renderPolicy(), cloneData.renderPolicy); - QCOMPARE(renderSettings.activeFrameGraph()->id(), cloneData.activeFrameGraphId); - QCOMPARE(renderSettings.id(), creationChangeData->subjectId()); - QCOMPARE(renderSettings.isEnabled(), true); - QCOMPARE(renderSettings.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(renderSettings.metaObject(), creationChangeData->metaObject()); - } - - // WHEN - renderSettings.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&renderSettings); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 2); // RenderSettings + PickingSettings (because it's a QNode) - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QRenderSettingsData cloneData = creationChangeData->data; - - QCOMPARE(renderSettings.pickingSettings()->pickMethod(), cloneData.pickMethod); - QCOMPARE(renderSettings.pickingSettings()->pickResultMode(), cloneData.pickResultMode); - QCOMPARE(renderSettings.pickingSettings()->faceOrientationPickingMode(), cloneData.faceOrientationPickingMode); - QCOMPARE(renderSettings.renderPolicy(), cloneData.renderPolicy); - QCOMPARE(renderSettings.activeFrameGraph()->id(), cloneData.activeFrameGraphId); - QCOMPARE(renderSettings.id(), creationChangeData->subjectId()); - QCOMPARE(renderSettings.isEnabled(), false); - QCOMPARE(renderSettings.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(renderSettings.metaObject(), creationChangeData->metaObject()); - } - } - void checkRenderPolicyUpdate() { // GIVEN @@ -252,11 +182,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &renderSettings); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &renderSettings); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -265,8 +194,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -285,11 +213,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &renderSettings); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &renderSettings); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -298,8 +225,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -319,11 +245,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &renderSettings); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &renderSettings); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -332,8 +257,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -353,11 +277,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &renderSettings); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &renderSettings); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -366,8 +289,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -387,11 +309,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &renderSettings); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &renderSettings); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -400,8 +321,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -421,11 +341,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &renderSettings); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &renderSettings); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -434,8 +353,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } diff --git a/tests/auto/render/qrenderstate/tst_qrenderstate.cpp b/tests/auto/render/qrenderstate/tst_qrenderstate.cpp index fb212bc8f..f18488f9a 100644 --- a/tests/auto/render/qrenderstate/tst_qrenderstate.cpp +++ b/tests/auto/render/qrenderstate/tst_qrenderstate.cpp @@ -55,7 +55,7 @@ #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" using namespace Qt3DCore; using namespace Qt3DRender; @@ -201,9 +201,8 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), frontend1); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), frontend1); // WHEN backend1->syncFromFrontEnd(frontend1, false); @@ -211,7 +210,7 @@ private Q_SLOTS: // THEN QVERIFY(backend1->impl() == backend2->impl()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } void checkStencilUpdates_data() @@ -285,17 +284,14 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), frontend1); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), frontend1); // WHEN backend1->syncFromFrontEnd(frontend1, false); // THEN QVERIFY(backend1->impl() == backend2->impl()); - - arbiter.events.clear(); } }; diff --git a/tests/auto/render/qrenderstateset/tst_qrenderstateset.cpp b/tests/auto/render/qrenderstateset/tst_qrenderstateset.cpp index 39f0c3c72..39b45ee42 100644 --- a/tests/auto/render/qrenderstateset/tst_qrenderstateset.cpp +++ b/tests/auto/render/qrenderstateset/tst_qrenderstateset.cpp @@ -30,14 +30,13 @@ #include #include #include -#include #include #include #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class MyStateSet; class MyStateSetPrivate : public Qt3DRender::QRenderStatePrivate @@ -73,56 +72,6 @@ private Q_SLOTS: QVERIFY(defaultstateSet->renderStates().isEmpty()); } - void checkCloning_data() - { - QTest::addColumn("stateSet"); - QTest::addColumn >("states"); - - Qt3DRender::QRenderStateSet *defaultConstructed = new Qt3DRender::QRenderStateSet(); - QTest::newRow("defaultConstructed") << defaultConstructed << QVector(); - - Qt3DRender::QRenderStateSet *stateSetWithStates = new Qt3DRender::QRenderStateSet(); - Qt3DRender::QRenderState *state1 = new MyStateSet(); - Qt3DRender::QRenderState *state2 = new MyStateSet(); - QVector states = QVector() << state1 << state2; - stateSetWithStates->addRenderState(state1); - stateSetWithStates->addRenderState(state2); - QTest::newRow("stateSetWithStates") << stateSetWithStates << states; - } - - void checkCloning() - { - // GIVEN - QFETCH(Qt3DRender::QRenderStateSet*, stateSet); - QFETCH(QVector, states); - - // THEN - QCOMPARE(stateSet->renderStates(), states); - - // WHEN - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(stateSet); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - // THEN - QCOMPARE(creationChanges.size(), 1 + states.size()); - - const Qt3DCore::QNodeCreatedChangePtr creationChangeData = - qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QRenderStateSetData &cloneData = creationChangeData->data; - - QCOMPARE(stateSet->id(), creationChangeData->subjectId()); - QCOMPARE(stateSet->isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(stateSet->metaObject(), creationChangeData->metaObject()); - QCOMPARE(stateSet->renderStates().count(), cloneData.renderStateIds.count()); - - for (int i = 0, m = states.count(); i < m; ++i) { - Qt3DRender::QRenderState *sOrig = states.at(i); - QCOMPARE(sOrig->id(), cloneData.renderStateIds.at(i)); - } - - delete stateSet; - } - void checkPropertyUpdates() { // GIVEN @@ -136,29 +85,26 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QVERIFY(arbiter.dirtyNodes.contains(stateSet.data())); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QVERIFY(arbiter.dirtyNodes().contains(stateSet.data())); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN stateSet->addRenderState(state1); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); // WHEN stateSet->removeRenderState(state1); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QVERIFY(arbiter.dirtyNodes.contains(stateSet.data())); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QVERIFY(arbiter.dirtyNodes().contains(stateSet.data())); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } void checkRenderStateBookkeeping() diff --git a/tests/auto/render/qrendersurfaceselector/tst_qrendersurfaceselector.cpp b/tests/auto/render/qrendersurfaceselector/tst_qrendersurfaceselector.cpp index a30617781..fa75e3580 100644 --- a/tests/auto/render/qrendersurfaceselector/tst_qrendersurfaceselector.cpp +++ b/tests/auto/render/qrendersurfaceselector/tst_qrendersurfaceselector.cpp @@ -33,9 +33,7 @@ #include #include #include -#include -#include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QRenderSurfaceSelector: public QObject { @@ -184,68 +182,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - QWindow newValue; - Qt3DRender::QRenderSurfaceSelector renderSurfaceSelector; - - renderSurfaceSelector.setSurface(&newValue); - renderSurfaceSelector.setExternalRenderTargetSize(QSize(128, 128)); - renderSurfaceSelector.setSurfacePixelRatio(25.0f); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&renderSurfaceSelector); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QRenderSurfaceSelectorData cloneData = creationChangeData->data; - - QCOMPARE(renderSurfaceSelector.surface(), cloneData.surface.data()); - QCOMPARE(renderSurfaceSelector.externalRenderTargetSize(), cloneData.externalRenderTargetSize); - QCOMPARE(renderSurfaceSelector.surfacePixelRatio(), cloneData.surfacePixelRatio); - QCOMPARE(renderSurfaceSelector.id(), creationChangeData->subjectId()); - QCOMPARE(renderSurfaceSelector.isEnabled(), true); - QCOMPARE(renderSurfaceSelector.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(renderSurfaceSelector.metaObject(), creationChangeData->metaObject()); - } - - // WHEN - renderSurfaceSelector.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&renderSurfaceSelector); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QRenderSurfaceSelectorData cloneData = creationChangeData->data; - - QCOMPARE(renderSurfaceSelector.surface(), cloneData.surface.data()); - QCOMPARE(renderSurfaceSelector.externalRenderTargetSize(), cloneData.externalRenderTargetSize); - QCOMPARE(renderSurfaceSelector.surfacePixelRatio(), cloneData.surfacePixelRatio); - QCOMPARE(renderSurfaceSelector.id(), creationChangeData->subjectId()); - QCOMPARE(renderSurfaceSelector.isEnabled(), false); - QCOMPARE(renderSurfaceSelector.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(renderSurfaceSelector.metaObject(), creationChangeData->metaObject()); - } - - // Prevents crashes with temporary window being destroyed - renderSurfaceSelector.setSurface(nullptr); - } - void checkSurfaceUpdate() { // GIVEN @@ -260,11 +196,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &renderSurfaceSelector); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &renderSurfaceSelector); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -273,8 +208,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } // Prevents crashes with temporary window being destroyed @@ -294,11 +228,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &renderSurfaceSelector); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &renderSurfaceSelector); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -307,8 +240,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -326,11 +258,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &renderSurfaceSelector); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &renderSurfaceSelector); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -339,8 +270,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } diff --git a/tests/auto/render/qrendertarget/tst_qrendertarget.cpp b/tests/auto/render/qrendertarget/tst_qrendertarget.cpp index ad9d5f329..3377e6f8f 100644 --- a/tests/auto/render/qrendertarget/tst_qrendertarget.cpp +++ b/tests/auto/render/qrendertarget/tst_qrendertarget.cpp @@ -32,9 +32,7 @@ #include #include #include -#include -#include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QRenderTarget : public QObject { @@ -95,62 +93,6 @@ private Q_SLOTS: QCOMPARE(renderTarget.outputs().size(), 0); } - void checkCreationData() - { - // GIVEN - Qt3DRender::QRenderTarget renderTarget; - Qt3DRender::QRenderTargetOutput output; - - renderTarget.addOutput(&output); - - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&renderTarget); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 2); // Target + Output - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QRenderTargetData cloneData = creationChangeData->data; - - QCOMPARE(renderTarget.id(), creationChangeData->subjectId()); - QCOMPARE(renderTarget.isEnabled(), true); - QCOMPARE(renderTarget.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(renderTarget.metaObject(), creationChangeData->metaObject()); - QCOMPARE(renderTarget.outputs().size(), cloneData.outputIds.size()); - QCOMPARE(output.id(), cloneData.outputIds.first()); - } - - // WHEN - renderTarget.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&renderTarget); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 2); // Target + Output - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QRenderTargetData cloneData = creationChangeData->data; - - QCOMPARE(renderTarget.id(), creationChangeData->subjectId()); - QCOMPARE(renderTarget.isEnabled(), false); - QCOMPARE(renderTarget.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(renderTarget.metaObject(), creationChangeData->metaObject()); - QCOMPARE(renderTarget.outputs().size(), cloneData.outputIds.size()); - QCOMPARE(output.id(), cloneData.outputIds.first()); - } - } - void checkRenderTargetOutputUpdate() { // GIVEN @@ -165,11 +107,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &renderTarget); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &renderTarget); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -178,11 +119,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &renderTarget); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &renderTarget); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } } }; diff --git a/tests/auto/render/qrendertargetoutput/tst_qrendertargetoutput.cpp b/tests/auto/render/qrendertargetoutput/tst_qrendertargetoutput.cpp index 55733f0f3..0fed1d7bb 100644 --- a/tests/auto/render/qrendertargetoutput/tst_qrendertargetoutput.cpp +++ b/tests/auto/render/qrendertargetoutput/tst_qrendertargetoutput.cpp @@ -34,9 +34,7 @@ #include #include #include -#include -#include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QRenderTargetOutput : public QObject { @@ -170,69 +168,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - Qt3DRender::QRenderTargetOutput renderTargetOutput; - - renderTargetOutput.setAttachmentPoint(Qt3DRender::QRenderTargetOutput::Color5); - renderTargetOutput.setMipLevel(10); - renderTargetOutput.setLayer(2); - renderTargetOutput.setFace(Qt3DRender::QAbstractTexture::CubeMapNegativeY); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&renderTargetOutput); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QRenderTargetOutputData cloneData = creationChangeData->data; - - QCOMPARE(renderTargetOutput.attachmentPoint(), cloneData.attachmentPoint); - QCOMPARE(Qt3DCore::QNodeId(), cloneData.textureId); - QCOMPARE(renderTargetOutput.mipLevel(), cloneData.mipLevel); - QCOMPARE(renderTargetOutput.layer(), cloneData.layer); - QCOMPARE(renderTargetOutput.face(), cloneData.face); - QCOMPARE(renderTargetOutput.id(), creationChangeData->subjectId()); - QCOMPARE(renderTargetOutput.isEnabled(), true); - QCOMPARE(renderTargetOutput.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(renderTargetOutput.metaObject(), creationChangeData->metaObject()); - } - - // WHEN - renderTargetOutput.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&renderTargetOutput); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QRenderTargetOutputData cloneData = creationChangeData->data; - - QCOMPARE(renderTargetOutput.attachmentPoint(), cloneData.attachmentPoint); - QCOMPARE(Qt3DCore::QNodeId(), cloneData.textureId); - QCOMPARE(renderTargetOutput.mipLevel(), cloneData.mipLevel); - QCOMPARE(renderTargetOutput.layer(), cloneData.layer); - QCOMPARE(renderTargetOutput.face(), cloneData.face); - QCOMPARE(renderTargetOutput.id(), creationChangeData->subjectId()); - QCOMPARE(renderTargetOutput.isEnabled(), false); - QCOMPARE(renderTargetOutput.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(renderTargetOutput.metaObject(), creationChangeData->metaObject()); - } - } - void checkAttachmentPointUpdate() { // GIVEN @@ -246,11 +181,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &renderTargetOutput); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &renderTargetOutput); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -259,8 +193,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -279,11 +212,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &renderTargetOutput); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &renderTargetOutput); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -292,8 +224,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -311,11 +242,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &renderTargetOutput); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &renderTargetOutput); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -324,8 +254,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -343,11 +272,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &renderTargetOutput); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &renderTargetOutput); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -356,8 +284,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -375,11 +302,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &renderTargetOutput); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &renderTargetOutput); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -388,8 +314,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } diff --git a/tests/auto/render/qrendertargetselector/tst_qrendertargetselector.cpp b/tests/auto/render/qrendertargetselector/tst_qrendertargetselector.cpp index 7bacc3b6d..af5b29bd2 100644 --- a/tests/auto/render/qrendertargetselector/tst_qrendertargetselector.cpp +++ b/tests/auto/render/qrendertargetselector/tst_qrendertargetselector.cpp @@ -30,12 +30,11 @@ #include #include #include -#include #include #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QRenderTargetSelector: public QObject { @@ -51,59 +50,6 @@ private Q_SLOTS: QCOMPARE(defaultTargetSelector->outputs().count(), 0); } - void checkCloning_data() - { - QTest::addColumn("renderTargetSelector"); - QTest::addColumn >("outputs"); - QTest::addColumn("target"); - - Qt3DRender::QRenderTargetSelector *defaultConstructed = new Qt3DRender::QRenderTargetSelector(); - QTest::newRow("defaultConstructed") << defaultConstructed << QVector() << static_cast(nullptr); - - Qt3DRender::QRenderTargetSelector *renderTargetSelectorWithTarget = new Qt3DRender::QRenderTargetSelector(); - Qt3DRender::QRenderTarget *target1 = new Qt3DRender::QRenderTarget(); - renderTargetSelectorWithTarget->setTarget(target1); - QTest::newRow("renderTargetSelectorWithTarget") << renderTargetSelectorWithTarget << QVector() << target1; - - Qt3DRender::QRenderTargetSelector *renderTargetSelectorWithTargetAndBuffers = new Qt3DRender::QRenderTargetSelector(); - Qt3DRender::QRenderTarget *target2 = new Qt3DRender::QRenderTarget(); - renderTargetSelectorWithTargetAndBuffers->setTarget(target2); - QVector attachmentPoints = QVector() << Qt3DRender::QRenderTargetOutput::Color0 << Qt3DRender::QRenderTargetOutput::Depth; - renderTargetSelectorWithTargetAndBuffers->setOutputs(attachmentPoints); - QTest::newRow("renderTargetSelectorWithTargetAndDrawBuffers") << renderTargetSelectorWithTargetAndBuffers << attachmentPoints << target2; - } - - void checkCloning() - { - // GIVEN - QFETCH(Qt3DRender::QRenderTargetSelector*, renderTargetSelector); - QFETCH(QVector, outputs); - QFETCH(Qt3DRender::QRenderTarget *, target); - - // THEN - QCOMPARE(renderTargetSelector->outputs(), outputs); - QCOMPARE(renderTargetSelector->target(), target); - - // WHEN - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(renderTargetSelector); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - // THEN - QCOMPARE(creationChanges.size(), 1 + (renderTargetSelector->target() ? 1 : 0)); - - const Qt3DCore::QNodeCreatedChangePtr creationChangeData = - qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QRenderTargetSelectorData &cloneData = creationChangeData->data; - - // THEN - QCOMPARE(renderTargetSelector->id(), creationChangeData->subjectId()); - QCOMPARE(renderTargetSelector->isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(renderTargetSelector->metaObject(), creationChangeData->metaObject()); - QCOMPARE(renderTargetSelector->target() ? renderTargetSelector->target()->id() : Qt3DCore::QNodeId(), cloneData.targetId); - - delete renderTargetSelector; - } - void checkPropertyUpdates() { // GIVEN @@ -117,30 +63,27 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), renderTargetSelector.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), renderTargetSelector.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN renderTargetSelector->setTarget(target); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); // WHEN renderTargetSelector->setTarget(nullptr); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), renderTargetSelector.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), renderTargetSelector.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN QVector outputs; @@ -149,30 +92,27 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), renderTargetSelector.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), renderTargetSelector.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN renderTargetSelector->setOutputs(outputs); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); // WHEN renderTargetSelector->setOutputs(QVector()); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), renderTargetSelector.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), renderTargetSelector.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } void checkRenderTargetBookkeeping() diff --git a/tests/auto/render/qscene2d/tst_qscene2d.cpp b/tests/auto/render/qscene2d/tst_qscene2d.cpp index 583da6eaf..3a9c0bc71 100644 --- a/tests/auto/render/qscene2d/tst_qscene2d.cpp +++ b/tests/auto/render/qscene2d/tst_qscene2d.cpp @@ -32,9 +32,7 @@ #include #include #include -#include -#include -#include "testpostmanarbiter.h" +#include "testarbiter.h" using namespace Qt3DRender::Quick; @@ -148,65 +146,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - Qt3DRender::Quick::QScene2D scene2d; - QScopedPointer output(new Qt3DRender::QRenderTargetOutput()); - - scene2d.setOutput(output.data()); - scene2d.setRenderPolicy(QScene2D::SingleShot); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&scene2d); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::Quick::QScene2DData cloneData = creationChangeData->data; - - QCOMPARE(scene2d.output()->id(), cloneData.output); - QCOMPARE(scene2d.renderPolicy(), cloneData.renderPolicy); - QCOMPARE(scene2d.id(), creationChangeData->subjectId()); - QCOMPARE(scene2d.isEnabled(), true); - QCOMPARE(scene2d.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(scene2d.metaObject(), creationChangeData->metaObject()); - QCOMPARE(scene2d.isMouseEnabled(), cloneData.mouseEnabled); - } - - // WHEN - scene2d.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&scene2d); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::Quick::QScene2DData cloneData = creationChangeData->data; - - QCOMPARE(scene2d.output()->id(), cloneData.output); - QCOMPARE(scene2d.renderPolicy(), cloneData.renderPolicy); - QCOMPARE(scene2d.id(), creationChangeData->subjectId()); - QCOMPARE(scene2d.isEnabled(), false); - QCOMPARE(scene2d.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(scene2d.metaObject(), creationChangeData->metaObject()); - } - } - void checkOutputUpdate() { // GIVEN @@ -221,11 +160,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &scene2d); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &scene2d); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -234,8 +172,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -253,11 +190,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &scene2d); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &scene2d); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -266,8 +202,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -285,11 +220,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &scene2d); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &scene2d); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -298,8 +232,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } diff --git a/tests/auto/render/qsceneloader/tst_qsceneloader.cpp b/tests/auto/render/qsceneloader/tst_qsceneloader.cpp index 79ca6a291..b237f2dd4 100644 --- a/tests/auto/render/qsceneloader/tst_qsceneloader.cpp +++ b/tests/auto/render/qsceneloader/tst_qsceneloader.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include #include @@ -41,7 +40,7 @@ #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QSceneLoader: public QObject { @@ -60,62 +59,6 @@ private Q_SLOTS: QVERIFY(static_cast(Qt3DCore::QNodePrivate::get(&sceneLoader))->m_subTreeRoot == nullptr); } - void checkCreationData() - { - // GIVEN - Qt3DRender::QSceneLoader sceneLoader; - const QUrl sceneUrl = QUrl(QStringLiteral("LA ConventionCenter")); - sceneLoader.setSource(sceneUrl); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&sceneLoader); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = - qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QSceneLoaderData cloneData = creationChangeData->data; - - QCOMPARE(sceneLoader.id(), creationChangeData->subjectId()); - QCOMPARE(sceneLoader.isEnabled(), true); - QCOMPARE(sceneLoader.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(sceneLoader.metaObject(), creationChangeData->metaObject()); - QCOMPARE(sceneLoader.source(), sceneUrl); - QCOMPARE(sceneLoader.source(), cloneData.source); - } - - // WHEN - sceneLoader.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&sceneLoader); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = - qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QSceneLoaderData cloneData = creationChangeData->data; - - QCOMPARE(sceneLoader.id(), creationChangeData->subjectId()); - QCOMPARE(sceneLoader.isEnabled(), false); - QCOMPARE(sceneLoader.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(sceneLoader.metaObject(), creationChangeData->metaObject()); - QCOMPARE(sceneLoader.source(), sceneUrl); - QCOMPARE(sceneLoader.source(), cloneData.source); - } - } - void checkSourcePropertyUpdate() { // GIVEN @@ -129,11 +72,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), sceneLoader.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), sceneLoader.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } void checkEntities() diff --git a/tests/auto/render/qscreenraycaster/tst_qscreenraycaster.cpp b/tests/auto/render/qscreenraycaster/tst_qscreenraycaster.cpp index 2fe515436..e12872d6c 100644 --- a/tests/auto/render/qscreenraycaster/tst_qscreenraycaster.cpp +++ b/tests/auto/render/qscreenraycaster/tst_qscreenraycaster.cpp @@ -32,7 +32,7 @@ #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class MyRayCaster : public Qt3DRender::QScreenRayCaster { @@ -44,11 +44,6 @@ public: qRegisterMetaType("Hits"); } - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) final - { - Qt3DRender::QScreenRayCaster::sceneChangeEvent(change); - } - private: friend class tst_RayCaster; }; @@ -103,11 +98,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), rayCaster.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), rayCaster.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } void checkBackendUpdates_data() diff --git a/tests/auto/render/qsetfence/tst_qsetfence.cpp b/tests/auto/render/qsetfence/tst_qsetfence.cpp index ad92e9fe0..0c74c6e83 100644 --- a/tests/auto/render/qsetfence/tst_qsetfence.cpp +++ b/tests/auto/render/qsetfence/tst_qsetfence.cpp @@ -37,25 +37,17 @@ ** ****************************************************************************/ -// TODO Remove in Qt6 -#include -QT_WARNING_DISABLE_DEPRECATED - #include #include #include #include #include -#include -#include -#include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class MySetFence : public Qt3DRender::QSetFence { public: - using Qt3DRender::QSetFence::sceneChangeEvent; }; class tst_QSetFence : public QObject @@ -95,10 +87,8 @@ private Q_SLOTS: QVERIFY(spy.isValid()); // THEN - Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - valueChange->setPropertyName("handleType"); - valueChange->setValue(QVariant::fromValue(Qt3DRender::QSetFence::OpenGLFenceId)); - setFence.sceneChangeEvent(valueChange); + auto *dNode = static_cast(Qt3DRender::QSetFencePrivate::get(&setFence)); + dNode->setHandleType(Qt3DRender::QSetFence::OpenGLFenceId); // THEN QCOMPARE(setFence.handleType(), Qt3DRender::QSetFence::OpenGLFenceId); @@ -106,7 +96,7 @@ private Q_SLOTS: // WHEN spy.clear(); - setFence.sceneChangeEvent(valueChange); + dNode->setHandleType(Qt3DRender::QSetFence::OpenGLFenceId); // THEN QCOMPARE(spy.count(), 0); @@ -120,10 +110,8 @@ private Q_SLOTS: QVERIFY(spy.isValid()); // WHEN - Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - valueChange->setPropertyName("handle"); - valueChange->setValue(QVariant(984)); - setFence.sceneChangeEvent(valueChange); + auto *dNode = static_cast(Qt3DRender::QSetFencePrivate::get(&setFence)); + dNode->setHandle(QVariant(984)); // THEN QCOMPARE(setFence.handle(),QVariant(984)); @@ -131,60 +119,12 @@ private Q_SLOTS: // WHEN spy.clear(); - setFence.sceneChangeEvent(valueChange); + dNode->setHandle(QVariant(984)); // THEN QCOMPARE(spy.count(), 0); } } - - void checkCreationData() - { - // GIVEN - Qt3DRender::QSetFence setFence; - - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&setFence); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - - QCOMPARE(setFence.id(), creationChangeData->subjectId()); - QCOMPARE(setFence.isEnabled(), true); - QCOMPARE(setFence.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(setFence.metaObject(), creationChangeData->metaObject()); - } - - // WHEN - setFence.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&setFence); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - - QCOMPARE(setFence.id(), creationChangeData->subjectId()); - QCOMPARE(setFence.isEnabled(), false); - QCOMPARE(setFence.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(setFence.metaObject(), creationChangeData->metaObject()); - } - } - }; QTEST_MAIN(tst_QSetFence) diff --git a/tests/auto/render/qshaderimage/tst_qshaderimage.cpp b/tests/auto/render/qshaderimage/tst_qshaderimage.cpp index 436d81192..cc5081063 100644 --- a/tests/auto/render/qshaderimage/tst_qshaderimage.cpp +++ b/tests/auto/render/qshaderimage/tst_qshaderimage.cpp @@ -43,9 +43,7 @@ #include #include #include -#include -#include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QShaderImage : public QObject { @@ -194,76 +192,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - Qt3DRender::QShaderImage shaderImage; - Qt3DRender::QTexture2D t; - - shaderImage.setTexture(&t); - shaderImage.setLayered(true); - shaderImage.setMipLevel(883); - shaderImage.setLayer(1584); - shaderImage.setAccess(Qt3DRender::QShaderImage::WriteOnly); - shaderImage.setFormat(Qt3DRender::QShaderImage::R32F); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&shaderImage); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - // ShaderImage + Texture creation - QCOMPARE(creationChanges.size(), 2); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QShaderImageData cloneData = creationChangeData->data; - - QCOMPARE(shaderImage.texture()->id(), cloneData.textureId); - QCOMPARE(shaderImage.layered(), cloneData.layered); - QCOMPARE(shaderImage.mipLevel(), cloneData.mipLevel); - QCOMPARE(shaderImage.layer(), cloneData.layer); - QCOMPARE(shaderImage.access(), cloneData.access); - QCOMPARE(shaderImage.format(), cloneData.format); - QCOMPARE(shaderImage.id(), creationChangeData->subjectId()); - QCOMPARE(shaderImage.isEnabled(), true); - QCOMPARE(shaderImage.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(shaderImage.metaObject(), creationChangeData->metaObject()); - } - - // WHEN - shaderImage.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&shaderImage); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - // ShaderImage + Texture creation - QCOMPARE(creationChanges.size(), 2); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QShaderImageData cloneData = creationChangeData->data; - - QCOMPARE(shaderImage.texture()->id(), cloneData.textureId); - QCOMPARE(shaderImage.layered(), cloneData.layered); - QCOMPARE(shaderImage.mipLevel(), cloneData.mipLevel); - QCOMPARE(shaderImage.layer(), cloneData.layer); - QCOMPARE(shaderImage.access(), cloneData.access); - QCOMPARE(shaderImage.format(), cloneData.format); - QCOMPARE(shaderImage.id(), creationChangeData->subjectId()); - QCOMPARE(shaderImage.isEnabled(), false); - QCOMPARE(shaderImage.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(shaderImage.metaObject(), creationChangeData->metaObject()); - } - } - void checkTextureUpdate() { // GIVEN @@ -278,11 +206,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &shaderImage); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &shaderImage); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -291,8 +218,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -310,11 +236,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &shaderImage); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &shaderImage); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -323,8 +248,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -342,11 +266,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &shaderImage); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &shaderImage); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -355,8 +278,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -374,11 +296,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &shaderImage); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &shaderImage); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -387,8 +308,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -406,11 +326,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &shaderImage); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &shaderImage); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -419,8 +338,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -438,11 +356,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &shaderImage); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &shaderImage); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -451,8 +368,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } diff --git a/tests/auto/render/qshaderprogram/tst_qshaderprogram.cpp b/tests/auto/render/qshaderprogram/tst_qshaderprogram.cpp index 15be26e8e..b7aa7f8de 100644 --- a/tests/auto/render/qshaderprogram/tst_qshaderprogram.cpp +++ b/tests/auto/render/qshaderprogram/tst_qshaderprogram.cpp @@ -26,19 +26,12 @@ ** ****************************************************************************/ -// TODO Remove in Qt6 -#include -QT_WARNING_DISABLE_DEPRECATED - #include #include #include #include #include -#include -#include -#include -#include "testpostmanarbiter.h" +#include "testarbiter.h" // We need to call QShaderProgram::sceneChangeEvent class tst_QShaderProgram : public Qt3DRender::QShaderProgram @@ -211,75 +204,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - Qt3DRender::QShaderProgram shaderProgram; - - shaderProgram.setVertexShaderCode(QByteArrayLiteral("Vertex")); - shaderProgram.setTessellationControlShaderCode(QByteArrayLiteral("TesselControl")); - shaderProgram.setTessellationEvaluationShaderCode(QByteArrayLiteral("TesselEval")); - shaderProgram.setGeometryShaderCode(QByteArrayLiteral("Geometry")); - shaderProgram.setFragmentShaderCode(QByteArrayLiteral("Fragment")); - shaderProgram.setComputeShaderCode(QByteArrayLiteral("Compute")); - shaderProgram.setFormat(QShaderProgram::SPIRV); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&shaderProgram); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QShaderProgramData cloneData = creationChangeData->data; - - QCOMPARE(shaderProgram.vertexShaderCode(), cloneData.vertexShaderCode); - QCOMPARE(shaderProgram.tessellationControlShaderCode(), cloneData.tessellationControlShaderCode); - QCOMPARE(shaderProgram.tessellationEvaluationShaderCode(), cloneData.tessellationEvaluationShaderCode); - QCOMPARE(shaderProgram.geometryShaderCode(), cloneData.geometryShaderCode); - QCOMPARE(shaderProgram.fragmentShaderCode(), cloneData.fragmentShaderCode); - QCOMPARE(shaderProgram.computeShaderCode(), cloneData.computeShaderCode); - QCOMPARE(shaderProgram.format(), cloneData.format); - QCOMPARE(shaderProgram.id(), creationChangeData->subjectId()); - QCOMPARE(shaderProgram.isEnabled(), true); - QCOMPARE(shaderProgram.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(shaderProgram.metaObject(), creationChangeData->metaObject()); - } - - // WHEN - shaderProgram.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&shaderProgram); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QShaderProgramData cloneData = creationChangeData->data; - - QCOMPARE(shaderProgram.vertexShaderCode(), cloneData.vertexShaderCode); - QCOMPARE(shaderProgram.tessellationControlShaderCode(), cloneData.tessellationControlShaderCode); - QCOMPARE(shaderProgram.tessellationEvaluationShaderCode(), cloneData.tessellationEvaluationShaderCode); - QCOMPARE(shaderProgram.geometryShaderCode(), cloneData.geometryShaderCode); - QCOMPARE(shaderProgram.fragmentShaderCode(), cloneData.fragmentShaderCode); - QCOMPARE(shaderProgram.computeShaderCode(), cloneData.computeShaderCode); - QCOMPARE(shaderProgram.id(), creationChangeData->subjectId()); - QCOMPARE(shaderProgram.isEnabled(), false); - QCOMPARE(shaderProgram.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(shaderProgram.metaObject(), creationChangeData->metaObject()); - } - } - void checkVertexShaderCodeUpdate() { // GIVEN @@ -293,11 +217,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &shaderProgram); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &shaderProgram); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -306,8 +229,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -325,11 +247,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &shaderProgram); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &shaderProgram); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -338,8 +259,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -357,11 +277,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &shaderProgram); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &shaderProgram); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -370,8 +289,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -389,11 +307,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &shaderProgram); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &shaderProgram); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -402,8 +319,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -421,11 +337,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &shaderProgram); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &shaderProgram); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -434,8 +349,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -453,11 +367,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &shaderProgram); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &shaderProgram); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -466,8 +379,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -484,23 +396,21 @@ private Q_SLOTS: QVERIFY(spy.isValid()); // WHEN - Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - valueChange->setPropertyName("log"); - valueChange->setValue(QVariant::fromValue(logValue)); - sceneChangeEvent(valueChange); + auto *dNode = static_cast(Qt3DCore::QNodePrivate::get(this)); + dNode->setLog(logValue); // THEN QCOMPARE(spy.count(), 1); - QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); QCOMPARE(log(), logValue); // WHEN spy.clear(); - sceneChangeEvent(valueChange); + dNode->setLog(logValue); // THEN QCOMPARE(spy.count(), 0); - QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); QCOMPARE(log(), logValue); // Cleanup @@ -520,23 +430,21 @@ private Q_SLOTS: QVERIFY(spy.isValid()); // WHEN - Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId())); - valueChange->setPropertyName("status"); - valueChange->setValue(QVariant::fromValue(newStatus)); - sceneChangeEvent(valueChange); + auto *dNode = static_cast(Qt3DCore::QNodePrivate::get(this)); + dNode->setStatus(newStatus); // THEN QCOMPARE(spy.count(), 1); - QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); QCOMPARE(status(), newStatus); // WHEN spy.clear(); - sceneChangeEvent(valueChange); + dNode->setStatus(newStatus); // THEN QCOMPARE(spy.count(), 0); - QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); QCOMPARE(status(), newStatus); // Cleanup @@ -581,7 +489,7 @@ private Q_SLOTS: // THEN QCOMPARE(spy.count(), 1); - QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 1); spy.clear(); } @@ -593,7 +501,7 @@ private Q_SLOTS: // THEN QCOMPARE(spy.count(), 0); - QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 1); } } diff --git a/tests/auto/render/qshaderprogrambuilder/tst_qshaderprogrambuilder.cpp b/tests/auto/render/qshaderprogrambuilder/tst_qshaderprogrambuilder.cpp index 851316e60..484eca943 100644 --- a/tests/auto/render/qshaderprogrambuilder/tst_qshaderprogrambuilder.cpp +++ b/tests/auto/render/qshaderprogrambuilder/tst_qshaderprogrambuilder.cpp @@ -33,10 +33,7 @@ #include #include #include -#include -#include -#include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QShaderProgramBuilder : public Qt3DRender::QShaderProgramBuilder { @@ -264,79 +261,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - Qt3DRender::QShaderProgramBuilder builder; - - builder.setShaderProgram(new Qt3DRender::QShaderProgram(&builder)); - builder.setEnabledLayers({"foo", "bar"}); - builder.setVertexShaderGraph(QUrl::fromEncoded("qrc:/vertex.json")); - builder.setTessellationControlShaderGraph(QUrl::fromEncoded("qrc:/tesscontrol.json")); - builder.setTessellationEvaluationShaderGraph(QUrl::fromEncoded("qrc:/tesseval.json")); - builder.setGeometryShaderGraph(QUrl::fromEncoded("qrc:/geometry.json")); - builder.setFragmentShaderGraph(QUrl::fromEncoded("qrc:/fragment.json")); - builder.setComputeShaderGraph(QUrl::fromEncoded("qrc:/compute.json")); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&builder); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 2); // second one is for the shader program child - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QShaderProgramBuilderData cloneData = creationChangeData->data; - - QCOMPARE(builder.shaderProgram()->id(), cloneData.shaderProgramId); - QCOMPARE(builder.enabledLayers(), cloneData.enabledLayers); - QCOMPARE(builder.vertexShaderGraph(), cloneData.vertexShaderGraph); - QCOMPARE(builder.tessellationControlShaderGraph(), cloneData.tessellationControlShaderGraph); - QCOMPARE(builder.tessellationEvaluationShaderGraph(), cloneData.tessellationEvaluationShaderGraph); - QCOMPARE(builder.geometryShaderGraph(), cloneData.geometryShaderGraph); - QCOMPARE(builder.fragmentShaderGraph(), cloneData.fragmentShaderGraph); - QCOMPARE(builder.computeShaderGraph(), cloneData.computeShaderGraph); - QCOMPARE(builder.id(), creationChangeData->subjectId()); - QCOMPARE(builder.isEnabled(), true); - QCOMPARE(builder.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(builder.metaObject(), creationChangeData->metaObject()); - } - - // WHEN - builder.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&builder); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 2); // second one is for the shader program child - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QShaderProgramBuilderData cloneData = creationChangeData->data; - - QCOMPARE(builder.shaderProgram()->id(), cloneData.shaderProgramId); - QCOMPARE(builder.enabledLayers(), cloneData.enabledLayers); - QCOMPARE(builder.vertexShaderGraph(), cloneData.vertexShaderGraph); - QCOMPARE(builder.tessellationControlShaderGraph(), cloneData.tessellationControlShaderGraph); - QCOMPARE(builder.tessellationEvaluationShaderGraph(), cloneData.tessellationEvaluationShaderGraph); - QCOMPARE(builder.geometryShaderGraph(), cloneData.geometryShaderGraph); - QCOMPARE(builder.fragmentShaderGraph(), cloneData.fragmentShaderGraph); - QCOMPARE(builder.computeShaderGraph(), cloneData.computeShaderGraph); - QCOMPARE(builder.id(), creationChangeData->subjectId()); - QCOMPARE(builder.isEnabled(), false); - QCOMPARE(builder.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(builder.metaObject(), creationChangeData->metaObject()); - } - } - void checkShaderProgramUpdate() { // GIVEN @@ -351,11 +275,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &builder); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &builder); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -364,8 +287,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -383,11 +305,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &builder); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &builder); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -396,8 +317,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -414,11 +334,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &builder); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &builder); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -427,8 +346,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -446,11 +364,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &builder); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &builder); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -459,8 +376,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -478,11 +394,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &builder); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &builder); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -491,8 +406,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -510,11 +424,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &builder); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &builder); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -523,8 +436,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -542,11 +454,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &builder); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &builder); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -555,8 +466,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -574,11 +484,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &builder); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &builder); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -587,8 +496,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } diff --git a/tests/auto/render/qsharedgltexture/tst_qsharedgltexture.cpp b/tests/auto/render/qsharedgltexture/tst_qsharedgltexture.cpp index 3187dbd52..f7185320b 100644 --- a/tests/auto/render/qsharedgltexture/tst_qsharedgltexture.cpp +++ b/tests/auto/render/qsharedgltexture/tst_qsharedgltexture.cpp @@ -35,9 +35,7 @@ QT_WARNING_DISABLE_DEPRECATED #include #include #include -#include -#include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QSharedGLTexture : public QObject { @@ -81,58 +79,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - Qt3DRender::QSharedGLTexture glTexture; - - glTexture.setTextureId(1200); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&glTexture); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QAbstractTextureData cloneData = creationChangeData->data; - - QCOMPARE(glTexture.id(), creationChangeData->subjectId()); - QCOMPARE(glTexture.isEnabled(), true); - QCOMPARE(glTexture.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(glTexture.metaObject(), creationChangeData->metaObject()); - QCOMPARE(cloneData.sharedTextureId, 1200); - } - - // WHEN - glTexture.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&glTexture); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QAbstractTextureData cloneData = creationChangeData->data; - - QCOMPARE(glTexture.id(), creationChangeData->subjectId()); - QCOMPARE(glTexture.isEnabled(), false); - QCOMPARE(glTexture.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(glTexture.metaObject(), creationChangeData->metaObject()); - QCOMPARE(cloneData.sharedTextureId, 1200); - } - } - void checkTextureIdUpdate() { // GIVEN @@ -146,11 +92,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &glTexture); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &glTexture); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -159,8 +104,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } diff --git a/tests/auto/render/qsortpolicy/tst_qsortpolicy.cpp b/tests/auto/render/qsortpolicy/tst_qsortpolicy.cpp index 66c625cfc..02bbeffd8 100644 --- a/tests/auto/render/qsortpolicy/tst_qsortpolicy.cpp +++ b/tests/auto/render/qsortpolicy/tst_qsortpolicy.cpp @@ -30,14 +30,11 @@ #include #include #include -#include -#include -#include #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" // We need to call QNode::clone which is protected // So we sublcass QNode instead of QObject @@ -54,51 +51,6 @@ private Q_SLOTS: QVERIFY(defaultsortPolicy->sortTypes().isEmpty()); } - void checkCloning_data() - { - QTest::addColumn("sortPolicy"); - QTest::addColumn >("sortTypes"); - - Qt3DRender::QSortPolicy *defaultConstructed = new Qt3DRender::QSortPolicy(); - QTest::newRow("defaultConstructed") << defaultConstructed << QVector(); - - Qt3DRender::QSortPolicy *sortPolicyWithSortTypes = new Qt3DRender::QSortPolicy(); - auto sortTypes = QVector() << Qt3DRender::QSortPolicy::BackToFront - << Qt3DRender::QSortPolicy::Material - << Qt3DRender::QSortPolicy::FrontToBack; - sortPolicyWithSortTypes->setSortTypes(sortTypes); - QTest::newRow("sortPolicyWithSortTypes") << sortPolicyWithSortTypes << sortTypes ; - } - - void checkCloning() - { - // GIVEN - QFETCH(Qt3DRender::QSortPolicy*, sortPolicy); - QFETCH(QVector, sortTypes); - - // THEN - QCOMPARE(sortPolicy->sortTypes(), sortTypes); - - // WHEN - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(sortPolicy); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - // THEN - QCOMPARE(creationChanges.size(), 1); - - const Qt3DCore::QNodeCreatedChangePtr creationChangeData = - qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QSortPolicyData &cloneData = creationChangeData->data; - - QCOMPARE(sortPolicy->id(), creationChangeData->subjectId()); - QCOMPARE(sortPolicy->isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(sortPolicy->metaObject(), creationChangeData->metaObject()); - QCOMPARE(sortPolicy->sortTypes().count(), cloneData.sortTypes.count()); - QCOMPARE(sortPolicy->sortTypes(), cloneData.sortTypes); - - delete sortPolicy; - } - void checkPropertyUpdates() { // GIVEN @@ -117,11 +69,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), sortPolicy.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), sortPolicy.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } }; diff --git a/tests/auto/render/qtechnique/tst_qtechnique.cpp b/tests/auto/render/qtechnique/tst_qtechnique.cpp index 40d763ad4..4a344c9d0 100644 --- a/tests/auto/render/qtechnique/tst_qtechnique.cpp +++ b/tests/auto/render/qtechnique/tst_qtechnique.cpp @@ -37,9 +37,7 @@ #include #include #include -#include -#include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QTechnique : public QObject { @@ -233,85 +231,6 @@ private Q_SLOTS: QCOMPARE(technique.filterKeys().size(), 0); } - void checkCreationData() - { - // GIVEN - Qt3DRender::QTechnique technique; - Qt3DRender::QRenderPass pass; - Qt3DRender::QParameter parameter; - Qt3DRender::QFilterKey filterKey; - - technique.addRenderPass(&pass); - technique.addParameter(¶meter); - technique.addFilterKey(&filterKey); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&technique); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 4); // Technique + Pass + Parameter + FilterKey - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QTechniqueData cloneData = creationChangeData->data; - - QCOMPARE(technique.graphicsApiFilter()->minorVersion(), cloneData.graphicsApiFilterData.m_minor); - QCOMPARE(technique.graphicsApiFilter()->majorVersion(), cloneData.graphicsApiFilterData.m_major); - QCOMPARE(technique.graphicsApiFilter()->profile(), cloneData.graphicsApiFilterData.m_profile); - QCOMPARE(technique.graphicsApiFilter()->vendor(), cloneData.graphicsApiFilterData.m_vendor); - QCOMPARE(technique.graphicsApiFilter()->extensions(), cloneData.graphicsApiFilterData.m_extensions); - QCOMPARE(technique.graphicsApiFilter()->api(), cloneData.graphicsApiFilterData.m_api); - QCOMPARE(technique.id(), creationChangeData->subjectId()); - QCOMPARE(technique.isEnabled(), true); - QCOMPARE(technique.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(technique.metaObject(), creationChangeData->metaObject()); - QCOMPARE(technique.renderPasses().size(), cloneData.renderPassIds.size()); - QCOMPARE(technique.parameters().size(), cloneData.parameterIds.size()); - QCOMPARE(technique.filterKeys().size(), cloneData.filterKeyIds.size()); - QCOMPARE(pass.id(), cloneData.renderPassIds.first()); - QCOMPARE(parameter.id(), cloneData.parameterIds.first()); - QCOMPARE(filterKey.id(), cloneData.filterKeyIds.first()); - } - - // WHEN - technique.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&technique); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 4); // Technique + Pass + Parameter + FilterKey - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QTechniqueData cloneData = creationChangeData->data; - - QCOMPARE(technique.graphicsApiFilter()->minorVersion(), cloneData.graphicsApiFilterData.m_minor); - QCOMPARE(technique.graphicsApiFilter()->majorVersion(), cloneData.graphicsApiFilterData.m_major); - QCOMPARE(technique.graphicsApiFilter()->profile(), cloneData.graphicsApiFilterData.m_profile); - QCOMPARE(technique.graphicsApiFilter()->vendor(), cloneData.graphicsApiFilterData.m_vendor); - QCOMPARE(technique.graphicsApiFilter()->extensions(), cloneData.graphicsApiFilterData.m_extensions); - QCOMPARE(technique.graphicsApiFilter()->api(), cloneData.graphicsApiFilterData.m_api); - QCOMPARE(technique.id(), creationChangeData->subjectId()); - QCOMPARE(technique.isEnabled(), false); - QCOMPARE(technique.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(technique.metaObject(), creationChangeData->metaObject()); - QCOMPARE(technique.renderPasses().size(), cloneData.renderPassIds.size()); - QCOMPARE(technique.parameters().size(), cloneData.parameterIds.size()); - QCOMPARE(technique.filterKeys().size(), cloneData.filterKeyIds.size()); - QCOMPARE(pass.id(), cloneData.renderPassIds.first()); - QCOMPARE(parameter.id(), cloneData.parameterIds.first()); - QCOMPARE(filterKey.id(), cloneData.filterKeyIds.first()); - } - } - void checkRenderPassUpdate() { // GIVEN @@ -326,11 +245,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QVERIFY(arbiter.dirtyNodes.contains(&technique)); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QVERIFY(arbiter.dirtyNodes().contains(&technique)); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { // WHEN @@ -338,9 +256,8 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QVERIFY(arbiter.dirtyNodes.contains(&technique)); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QVERIFY(arbiter.dirtyNodes().contains(&technique)); } } @@ -358,11 +275,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QVERIFY(arbiter.dirtyNodes.contains(&technique)); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QVERIFY(arbiter.dirtyNodes().contains(&technique)); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -371,11 +287,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QVERIFY(arbiter.dirtyNodes.contains(&technique)); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QVERIFY(arbiter.dirtyNodes().contains(&technique)); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } } @@ -393,11 +308,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QVERIFY(arbiter.dirtyNodes.contains(&technique)); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QVERIFY(arbiter.dirtyNodes().contains(&technique)); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -406,11 +320,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QVERIFY(arbiter.dirtyNodes.contains(&technique)); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QVERIFY(arbiter.dirtyNodes().contains(&technique)); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } } @@ -427,11 +340,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QVERIFY(arbiter.dirtyNodes.contains(&technique)); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QVERIFY(arbiter.dirtyNodes().contains(&technique)); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { // WHEN @@ -439,11 +351,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QVERIFY(arbiter.dirtyNodes.contains(&technique)); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QVERIFY(arbiter.dirtyNodes().contains(&technique)); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { // WHEN @@ -451,11 +362,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QVERIFY(arbiter.dirtyNodes.contains(&technique)); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QVERIFY(arbiter.dirtyNodes().contains(&technique)); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { // WHEN @@ -463,11 +373,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QVERIFY(arbiter.dirtyNodes.contains(&technique)); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QVERIFY(arbiter.dirtyNodes().contains(&technique)); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } } }; diff --git a/tests/auto/render/qtechniquefilter/tst_qtechniquefilter.cpp b/tests/auto/render/qtechniquefilter/tst_qtechniquefilter.cpp index 37f0ba9a7..0e2c3ff2f 100644 --- a/tests/auto/render/qtechniquefilter/tst_qtechniquefilter.cpp +++ b/tests/auto/render/qtechniquefilter/tst_qtechniquefilter.cpp @@ -30,14 +30,13 @@ #include #include #include -#include #include #include #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QTechniqueFilter: public QObject { @@ -53,95 +52,6 @@ private Q_SLOTS: QCOMPARE(defaulttechniqueFilter->parameters().count(), 0); } - void checkCloning_data() - { - QTest::addColumn("techniqueFilter"); - QTest::addColumn >("parameters"); - QTest::addColumn >("filterKeys"); - - Qt3DRender::QTechniqueFilter *defaultConstructed = new Qt3DRender::QTechniqueFilter(); - QTest::newRow("defaultConstructed") << defaultConstructed << QVector() << QVector(); - - Qt3DRender::QTechniqueFilter *techniqueFilterWithParams = new Qt3DRender::QTechniqueFilter(); - Qt3DRender::QParameter *parameter1 = new Qt3DRender::QParameter(QStringLiteral("displacement"), 454.0f); - Qt3DRender::QParameter *parameter2 = new Qt3DRender::QParameter(QStringLiteral("torque"), 650); - QVector params1 = QVector() << parameter1 << parameter2; - techniqueFilterWithParams->addParameter(parameter1); - techniqueFilterWithParams->addParameter(parameter2); - QTest::newRow("techniqueFilterWithParams") << techniqueFilterWithParams << params1 << QVector(); - - Qt3DRender::QTechniqueFilter *techniqueFilterWithAnnotations = new Qt3DRender::QTechniqueFilter(); - Qt3DRender::QFilterKey *filterKey1 = new Qt3DRender::QFilterKey(); - Qt3DRender::QFilterKey *filterKey2 = new Qt3DRender::QFilterKey(); - filterKey1->setName(QStringLiteral("hasSuperCharger")); - filterKey1->setValue(true); - filterKey1->setName(QStringLiteral("hasNitroKit")); - filterKey1->setValue(false); - QVector filterKeys1 = QVector() << filterKey1 << filterKey2; - techniqueFilterWithAnnotations->addMatch(filterKey1); - techniqueFilterWithAnnotations->addMatch(filterKey2); - QTest::newRow("techniqueFilterWithAnnotations") << techniqueFilterWithAnnotations << QVector() << filterKeys1; - - Qt3DRender::QTechniqueFilter *techniqueFilterWithParamsAndAnnotations = new Qt3DRender::QTechniqueFilter(); - Qt3DRender::QParameter *parameter3 = new Qt3DRender::QParameter(QStringLiteral("displacement"), 383.0f); - Qt3DRender::QParameter *parameter4 = new Qt3DRender::QParameter(QStringLiteral("torque"), 555); - Qt3DRender::QFilterKey *filterKey3 = new Qt3DRender::QFilterKey(); - Qt3DRender::QFilterKey *filterKey4 = new Qt3DRender::QFilterKey(); - filterKey3->setName(QStringLiteral("hasSuperCharger")); - filterKey3->setValue(false); - filterKey4->setName(QStringLiteral("hasNitroKit")); - filterKey4->setValue(true); - QVector params2 = QVector() << parameter3 << parameter4; - QVector filterKeys2 = QVector() << filterKey3 << filterKey4; - techniqueFilterWithParamsAndAnnotations->addParameter(parameter3); - techniqueFilterWithParamsAndAnnotations->addParameter(parameter4); - techniqueFilterWithParamsAndAnnotations->addMatch(filterKey3); - techniqueFilterWithParamsAndAnnotations->addMatch(filterKey4); - QTest::newRow("techniqueFilterWithParamsAndAnnotations") << techniqueFilterWithParamsAndAnnotations << params2 << filterKeys2; - } - - void checkCloning() - { - // GIVEN - QFETCH(Qt3DRender::QTechniqueFilter*, techniqueFilter); - QFETCH(QVector, parameters); - QFETCH(QVector, filterKeys); - - // THEN - QCOMPARE(techniqueFilter->parameters(), parameters); - QCOMPARE(techniqueFilter->matchAll(), filterKeys); - - // WHEN - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(techniqueFilter); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - // THEN - QCOMPARE(creationChanges.size(), 1 + parameters.size() + filterKeys.size()); - - const Qt3DCore::QNodeCreatedChangePtr creationChangeData = - qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QTechniqueFilterData &cloneData = creationChangeData->data; - - QCOMPARE(techniqueFilter->id(), creationChangeData->subjectId()); - QCOMPARE(techniqueFilter->isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(techniqueFilter->metaObject(), creationChangeData->metaObject()); - - QCOMPARE(techniqueFilter->matchAll().count(), cloneData.matchIds.count()); - QCOMPARE(techniqueFilter->parameters().count(), cloneData.parameterIds.count()); - - for (int i = 0, m = parameters.count(); i < m; ++i) { - Qt3DRender::QParameter *pOrig = parameters.at(i); - QCOMPARE(pOrig->id(), cloneData.parameterIds.at(i)); - } - - for (int i = 0, m = filterKeys.count(); i < m; ++i) { - Qt3DRender::QFilterKey *aOrig = filterKeys.at(i); - QCOMPARE(aOrig->id(), cloneData.matchIds.at(i)); - } - - delete techniqueFilter; - } - void checkPropertyUpdates() { // GIVEN @@ -155,10 +65,9 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), techniqueFilter.data()); - arbiter.dirtyNodes.clear(); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), techniqueFilter.data()); + arbiter.clear(); // WHEN @@ -166,18 +75,16 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); // WHEN techniqueFilter->removeParameter(param1); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), techniqueFilter.data()); - arbiter.dirtyNodes.clear(); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), techniqueFilter.data()); + arbiter.clear(); // WHEN Qt3DRender::QFilterKey *filterKey1 = new Qt3DRender::QFilterKey(); @@ -185,28 +92,25 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), techniqueFilter.data()); - arbiter.dirtyNodes.clear(); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), techniqueFilter.data()); + arbiter.clear(); // WHEN techniqueFilter->addMatch(filterKey1); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); // WHEN techniqueFilter->removeMatch(filterKey1); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), techniqueFilter.data()); - arbiter.dirtyNodes.clear(); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), techniqueFilter.data()); + arbiter.clear(); } void checkParameterBookkeeping() diff --git a/tests/auto/render/qtextureimage/tst_qtextureimage.cpp b/tests/auto/render/qtextureimage/tst_qtextureimage.cpp index ba5c2c3d8..9b2c75fb3 100644 --- a/tests/auto/render/qtextureimage/tst_qtextureimage.cpp +++ b/tests/auto/render/qtextureimage/tst_qtextureimage.cpp @@ -35,9 +35,7 @@ QT_WARNING_DISABLE_DEPRECATED #include #include #include -#include -#include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QTextureImage : public QObject { @@ -101,68 +99,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - Qt3DRender::QTextureImage textureImage; - - textureImage.setSource(QUrl(QStringLiteral("URL"))); - textureImage.setMirrored(false); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&textureImage); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QAbstractTextureImageData cloneData = creationChangeData->data; - - QCOMPARE(textureImage.id(), creationChangeData->subjectId()); - QCOMPARE(textureImage.isEnabled(), true); - QCOMPARE(textureImage.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(textureImage.metaObject(), creationChangeData->metaObject()); - - const auto generator = qSharedPointerCast(cloneData.generator); - QVERIFY(generator); - QCOMPARE(generator->isMirrored(), textureImage.isMirrored()); - QCOMPARE(generator->url(), textureImage.source()); - - } - - // WHEN - textureImage.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&textureImage); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QAbstractTextureImageData cloneData = creationChangeData->data; - - QCOMPARE(textureImage.id(), creationChangeData->subjectId()); - QCOMPARE(textureImage.isEnabled(), false); - QCOMPARE(textureImage.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(textureImage.metaObject(), creationChangeData->metaObject()); - - const auto generator = qSharedPointerCast(cloneData.generator); - QVERIFY(generator); - QCOMPARE(generator->isMirrored(), textureImage.isMirrored()); - QCOMPARE(generator->url(), textureImage.source()); - } - } - void checkSourceUpdate() { // GIVEN @@ -176,10 +112,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &textureImage); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &textureImage); - arbiter.events.clear(); + arbiter.clear(); } { @@ -188,7 +124,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -206,10 +142,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &textureImage); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &textureImage); - arbiter.events.clear(); + arbiter.clear(); } { @@ -218,7 +154,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } diff --git a/tests/auto/render/qtextureimagedata/tst_qtextureimagedata.cpp b/tests/auto/render/qtextureimagedata/tst_qtextureimagedata.cpp index ba0c9a9bf..4912dac0c 100644 --- a/tests/auto/render/qtextureimagedata/tst_qtextureimagedata.cpp +++ b/tests/auto/render/qtextureimagedata/tst_qtextureimagedata.cpp @@ -31,7 +31,7 @@ #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" // We need to call QNode::clone which is protected // So we sublcass QNode instead of QObject diff --git a/tests/auto/render/qtextureloader/tst_qtextureloader.cpp b/tests/auto/render/qtextureloader/tst_qtextureloader.cpp index b6d949c83..78c9a15a8 100644 --- a/tests/auto/render/qtextureloader/tst_qtextureloader.cpp +++ b/tests/auto/render/qtextureloader/tst_qtextureloader.cpp @@ -35,9 +35,7 @@ QT_WARNING_DISABLE_DEPRECATED #include #include #include -#include -#include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QTextureLoader : public QObject { @@ -107,56 +105,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - Qt3DRender::QTextureLoader textureLoader; - - textureLoader.setSource(QUrl(QStringLiteral("SomeUrl"))); - textureLoader.setMirrored(false); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&textureLoader); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QAbstractTextureData cloneData = creationChangeData->data; - - QCOMPARE(textureLoader.id(), creationChangeData->subjectId()); - QCOMPARE(textureLoader.isEnabled(), true); - QCOMPARE(textureLoader.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(textureLoader.metaObject(), creationChangeData->metaObject()); - } - - // WHEN - textureLoader.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&textureLoader); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - - QCOMPARE(textureLoader.id(), creationChangeData->subjectId()); - QCOMPARE(textureLoader.isEnabled(), false); - QCOMPARE(textureLoader.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(textureLoader.metaObject(), creationChangeData->metaObject()); - } - } - void checkSourceUpdate() { // GIVEN @@ -170,26 +118,16 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &textureLoader); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &textureLoader); Qt3DRender::QAbstractTexturePrivate *d = dynamic_cast(Qt3DRender::QAbstractTexturePrivate::get(&textureLoader)); const auto generator = qSharedPointerCast(d->dataFunctor()); QVERIFY(generator); QCOMPARE(generator->url(), QUrl(QStringLiteral("Gary"))); - arbiter.events.clear(); + arbiter.clear(); } - - { - // WHEN - textureLoader.setSource(QUrl(QStringLiteral("Gary"))); - QCoreApplication::processEvents(); - - // THEN - QCOMPARE(arbiter.events.size(), 0); - } - } void checkMirroredUpdate() @@ -205,15 +143,15 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &textureLoader); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &textureLoader); Qt3DRender::QAbstractTexturePrivate *d = dynamic_cast(Qt3DRender::QAbstractTexturePrivate::get(&textureLoader)); const auto generator = qSharedPointerCast(d->dataFunctor()); QVERIFY(generator); QCOMPARE(generator->isMirrored(), false); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -222,7 +160,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } diff --git a/tests/auto/render/qviewport/tst_qviewport.cpp b/tests/auto/render/qviewport/tst_qviewport.cpp index ab3dda08f..287894c22 100644 --- a/tests/auto/render/qviewport/tst_qviewport.cpp +++ b/tests/auto/render/qviewport/tst_qviewport.cpp @@ -29,65 +29,17 @@ #include #include #include -#include #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QViewport: public QObject { Q_OBJECT private Q_SLOTS: - - void checkCloning_data() - { - QTest::addColumn("viewport"); - QTest::addColumn("normalizedRect"); - QTest::addColumn("gamma"); - - Qt3DRender::QViewport *defaultConstructed = new Qt3DRender::QViewport(); - QTest::newRow("defaultConstructed") << defaultConstructed << QRectF(0.0f, 0.0f, 1.0f, 1.0f) << 2.2f; - - Qt3DRender::QViewport *smallGreenViewport = new Qt3DRender::QViewport(); - smallGreenViewport->setNormalizedRect(QRectF(0.2f, 0.2f, 0.6f, 0.6f)); - smallGreenViewport->setGamma(1.8f); - QTest::newRow("smallGreenViewport") << smallGreenViewport << QRectF(0.2f, 0.2f, 0.6f, 0.6f) << 1.8f; - } - - void checkCloning() - { - // GIVEN - QFETCH(Qt3DRender::QViewport *, viewport); - QFETCH(QRectF, normalizedRect); - QFETCH(float, gamma); - - // THEN - QCOMPARE(viewport->normalizedRect(), normalizedRect); - QCOMPARE(viewport->gamma(), gamma); - - // WHEN - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(viewport); - QVector creationChanges = creationChangeGenerator.creationChanges(); - - // THEN - QCOMPARE(creationChanges.size(), 1); - - const Qt3DCore::QNodeCreatedChangePtr creationChangeData = - qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QViewportData &cloneData = creationChangeData->data; - - QCOMPARE(viewport->id(), creationChangeData->subjectId()); - QCOMPARE(viewport->isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(viewport->metaObject(), creationChangeData->metaObject()); - QCOMPARE(viewport->normalizedRect(), cloneData.normalizedRect); - QCOMPARE(viewport->gamma(), cloneData.gamma); - - delete viewport; - } - void checkPropertyUpdates() { // GIVEN @@ -101,31 +53,28 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), viewport.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), viewport.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN viewport->setNormalizedRect(QRectF(0.5, 0.5, 1.0, 1.0)); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); // WHEN viewport->setNormalizedRect(QRectF(0.0, 0.0, 1.0, 1.0)); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), viewport.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), viewport.data()); } - arbiter.events.clear(); + arbiter.clear(); { // WHEN @@ -133,28 +82,25 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), viewport.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), viewport.data()); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN viewport->setGamma(1.8f); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); // WHEN viewport->setGamma(2.0f); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), viewport.data()); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), viewport.data()); } } }; diff --git a/tests/auto/render/qwaitfence/tst_qwaitfence.cpp b/tests/auto/render/qwaitfence/tst_qwaitfence.cpp index 801abfcc6..4c842c2cc 100644 --- a/tests/auto/render/qwaitfence/tst_qwaitfence.cpp +++ b/tests/auto/render/qwaitfence/tst_qwaitfence.cpp @@ -43,9 +43,7 @@ #include #include #include -#include -#include -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_QWaitFence : public QObject { @@ -153,67 +151,6 @@ private Q_SLOTS: } } - void checkCreationData() - { - // GIVEN - Qt3DRender::QWaitFence waitFence; - - waitFence.setHandleType(Qt3DRender::QWaitFence::OpenGLFenceId); - waitFence.setHandle(QVariant(1200)); - waitFence.setWaitOnCPU(true); - waitFence.setTimeout(1584); - - // WHEN - QVector creationChanges; - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&waitFence); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QWaitFenceData cloneData = creationChangeData->data; - - QCOMPARE(waitFence.handleType(), cloneData.handleType); - QCOMPARE(waitFence.handle(), cloneData.handle); - QCOMPARE(waitFence.waitOnCPU(), cloneData.waitOnCPU); - QCOMPARE(waitFence.timeout(), cloneData.timeout); - QCOMPARE(waitFence.id(), creationChangeData->subjectId()); - QCOMPARE(waitFence.isEnabled(), true); - QCOMPARE(waitFence.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(waitFence.metaObject(), creationChangeData->metaObject()); - } - - // WHEN - waitFence.setEnabled(false); - - { - Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(&waitFence); - creationChanges = creationChangeGenerator.creationChanges(); - } - - // THEN - { - QCOMPARE(creationChanges.size(), 1); - - const auto creationChangeData = qSharedPointerCast>(creationChanges.first()); - const Qt3DRender::QWaitFenceData cloneData = creationChangeData->data; - - QCOMPARE(waitFence.handleType(), cloneData.handleType); - QCOMPARE(waitFence.handle(), cloneData.handle); - QCOMPARE(waitFence.waitOnCPU(), cloneData.waitOnCPU); - QCOMPARE(waitFence.timeout(), cloneData.timeout); - QCOMPARE(waitFence.id(), creationChangeData->subjectId()); - QCOMPARE(waitFence.isEnabled(), false); - QCOMPARE(waitFence.isEnabled(), creationChangeData->isNodeEnabled()); - QCOMPARE(waitFence.metaObject(), creationChangeData->metaObject()); - } - } - void checkHandleTypeUpdate() { // GIVEN @@ -227,11 +164,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &waitFence); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &waitFence); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -240,8 +176,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -258,11 +193,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &waitFence); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &waitFence); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -271,8 +205,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -289,11 +222,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &waitFence); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &waitFence); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -302,8 +234,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } @@ -320,11 +251,10 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &waitFence); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &waitFence); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } { @@ -333,8 +263,7 @@ private Q_SLOTS: QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); } } }; diff --git a/tests/auto/render/raycaster/tst_raycaster.cpp b/tests/auto/render/raycaster/tst_raycaster.cpp index 57a1bcf47..593852c65 100644 --- a/tests/auto/render/raycaster/tst_raycaster.cpp +++ b/tests/auto/render/raycaster/tst_raycaster.cpp @@ -32,7 +32,7 @@ #include #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" #include "testrenderer.h" class tst_RayCaster : public Qt3DCore::QBackendNodeTester diff --git a/tests/auto/render/raycastingjob/tst_raycastingjob.cpp b/tests/auto/render/raycastingjob/tst_raycastingjob.cpp index daec0b86c..c725bf73a 100644 --- a/tests/auto/render/raycastingjob/tst_raycastingjob.cpp +++ b/tests/auto/render/raycastingjob/tst_raycastingjob.cpp @@ -27,12 +27,11 @@ ****************************************************************************/ #include "qmlscenereader.h" -#include "testpostmanarbiter.h" +#include "testarbiter.h" #include #include #include -#include #include #include #include @@ -279,7 +278,6 @@ private Q_SLOTS: Qt3DRender::Render::RayCaster *backendRayCaster = test->nodeManagers()->rayCasterManager()->lookupResource(rayCaster->id()); QVERIFY(backendRayCaster); - Qt3DCore::QBackendNodePrivate::get(backendRayCaster)->setArbiter(test->arbiter()); // WHEN Qt3DRender::Render::RayCastingJob rayCastingJob; @@ -339,7 +337,6 @@ private Q_SLOTS: Qt3DRender::Render::RayCaster *backendRayCaster = test->nodeManagers()->rayCasterManager()->lookupResource(rayCaster->id()); QVERIFY(backendRayCaster); - Qt3DCore::QBackendNodePrivate::get(backendRayCaster)->setArbiter(test->arbiter()); // WHEN Qt3DRender::Render::RayCastingJob rayCastingJob; diff --git a/tests/auto/render/render.pro b/tests/auto/render/render.pro index 14fc74883..e750407b3 100644 --- a/tests/auto/render/render.pro +++ b/tests/auto/render/render.pro @@ -133,7 +133,6 @@ qtConfig(qt3d-opengl-renderer):qtConfig(private_tests) { geometryloaders \ picking \ boundingsphere \ - qdefaultmeshes \ pickboundingvolumejob \ gltfplugins \ updatemeshtrianglelistjob \ diff --git a/tests/auto/render/rendercapture/tst_rendercapture.cpp b/tests/auto/render/rendercapture/tst_rendercapture.cpp index 3ad3668c9..272d49e13 100644 --- a/tests/auto/render/rendercapture/tst_rendercapture.cpp +++ b/tests/auto/render/rendercapture/tst_rendercapture.cpp @@ -31,7 +31,7 @@ #include #include #include -#include "testpostmanarbiter.h" +#include "testarbiter.h" #include "testrenderer.h" class tst_RenderCapture : public Qt3DCore::QBackendNodeTester diff --git a/tests/auto/render/scene2d/tst_scene2d.cpp b/tests/auto/render/scene2d/tst_scene2d.cpp index b0a7fbeb8..4b4ba03f0 100644 --- a/tests/auto/render/scene2d/tst_scene2d.cpp +++ b/tests/auto/render/scene2d/tst_scene2d.cpp @@ -40,7 +40,6 @@ #include #include #include -#include #include #include "testrenderer.h" diff --git a/tests/auto/render/sceneloader/tst_sceneloader.cpp b/tests/auto/render/sceneloader/tst_sceneloader.cpp index d146abfcc..9efdd386c 100644 --- a/tests/auto/render/sceneloader/tst_sceneloader.cpp +++ b/tests/auto/render/sceneloader/tst_sceneloader.cpp @@ -31,11 +31,9 @@ #include #include #include -#include #include #include -#include -#include "testpostmanarbiter.h" +#include "testarbiter.h" #include "testrenderer.h" class tst_SceneLoader : public Qt3DCore::QBackendNodeTester diff --git a/tests/auto/render/setfence/tst_setfence.cpp b/tests/auto/render/setfence/tst_setfence.cpp index 75c414e7f..d7ef930ca 100644 --- a/tests/auto/render/setfence/tst_setfence.cpp +++ b/tests/auto/render/setfence/tst_setfence.cpp @@ -37,18 +37,13 @@ ** ****************************************************************************/ -// TODO Remove in Qt6 -#include -QT_WARNING_DISABLE_DEPRECATED - #include #include #include #include -#include #include "qbackendnodetester.h" #include "testrenderer.h" -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_SetFence : public Qt3DCore::QBackendNodeTester { @@ -120,50 +115,6 @@ private Q_SLOTS: renderer.clearDirtyBits(Qt3DRender::Render::AbstractRenderer::AllDirty); } } - - void checkSetHandleType() - { - // GIVEN - Qt3DRender::Render::SetFence backendSetFence; - TestRenderer renderer; - TestArbiter arbiter; - - Qt3DCore::QBackendNodePrivate::get(&backendSetFence)->setArbiter(&arbiter); - backendSetFence.setRenderer(&renderer); - - // WHEN - backendSetFence.setHandleType(Qt3DRender::QSetFence::OpenGLFenceId); - - // THEN - Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast(); - QCOMPARE(arbiter.events.count(), 1); - QCOMPARE(change->propertyName(), "handleType"); - QCOMPARE(change->value().value(), Qt3DRender::QSetFence::OpenGLFenceId); - - arbiter.events.clear(); - } - - void checkSetHandle() - { - // GIVEN - Qt3DRender::Render::SetFence backendSetFence; - TestRenderer renderer; - TestArbiter arbiter; - - Qt3DCore::QBackendNodePrivate::get(&backendSetFence)->setArbiter(&arbiter); - backendSetFence.setRenderer(&renderer); - - // WHEN - backendSetFence.setHandle(QVariant(984)); - - // THEN - Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast(); - QCOMPARE(arbiter.events.count(), 1); - QCOMPARE(change->propertyName(), "handle"); - QCOMPARE(change->value(), QVariant(984)); - - arbiter.events.clear(); - } }; QTEST_MAIN(tst_SetFence) diff --git a/tests/auto/render/shaderbuilder/tst_shaderbuilder.cpp b/tests/auto/render/shaderbuilder/tst_shaderbuilder.cpp index 24dbe514a..526f46243 100644 --- a/tests/auto/render/shaderbuilder/tst_shaderbuilder.cpp +++ b/tests/auto/render/shaderbuilder/tst_shaderbuilder.cpp @@ -28,13 +28,12 @@ #include #include -#include #include #include #include #include #include "testrenderer.h" -#include "testpostmanarbiter.h" +#include Q_DECLARE_METATYPE(Qt3DRender::QShaderProgram::ShaderType) @@ -583,7 +582,6 @@ private slots: Qt3DRender::Render::ShaderBuilder backend; TestArbiter arbiter; - Qt3DCore::QBackendNodePrivate::get(&backend)->setArbiter(&arbiter); // WHEN diff --git a/tests/auto/render/skeleton/tst_skeleton.cpp b/tests/auto/render/skeleton/tst_skeleton.cpp index 63ed51058..f98d26694 100644 --- a/tests/auto/render/skeleton/tst_skeleton.cpp +++ b/tests/auto/render/skeleton/tst_skeleton.cpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include using namespace Qt3DCore; diff --git a/tests/auto/render/sortpolicy/tst_sortpolicy.cpp b/tests/auto/render/sortpolicy/tst_sortpolicy.cpp index 5552a1760..b6ee78f41 100644 --- a/tests/auto/render/sortpolicy/tst_sortpolicy.cpp +++ b/tests/auto/render/sortpolicy/tst_sortpolicy.cpp @@ -55,7 +55,7 @@ private Q_SLOTS: Qt3DRender::QFrameGraphNode parent; auto parentBackend = new Qt3DRender::Render::FrameGraphNode; parentBackend->setRenderer(&renderer); - simulateInitialization(&parent, parentBackend); + simulateInitializationSync(&parent, parentBackend); Qt3DRender::Render::FrameGraphManager manager; manager.appendNode(parent.id(), parentBackend); diff --git a/tests/auto/render/texture/tst_texture.cpp b/tests/auto/render/texture/tst_texture.cpp index aec79bbbd..3db774eb4 100644 --- a/tests/auto/render/texture/tst_texture.cpp +++ b/tests/auto/render/texture/tst_texture.cpp @@ -30,8 +30,8 @@ #include #include -#include "testpostmanarbiter.h" #include "testrenderer.h" +#include class DummyTexture : public Qt3DRender::QAbstractTexture { @@ -111,116 +111,104 @@ void tst_RenderTexture::checkFrontendPropertyNotifications() QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &texture); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &texture); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN texture.setWidth(512); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); // WHEN texture.setHeight(256); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &texture); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &texture); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN texture.setHeight(256); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); // WHEN texture.setDepth(128); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &texture); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &texture); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN texture.setDepth(128); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.events.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); // WHEN texture.setLayers(16); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &texture); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &texture); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN texture.setLayers(16); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); // WHEN texture.setSamples(32); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &texture); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &texture); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN texture.setSamples(32); QCoreApplication::processEvents(); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 0); + QCOMPARE(arbiter.dirtyNodes().size(), 0); // WHEN Qt3DRender::QTextureImage img; texture.addTextureImage(&img); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &texture); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &texture); - arbiter.dirtyNodes.clear(); + arbiter.clear(); // WHEN texture.removeTextureImage(&img); // THEN - QCOMPARE(arbiter.events.size(), 0); - QCOMPARE(arbiter.dirtyNodes.size(), 1); - QCOMPARE(arbiter.dirtyNodes.front(), &texture); + QCOMPARE(arbiter.dirtyNodes().size(), 1); + QCOMPARE(arbiter.dirtyNodes().front(), &texture); - arbiter.dirtyNodes.clear(); + arbiter.clear(); } template diff --git a/tests/auto/render/transform/tst_transform.cpp b/tests/auto/render/transform/tst_transform.cpp index a3fcdb9c8..b6c3c0b41 100644 --- a/tests/auto/render/transform/tst_transform.cpp +++ b/tests/auto/render/transform/tst_transform.cpp @@ -35,7 +35,7 @@ #include #include "qbackendnodetester.h" #include "testrenderer.h" -#include "testpostmanarbiter.h" +#include "testarbiter.h" class tst_Transform : public Qt3DCore::QBackendNodeTester { diff --git a/tests/auto/render/updateshaderdatatransformjob/tst_updateshaderdatatransformjob.cpp b/tests/auto/render/updateshaderdatatransformjob/tst_updateshaderdatatransformjob.cpp index b2d0b612c..7e5a114bb 100644 --- a/tests/auto/render/updateshaderdatatransformjob/tst_updateshaderdatatransformjob.cpp +++ b/tests/auto/render/updateshaderdatatransformjob/tst_updateshaderdatatransformjob.cpp @@ -37,7 +37,6 @@ #include #include #include -#include #include #include "qmlscenereader.h" -- cgit v1.2.3