1// Copyright (C) 2017 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 "qchannelcomponent.h"
5
6#include <QtCore/qlist.h>
7
8QT_BEGIN_NAMESPACE
9
10namespace Qt3DAnimation {
11
12class QChannelComponentPrivate
13{
14public:
15 QVector<QKeyFrame> m_keyFrames;
16 QString m_name;
17};
18
19QChannelComponent::QChannelComponent()
20 : d(new QChannelComponentPrivate)
21{
22}
23
24QChannelComponent::QChannelComponent(const QString &name)
25 : d(new QChannelComponentPrivate)
26{
27 d->m_name = name;
28}
29
30QChannelComponent::QChannelComponent(const QChannelComponent &rhs)
31 : d(new QChannelComponentPrivate)
32{
33 *d = *(rhs.d);
34}
35
36QChannelComponent &QChannelComponent::operator=(const QChannelComponent &rhs)
37{
38 if (this != &rhs)
39 *d = *(rhs.d);
40 return *this;
41}
42
43QChannelComponent::~QChannelComponent()
44{
45}
46
47void QChannelComponent::setName(const QString &name)
48{
49 d->m_name = name;
50}
51
52QString QChannelComponent::name() const
53{
54 return d->m_name;
55}
56
57int QChannelComponent::keyFrameCount() const
58{
59 return d->m_keyFrames.size();
60}
61
62void QChannelComponent::appendKeyFrame(const QKeyFrame &kf)
63{
64 d->m_keyFrames.append(t: kf);
65}
66
67void QChannelComponent::insertKeyFrame(int index, const QKeyFrame &kf)
68{
69 d->m_keyFrames.insert(i: index, t: kf);
70}
71
72void QChannelComponent::removeKeyFrame(int index)
73{
74 d->m_keyFrames.remove(i: index);
75}
76
77void QChannelComponent::clearKeyFrames()
78{
79 d->m_keyFrames.clear();
80}
81
82QChannelComponent::const_iterator QChannelComponent::begin() const noexcept
83{
84 return d->m_keyFrames.cbegin().operator->();
85}
86
87QChannelComponent::const_iterator QChannelComponent::end() const noexcept
88{
89 return d->m_keyFrames.cend().operator->();
90}
91
92bool operator==(const QChannelComponent &lhs, const QChannelComponent &rhs) noexcept
93{
94 return lhs.d->m_name == rhs.d->m_name &&
95 lhs.d->m_keyFrames == rhs.d->m_keyFrames;
96}
97
98bool operator!=(const QChannelComponent &lhs, const QChannelComponent &rhs) noexcept
99{
100 return lhs.d->m_name != rhs.d->m_name ||
101 lhs.d->m_keyFrames != rhs.d->m_keyFrames;
102}
103
104} // namespace Qt3DAnimation
105
106QT_END_NAMESPACE
107

source code of qt3d/src/animation/frontend/qchannelcomponent.cpp