From da80f3ffc733e19968b582699d4e4657ce7601fc Mon Sep 17 00:00:00 2001 From: Colin Ogilvie Date: Mon, 11 Jan 2016 12:14:44 +0000 Subject: Start at implementing QAbstractAction Input Change-Id: I392dd326cb0bf1b8c12b72d8554a866156d43e76 Reviewed-by: Sean Harmer --- src/input/frontend/frontend.pri | 6 ++- src/input/frontend/qabstractactioninput.cpp | 54 ++++++++++++++++++++++++++ src/input/frontend/qabstractactioninput.h | 60 +++++++++++++++++++++++++++++ src/input/frontend/qaction.cpp | 14 +++---- src/input/frontend/qaction.h | 8 ++-- src/input/frontend/qactioninput.cpp | 4 +- src/input/frontend/qactioninput.h | 5 ++- 7 files changed, 135 insertions(+), 16 deletions(-) create mode 100644 src/input/frontend/qabstractactioninput.cpp create mode 100644 src/input/frontend/qabstractactioninput.h (limited to 'src/input/frontend') diff --git a/src/input/frontend/frontend.pri b/src/input/frontend/frontend.pri index 9d90c567f..4a6559a05 100644 --- a/src/input/frontend/frontend.pri +++ b/src/input/frontend/frontend.pri @@ -24,7 +24,8 @@ HEADERS += \ $$PWD/qaxissetting.h \ $$PWD/qabstractphysicaldevice_p.h \ $$PWD/qaxisactionhandler_p.h \ - $$PWD/qaxisactionhandler.h + $$PWD/qaxisactionhandler.h \ + $$PWD/qabstractactioninput.h SOURCES += \ $$PWD/qinputaspect.cpp \ @@ -44,6 +45,7 @@ SOURCES += \ $$PWD/qabstractphysicaldevice.cpp \ $$PWD/qinputdeviceintegrationfactory.cpp \ $$PWD/qaxissetting.cpp \ - $$PWD/qaxisactionhandler.cpp + $$PWD/qaxisactionhandler.cpp \ + $$PWD/qabstractactioninput.cpp INCLUDEPATH += $$PWD diff --git a/src/input/frontend/qabstractactioninput.cpp b/src/input/frontend/qabstractactioninput.cpp new file mode 100644 index 000000000..4933a8dda --- /dev/null +++ b/src/input/frontend/qabstractactioninput.cpp @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** 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 "qabstractactioninput.h" +#include + +QT_BEGIN_NAMESPACE + +namespace Qt3DInput { + +QAbstractActionInput::QAbstractActionInput(Qt3DCore::QNodePrivate &dd, Qt3DCore::QNode *parent) + : Qt3DCore::QNode(dd, parent) +{ +} + +QAbstractActionInput::~QAbstractActionInput() +{ +} + +} // Qt3DInput + +QT_END_NAMESPACE diff --git a/src/input/frontend/qabstractactioninput.h b/src/input/frontend/qabstractactioninput.h new file mode 100644 index 000000000..6644820a8 --- /dev/null +++ b/src/input/frontend/qabstractactioninput.h @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** 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_QABSTRACTACTIONINPUT_H +#define QT3DINPUT_QABSTRACTACTIONINPUT_H + +#include +#include + +QT_BEGIN_NAMESPACE + +namespace Qt3DInput { + +class QNodePrivate; + +class QT3DINPUTSHARED_EXPORT QAbstractActionInput : public Qt3DCore::QNode +{ + Q_OBJECT +public: + explicit QAbstractActionInput(Qt3DCore::QNodePrivate &dd, Qt3DCore::QNode *parent = 0); + ~QAbstractActionInput(); +}; + +} // Qt3DInput + +QT_END_NAMESPACE + +#endif // QT3DINPUT_QABSTRACTACTIONINPUT_H diff --git a/src/input/frontend/qaction.cpp b/src/input/frontend/qaction.cpp index e41917542..62b294357 100644 --- a/src/input/frontend/qaction.cpp +++ b/src/input/frontend/qaction.cpp @@ -37,7 +37,7 @@ #include "qaction.h" #include #include -#include +#include QT_BEGIN_NAMESPACE @@ -51,7 +51,7 @@ public: {} QString m_name; - QVector m_inputs; + QVector m_inputs; }; QAction::QAction(Qt3DCore::QNode *parent) @@ -79,7 +79,7 @@ QString QAction::name() const return d->m_name; } -void QAction::addInput(QActionInput *input) +void QAction::addInput(QAbstractActionInput *input) { Q_D(QAction); if (!d->m_inputs.contains(input)) { @@ -97,7 +97,7 @@ void QAction::addInput(QActionInput *input) } } -void QAction::removeInput(QActionInput *input) +void QAction::removeInput(QAbstractActionInput *input) { Q_D(QAction); if (d->m_inputs.contains(input)) { @@ -113,7 +113,7 @@ void QAction::removeInput(QActionInput *input) } } -QVector QAction::inputs() const +QVector QAction::inputs() const { Q_D(const QAction); return d->m_inputs; @@ -124,8 +124,8 @@ void QAction::copy(const Qt3DCore::QNode *ref) QNode::copy(ref); const QAction *action = static_cast(ref); d_func()->m_name = action->d_func()->m_name; - Q_FOREACH (QActionInput *input, action->inputs()) - d_func()->m_inputs.append(qobject_cast(QNode::clone(input))); + Q_FOREACH (QAbstractActionInput *input, action->inputs()) + d_func()->m_inputs.append(qobject_cast(QNode::clone(input))); } } // Qt3DInput diff --git a/src/input/frontend/qaction.h b/src/input/frontend/qaction.h index 80c0a264d..0f70305bc 100644 --- a/src/input/frontend/qaction.h +++ b/src/input/frontend/qaction.h @@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE namespace Qt3DInput { class QActionPrivate; -class QActionInput; +class QAbstractActionInput; class QT3DINPUTSHARED_EXPORT QAction : public Qt3DCore::QNode { @@ -57,12 +57,12 @@ public: QString name() const; - void addInput(QActionInput *input); - void removeInput(QActionInput *input); - QVector inputs() const; public Q_SLOTS: void setName(const QString &name); + void addInput(QAbstractActionInput *input); + void removeInput(QAbstractActionInput *input); + QVector inputs() const; Q_SIGNALS: void nameChanged(const QString &name); diff --git a/src/input/frontend/qactioninput.cpp b/src/input/frontend/qactioninput.cpp index 252e858a4..08de69b82 100644 --- a/src/input/frontend/qactioninput.cpp +++ b/src/input/frontend/qactioninput.cpp @@ -36,6 +36,7 @@ #include "qactioninput.h" #include #include +#include QT_BEGIN_NAMESPACE @@ -54,8 +55,9 @@ public: }; QActionInput::QActionInput(Qt3DCore::QNode *parent) - : Qt3DCore::QNode(*new QActionInputPrivate(), parent) + : Qt3DInput::QAbstractActionInput(*new QActionInputPrivate(), parent) { + } QActionInput::~QActionInput() diff --git a/src/input/frontend/qactioninput.h b/src/input/frontend/qactioninput.h index 1b895832d..79a05540d 100644 --- a/src/input/frontend/qactioninput.h +++ b/src/input/frontend/qactioninput.h @@ -39,6 +39,7 @@ #include #include +#include QT_BEGIN_NAMESPACE @@ -47,7 +48,7 @@ namespace Qt3DInput { class QAbstractPhysicalDevice; class QActionInputPrivate; -class QT3DINPUTSHARED_EXPORT QActionInput : public Qt3DCore::QNode +class QT3DINPUTSHARED_EXPORT QActionInput : public Qt3DInput::QAbstractActionInput { Q_OBJECT Q_PROPERTY(Qt3DInput::QAbstractPhysicalDevice *sourceDevice READ sourceDevice WRITE setSourceDevice NOTIFY sourceDeviceChanged) @@ -80,4 +81,4 @@ private: QT_END_NAMESPACE -#endif // QACTIONINPUT_H +#endif // QT3DINPUT_QACTIONINPUT_H -- cgit v1.2.3