1// Copyright (C) 2016 The Qt Company Ltd.
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 "quick3danimationcontroller_p.h"
5
6QT_BEGIN_NAMESPACE
7
8namespace Qt3DAnimation {
9namespace Quick {
10
11QQuick3DAnimationController::QQuick3DAnimationController(QObject *parent)
12 : QObject(parent)
13{
14}
15
16QQmlListProperty<QAnimationGroup> QQuick3DAnimationController::animationGroups()
17{
18 using qt_size_type = qsizetype;
19 using ListContentType = QAnimationGroup;
20 auto appendFunction = [](QQmlListProperty<ListContentType> *list, ListContentType *bar) {
21 QQuick3DAnimationController *controller = qobject_cast<QQuick3DAnimationController *>(object: list->object);
22 if (controller)
23 controller->parentAnimationController()->addAnimationGroup(animationGroups: bar);
24 };
25 auto countFunction = [](QQmlListProperty<ListContentType> *list) -> qt_size_type {
26 QQuick3DAnimationController *controller = qobject_cast<QQuick3DAnimationController *>(object: list->object);
27 if (controller)
28 return controller->parentAnimationController()->animationGroupList().size();
29 return 0;
30 };
31 auto atFunction = [](QQmlListProperty<ListContentType> *list, qt_size_type index) -> ListContentType * {
32 QQuick3DAnimationController *controller = qobject_cast<QQuick3DAnimationController *>(object: list->object);
33 if (controller)
34 return qobject_cast<QAnimationGroup *>(object: controller->parentAnimationController()->getGroup(index));
35 return nullptr;
36 };
37 auto clearFunction = [](QQmlListProperty<ListContentType> *list) {
38 QQuick3DAnimationController *controller = qobject_cast<QQuick3DAnimationController *>(object: list->object);
39 if (controller)
40 controller->parentAnimationController()->setAnimationGroups({});
41 };
42
43 return QQmlListProperty<ListContentType>(this, nullptr, appendFunction, countFunction, atFunction, clearFunction);
44}
45
46
47} // namespace Quick
48} // namespace Qt3DAnimation
49
50QT_END_NAMESPACE
51
52#include "moc_quick3danimationcontroller_p.cpp"
53

source code of qt3d/src/quick3d/quick3danimation/items/quick3danimationcontroller.cpp