| 1 | // Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #include <Qt3DQuickInput/private/quick3dinputsequence_p.h> |
| 5 | |
| 6 | QT_BEGIN_NAMESPACE |
| 7 | |
| 8 | namespace Qt3DInput { |
| 9 | namespace Input { |
| 10 | namespace Quick { |
| 11 | |
| 12 | Quick3DInputSequence::Quick3DInputSequence(QObject *parent) |
| 13 | : QObject(parent) |
| 14 | { |
| 15 | } |
| 16 | |
| 17 | QQmlListProperty<QAbstractActionInput> Quick3DInputSequence::qmlActionInputs() |
| 18 | { |
| 19 | using qt_size_type = qsizetype; |
| 20 | using ListContentType = QAbstractActionInput; |
| 21 | auto appendFunction = [](QQmlListProperty<ListContentType> *list, ListContentType *input) { |
| 22 | Quick3DInputSequence *action = qobject_cast<Quick3DInputSequence *>(object: list->object); |
| 23 | action->parentSequence()->addSequence(input); |
| 24 | }; |
| 25 | auto countFunction = [](QQmlListProperty<ListContentType> *list) -> qt_size_type { |
| 26 | Quick3DInputSequence *action = qobject_cast<Quick3DInputSequence *>(object: list->object); |
| 27 | return action->parentSequence()->sequences().size(); |
| 28 | }; |
| 29 | auto atFunction = [](QQmlListProperty<ListContentType> *list, qt_size_type index) -> ListContentType * { |
| 30 | Quick3DInputSequence *action = qobject_cast<Quick3DInputSequence *>(object: list->object); |
| 31 | return action->parentSequence()->sequences().at(i: index); |
| 32 | }; |
| 33 | auto clearFunction = [](QQmlListProperty<ListContentType> *list) { |
| 34 | Quick3DInputSequence *action = qobject_cast<Quick3DInputSequence *>(object: list->object); |
| 35 | const auto sequences = action->parentSequence()->sequences(); |
| 36 | for (QAbstractActionInput *input : sequences) |
| 37 | action->parentSequence()->removeSequence(input); |
| 38 | }; |
| 39 | |
| 40 | return QQmlListProperty<ListContentType>(this, nullptr, appendFunction, countFunction, atFunction, clearFunction); |
| 41 | } |
| 42 | |
| 43 | |
| 44 | } // namespace Quick |
| 45 | } // namespace Input |
| 46 | } // namespace Qt3DInput |
| 47 | |
| 48 | QT_END_NAMESPACE |
| 49 | |
| 50 | #include "moc_quick3dinputsequence_p.cpp" |
| 51 |
