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/quick3dinputchord_p.h>
5
6QT_BEGIN_NAMESPACE
7
8namespace Qt3DInput {
9namespace Input {
10namespace Quick {
11
12Quick3DInputChord::Quick3DInputChord(QObject *parent)
13 : QObject(parent)
14{
15}
16
17QQmlListProperty<QAbstractActionInput> Quick3DInputChord::qmlActionInputs()
18{
19 using qt_size_type = qsizetype;
20 using ListContentType = QAbstractActionInput;
21 auto appendFunction = [](QQmlListProperty<ListContentType> *list, ListContentType *input) {
22 Quick3DInputChord *action = qobject_cast<Quick3DInputChord *>(object: list->object);
23 action->parentChord()->addChord(input);
24 };
25 auto countFunction = [](QQmlListProperty<ListContentType> *list) -> qt_size_type {
26 Quick3DInputChord *action = qobject_cast<Quick3DInputChord *>(object: list->object);
27 return action->parentChord()->chords().size();
28 };
29 auto atFunction = [](QQmlListProperty<ListContentType> *list, qt_size_type index) -> ListContentType * {
30 Quick3DInputChord *action = qobject_cast<Quick3DInputChord *>(object: list->object);
31 return action->parentChord()->chords().at(i: index);
32 };
33 auto clearFunction = [](QQmlListProperty<ListContentType> *list) {
34 Quick3DInputChord *action = qobject_cast<Quick3DInputChord *>(object: list->object);
35 const auto chords = action->parentChord()->chords();
36 for (QAbstractActionInput *input : chords)
37 action->parentChord()->removeChord(input);
38 };
39
40 return QQmlListProperty<ListContentType>(this, nullptr, appendFunction, countFunction, atFunction, clearFunction);
41}
42
43} // namespace Quick
44} // namespace Input
45} // namespace Qt3DInput
46
47QT_END_NAMESPACE
48
49#include "moc_quick3dinputchord_p.cpp"
50

source code of qt3d/src/quick3d/quick3dinput/items/quick3dinputchord.cpp