summaryrefslogtreecommitdiffstats
path: root/src/input/backend/physicaldeviceproxy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/input/backend/physicaldeviceproxy.cpp')
-rw-r--r--src/input/backend/physicaldeviceproxy.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/input/backend/physicaldeviceproxy.cpp b/src/input/backend/physicaldeviceproxy.cpp
index 9512296b8..d0ed4356a 100644
--- a/src/input/backend/physicaldeviceproxy.cpp
+++ b/src/input/backend/physicaldeviceproxy.cpp
@@ -44,6 +44,7 @@
#include <QtCore/QCoreApplication>
#include <Qt3DInput/private/inputmanagers_p.h>
+#include <Qt3DInput/private/qabstractphysicaldeviceproxy_p.h>
#include <Qt3DInput/private/qabstractphysicaldeviceproxy_p_p.h>
QT_BEGIN_NAMESPACE
@@ -53,7 +54,7 @@ namespace Qt3DInput {
namespace Input {
PhysicalDeviceProxy::PhysicalDeviceProxy()
- : QBackendNode(QBackendNode::ReadWrite)
+ : BackendNode(QBackendNode::ReadWrite)
, m_manager(nullptr)
{
}
@@ -102,14 +103,20 @@ Qt3DCore::QNodeId PhysicalDeviceProxy::physicalDeviceId() const
return m_physicalDeviceId;
}
-void PhysicalDeviceProxy::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
+void PhysicalDeviceProxy::syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime)
{
- const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QAbstractPhysicalDeviceProxyData>>(change);
- const QAbstractPhysicalDeviceProxyData &data = typedChange->data;
- m_deviceName = data.deviceName;
+ BackendNode::syncFromFrontEnd(frontEnd, firstTime);
- // Request to load the actual device
- m_manager->addPendingProxyToLoad(peerId());
+ if (firstTime) {
+ const QAbstractPhysicalDeviceProxy *node = qobject_cast<const QAbstractPhysicalDeviceProxy *>(frontEnd);
+ if (!node)
+ return;
+
+ m_deviceName = node->deviceName();
+
+ // Request to load the actual device
+ m_manager->addPendingProxyToLoad(peerId());
+ }
}
PhysicalDeviceProxyNodeFunctor::PhysicalDeviceProxyNodeFunctor(PhysicalDeviceProxyManager *manager)