summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Ottens <kevin.ottens@kdab.com>2016-08-22 13:10:22 +0200
committerSean Harmer <sean.harmer@kdab.com>2016-08-24 19:33:17 +0000
commit61d1ef40a84e2adfc1ade836158eb67dee9d5ceb (patch)
treeb0e136ac789eb38b96cbc685c312ad5f25878444
parent2cccefe1524504a0d67cc4bda7fbc3759e5232b3 (diff)
Add convenience to look for action inputs by id
It will look in all the possible resource managers for the corresponding id. Change-Id: I335099cd4d718cdebb9b9b3381f751f3001bfb1e Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
-rw-r--r--src/input/backend/inputhandler.cpp10
-rw-r--r--src/input/backend/inputhandler_p.h4
2 files changed, 14 insertions, 0 deletions
diff --git a/src/input/backend/inputhandler.cpp b/src/input/backend/inputhandler.cpp
index a26ebce61..82b017b1c 100644
--- a/src/input/backend/inputhandler.cpp
+++ b/src/input/backend/inputhandler.cpp
@@ -309,6 +309,16 @@ void InputHandler::updateEventSource()
}
}
+AbstractActionInput *InputHandler::lookupActionInput(Qt3DCore::QNodeId id) const
+{
+ AbstractActionInput *input = nullptr;
+ if ((input = actionInputManager()->lookupResource(id)) != nullptr)
+ return input;
+ if ((input = inputSequenceManager()->lookupResource(id)) != nullptr)
+ return input;
+ return inputChordManager()->lookupResource(id); // nullptr if not found
+}
+
} // namespace Input
} // namespace Qt3DInput
diff --git a/src/input/backend/inputhandler_p.h b/src/input/backend/inputhandler_p.h
index 72078b54c..2cfb56e3f 100644
--- a/src/input/backend/inputhandler_p.h
+++ b/src/input/backend/inputhandler_p.h
@@ -61,6 +61,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DCore {
class QEventFilterService;
+class QNodeId;
}
namespace Qt3DInput {
@@ -69,6 +70,7 @@ class QInputDeviceIntegration;
namespace Input {
+class AbstractActionInput;
class KeyboardInputManager;
class KeyboardDeviceManager;
class KeyboardEventFilter;
@@ -144,6 +146,8 @@ public:
void updateEventSource();
+ AbstractActionInput *lookupActionInput(Qt3DCore::QNodeId id) const;
+
private:
KeyboardDeviceManager *m_keyboardDeviceManager;
KeyboardInputManager *m_keyboardInputManager;