From d6bc19e54da84c6227c854aa3ce65a0581440867 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Wed, 13 Dec 2023 23:49:50 +0100 Subject: [PATCH] Qt5InformationNodeInstanceServer: Avoid using sender() Get rid of some unused includes. Change-Id: Ib8dd5f9672c446c5c571e79ed1f26f3f4af2b65d Reviewed-by: Miikka Heikkinen --- .../qt5informationnodeinstanceserver.cpp | 23 ++++++++++--------- .../qt5informationnodeinstanceserver.h | 4 +--- .../instances/quick3dnodeinstance.cpp | 13 +++++------ 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/tools/qml2puppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp b/src/tools/qml2puppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp index 180390def44..2200a402531 100644 --- a/src/tools/qml2puppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp +++ b/src/tools/qml2puppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp @@ -10,13 +10,10 @@ #include #include "servernodeinstance.h" -#include "childrenchangeeventfilter.h" #include "propertyabstractcontainer.h" #include "propertybindingcontainer.h" #include "propertyvaluecontainer.h" #include "instancecontainer.h" -#include "createinstancescommand.h" -#include "changefileurlcommand.h" #include "clearscenecommand.h" #include "reparentinstancescommand.h" #include "update3dviewstatecommand.h" @@ -28,8 +25,7 @@ #include "removepropertiescommand.h" #include "valueschangedcommand.h" #include "informationchangedcommand.h" -#include "pixmapchangedcommand.h" -#include "commondefines.h" +#include "imagecontainer.h" #include "changestatecommand.h" #include "childrenchangedcommand.h" #include "completecomponentcommand.h" @@ -44,7 +40,6 @@ #include "requestmodelnodepreviewimagecommand.h" #include "changeauxiliarycommand.h" -#include "dummycontextobject.h" #include "../editor3d/generalhelper.h" #include "../editor3d/mousearea3d.h" #include "../editor3d/camerageometry.h" @@ -2775,15 +2770,21 @@ void Qt5InformationNodeInstanceServer::handlePickTarget( if (checkNode->property("_pickTarget").isNull()) { if (checkRepeater) { QObject::connect(checkRepeater, &QQuick3DRepeater::objectAdded, - this, &Qt5InformationNodeInstanceServer::handleDynamicAddObject); + this, [this, checkNode] { + handleDynamicAddObject(checkNode); + }); #if defined(QUICK3D_ASSET_UTILS_MODULE) } else if (checkRunLoader) { QObject::connect(checkRunLoader, &QQuick3DRuntimeLoader::statusChanged, - this, &Qt5InformationNodeInstanceServer::handleDynamicAddObject); + this, [this, checkNode] { + handleDynamicAddObject(checkNode); + }); #endif } else { QObject::connect(checkLoader, &QQuick3DLoader::loaded, - this, &Qt5InformationNodeInstanceServer::handleDynamicAddObject); + this, [this, checkNode] { + handleDynamicAddObject(checkNode); + }); } } checkNode->setProperty("_pickTarget", QVariant::fromValue(obj)); @@ -2804,9 +2805,9 @@ bool Qt5InformationNodeInstanceServer::isInformationServer() const // This method should be connected to signals indicating a new object has been constructed outside // normal scene creation. E.g. QQuick3DRepeater::objectAdded. -void Qt5InformationNodeInstanceServer::handleDynamicAddObject() +void Qt5InformationNodeInstanceServer::handleDynamicAddObject(QObject *object) { - m_dynamicObjectConstructors.insert(sender()); + m_dynamicObjectConstructors.insert(object); m_dynamicAddObjectTimer.start(); } diff --git a/src/tools/qml2puppet/qml2puppet/instances/qt5informationnodeinstanceserver.h b/src/tools/qml2puppet/qml2puppet/instances/qt5informationnodeinstanceserver.h index b603bb134eb..cb7dd20a96e 100644 --- a/src/tools/qml2puppet/qml2puppet/instances/qt5informationnodeinstanceserver.h +++ b/src/tools/qml2puppet/qml2puppet/instances/qt5informationnodeinstanceserver.h @@ -8,8 +8,6 @@ #include "valueschangedcommand.h" #include "changeselectioncommand.h" #include "requestmodelnodepreviewimagecommand.h" -#include "propertybindingcontainer.h" -#include "propertyabstractcontainer.h" #include "animationdriver.h" #ifdef QUICK3D_PARTICLES_MODULE @@ -61,7 +59,7 @@ public: void handlePickTarget(const ServerNodeInstance &instance) override; bool isInformationServer() const override; - void handleDynamicAddObject(); + void handleDynamicAddObject(QObject *object); private slots: void handleSelectionChanged(const QVariant &objs); diff --git a/src/tools/qml2puppet/qml2puppet/instances/quick3dnodeinstance.cpp b/src/tools/qml2puppet/qml2puppet/instances/quick3dnodeinstance.cpp index 9ab66649cfa..938de00c5bd 100644 --- a/src/tools/qml2puppet/qml2puppet/instances/quick3dnodeinstance.cpp +++ b/src/tools/qml2puppet/qml2puppet/instances/quick3dnodeinstance.cpp @@ -2,7 +2,6 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "quick3dnodeinstance.h" -#include "qt5nodeinstanceserver.h" #include "qt5informationnodeinstanceserver.h" #ifdef QUICK3D_MODULE @@ -50,16 +49,16 @@ void Quick3DNodeInstance::initialize( #endif if (auto infoServer = qobject_cast(nodeInstanceServer())) { if (repObj) { - QObject::connect(repObj, &QQuick3DRepeater::objectAdded, - infoServer, &Qt5InformationNodeInstanceServer::handleDynamicAddObject); + QObject::connect(repObj, &QQuick3DRepeater::objectAdded, infoServer, + [infoServer, obj] { infoServer->handleDynamicAddObject(obj); }); #if defined(QUICK3D_ASSET_UTILS_MODULE) } else if (runLoadObj) { - QObject::connect(runLoadObj, &QQuick3DRuntimeLoader::statusChanged, - infoServer, &Qt5InformationNodeInstanceServer::handleDynamicAddObject); + QObject::connect(runLoadObj, &QQuick3DRuntimeLoader::statusChanged, infoServer, + [infoServer, obj] { infoServer->handleDynamicAddObject(obj); }); #endif } else { - QObject::connect(loadObj, &QQuick3DLoader::loaded, - infoServer, &Qt5InformationNodeInstanceServer::handleDynamicAddObject); + QObject::connect(loadObj, &QQuick3DLoader::loaded, infoServer, + [infoServer, obj] { infoServer->handleDynamicAddObject(obj); }); } } }