summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2016-02-25 18:32:01 +0100
committerPaul Lemire <paul.lemire@kdab.com>2016-02-29 11:12:57 +0000
commit8a30f6391791e468a680834d1e445102e6fe4d47 (patch)
tree2524bdb58338e0c7063fcd8172f338594946f4cd
parent3609ef317c5b454548b25d31100fd3d2090a6e9d (diff)
Inputs overhauled
- Remove QAxisActionHandler - Remove AxisAxtionHandler, AxisActionPayload, UpdateHandlerJob - Make QLogicalDevice a QComponent - QAction sending action active update to frontend - QAxis sending axis value update to frontend - QFirstPersonCameraController rewritten in a more efficient manner Change-Id: I09a83f95b97238e4393a88103f76d8ba93e1403d Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
-rw-r--r--examples/qt3d/examples-common/FirstPersonCameraController.qml173
-rw-r--r--examples/qt3d/examples-common/qfirstpersoncameracontroller.cpp66
-rw-r--r--examples/qt3d/examples-common/qfirstpersoncameracontroller.h3
-rw-r--r--examples/qt3d/examples-common/qfirstpersoncameracontroller_p.h16
-rw-r--r--src/input/backend/action.cpp14
-rw-r--r--src/input/backend/axis.cpp14
-rw-r--r--src/input/backend/axisactionhandler.cpp138
-rw-r--r--src/input/backend/axisactionhandler_p.h104
-rw-r--r--src/input/backend/axisactionpayload_p.h129
-rw-r--r--src/input/backend/backend.pri5
-rw-r--r--src/input/backend/inputhandler.cpp1
-rw-r--r--src/input/backend/inputhandler_p.h3
-rw-r--r--src/input/backend/inputmanagers_p.h18
-rw-r--r--src/input/backend/updatehandlerjob.cpp158
-rw-r--r--src/input/backend/updatehandlerjob_p.h91
-rw-r--r--src/input/frontend/frontend.pri3
-rw-r--r--src/input/frontend/qaxisactionhandler.cpp200
-rw-r--r--src/input/frontend/qaxisactionhandler.h88
-rw-r--r--src/input/frontend/qaxisactionhandler_p.h76
-rw-r--r--src/input/frontend/qinputaspect.cpp31
-rw-r--r--src/input/frontend/qlogicaldevice.cpp10
-rw-r--r--src/input/frontend/qlogicaldevice.h4
-rw-r--r--src/quick3d/imports/input/qt3dquick3dinputplugin.cpp2
-rw-r--r--tests/auto/input/action/action.pro2
-rw-r--r--tests/auto/input/action/tst_action.cpp32
-rw-r--r--tests/auto/input/axis/axis.pro2
-rw-r--r--tests/auto/input/axis/tst_axis.cpp32
27 files changed, 160 insertions, 1255 deletions
diff --git a/examples/qt3d/examples-common/FirstPersonCameraController.qml b/examples/qt3d/examples-common/FirstPersonCameraController.qml
index 81c20d71f..6c805a5bf 100644
--- a/examples/qt3d/examples-common/FirstPersonCameraController.qml
+++ b/examples/qt3d/examples-common/FirstPersonCameraController.qml
@@ -63,13 +63,13 @@ Entity {
QtObject {
id: d
readonly property vector3d firstPersonUp: Qt.vector3d(0, 1, 0)
- property bool leftMouseButtonPressed: false
- property real vx: 0;
- property real vy: 0;
- property real vz: 0;
- property real dx: 0
- property real dy: 0
- property bool fineMotion: false
+ readonly property bool leftMouseButtonPressed: leftMouseButtonAction.active
+ readonly property real vx: txAxis.value * linearSpeed;
+ readonly property real vy: tyAxis.value * linearSpeed;
+ readonly property real vz: tzAxis.value * linearSpeed;
+ readonly property real dx: rxAxis.value * lookSpeed
+ readonly property real dy: ryAxis.value * lookSpeed
+ readonly property bool fineMotion: fineMotionAction.active
}
KeyboardController {
@@ -81,176 +81,83 @@ Entity {
sensitivity: d.fineMotion ? 0.01 : 0.1
}
- LogicalDevice {
- id: cameraControlDevice
+ components: [
- actions: [
- Action {
- name: "LMB"
- inputs: [
+ LogicalDevice {
+ actions: [
+ Action {
+ id: leftMouseButtonAction
ActionInput {
sourceDevice: mouseSourceDevice
keys: [MouseController.Left]
}
- ]
- },
- Action {
- name: "fineMotion"
- inputs: [
+ },
+ Action {
+ id: fineMotionAction
ActionInput {
sourceDevice: keyboardSourceDevice
keys: [Qt.Key_Shift]
}
- ]
- }
- ] // actions
+ }
+ ] // actions
- axes: [
- // Rotation
- Axis {
- name: "RX"
- inputs: [
+ axes: [
+ // Rotation
+ Axis {
+ id: rxAxis
AxisInput {
sourceDevice: mouseSourceDevice
axis: MouseController.X
}
- ]
- },
- Axis {
- name: "RY"
- inputs: [
+ },
+ Axis {
+ id: ryAxis
AxisInput {
sourceDevice: mouseSourceDevice
axis: MouseController.Y
}
- ]
- },
- // Translation
- Axis {
- name: "TX"
- inputs: [
+ },
+ // Translation
+ Axis {
+ id: txAxis
AxisInput {
sourceDevice: keyboardSourceDevice
keys: [Qt.Key_Left]
scale: -1.0
- },
+ }
AxisInput {
sourceDevice: keyboardSourceDevice
keys: [Qt.Key_Right]
scale: 1.0
}
- ]
- },
- Axis {
- name: "TZ"
- inputs: [
+ },
+ Axis {
+ id: tzAxis
AxisInput {
sourceDevice: keyboardSourceDevice
keys: [Qt.Key_Up]
scale: 1.0
- },
+ }
AxisInput {
sourceDevice: keyboardSourceDevice
keys: [Qt.Key_Down]
scale: -1.0
}
- ]
- },
- Axis {
- name: "TY"
- inputs: [
+ },
+ Axis {
+ id: tyAxis
AxisInput {
sourceDevice: keyboardSourceDevice
keys: [Qt.Key_PageUp]
scale: 1.0
- },
+ }
AxisInput {
sourceDevice: keyboardSourceDevice
keys: [Qt.Key_PageDown]
scale: -1.0
}
- ]
- }
- ] // axes
- }
-
- components: [
- AxisActionHandler {
- id: handler
- logicalDevice: cameraControlDevice
-
- onAxisValueChanged: {
-
- switch (name) {
-
- case "TX": {
- d.vx = axisValue * linearSpeed
- break;
- }
-
- case "TY": {
- d.vy = axisValue * linearSpeed
- break;
- }
-
- case "TZ": {
- d.vz = axisValue * linearSpeed
- break;
- }
-
- case "RX": {
- d.dx = axisValue;
- break;
- }
-
- case "RY": {
- d.dy = axisValue;
- break;
- }
- case "MouseWheel": {
- d.zoom = axisValue;
- break
}
-
- }
- }
-
- onActionStarted: {
-
- switch (name) {
-
- case "LMB": {
- d.leftMouseButtonPressed = true;
- break;
- }
-
- case "fineMotion": {
- console.log("fineMotion started")
- d.fineMotion = true;
- break;
- }
-
- }
-
- }
-
- onActionFinished: {
-
- switch (name) {
-
- case "LMB": {
- d.leftMouseButtonPressed = false;
- break;
- }
-
- case "fineMotion": {
- console.log("fineMotion finished")
- d.fineMotion = false;
- break;
- }
-
- }
- }
+ ] // axes
},
LogicComponent {
@@ -260,8 +167,8 @@ Entity {
root.camera.translate(Qt.vector3d(d.vx, d.vy, d.vz).times(dt))
if (d.leftMouseButtonPressed) {
- root.camera.pan(root.lookSpeed * d.dx * dt, d.firstPersonUp)
- root.camera.tilt(root.lookSpeed * d.dy * dt)
+ root.camera.pan(d.dx * dt, d.firstPersonUp)
+ root.camera.tilt(d.dy * dt)
}
}
}
diff --git a/examples/qt3d/examples-common/qfirstpersoncameracontroller.cpp b/examples/qt3d/examples-common/qfirstpersoncameracontroller.cpp
index 1a06fb64e..dd12ec344 100644
--- a/examples/qt3d/examples-common/qfirstpersoncameracontroller.cpp
+++ b/examples/qt3d/examples-common/qfirstpersoncameracontroller.cpp
@@ -56,7 +56,6 @@
#include <Qt3DInput/QAction>
#include <Qt3DInput/QActionInput>
#include <Qt3DInput/QLogicalDevice>
-#include <Qt3DInput/QAxisActionHandler>
#include <Qt3DInput/QKeyboardController>
#include <Qt3DInput/QMouseController>
#include <Qt3DLogic/QLogicComponent>
@@ -89,12 +88,9 @@ QFirstPersonCameraControllerPrivate::QFirstPersonCameraControllerPrivate()
, m_keyboardController(new QKeyboardController())
, m_mouseController(new QMouseController())
, m_logicalDevice(new QLogicalDevice())
- , m_axisActionHandler(new QAxisActionHandler())
, m_logicComponent(new Qt3DLogic::QLogicComponent())
, m_linearSpeed(10.0f)
, m_lookSpeed(180.0f)
- , m_fineMotion(false)
- , m_leftMouseButtonPressed(false)
, m_firstPersonUp(QVector3D(0.0f, 1.0f, 0.0f))
{}
@@ -106,13 +102,11 @@ void QFirstPersonCameraControllerPrivate::init()
m_leftMouseButtonInput->setKeys(QVariantList() << QMouseController::Left);
m_leftMouseButtonInput->setSourceDevice(m_mouseController);
m_leftMouseButtonAction->addInput(m_leftMouseButtonInput);
- m_leftMouseButtonAction->setName(QStringLiteral("LMB"));
// Fine Motion Action
m_fineMotionKeyInput->setKeys(QVariantList() << Qt::Key_Shift);
m_fineMotionKeyInput->setSourceDevice(m_keyboardController);
m_fineMotionAction->addInput(m_fineMotionKeyInput);
- m_fineMotionAction->setName(QStringLiteral("fineMotion"));
//// Axes
@@ -120,13 +114,11 @@ void QFirstPersonCameraControllerPrivate::init()
m_mouseRxInput->setAxis(QMouseController::X);
m_mouseRxInput->setSourceDevice(m_mouseController);
m_rxAxis->addInput(m_mouseRxInput);
- m_rxAxis->setName(QStringLiteral("RX"));
// Mouse Y
m_mouseRyInput->setAxis(QMouseController::Y);
m_mouseRyInput->setSourceDevice(m_mouseController);
m_ryAxis->addInput(m_mouseRyInput);
- m_ryAxis->setName(QStringLiteral("RY"));
// Keyboard Pos Tx
m_keyboardTxPosInput->setKeys(QVariantList() << Qt::Key_Right);
@@ -164,10 +156,6 @@ void QFirstPersonCameraControllerPrivate::init()
m_keyboardTzNegInput->setSourceDevice(m_keyboardController);
m_tzAxis->addInput(m_keyboardTzNegInput);
- m_txAxis->setName(QStringLiteral("TX"));
- m_tyAxis->setName(QStringLiteral("TY"));
- m_tzAxis->setName(QStringLiteral("TZ"));
-
//// Logical Device
m_logicalDevice->addAction(m_fineMotionAction);
@@ -179,68 +167,28 @@ void QFirstPersonCameraControllerPrivate::init()
m_logicalDevice->addAxis(m_tzAxis);
Q_Q(QFirstPersonCameraController);
-
- //// AxisActionHandler
-
- QObject::connect(m_axisActionHandler, SIGNAL(actionStarted(QString)),
- q, SLOT(_q_onActionStarted(QString)));
- QObject::connect(m_axisActionHandler, SIGNAL(actionFinished(QString)),
- q, SLOT(_q_onActionFinished(QString)));
- QObject::connect(m_axisActionHandler, SIGNAL(axisValueChanged(QString,float)),
- q, SLOT(_q_onAxisValueChanged(QString,float)));
-
- m_axisActionHandler->setLogicalDevice(m_logicalDevice);
-
//// LogicComponent
QObject::connect(m_logicComponent, SIGNAL(frameUpdate(float)),
q, SLOT(_q_onFrameUpdate(float)));
q->addComponent(m_logicComponent);
- q->addComponent(m_axisActionHandler);
+ q->addComponent(m_logicalDevice);
}
void QFirstPersonCameraControllerPrivate::_q_onFrameUpdate(float dt)
{
if (m_camera != Q_NULLPTR) {
- m_camera->translate(m_vxyz * dt);
- if (m_leftMouseButtonPressed) {
- m_camera->pan(m_rxyz.x() * dt, m_firstPersonUp);
- m_camera->tilt(m_rxyz.y() * dt);
+ m_camera->translate(QVector3D(m_txAxis->value() * m_linearSpeed,
+ m_tyAxis->value() * m_linearSpeed,
+ m_tzAxis->value() * m_linearSpeed) * dt);
+ if (m_leftMouseButtonAction->isActive()) {
+ m_camera->pan(m_rxAxis->value() * m_lookSpeed * dt, m_firstPersonUp);
+ m_camera->tilt(m_ryAxis->value() * m_lookSpeed * dt);
}
}
}
-void QFirstPersonCameraControllerPrivate::_q_onAxisValueChanged(QString name, float value)
-{
- if (name == QStringLiteral("RX"))
- m_rxyz.setX(value * m_lookSpeed);
- else if (name == QStringLiteral("RY"))
- m_rxyz.setY(value * m_lookSpeed);
- else if (name == QStringLiteral("TX"))
- m_vxyz.setX(value * m_linearSpeed);
- else if (name == QStringLiteral("TY"))
- m_vxyz.setY(value * m_linearSpeed);
- else if (name == QStringLiteral("TZ"))
- m_vxyz.setZ(value * m_linearSpeed);
-}
-
-void QFirstPersonCameraControllerPrivate::_q_onActionStarted(QString name)
-{
- if (name == QStringLiteral("LMB"))
- m_leftMouseButtonPressed = true;
- else if (name == QStringLiteral("fineMotion"))
- m_fineMotion = true;
-}
-
-void QFirstPersonCameraControllerPrivate::_q_onActionFinished(QString name)
-{
- if (name == QStringLiteral("LMB"))
- m_leftMouseButtonPressed = false;
- else if (name == QStringLiteral("fineMotion"))
- m_fineMotion = false;
-}
-
QFirstPersonCameraController::QFirstPersonCameraController(Qt3DCore::QNode *parent)
: Qt3DCore::QEntity(*new QFirstPersonCameraControllerPrivate, parent)
{
diff --git a/examples/qt3d/examples-common/qfirstpersoncameracontroller.h b/examples/qt3d/examples-common/qfirstpersoncameracontroller.h
index dfc93cc7a..be1496936 100644
--- a/examples/qt3d/examples-common/qfirstpersoncameracontroller.h
+++ b/examples/qt3d/examples-common/qfirstpersoncameracontroller.h
@@ -90,9 +90,6 @@ Q_SIGNALS:
private:
Q_DECLARE_PRIVATE(QFirstPersonCameraController)
Q_PRIVATE_SLOT(d_func(), void _q_onFrameUpdate(float))
- Q_PRIVATE_SLOT(d_func(), void _q_onAxisValueChanged(QString, float))
- Q_PRIVATE_SLOT(d_func(), void _q_onActionStarted(QString))
- Q_PRIVATE_SLOT(d_func(), void _q_onActionFinished(QString))
};
} // Qt3DInput
diff --git a/examples/qt3d/examples-common/qfirstpersoncameracontroller_p.h b/examples/qt3d/examples-common/qfirstpersoncameracontroller_p.h
index 29120e431..e1d53fa95 100644
--- a/examples/qt3d/examples-common/qfirstpersoncameracontroller_p.h
+++ b/examples/qt3d/examples-common/qfirstpersoncameracontroller_p.h
@@ -84,15 +84,19 @@ public:
void init();
Qt3DRender::QCamera *m_camera;
+
QAction *m_leftMouseButtonAction;
QAction *m_fineMotionAction;
+
QAxis *m_rxAxis;
QAxis *m_ryAxis;
QAxis *m_txAxis;
QAxis *m_tyAxis;
QAxis *m_tzAxis;
+
QActionInput *m_leftMouseButtonInput;
QActionInput *m_fineMotionKeyInput;
+
QAxisInput *m_mouseRxInput;
QAxisInput *m_mouseRyInput;
QAxisInput *m_keyboardTxPosInput;
@@ -101,23 +105,19 @@ public:
QAxisInput *m_keyboardTxNegInput;
QAxisInput *m_keyboardTyNegInput;
QAxisInput *m_keyboardTzNegInput;
+
QKeyboardController *m_keyboardController;
QMouseController *m_mouseController;
+
QLogicalDevice *m_logicalDevice;
- QAxisActionHandler *m_axisActionHandler;
+
Qt3DLogic::QLogicComponent *m_logicComponent;
+
float m_linearSpeed;
float m_lookSpeed;
- QVector3D m_vxyz;
- bool m_fineMotion;
- QVector3D m_rxyz;
- bool m_leftMouseButtonPressed;
QVector3D m_firstPersonUp;
void _q_onFrameUpdate(float);
- void _q_onAxisValueChanged(QString, float);
- void _q_onActionStarted(QString);
- void _q_onActionFinished(QString);
Q_DECLARE_PUBLIC(QFirstPersonCameraController)
};
diff --git a/src/input/backend/action.cpp b/src/input/backend/action.cpp
index 6c5e25a5c..df3d773a2 100644
--- a/src/input/backend/action.cpp
+++ b/src/input/backend/action.cpp
@@ -41,6 +41,7 @@
#include <Qt3DInput/qaction.h>
#include <Qt3DInput/qabstractactioninput.h>
#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qbackendscenepropertychange.h>
QT_BEGIN_NAMESPACE
@@ -49,7 +50,7 @@ namespace Qt3DInput {
namespace Input {
Action::Action()
- : Qt3DCore::QBackendNode()
+ : Qt3DCore::QBackendNode(ReadWrite)
, m_enabled(false)
, m_actionTriggered(false)
{
@@ -74,7 +75,16 @@ void Action::cleanup()
void Action::setActionTriggered(bool actionTriggered)
{
- m_actionTriggered = actionTriggered;
+ if (actionTriggered != m_actionTriggered) {
+ m_actionTriggered = actionTriggered;
+
+ // Send change to the frontend
+ Qt3DCore::QBackendScenePropertyChangePtr e(new Qt3DCore::QBackendScenePropertyChange(Qt3DCore::NodeUpdated, peerUuid()));
+ e->setTargetNode(peerUuid());
+ e->setPropertyName("active");
+ e->setValue(m_actionTriggered);
+ notifyObservers(e);
+ }
}
void Action::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
diff --git a/src/input/backend/axis.cpp b/src/input/backend/axis.cpp
index ad8ce5471..9f041f829 100644
--- a/src/input/backend/axis.cpp
+++ b/src/input/backend/axis.cpp
@@ -41,6 +41,7 @@
#include <Qt3DInput/qaxis.h>
#include <Qt3DInput/qaxisinput.h>
#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qbackendscenepropertychange.h>
QT_BEGIN_NAMESPACE
@@ -49,7 +50,7 @@ namespace Qt3DInput {
namespace Input {
Axis::Axis()
- : Qt3DCore::QBackendNode()
+ : Qt3DCore::QBackendNode(ReadWrite)
, m_enabled(false)
, m_axisValue(0.0f)
{
@@ -74,7 +75,16 @@ void Axis::cleanup()
void Axis::setAxisValue(float axisValue)
{
- m_axisValue = axisValue;
+ if (axisValue != m_axisValue) {
+ m_axisValue = axisValue;
+
+ // Send a change to the frontend
+ Qt3DCore::QBackendScenePropertyChangePtr e(new Qt3DCore::QBackendScenePropertyChange(Qt3DCore::NodeUpdated, peerUuid()));
+ e->setTargetNode(peerUuid());
+ e->setPropertyName("value");
+ e->setValue(m_axisValue);
+ notifyObservers(e);
+ }
}
void Axis::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
diff --git a/src/input/backend/axisactionhandler.cpp b/src/input/backend/axisactionhandler.cpp
deleted file mode 100644
index 9efeb1acc..000000000
--- a/src/input/backend/axisactionhandler.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "axisactionhandler_p.h"
-#include <Qt3DInput/qaxisactionhandler.h>
-#include <Qt3DInput/qlogicaldevice.h>
-#include <Qt3DCore/qscenepropertychange.h>
-#include <Qt3DInput/private/inputmanagers_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
-#include <Qt3DCore/qbackendscenepropertychange.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-namespace Input {
-
-AxisActionHandler::AxisActionHandler()
- : Qt3DCore::QBackendNode(ReadWrite)
- , m_logicalDevice()
-{
-
-}
-
-void AxisActionHandler::updateFromPeer(Qt3DCore::QNode *peer)
-{
- Qt3DInput::QAxisActionHandler *handler = static_cast<Qt3DInput::QAxisActionHandler *>(peer);
- if (handler->logicalDevice())
- m_logicalDevice = handler->logicalDevice()->id();
- // TO DO: Store the state of the actions
-}
-
-void AxisActionHandler::cleanup()
-{
- m_logicalDevice = Qt3DCore::QNodeId();
-}
-
-void AxisActionHandler::setAndTransmitActionPayload(const ActionStates &actionStates, const ActionPayload &deltaPayload)
-{
- if (m_lastActionStates != actionStates) {
- m_lastActionStates = actionStates;
-
- Qt3DCore::QBackendScenePropertyChangePtr e(new Qt3DCore::QBackendScenePropertyChange(Qt3DCore::NodeUpdated, peerUuid()));
- e->setTargetNode(peerUuid());
- e->setPropertyName("actionPayload");
- e->setValue(QVariant::fromValue(deltaPayload));
- notifyObservers(e);
- }
-}
-
-void AxisActionHandler::setAndTransmitAxisPayload(const AxisPayload &payload)
-{
- if (m_lastAxisPayload != payload) {
- m_lastAxisPayload = payload;
-
- Qt3DCore::QBackendScenePropertyChangePtr e(new Qt3DCore::QBackendScenePropertyChange(Qt3DCore::NodeUpdated, peerUuid()));
- e->setTargetNode(peerUuid());
- e->setPropertyName("axisPayload");
- e->setValue(QVariant::fromValue(payload));
- notifyObservers(e);
- }
-}
-
-void AxisActionHandler::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
-{
- if (e->type() == Qt3DCore::NodeUpdated) {
- Qt3DCore::QScenePropertyChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QScenePropertyChange>(e);
- if (propertyChange->propertyName() == QByteArrayLiteral("logicalDevice")) {
- m_logicalDevice = propertyChange->value().value<Qt3DCore::QNodeId>();
- }
- }
-}
-
-AxisActionHandlerNodeFunctor::AxisActionHandlerNodeFunctor(AxisActionHandlerManager *manager)
- : m_manager(manager)
-{
-}
-
-Qt3DCore::QBackendNode *AxisActionHandlerNodeFunctor::create(Qt3DCore::QNode *frontend) const
-{
- HAxisActionHandler handle = m_manager->getOrAcquireHandle(frontend->id());
- AxisActionHandler *backend = m_manager->data(handle);
- m_manager->addActiveAxisActionHandler(handle);
- backend->setPeer(frontend);
- return backend;
-}
-
-Qt3DCore::QBackendNode *AxisActionHandlerNodeFunctor::get(Qt3DCore::QNodeId id) const
-{
- return m_manager->lookupResource(id);
-}
-
-void AxisActionHandlerNodeFunctor::destroy(Qt3DCore::QNodeId id) const
-{
- HAxisActionHandler handle = m_manager->lookupHandle(id);
- m_manager->releaseResource(id);
- m_manager->removeActiveAxisActionHandler(handle);
-}
-
-} // namespace Input
-} // namespace Qt3DInput
-
-QT_END_NAMESPACE
diff --git a/src/input/backend/axisactionhandler_p.h b/src/input/backend/axisactionhandler_p.h
deleted file mode 100644
index 21fd5289f..000000000
--- a/src/input/backend/axisactionhandler_p.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QINPUTASPECT_INPUT_AXISACTIONHANDLER_P_H
-#define QINPUTASPECT_INPUT_AXISACTIONHANDLER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DCore/qbackendnode.h>
-#include <Qt3DCore/qnodeid.h>
-#include <Qt3DInput/private/axisactionpayload_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-namespace Input {
-
-class AxisActionHandlerManager;
-
-class AxisActionHandler : public Qt3DCore::QBackendNode
-{
-public:
- AxisActionHandler();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
- void cleanup();
- inline Qt3DCore::QNodeId logicalDevice() const { return m_logicalDevice; }
- void setAndTransmitActionPayload(const ActionStates &actionStates, const ActionPayload &deltaPayload);
- void setAndTransmitAxisPayload(const AxisPayload &payload);
- inline AxisPayload lastAxisPayload() const { return m_lastAxisPayload; }
- inline ActionPayload lastActionStates() const { return m_lastActionStates; }
-
-protected:
- void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
-
-private:
- Qt3DCore::QNodeId m_logicalDevice;
- AxisPayload m_lastAxisPayload;
- ActionPayload m_lastActionStates;
-};
-
-class AxisActionHandlerNodeFunctor : public Qt3DCore::QBackendNodeMapper
-{
-public:
- explicit AxisActionHandlerNodeFunctor(AxisActionHandlerManager *manager);
-
- Qt3DCore::QBackendNode *create(Qt3DCore::QNode *frontend) const Q_DECL_FINAL;
- Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const Q_DECL_FINAL;
- void destroy(Qt3DCore::QNodeId id) const Q_DECL_FINAL;
-
-private:
- AxisActionHandlerManager *m_manager;
-};
-
-} // namespace Input
-} // namespace Qt3DInput
-
-QT_END_NAMESPACE
-
-#endif // QINPUTASPECT_INPUT_AXISACTIONHANDLER_P_H
diff --git a/src/input/backend/axisactionpayload_p.h b/src/input/backend/axisactionpayload_p.h
deleted file mode 100644
index 48a0c20f6..000000000
--- a/src/input/backend/axisactionpayload_p.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DINPUT_INPUT_AXISACTIONPAYLOAD_P_H
-#define QT3DINPUT_INPUT_AXISACTIONPAYLOAD_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DInput/qt3dinput_global.h>
-#include <Qt3DCore/qnodeid.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-
-namespace Input {
-
-struct AxisUpdate
-{
- Qt3DCore::QNodeId id;
- QString name;
- float value;
-
- bool operator ==(const AxisUpdate &other) const
- {
- return (id == other.id) && qFuzzyCompare(value, other.value);
- }
-};
-
-struct ActionUpdate
-{
- Qt3DCore::QNodeId id;
- QString name;
- bool triggered;
-
- bool operator ==(const ActionUpdate &other) const
- {
- return (id == other.id) && (triggered == other.triggered);
- }
-};
-
-struct ActionPayload
-{
- QVector<ActionUpdate> actions;
-
- bool operator ==(const ActionPayload &other) const
- {
- return actions == other.actions;
- }
-
- bool operator !=(const ActionPayload &other) const
- {
- return !(*this == other);
- }
-};
-
-typedef ActionPayload ActionStates;
-
-struct AxisPayload
-{
- QVector<AxisUpdate> axes;
-
- bool operator ==(const AxisPayload &other) const
- {
- return axes == other.axes;
- }
-
- bool operator !=(const AxisPayload &other) const
- {
- return !(*this == other);
- }
-};
-
-} // Input
-
-} // Qt3DInput
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(Qt3DInput::Input::AxisPayload);
-Q_DECLARE_METATYPE(Qt3DInput::Input::ActionPayload);
-
-#endif // QT3DINPUT_INPUT_AXISACTIONPAYLOAD_P_H
-
diff --git a/src/input/backend/backend.pri b/src/input/backend/backend.pri
index b57dc2a28..d4d76dae1 100644
--- a/src/input/backend/backend.pri
+++ b/src/input/backend/backend.pri
@@ -22,9 +22,6 @@ HEADERS += \
$$PWD/axissetting_p.h \
$$PWD/qabstractphysicaldevicebackendnode_p.h \
$$PWD/updateaxisactionjob_p.h \
- $$PWD/axisactionhandler_p.h \
- $$PWD/updatehandlerjob_p.h \
- $$PWD/axisactionpayload_p.h \
$$PWD/keyboardmousegenericdeviceintegration_p.h \
$$PWD/genericdevicebackendnode_p.h \
$$PWD/inputchord_p.h \
@@ -52,8 +49,6 @@ SOURCES += \
$$PWD/movingaverage.cpp \
$$PWD/axissetting.cpp \
$$PWD/updateaxisactionjob.cpp \
- $$PWD/axisactionhandler.cpp \
- $$PWD/updatehandlerjob.cpp \
$$PWD/keyboardmousegenericdeviceintegration.cpp \
$$PWD/genericdevicebackendnode.cpp \
$$PWD/inputchord.cpp \
diff --git a/src/input/backend/inputhandler.cpp b/src/input/backend/inputhandler.cpp
index 834ec19d1..1556256cd 100644
--- a/src/input/backend/inputhandler.cpp
+++ b/src/input/backend/inputhandler.cpp
@@ -65,7 +65,6 @@ InputHandler::InputHandler()
, m_axisManager(new AxisManager())
, m_actionManager(new ActionManager())
, m_axisInputManager(new AxisInputManager())
- , m_axisActionHandlerManager(new AxisActionHandlerManager())
, m_axisSettingManager(new AxisSettingManager())
, m_actionInputManager(new ActionInputManager())
, m_inputChordManager(new InputChordManager())
diff --git a/src/input/backend/inputhandler_p.h b/src/input/backend/inputhandler_p.h
index 460497958..25ad2e838 100644
--- a/src/input/backend/inputhandler_p.h
+++ b/src/input/backend/inputhandler_p.h
@@ -76,7 +76,6 @@ class MouseControllerManager;
class MouseInputManager;
class MouseEventFilter;
class AxisManager;
-class AxisActionHandlerManager;
class ActionManager;
class AxisInputManager;
class AxisSettingManager;
@@ -102,7 +101,6 @@ public:
inline AxisManager *axisManager() const { return m_axisManager; }
inline ActionManager *actionManager() const { return m_actionManager; }
inline AxisInputManager *axisInputManager() const { return m_axisInputManager; }
- inline AxisActionHandlerManager *axisActionHandlerManager() const { return m_axisActionHandlerManager; }
inline AxisSettingManager *axisSettingManager() const { return m_axisSettingManager; }
inline ActionInputManager *actionInputManager() const { return m_actionInputManager; }
inline InputChordManager *inputChordManager() const { return m_inputChordManager; }
@@ -158,7 +156,6 @@ private:
AxisManager *m_axisManager;
ActionManager *m_actionManager;
AxisInputManager *m_axisInputManager;
- AxisActionHandlerManager *m_axisActionHandlerManager;
AxisSettingManager *m_axisSettingManager;
ActionInputManager *m_actionInputManager;
InputChordManager *m_inputChordManager;
diff --git a/src/input/backend/inputmanagers_p.h b/src/input/backend/inputmanagers_p.h
index 32e09348c..36b5f2ce7 100644
--- a/src/input/backend/inputmanagers_p.h
+++ b/src/input/backend/inputmanagers_p.h
@@ -64,7 +64,6 @@
#include <Qt3DInput/private/axisinput_p.h>
#include <Qt3DInput/private/action_p.h>
#include <Qt3DInput/private/axis_p.h>
-#include <Qt3DInput/private/axisactionhandler_p.h>
#include <Qt3DInput/private/axissetting_p.h>
#include <Qt3DInput/private/logicaldevice_p.h>
#include <Qt3DInput/private/genericdevicebackendnode_p.h>
@@ -124,23 +123,6 @@ public:
AxisManager() {}
};
-class AxisActionHandlerManager : public Qt3DCore::QResourceManager<
- AxisActionHandler,
- Qt3DCore::QNodeId,
- 16,
- Qt3DCore::ArrayAllocatingPolicy>
-{
-public:
- AxisActionHandlerManager() {}
-
- void addActiveAxisActionHandler(HAxisActionHandler handle) { m_activeAxisActionHandlers.push_back(handle); }
- void removeActiveAxisActionHandler(HAxisActionHandler handle) { m_activeAxisActionHandlers.removeOne(handle); }
- QVector<HAxisActionHandler> activeAxisActionHandlers() const { return m_activeAxisActionHandlers; }
-
-private:
- QVector<HAxisActionHandler> m_activeAxisActionHandlers;
-};
-
class AxisSettingManager : public Qt3DCore::QResourceManager<
AxisSetting,
Qt3DCore::QNodeId,
diff --git a/src/input/backend/updatehandlerjob.cpp b/src/input/backend/updatehandlerjob.cpp
deleted file mode 100644
index 31ac7648c..000000000
--- a/src/input/backend/updatehandlerjob.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "updatehandlerjob_p.h"
-#include <Qt3DInput/private/inputhandler_p.h>
-#include <Qt3DInput/private/inputmanagers_p.h>
-#include <Qt3DInput/private/axisactionpayload_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput
-{
-
-namespace Input
-{
-
-namespace {
-
-int containsAxis(const Qt3DCore::QNodeId axisId, const AxisPayload &payload)
-{
- for (int i = 0, m = payload.axes.size(); i < m; ++i)
- if (payload.axes.at(i).id == axisId)
- return i;
- return -1;
-}
-
-int containsAction(const Qt3DCore::QNodeId actionId, const ActionPayload &payload)
-{
- for (int i = 0, m = payload.actions.size(); i < m; ++i)
- if (payload.actions.at(i).id == actionId)
- return i;
- return -1;
-}
-
-} // anonymous
-
-UpdateHandlerJob::UpdateHandlerJob(AxisActionHandler *axisActionHandler, HLogicalDevice logicalDeviceHandler, InputHandler *handler)
- : m_axisActionHandler(axisActionHandler)
- , m_logicalDeviceHandle(logicalDeviceHandler)
- , m_handler(handler)
-{
-}
-
-void UpdateHandlerJob::run()
-{
- // Find the LogicalDevice
- // Find each Axis
- // Check if their values have changed since the last time
- // If so -> add to notification payload
-
- // Find each Action
- // Check if action state has changed since last frame
- // If so -> add to notification payload
-
- LogicalDevice *logicalDevice = m_handler->logicalDeviceManager()->data(m_logicalDeviceHandle);
- updateActions(logicalDevice);
- updateAxes(logicalDevice);
-}
-
-void UpdateHandlerJob::updateAxes(LogicalDevice *device)
-{
- AxisPayload payload = m_axisActionHandler->lastAxisPayload();
-
- Q_FOREACH (const Qt3DCore::QNodeId axisId, device->axes()) {
- const Axis *axis = m_handler->axisManager()->lookupResource(axisId);
- const int axisPositionInPayload = containsAxis(axisId, payload);
-
- if (axisPositionInPayload < 0) {
- // Not contained in the payload
- AxisUpdate axisUpdate;
- axisUpdate.name = axis->name();
- axisUpdate.id = axisId;
- axisUpdate.value = axis->axisValue();
- payload.axes.push_back(axisUpdate);
- } else {
- // The axis has the same value as before -> remove from the payload
- if (payload.axes.at(axisPositionInPayload).value != axis->axisValue())
- payload.axes[axisPositionInPayload].value = axis->axisValue();
- }
- }
-
- m_axisActionHandler->setAndTransmitAxisPayload(payload);
-}
-
-void UpdateHandlerJob::updateActions(LogicalDevice *device)
-{
- ActionStates actionStates;
-
- // Push each action into the payload to build the current action state for the frame
- Q_FOREACH (const Qt3DCore::QNodeId actionId, device->actions()) {
- const Action *action = m_handler->actionManager()->lookupResource(actionId);
- ActionUpdate actionState;
- actionState.id = actionId;
- actionState.name = action->name();
- actionState.triggered = action->actionTriggered();
- actionStates.actions.push_back(actionState);
- }
-
- // Compare the action state against the previous payload state
- ActionStates oldActionStates = m_axisActionHandler->lastActionStates();
- ActionPayload updatePayload;
-
- // Build up a delta payload
- Q_FOREACH (const ActionUpdate &actionUpdate, actionStates.actions) {
- const int posOfActionInOldPayload = containsAction(actionUpdate.id, oldActionStates);
- // If the action is not in the old payload or
- // is in the old payload state but has a different value
- // we add it to the delta payload
- if (posOfActionInOldPayload < 0 ||
- oldActionStates.actions.at(posOfActionInOldPayload).triggered != actionUpdate.triggered)
- updatePayload.actions.push_back(actionUpdate);
- }
-
- m_axisActionHandler->setAndTransmitActionPayload(actionStates, updatePayload);
-}
-
-} // Input
-
-} // Qt3DInput
-
-QT_END_NAMESPACE
-
diff --git a/src/input/backend/updatehandlerjob_p.h b/src/input/backend/updatehandlerjob_p.h
deleted file mode 100644
index 4ca90e800..000000000
--- a/src/input/backend/updatehandlerjob_p.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QINPUTASPECT_INPUT_UPDATEHANDLERSJOBS_H
-#define QINPUTASPECT_INPUT_UPDATEHANDLERSJOBS_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DCore/qaspectjob.h>
-#include <Qt3DInput/private/handle_types_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-
-namespace Input {
-
-class InputHandler;
-
-class UpdateHandlerJob : public Qt3DCore::QAspectJob
-{
-public:
- explicit UpdateHandlerJob(AxisActionHandler *axisActionHandler,
- HLogicalDevice logicalDeviceHandler,
- InputHandler *handler);
-
- void run() Q_DECL_FINAL;
-
-private:
- AxisActionHandler *m_axisActionHandler;
- HLogicalDevice m_logicalDeviceHandle;
- InputHandler *m_handler;
-
- void updateAxes(LogicalDevice *device);
- void updateActions(LogicalDevice *device);
-};
-
-typedef QScopedPointer<UpdateHandlerJob> UpdateHandlerJobPtr;
-
-} // Input
-
-} // Qt3DInput
-
-QT_END_NAMESPACE
-
-#endif // QINPUTASPECT_INPUT_UPDATEHANDLERSJOBS_H
diff --git a/src/input/frontend/frontend.pri b/src/input/frontend/frontend.pri
index 74a3f5805..46f0dbbf0 100644
--- a/src/input/frontend/frontend.pri
+++ b/src/input/frontend/frontend.pri
@@ -23,8 +23,6 @@ HEADERS += \
$$PWD/qinputdeviceintegrationfactory_p.h \
$$PWD/qaxissetting.h \
$$PWD/qabstractphysicaldevice_p.h \
- $$PWD/qaxisactionhandler_p.h \
- $$PWD/qaxisactionhandler.h \
$$PWD/qgenericinputdevice.h \
$$PWD/qabstractactioninput.h \
$$PWD/qabstractaggregateactioninput.h \
@@ -52,7 +50,6 @@ SOURCES += \
$$PWD/qabstractphysicaldevice.cpp \
$$PWD/qinputdeviceintegrationfactory.cpp \
$$PWD/qaxissetting.cpp \
- $$PWD/qaxisactionhandler.cpp \
$$PWD/qgenericinputdevice.cpp \
$$PWD/qabstractactioninput.cpp \
$$PWD/qabstractaggregateactioninput.cpp \
diff --git a/src/input/frontend/qaxisactionhandler.cpp b/src/input/frontend/qaxisactionhandler.cpp
deleted file mode 100644
index 98d1a1263..000000000
--- a/src/input/frontend/qaxisactionhandler.cpp
+++ /dev/null
@@ -1,200 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qaxisactionhandler.h"
-#include "qaxisactionhandler_p.h"
-
-#include <Qt3DInput/qlogicaldevice.h>
-#include <Qt3DInput/private/axisactionpayload_p.h>
-#include <Qt3DCore/qbackendscenepropertychange.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-
-/*! \internal */
-QAxisActionHandlerPrivate::QAxisActionHandlerPrivate()
- : Qt3DCore::QComponentPrivate()
- , m_logicalDevice(Q_NULLPTR)
-{
-}
-
-/*!
- \class Qt3DInput::QAxisActionHandler
- \inmodule Qt3DInput
- \inherits Qt3DCore::QComponent
- \brief QAxisActionHandler is the main link between Qt3d Actions and the rest of the program.
-
- It is responsible for linking to the actions on the connected logical device and performing
- some meaninful work within the application.
-
- \since 5.7
-*/
-
-/*!
- \qmltype AxisActionHandler
- \inqmlmodule Qt3D.Input
- \instantiates Qt3DInput::QAxisActionHandler
- \brief QML frontend for the Qt3DInput::QAxisActionHandler C++ class.
-
- QAxisActionHandler is the main link between Qt3d Actions and the rest of the program.
-
- It is responsible for linking to the actions on the connected logical device and performing
- some meaninful work within the application.
-
- \qml
- AxisActionHandler {
- id: axisActionHandler
- logicalDevice: keyboardLogicalDevice
-
- onActionStarted: {
- if (name === "fire")
- console.log("Firing")
- }
-
- onActionFinished: {
- if (name === "fire")
- console.log("Stopped Firing")
- }
-
- }
- \endqml
- \since 5.7
-*/
-
-/*!
- Constructs a new QAxisActionHandler instance with parent \a parent.
- */
-QAxisActionHandler::QAxisActionHandler(Qt3DCore::QNode *parent)
- : Qt3DCore::QComponent(*new QAxisActionHandlerPrivate, parent)
-{
-}
-
-QAxisActionHandler::QAxisActionHandler(QAxisActionHandlerPrivate &dd, Qt3DCore::QNode *parent)
- : Qt3DCore::QComponent(dd, parent)
-{
-
-}
-
-/*!
- Deletes the QAxisActionHandler instance.
- */
-QAxisActionHandler::~QAxisActionHandler()
-{
- QNode::cleanup();
-}
-
-/*!
- \fn QAxisActionHandler::logicalDeviceChanged()
-
- This signal is emitted when the logical device ascociated with the handeler is changed.
-*/
-
-/*!
- \qmlproperty LogicalDevice Qt3D.Input::AxisActionHandler::logicalDevice
-
- The current logical device of the assocciated with this handeler
-*/
-
-/*!
- \qmlsignal Qt3D.Input::AxisActionHandler::logicalDeviceChanged()
-
- This signal is emitted when the logical device ascociated with the handeler is changed.
-
- The corresponding handeler is \c onLogicalDeviceChanged
-*/
-/*!
- Return the logical device whos actions and actions this object handles.
- */
-Qt3DInput::QLogicalDevice *QAxisActionHandler::logicalDevice() const
-{
- Q_D(const QAxisActionHandler);
- return d->m_logicalDevice;
-}
-
-/*!
- Set the logical device whos actions and actions this object handles.
- */
-void QAxisActionHandler::setLogicalDevice(Qt3DInput::QLogicalDevice *logicalDevice)
-{
- Q_D(QAxisActionHandler);
- if (d->m_logicalDevice == logicalDevice)
- return;
-
- // Need to set the parent of the logical device if it has none
- // so as to trigger the backend node created with a NodeCreated notification
- if (logicalDevice && !logicalDevice->parent())
- logicalDevice->setParent(this);
-
- d->m_logicalDevice = logicalDevice;
- emit logicalDeviceChanged(logicalDevice);
-}
-
-void QAxisActionHandler::copy(const QNode *ref)
-{
- QComponent::copy(ref);
- const QAxisActionHandler *component = static_cast<const QAxisActionHandler *>(ref);
- d_func()->m_logicalDevice = qobject_cast<QLogicalDevice *>(QNode::clone(component->d_func()->m_logicalDevice));
-}
-
-void QAxisActionHandler::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
-{
- Qt3DCore::QBackendScenePropertyChangePtr e = qSharedPointerCast<Qt3DCore::QBackendScenePropertyChange>(change);
- if (e->type() == Qt3DCore::NodeUpdated) {
- if (e->propertyName() == QByteArrayLiteral("axisPayload")) {
- Qt3DInput::Input::AxisPayload payload = e->value().value<Qt3DInput::Input::AxisPayload>();
- Q_FOREACH (const Qt3DInput::Input::AxisUpdate &axisUpdate, payload.axes)
- axisValueChanged(axisUpdate.name, axisUpdate.value);
-
- } else if (e->propertyName() == QByteArrayLiteral("actionPayload")) {
- Qt3DInput::Input::ActionPayload payload = e->value().value<Qt3DInput::Input::ActionPayload>();
- Q_FOREACH (const Qt3DInput::Input::ActionUpdate &actionUpdate, payload.actions) {
- if (actionUpdate.triggered)
- actionStarted(actionUpdate.name);
- else
- actionFinished(actionUpdate.name);
- }
- }
- }
-}
-
-QT_END_NAMESPACE
-
-} // namespace Qt3DInput
-
diff --git a/src/input/frontend/qaxisactionhandler.h b/src/input/frontend/qaxisactionhandler.h
deleted file mode 100644
index 318679f41..000000000
--- a/src/input/frontend/qaxisactionhandler.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DINPUT_QAXISACTIONHANDLER_H
-#define QT3DINPUT_QAXISACTIONHANDLER_H
-
-#include <Qt3DInput/qt3dinput_global.h>
-#include <Qt3DCore/qcomponent.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-
-class QAxisActionHandlerPrivate;
-class QLogicalDevice;
-
-class QT3DINPUTSHARED_EXPORT QAxisActionHandler : public Qt3DCore::QComponent
-{
- Q_OBJECT
- Q_PROPERTY(Qt3DInput::QLogicalDevice* logicalDevice READ logicalDevice WRITE setLogicalDevice NOTIFY logicalDeviceChanged)
-
-public:
- explicit QAxisActionHandler(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QAxisActionHandler();
-
- Qt3DInput::QLogicalDevice *logicalDevice() const;
-
-public Q_SLOTS:
- void setLogicalDevice(Qt3DInput::QLogicalDevice *logicalDevice);
-
-Q_SIGNALS:
- void logicalDeviceChanged(Qt3DInput::QLogicalDevice *logicalDevice);
-
- void actionStarted(QString name);
- void actionFinished(QString name);
- void axisValueChanged(QString name, float axisValue);
-
-protected:
- Q_DECLARE_PRIVATE(QAxisActionHandler)
- QAxisActionHandler(QAxisActionHandlerPrivate &dd, Qt3DCore::QNode *parent = 0);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
- void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
-
-private:
- QT3D_CLONEABLE(QAxisActionHandler)
-};
-
-} // namespace Qt3DInput
-
-QT_END_NAMESPACE
-
-#endif // QT3DINPUT_QAXISACTIONHANDLER_H
diff --git a/src/input/frontend/qaxisactionhandler_p.h b/src/input/frontend/qaxisactionhandler_p.h
deleted file mode 100644
index 94b5ada3d..000000000
--- a/src/input/frontend/qaxisactionhandler_p.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DINPUT_QACTIONHANDLER_P_H
-#define QT3DINPUT_QACTIONHANDLER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DCore/private/qcomponent_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-
-class QLogicalDevice;
-
-class QAxisActionHandlerPrivate : public Qt3DCore::QComponentPrivate
-{
-public:
- QAxisActionHandlerPrivate();
-
- QLogicalDevice *m_logicalDevice;
-};
-
-}
-
-
-QT_END_NAMESPACE
-
-#endif // QT3DINPUT_QACTIONHANDLER_P_H
-
diff --git a/src/input/frontend/qinputaspect.cpp b/src/input/frontend/qinputaspect.cpp
index fd93d72a7..8077f99f7 100644
--- a/src/input/frontend/qinputaspect.cpp
+++ b/src/input/frontend/qinputaspect.cpp
@@ -60,7 +60,6 @@
#include <QPluginLoader>
#include <Qt3DInput/qaxis.h>
-#include <Qt3DInput/qaxisactionhandler.h>
#include <Qt3DInput/qaction.h>
#include <Qt3DInput/qaxisinput.h>
#include <Qt3DInput/qaxissetting.h>
@@ -70,7 +69,6 @@
#include <Qt3DInput/qlogicaldevice.h>
#include <Qt3DInput/qabstractphysicaldevice.h>
#include <Qt3DInput/private/axis_p.h>
-#include <Qt3DInput/private/axisactionhandler_p.h>
#include <Qt3DInput/private/action_p.h>
#include <Qt3DInput/private/axisinput_p.h>
#include <Qt3DInput/private/axissetting_p.h>
@@ -81,7 +79,6 @@
#include <Qt3DInput/private/inputbackendnodefunctor_p.h>
#include <Qt3DInput/private/inputmanagers_p.h>
#include <Qt3DInput/private/updateaxisactionjob_p.h>
-#include <Qt3DInput/private/updatehandlerjob_p.h>
#include <Qt3DInput/private/keyboardmousegenericdeviceintegration_p.h>
#include <Qt3DInput/private/genericdevicebackendnode_p.h>
#include <Qt3DInput/private/inputsettings_p.h>
@@ -124,7 +121,6 @@ QInputAspect::QInputAspect(QObject *parent)
registerBackendType<QActionInput>(QBackendNodeMapperPtr(new Input::InputNodeFunctor<Input::ActionInput, Input::ActionInputManager>(d_func()->m_inputHandler->actionInputManager())));
registerBackendType<QInputChord>(QBackendNodeMapperPtr(new Input::InputNodeFunctor<Input::InputChord, Input::InputChordManager>(d_func()->m_inputHandler->inputChordManager())));
registerBackendType<QInputSequence>(QBackendNodeMapperPtr(new Input::InputNodeFunctor<Input::InputSequence, Input::InputSequenceManager>(d_func()->m_inputHandler->inputSequenceManager())));
- registerBackendType<Qt3DInput::QAxisActionHandler>(QBackendNodeMapperPtr(new Input::AxisActionHandlerNodeFunctor(d_func()->m_inputHandler->axisActionHandlerManager())));
registerBackendType<QLogicalDevice>(QBackendNodeMapperPtr(new Input::LogicalDeviceNodeFunctor(d_func()->m_inputHandler->logicalDeviceManager())));
registerBackendType<QGenericInputDevice>(QBackendNodeMapperPtr(new Input::GenericDeviceBackendFunctor(this, d_func()->m_inputHandler.data())));
registerBackendType<QInputSettings>(QBackendNodeMapperPtr(new Input::InputSettingsFunctor(d_func()->m_inputHandler.data())));
@@ -184,33 +180,18 @@ QVector<QAspectJobPtr> QInputAspect::jobsToExecute(qint64 time)
Q_FOREACH (QInputDeviceIntegration *integration, d->m_inputHandler->inputDeviceIntegrations())
jobs += integration->jobsToExecute(time);
- // Jobs that update Axis/Action (store combined axis/action value)
- QHash<Input::HLogicalDevice, QAspectJobPtr> logicalDeviceJobs;
+ // All the jobs added up until this point are independents
+ // but the axis action jobs will be dependent on these
+ const QVector<QAspectJobPtr> dependsOnJobs = jobs;
+ // Jobs that update Axis/Action (store combined axis/action value)
Q_FOREACH (Input::HLogicalDevice devHandle, d->m_inputHandler->logicalDeviceManager()->activeDevices()) {
QAspectJobPtr updateAxisActionJob(new Input::UpdateAxisActionJob(time, d->m_inputHandler.data(), devHandle));
- logicalDeviceJobs.insert(devHandle, updateAxisActionJob);
-
- Q_FOREACH (const QAspectJobPtr job, jobs)
+ jobs += updateAxisActionJob;
+ Q_FOREACH (const QAspectJobPtr job, dependsOnJobs)
updateAxisActionJob->addDependency(job);
}
- // Jobs that update the axisactionhandlers
- Q_FOREACH (Input::HAxisActionHandler handlerHandle, d->m_inputHandler->axisActionHandlerManager()->activeAxisActionHandlers()) {
- Input::AxisActionHandler *axisActionHandler = d->m_inputHandler->axisActionHandlerManager()->data(handlerHandle);
- Input::HLogicalDevice logicalDeviceHandle = d->m_inputHandler->logicalDeviceManager()->lookupHandle(axisActionHandler->logicalDevice());
- QAspectJobPtr updateHandlerJob(new Input::UpdateHandlerJob(axisActionHandler, logicalDeviceHandle, d->m_inputHandler.data()));
-
- // Create AxisActionHandler Job
- jobs += updateHandlerJob;
-
- QAspectJobPtr logicalDeviceJob = logicalDeviceJobs.value(logicalDeviceHandle);
- if (logicalDeviceJob) {
- updateHandlerJob->addDependency(logicalDeviceJob);
- jobs += logicalDeviceJob;
- }
- }
-
return jobs;
}
diff --git a/src/input/frontend/qlogicaldevice.cpp b/src/input/frontend/qlogicaldevice.cpp
index 0b0eff28c..0216226ef 100644
--- a/src/input/frontend/qlogicaldevice.cpp
+++ b/src/input/frontend/qlogicaldevice.cpp
@@ -38,7 +38,7 @@
****************************************************************************/
#include "qlogicaldevice.h"
-#include <Qt3DCore/private/qnode_p.h>
+#include <Qt3DCore/private/qcomponent_p.h>
#include <Qt3DInput/qaction.h>
#include <Qt3DInput/qaxis.h>
#include <Qt3DCore/qscenepropertychange.h>
@@ -49,11 +49,11 @@ namespace Qt3DInput {
/*!
\internal
*/
-class QLogicalDevicePrivate : public Qt3DCore::QNodePrivate
+class QLogicalDevicePrivate : public Qt3DCore::QComponentPrivate
{
public:
QLogicalDevicePrivate()
- : Qt3DCore::QNodePrivate()
+ : Qt3DCore::QComponentPrivate()
{}
QVector<QAction *> m_actions;
@@ -146,7 +146,7 @@ public:
Constructs a new QLogicalDevice instance with parent \a parent.
*/
QLogicalDevice::QLogicalDevice(Qt3DCore::QNode *parent)
- : Qt3DCore::QNode(*new QLogicalDevicePrivate(), parent)
+ : Qt3DCore::QComponent(*new QLogicalDevicePrivate(), parent)
{
}
@@ -155,7 +155,7 @@ QLogicalDevice::QLogicalDevice(Qt3DCore::QNode *parent)
*/
QLogicalDevice::~QLogicalDevice()
{
- QNode::cleanup();
+ QComponent::cleanup();
}
/*!
diff --git a/src/input/frontend/qlogicaldevice.h b/src/input/frontend/qlogicaldevice.h
index 21df566ff..fd0084a6c 100644
--- a/src/input/frontend/qlogicaldevice.h
+++ b/src/input/frontend/qlogicaldevice.h
@@ -41,7 +41,7 @@
#define QT3DINPUT_QLOGICALDEVICE_H
#include <Qt3DInput/qt3dinput_global.h>
-#include <Qt3DCore/qnode.h>
+#include <Qt3DCore/qcomponent.h>
QT_BEGIN_NAMESPACE
@@ -51,7 +51,7 @@ class QLogicalDevicePrivate;
class QAction;
class QAxis;
-class QT3DINPUTSHARED_EXPORT QLogicalDevice : public Qt3DCore::QNode
+class QT3DINPUTSHARED_EXPORT QLogicalDevice : public Qt3DCore::QComponent
{
Q_OBJECT
public:
diff --git a/src/quick3d/imports/input/qt3dquick3dinputplugin.cpp b/src/quick3d/imports/input/qt3dquick3dinputplugin.cpp
index 5515a2030..320b9754b 100644
--- a/src/quick3d/imports/input/qt3dquick3dinputplugin.cpp
+++ b/src/quick3d/imports/input/qt3dquick3dinputplugin.cpp
@@ -50,7 +50,6 @@
#include <Qt3DInput/qaxisinput.h>
#include <Qt3DInput/qaxissetting.h>
#include <Qt3DInput/qaction.h>
-#include <Qt3DInput/qaxisactionhandler.h>
#include <Qt3DInput/qactioninput.h>
#include <Qt3DInput/qinputsequence.h>
#include <Qt3DInput/qinputchord.h>
@@ -84,7 +83,6 @@ void Qt3DQuick3DInputPlugin::registerTypes(const char *uri)
qmlRegisterType<Qt3DInput::QMouseController>(uri, 2, 0, "MouseController");
qmlRegisterExtendedType<Qt3DInput::QLogicalDevice, Qt3DInput::Input::Quick::Quick3DLogicalDevice>(uri, 2, 0, "LogicalDevice");
- qmlRegisterType<Qt3DInput::QAxisActionHandler>(uri, 2, 0, "AxisActionHandler");
qmlRegisterUncreatableType<Qt3DInput::QAbstractActionInput>(uri, 2, 0, "AbstractActionInput", QStringLiteral("AbstractActionInput is abstract"));
qmlRegisterType<Qt3DInput::QActionInput>(uri, 2, 0, "ActionInput");
qmlRegisterUncreatableType<Qt3DInput::QAbstractAggregateActionInput>(uri, 2, 0, "AbstractAggregateActionInput", QStringLiteral("AbstractAggregateActionInput is abstract"));
diff --git a/tests/auto/input/action/action.pro b/tests/auto/input/action/action.pro
index 81bf7ad75..2861e5d13 100644
--- a/tests/auto/input/action/action.pro
+++ b/tests/auto/input/action/action.pro
@@ -7,3 +7,5 @@ QT += core-private 3dcore 3dcore-private 3dinput 3dinput-private testlib
CONFIG += testcase
SOURCES += tst_action.cpp
+
+include(../../render/commons/commons.pri)
diff --git a/tests/auto/input/action/tst_action.cpp b/tests/auto/input/action/tst_action.cpp
index e28872268..6e0d50e26 100644
--- a/tests/auto/input/action/tst_action.cpp
+++ b/tests/auto/input/action/tst_action.cpp
@@ -33,6 +33,8 @@
#include <Qt3DInput/private/action_p.h>
#include <Qt3DInput/QActionInput>
#include <Qt3DInput/QAction>
+#include <Qt3DCore/private/qbackendnode_p.h>
+#include "testpostmanarbiter.h"
class tst_Action: public QObject
{
@@ -141,6 +143,36 @@ private Q_SLOTS:
// THEN
QCOMPARE(backendAction.inputs().size(), 0);
}
+
+ void checkActivePropertyBackendNotification()
+ {
+ // GIVEN
+ TestArbiter arbiter;
+ Qt3DInput::Input::Action backendAction;
+ Qt3DCore::QBackendNodePrivate::get(&backendAction)->setArbiter(&arbiter);
+ const bool currentActionTriggeredValue = backendAction.actionTriggered();
+
+ // WHEN
+ backendAction.setActionTriggered(true);
+
+ // THEN
+ QVERIFY(currentActionTriggeredValue != backendAction.actionTriggered());
+ QCOMPARE(arbiter.events.count(), 1);
+ Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ QCOMPARE(change->propertyName(), "active");
+ QCOMPARE(change->value().toBool(), backendAction.actionTriggered());
+
+ arbiter.events.clear();
+
+ // WHEN
+ backendAction.setActionTriggered(true);
+
+ // THEN
+ QVERIFY(currentActionTriggeredValue != backendAction.actionTriggered());
+ QCOMPARE(arbiter.events.count(), 0);
+
+ arbiter.events.clear();
+ }
};
QTEST_APPLESS_MAIN(tst_Action)
diff --git a/tests/auto/input/axis/axis.pro b/tests/auto/input/axis/axis.pro
index 3ecb170b3..9e9e95c9b 100644
--- a/tests/auto/input/axis/axis.pro
+++ b/tests/auto/input/axis/axis.pro
@@ -7,3 +7,5 @@ QT += core-private 3dcore 3dcore-private 3dinput 3dinput-private testlib
CONFIG += testcase
SOURCES += tst_axis.cpp
+
+include(../../render/commons/commons.pri)
diff --git a/tests/auto/input/axis/tst_axis.cpp b/tests/auto/input/axis/tst_axis.cpp
index 8c02cc1eb..140b5730c 100644
--- a/tests/auto/input/axis/tst_axis.cpp
+++ b/tests/auto/input/axis/tst_axis.cpp
@@ -33,6 +33,8 @@
#include <Qt3DInput/private/axis_p.h>
#include <Qt3DInput/QAxisInput>
#include <Qt3DInput/QAxis>
+#include <Qt3DCore/private/qbackendnode_p.h>
+#include "testpostmanarbiter.h"
class tst_Axis: public QObject
{
@@ -141,6 +143,36 @@ private Q_SLOTS:
// THEN
QCOMPARE(backendAxis.inputs().size(), 0);
}
+
+ void checkValuePropertyBackendNotification()
+ {
+ // GIVEN
+ TestArbiter arbiter;
+ Qt3DInput::Input::Axis backendAxis;
+ Qt3DCore::QBackendNodePrivate::get(&backendAxis)->setArbiter(&arbiter);
+
+ // WHEN
+ backendAxis.setAxisValue(454.0f);
+
+ // THEN
+ QCOMPARE(backendAxis.axisValue(), 454.0f);
+ QCOMPARE(arbiter.events.count(), 1);
+ Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ QCOMPARE(change->propertyName(), "value");
+ QCOMPARE(change->value().toFloat(), backendAxis.axisValue());
+
+ arbiter.events.clear();
+
+ // WHEN
+ backendAxis.setAxisValue(454.0f);
+
+ // THEN
+ QCOMPARE(backendAxis.axisValue(), 454.0f);
+ QCOMPARE(arbiter.events.count(), 0);
+
+ arbiter.events.clear();
+
+ }
};
QTEST_APPLESS_MAIN(tst_Axis)