Qt5InformationNodeInstanceServer: Avoid using sender()

Get rid of some unused includes.

Change-Id: Ib8dd5f9672c446c5c571e79ed1f26f3f4af2b65d
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
Jarek Kobus
2023-12-13 23:49:50 +01:00
parent 2f4fa0b62d
commit d6bc19e54d
3 changed files with 19 additions and 21 deletions

View File

@@ -10,13 +10,10 @@
#include <QMatrix4x4>
#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();
}

View File

@@ -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);

View File

@@ -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<Qt5InformationNodeInstanceServer *>(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); });
}
}
}