diff options
author | Kevin Ottens <kevin.ottens@kdab.com> | 2016-05-20 11:35:55 +0200 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2016-05-23 19:21:16 +0000 |
commit | c0f13a86ffcc9c19efb6d7be24440f3df2babc23 (patch) | |
tree | dda0f1296b80729d2ee2622bdf33dd6578671a15 /src | |
parent | 33167f76410e4c864f075838bd618da3ae973659 (diff) |
Unit tests for QKeyboardHandler
Also repairs the sourceDevice notification change since the tests showed
up it was broken.
Change-Id: I20b81806452e54f89353f35464b5241de6e18a99
Task-number: QTBUG-53358
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/input/backend/inputhandler_p.h | 2 | ||||
-rw-r--r-- | src/input/backend/keyboarddevice_p.h | 2 | ||||
-rw-r--r-- | src/input/backend/keyboardhandler.cpp | 2 | ||||
-rw-r--r-- | src/input/backend/keyboardhandler_p.h | 7 |
4 files changed, 8 insertions, 5 deletions
diff --git a/src/input/backend/inputhandler_p.h b/src/input/backend/inputhandler_p.h index 4f785bc9f..53dda814d 100644 --- a/src/input/backend/inputhandler_p.h +++ b/src/input/backend/inputhandler_p.h @@ -89,7 +89,7 @@ class GenericDeviceBackendNodeManager; class InputSettings; class EventSourceSetterHelper; -class InputHandler +class Q_AUTOTEST_EXPORT InputHandler { public: InputHandler(); diff --git a/src/input/backend/keyboarddevice_p.h b/src/input/backend/keyboarddevice_p.h index 19f90e683..ef5bd059d 100644 --- a/src/input/backend/keyboarddevice_p.h +++ b/src/input/backend/keyboarddevice_p.h @@ -66,7 +66,7 @@ namespace Input { class InputHandler; -class KeyboardDevice : public Qt3DInput::QAbstractPhysicalDeviceBackendNode +class Q_AUTOTEST_EXPORT KeyboardDevice : public Qt3DInput::QAbstractPhysicalDeviceBackendNode { public: KeyboardDevice(); diff --git a/src/input/backend/keyboardhandler.cpp b/src/input/backend/keyboardhandler.cpp index 2132496b1..d865fd92f 100644 --- a/src/input/backend/keyboardhandler.cpp +++ b/src/input/backend/keyboardhandler.cpp @@ -108,7 +108,7 @@ void KeyboardHandler::sceneChangeEvent(const QSceneChangePtr &e) bool focusRequest = false; if (e->type() == PropertyUpdated) { QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e); - if (propertyChange->propertyName() == QByteArrayLiteral("device")) { + if (propertyChange->propertyName() == QByteArrayLiteral("sourceDevice")) { const QNodeId newId = propertyChange->value().value<QNodeId>(); if (m_keyboardDevice != newId) { setSourcerDevice(newId); diff --git a/src/input/backend/keyboardhandler_p.h b/src/input/backend/keyboardhandler_p.h index e1dfe8fa0..6dd3a2c5e 100644 --- a/src/input/backend/keyboardhandler_p.h +++ b/src/input/backend/keyboardhandler_p.h @@ -63,7 +63,7 @@ namespace Input { class InputHandler; -class KeyboardHandler : public Qt3DCore::QBackendNode +class Q_AUTOTEST_EXPORT KeyboardHandler : public Qt3DCore::QBackendNode { public: KeyboardHandler(); @@ -73,8 +73,11 @@ public: void setFocus(bool focus); void keyEvent(const QKeyEventPtr &event); -protected: + inline bool focus() const { return m_focus; } + void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE; + +protected: void requestFocus(); void setSourcerDevice(Qt3DCore::QNodeId device); |