summaryrefslogtreecommitdiffstats
path: root/src/input/backend/qabstractphysicaldevicebackendnode.cpp
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2016-03-29 15:55:23 +0100
committerSean Harmer <sean.harmer@kdab.com>2016-03-31 07:35:01 +0000
commitcb0dc5d1a650e7269a6debac8db6953a577c8d2c (patch)
treeb914b77bdb768e7aa5e57fa7c6c31c29d2e4d4f8 /src/input/backend/qabstractphysicaldevicebackendnode.cpp
parentfc2fda9c78fd3b8c698b7cc15774d81f49fceeb9 (diff)
Add protected overload of initializeFromPeer() for backend devices
Subclasses should call this from their overloads to set up the base device properties. Since we do not yet know if all AxisSettings objects will exist by this time, just store the id's of them and we will add a job to extract the settings in the next frame once we know they will all have backend objects. Change-Id: I207db9d2be165f8fb64668c4a890ad931eb0081e Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/input/backend/qabstractphysicaldevicebackendnode.cpp')
-rw-r--r--src/input/backend/qabstractphysicaldevicebackendnode.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/input/backend/qabstractphysicaldevicebackendnode.cpp b/src/input/backend/qabstractphysicaldevicebackendnode.cpp
index bd8aea92b..324eacda0 100644
--- a/src/input/backend/qabstractphysicaldevicebackendnode.cpp
+++ b/src/input/backend/qabstractphysicaldevicebackendnode.cpp
@@ -45,6 +45,7 @@
#include "inputmanagers_p.h"
#include <Qt3DInput/qinputaspect.h>
+#include <Qt3DInput/qphysicaldevicecreatedchange.h>
#include <Qt3DInput/private/qinputaspect_p.h>
#include <Qt3DCore/qscenepropertychange.h>
@@ -161,6 +162,17 @@ void QAbstractPhysicalDeviceBackendNode::updateFromPeer(Qt3DCore::QNode *peer)
}
}
+void QAbstractPhysicalDeviceBackendNode::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
+{
+ const auto deviceChange = qSharedPointerCast<QPhysicalDeviceCreatedChangeBase>(change);
+ Q_D(QAbstractPhysicalDeviceBackendNode);
+ d->m_enabled = change->isNodeEnabled();
+ // Store the axis setting Ids. We will update the settings themselves from
+ // a job scheduled on the next frame.
+ // TODO: Create such a job once all types can be created this way.
+ d->m_pendingAxisSettingIds = deviceChange->axisSettingIds();
+}
+
void QAbstractPhysicalDeviceBackendNode::cleanup()
{
Q_D(QAbstractPhysicalDeviceBackendNode);