summaryrefslogtreecommitdiffstats
path: root/src/input/frontend
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2016-03-14 11:33:29 +0000
committerSean Harmer <sean.harmer@kdab.com>2016-03-22 18:16:04 +0000
commitd5bbe5a0680edda59b3fd202bd1e89c11a680f7d (patch)
tree3262e0a7bd3f6231ac69675389d568022f00e0b1 /src/input/frontend
parent56c34129c2779a28c4f50d726f877c15265277b7 (diff)
QAction creates creation changes
Task-number: QTBUG-51835 Change-Id: Ide8d96e46706cc2419c1f61fd03281d8981df650 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/input/frontend')
-rw-r--r--src/input/frontend/frontend.pri3
-rw-r--r--src/input/frontend/qaction.cpp35
-rw-r--r--src/input/frontend/qaction.h1
-rw-r--r--src/input/frontend/qaction_p.h96
4 files changed, 109 insertions, 26 deletions
diff --git a/src/input/frontend/frontend.pri b/src/input/frontend/frontend.pri
index 414018f41..96185bccc 100644
--- a/src/input/frontend/frontend.pri
+++ b/src/input/frontend/frontend.pri
@@ -30,7 +30,8 @@ HEADERS += \
$$PWD/qinputsequence.h \
$$PWD/qabstractaggregateactioninput_p.h \
$$PWD/qinputsettings.h \
- $$PWD/qinputsettings_p.h
+ $$PWD/qinputsettings_p.h \
+ $$PWD/qaction_p.h
SOURCES += \
$$PWD/qinputaspect.cpp \
diff --git a/src/input/frontend/qaction.cpp b/src/input/frontend/qaction.cpp
index 55bf92967..654c7ba05 100644
--- a/src/input/frontend/qaction.cpp
+++ b/src/input/frontend/qaction.cpp
@@ -38,38 +38,15 @@
****************************************************************************/
#include "qaction.h"
+#include "qaction_p.h"
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qnodecreatedchange.h>
#include <Qt3DInput/qabstractactioninput.h>
QT_BEGIN_NAMESPACE
namespace Qt3DInput {
-/*!
- \class Qt3DInput::QActionPrivate
- \internal
-*/
-class QActionPrivate : public Qt3DCore::QNodePrivate
-{
-public:
- QActionPrivate()
- : Qt3DCore::QNodePrivate()
- , m_active(false)
- {}
-
- Q_DECLARE_PUBLIC(QAction)
-
- QVector<QAbstractActionInput *> m_inputs;
- bool m_active;
-
- void setActive(bool active)
- {
- if (active != m_active) {
- m_active = active;
- q_func()->activeChanged(active);
- }
- }
-};
/*!
\class Qt3DInput::QActionInput
@@ -203,6 +180,14 @@ void QAction::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
}
}
+Qt3DCore::QNodeCreatedChangeBasePtr QAction::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QActionData>::create(this);
+ auto &data = creationChange->data;
+ data.inputIds = qIdsForNodes(inputs());
+ return creationChange;
+}
+
} // Qt3DInput
QT_END_NAMESPACE
diff --git a/src/input/frontend/qaction.h b/src/input/frontend/qaction.h
index 3432a1562..211caf4d6 100644
--- a/src/input/frontend/qaction.h
+++ b/src/input/frontend/qaction.h
@@ -74,6 +74,7 @@ protected:
private:
Q_DECLARE_PRIVATE(QAction)
QT3D_CLONEABLE(QAction)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // Qt3DInput
diff --git a/src/input/frontend/qaction_p.h b/src/input/frontend/qaction_p.h
new file mode 100644
index 000000000..99d47f90b
--- /dev/null
+++ b/src/input/frontend/qaction_p.h
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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_QACTION_P_H
+#define QT3DINPUT_QACTION_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/qnode_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+/*!
+ \class Qt3DInput::QActionPrivate
+ \internal
+*/
+class QActionPrivate : public Qt3DCore::QNodePrivate
+{
+public:
+ QActionPrivate()
+ : Qt3DCore::QNodePrivate()
+ , m_active(false)
+ {}
+
+ Q_DECLARE_PUBLIC(QAction)
+
+ QVector<QAbstractActionInput *> m_inputs;
+ bool m_active;
+
+ void setActive(bool active)
+ {
+ if (active != m_active) {
+ m_active = active;
+ q_func()->activeChanged(active);
+ }
+ }
+};
+
+struct QActionData
+{
+ QVector<Qt3DCore::QNodeId> inputIds;
+};
+
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_QACTION_P_H
+