diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2015-11-28 16:25:58 +0000 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2015-11-29 18:35:26 +0000 |
commit | 1196a530f0865129a251921cf4b2e755500946ee (patch) | |
tree | 686c0ec391b323d6e48897869c9fe46e813bd40f /src/input/frontend/qabstractphysicaldevice.cpp | |
parent | 35c1ba9568524de1e31e63b3439982971904a1f1 (diff) |
Add API to handle QAxisSettings in QAbstractPhysicalDevice
Change-Id: I8d40a0fcd315f3408dfa734fa43c1cef664e3ec2
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/input/frontend/qabstractphysicaldevice.cpp')
-rw-r--r-- | src/input/frontend/qabstractphysicaldevice.cpp | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/src/input/frontend/qabstractphysicaldevice.cpp b/src/input/frontend/qabstractphysicaldevice.cpp index a47b915fd..61236e215 100644 --- a/src/input/frontend/qabstractphysicaldevice.cpp +++ b/src/input/frontend/qabstractphysicaldevice.cpp @@ -35,14 +35,25 @@ ****************************************************************************/ #include "qabstractphysicaldevice.h" +#include "qabstractphysicaldevice_p.h" #include <Qt3DCore/private/qnode_p.h> QT_BEGIN_NAMESPACE namespace Qt3DInput { +QAbstractPhysicalDevicePrivate::QAbstractPhysicalDevicePrivate() + : m_axisSettings() +{ +} + QAbstractPhysicalDevice::QAbstractPhysicalDevice(Qt3DCore::QNode *parent) - : Qt3DCore::QNode(parent) + : Qt3DCore::QNode(*new QAbstractPhysicalDevicePrivate, parent) +{ +} + +QAbstractPhysicalDevice::QAbstractPhysicalDevice(QAbstractPhysicalDevicePrivate &dd, Qt3DCore::QNode *parent) + : Qt3DCore::QNode(dd, parent) { } @@ -51,6 +62,33 @@ QAbstractPhysicalDevice::~QAbstractPhysicalDevice() Q_ASSERT_X(Qt3DCore::QNodePrivate::get(this)->m_wasCleanedUp, Q_FUNC_INFO, "QNode::cleanup should have been called by now. A Qt3DInput::QAbstractPhysicalDevice subclass didn't call QNode::cleanup in its destructor"); } +void QAbstractPhysicalDevice::addAxisSetting(QAxisSetting *axisSetting) +{ + Q_D(QAbstractPhysicalDevice); + if (!d->m_axisSettings.contains(axisSetting)) + d->m_axisSettings.push_back(axisSetting); +} + +void QAbstractPhysicalDevice::removeAxisSetting(QAxisSetting *axisSetting) +{ + Q_D(QAbstractPhysicalDevice); + if (d->m_axisSettings.contains(axisSetting)) + d->m_axisSettings.removeOne(axisSetting); +} + +QVector<QAxisSetting *> QAbstractPhysicalDevice::axisSettings() const +{ + Q_D(const QAbstractPhysicalDevice); + return d->m_axisSettings; +} + +void QAbstractPhysicalDevice::copy(const QNode *ref) +{ + QNode::copy(ref); + const QAbstractPhysicalDevice *physicalDevice = static_cast<const QAbstractPhysicalDevice *>(ref); + d_func()->m_axisSettings = physicalDevice->axisSettings(); +} + } QT_END_NAMESPACE |