diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2016-01-19 08:09:27 +0100 |
---|---|---|
committer | Paul Lemire <paul.lemire@kdab.com> | 2016-01-19 15:21:11 +0000 |
commit | 3af2c463545eba1f7a333a0b3da21b38f41e39fc (patch) | |
tree | 6995f6962be19b014403f18f4457e34fddc886d3 /src | |
parent | dba58cff4a6da0a079909205e6da22825d6fa26e (diff) |
InputSettings: backend for QInputSettings added
Change-Id: I4f8ba75e95ab479c816a9f6eca341edd45c01e3c
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/input/backend/backend.pri | 6 | ||||
-rw-r--r-- | src/input/backend/inputsettings.cpp | 73 | ||||
-rw-r--r-- | src/input/backend/inputsettings_p.h | 79 |
3 files changed, 156 insertions, 2 deletions
diff --git a/src/input/backend/backend.pri b/src/input/backend/backend.pri index 5f7f7b51b..bb1806cae 100644 --- a/src/input/backend/backend.pri +++ b/src/input/backend/backend.pri @@ -28,7 +28,8 @@ HEADERS += \ $$PWD/keyboardmousegenericdeviceintegration_p.h \ $$PWD/genericdevicebackendnode_p.h \ $$PWD/inputchord_p.h \ - $$PWD/inputsequence_p.h + $$PWD/inputsequence_p.h \ + $$PWD/inputsettings_p.h SOURCES += \ $$PWD/keyboardcontroller.cpp \ @@ -55,6 +56,7 @@ SOURCES += \ $$PWD/keyboardmousegenericdeviceintegration.cpp \ $$PWD/genericdevicebackendnode.cpp \ $$PWD/inputchord.cpp \ - $$PWD/inputsequence.cpp + $$PWD/inputsequence.cpp \ + $$PWD/inputsettings.cpp INCLUDEPATH += $$PWD diff --git a/src/input/backend/inputsettings.cpp b/src/input/backend/inputsettings.cpp new file mode 100644 index 000000000..8352e667c --- /dev/null +++ b/src/input/backend/inputsettings.cpp @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "inputsettings_p.h" +#include <Qt3DInput/qinputsettings.h> +#include <Qt3DCore/qscenepropertychange.h> + +QT_BEGIN_NAMESPACE + +namespace Qt3DInput { + +namespace Input { + +InputSettings::InputSettings() + : QBackendNode(QBackendNode::ReadOnly) + , m_eventSource(Q_NULLPTR) +{ +} + +void InputSettings::updateFromPeer(Qt3DCore::QNode *peer) +{ + QInputSettings *settings = static_cast<QInputSettings *>(peer); + m_eventSource = settings->eventSource(); + // Does it make sense to check for the enabled property for such a node ? +} + +void InputSettings::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) +{ + if (e->type() == Qt3DCore::NodeUpdated) { + Qt3DCore::QScenePropertyChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QScenePropertyChange>(e); + if (propertyChange->propertyName() == QByteArrayLiteral("eventSource")) + m_eventSource = propertyChange->value().value<QObject *>(); + } +} + +} // Input + +} // Qt3DInput + +QT_END_NAMESPACE diff --git a/src/input/backend/inputsettings_p.h b/src/input/backend/inputsettings_p.h new file mode 100644 index 000000000..866cc3820 --- /dev/null +++ b/src/input/backend/inputsettings_p.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT3DINPUT_INPUT_INPUTSETTINGS_H +#define QT3DINPUT_INPUT_INPUTSETTINGS_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 <QPointer> +#include <Qt3DCore/qbackendnode.h> + +QT_BEGIN_NAMESPACE + +namespace Qt3DInput { + +namespace Input { + +class InputSettings : public Qt3DCore::QBackendNode +{ +public: + InputSettings(); + void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE; + +protected: + void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE; + +private: + QPointer<QObject> m_eventSource; +}; + +} // Input + +} // Qt3DInput + +QT_END_NAMESPACE + +#endif // QT3DINPUT_INPUT_INPUTSETTINGS_H |