summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2017-03-27 11:23:35 +0100
committerSean Harmer <sean.harmer@kdab.com>2017-03-30 08:48:35 +0000
commit0258a5593dab0ee885824fd026031ef6d0fe3ac1 (patch)
treec7f4e51808a33327b67ca0c3b2fc64d69df2dbc6
parenta28735696cc09c2462a7490b77ccf4a8e7053ea6 (diff)
Use [setL|l]oopCount in C++ for QAbstractClipAnimator
Keep the property name as loops for consistency with Qt Quick. Avoids ambiguity in function name meaning. Change-Id: Icf35f30d3020e77aba9db878c9dbc6e890c898ff Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
-rw-r--r--src/animation/frontend/qabstractclipanimator.cpp6
-rw-r--r--src/animation/frontend/qabstractclipanimator.h8
-rw-r--r--tests/auto/animation/blendedclipanimator/tst_blendedclipanimator.cpp2
-rw-r--r--tests/auto/animation/clipanimator/tst_clipanimator.cpp6
-rw-r--r--tests/auto/animation/qblendedclipanimator/tst_qblendedclipanimator.cpp20
-rw-r--r--tests/auto/animation/qclipanimator/tst_qclipanimator.cpp20
6 files changed, 31 insertions, 31 deletions
diff --git a/src/animation/frontend/qabstractclipanimator.cpp b/src/animation/frontend/qabstractclipanimator.cpp
index 439737601..307f2d2f3 100644
--- a/src/animation/frontend/qabstractclipanimator.cpp
+++ b/src/animation/frontend/qabstractclipanimator.cpp
@@ -79,7 +79,7 @@ QChannelMapper *QAbstractClipAnimator::channelMapper() const
return d->m_mapper;
}
-int QAbstractClipAnimator::loops() const
+int QAbstractClipAnimator::loopCount() const
{
Q_D(const QAbstractClipAnimator);
return d->m_loops;
@@ -114,14 +114,14 @@ void QAbstractClipAnimator::setChannelMapper(QChannelMapper *mapping)
emit channelMapperChanged(mapping);
}
-void QAbstractClipAnimator::setLoops(int loops)
+void QAbstractClipAnimator::setLoopCount(int loops)
{
Q_D(QAbstractClipAnimator);
if (d->m_loops == loops)
return;
d->m_loops = loops;
- emit loopsChanged(loops);
+ emit loopCountChanged(loops);
}
} // namespace Qt3DAnimation
diff --git a/src/animation/frontend/qabstractclipanimator.h b/src/animation/frontend/qabstractclipanimator.h
index e106bae74..805fcb2b3 100644
--- a/src/animation/frontend/qabstractclipanimator.h
+++ b/src/animation/frontend/qabstractclipanimator.h
@@ -55,7 +55,7 @@ class QT3DANIMATIONSHARED_EXPORT QAbstractClipAnimator : public Qt3DCore::QCompo
{
Q_OBJECT
Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged)
- Q_PROPERTY(int loops READ loops WRITE setLoops NOTIFY loopsChanged)
+ Q_PROPERTY(int loops READ loopCount WRITE setLoopCount NOTIFY loopCountChanged)
Q_PROPERTY(Qt3DAnimation::QChannelMapper *channelMapper READ channelMapper WRITE setChannelMapper NOTIFY channelMapperChanged)
public:
@@ -66,17 +66,17 @@ public:
bool isRunning() const;
Qt3DAnimation::QChannelMapper *channelMapper() const;
- int loops() const;
+ int loopCount() const;
public Q_SLOTS:
void setRunning(bool running);
void setChannelMapper(Qt3DAnimation::QChannelMapper *channelMapper);
- void setLoops(int loops);
+ void setLoopCount(int loops);
Q_SIGNALS:
void runningChanged(bool running);
void channelMapperChanged(Qt3DAnimation::QChannelMapper *channelMapper);
- void loopsChanged(int loops);
+ void loopCountChanged(int loops);
protected:
explicit QAbstractClipAnimator(Qt3DCore::QNode *parent = nullptr);
diff --git a/tests/auto/animation/blendedclipanimator/tst_blendedclipanimator.cpp b/tests/auto/animation/blendedclipanimator/tst_blendedclipanimator.cpp
index 2b26fbfce..3265de167 100644
--- a/tests/auto/animation/blendedclipanimator/tst_blendedclipanimator.cpp
+++ b/tests/auto/animation/blendedclipanimator/tst_blendedclipanimator.cpp
@@ -103,7 +103,7 @@ private Q_SLOTS:
blendedClipAnimator.setRunning(true);
blendedClipAnimator.setBlendTree(&blendTree);
blendedClipAnimator.setChannelMapper(&mapper);
- blendedClipAnimator.setLoops(10);
+ blendedClipAnimator.setLoopCount(10);
{
// WHEN
diff --git a/tests/auto/animation/clipanimator/tst_clipanimator.cpp b/tests/auto/animation/clipanimator/tst_clipanimator.cpp
index b5173e56d..615547405 100644
--- a/tests/auto/animation/clipanimator/tst_clipanimator.cpp
+++ b/tests/auto/animation/clipanimator/tst_clipanimator.cpp
@@ -52,7 +52,7 @@ private Q_SLOTS:
auto clip = new Qt3DAnimation::QAnimationClipLoader();
animator.setClip(clip);
- animator.setLoops(10);
+ animator.setLoopCount(10);
// WHEN
simulateInitialization(&animator, &backendAnimator);
@@ -62,7 +62,7 @@ private Q_SLOTS:
QCOMPARE(backendAnimator.isEnabled(), animator.isEnabled());
QCOMPARE(backendAnimator.clipId(), clip->id());
QCOMPARE(backendAnimator.isRunning(), animator.isRunning());
- QCOMPARE(backendAnimator.loops(), animator.loops());
+ QCOMPARE(backendAnimator.loops(), animator.loopCount());
}
void checkInitialAndCleanedUpState()
@@ -84,7 +84,7 @@ private Q_SLOTS:
auto clip = new Qt3DAnimation::QAnimationClipLoader();
animator.setClip(clip);
animator.setRunning(true);
- animator.setLoops(25);
+ animator.setLoopCount(25);
// WHEN
simulateInitialization(&animator, &backendAnimator);
diff --git a/tests/auto/animation/qblendedclipanimator/tst_qblendedclipanimator.cpp b/tests/auto/animation/qblendedclipanimator/tst_qblendedclipanimator.cpp
index 3ab8e007b..d25041886 100644
--- a/tests/auto/animation/qblendedclipanimator/tst_qblendedclipanimator.cpp
+++ b/tests/auto/animation/qblendedclipanimator/tst_qblendedclipanimator.cpp
@@ -60,7 +60,7 @@ private Q_SLOTS:
QVERIFY(blendedClipAnimator.blendTree() == nullptr);
QVERIFY(blendedClipAnimator.channelMapper() == nullptr);
QCOMPARE(blendedClipAnimator.isRunning(), false);
- QCOMPARE(blendedClipAnimator.loops(), 1);
+ QCOMPARE(blendedClipAnimator.loopCount(), 1);
}
void checkPropertyChanges()
@@ -128,21 +128,21 @@ private Q_SLOTS:
{
// WHEN
- QSignalSpy spy(&blendedClipAnimator, SIGNAL(loopsChanged(int)));
+ QSignalSpy spy(&blendedClipAnimator, SIGNAL(loopCountChanged(int)));
const int newValue = 5;
- blendedClipAnimator.setLoops(newValue);
+ blendedClipAnimator.setLoopCount(newValue);
// THEN
QVERIFY(spy.isValid());
- QCOMPARE(blendedClipAnimator.loops(), newValue);
+ QCOMPARE(blendedClipAnimator.loopCount(), newValue);
QCOMPARE(spy.count(), 1);
// WHEN
spy.clear();
- blendedClipAnimator.setLoops(newValue);
+ blendedClipAnimator.setLoopCount(newValue);
// THEN
- QCOMPARE(blendedClipAnimator.loops(), newValue);
+ QCOMPARE(blendedClipAnimator.loopCount(), newValue);
QCOMPARE(spy.count(), 0);
}
}
@@ -180,7 +180,7 @@ private Q_SLOTS:
QCOMPARE(blendedClipAnimator.isEnabled(), true);
QCOMPARE(blendedClipAnimator.isEnabled(), creationChangeData->isNodeEnabled());
QCOMPARE(blendedClipAnimator.metaObject(), creationChangeData->metaObject());
- QCOMPARE(blendedClipAnimator.loops(), cloneData.loops);
+ QCOMPARE(blendedClipAnimator.loopCount(), cloneData.loops);
}
// WHEN
@@ -352,14 +352,14 @@ private Q_SLOTS:
{
// WHEN
- blendedClipAnimator.setLoops(1584);
+ blendedClipAnimator.setLoopCount(1584);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
auto change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "loops");
- QCOMPARE(change->value().value<int>(), blendedClipAnimator.loops());
+ QCOMPARE(change->value().value<int>(), blendedClipAnimator.loopCount());
QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
@@ -367,7 +367,7 @@ private Q_SLOTS:
{
// WHEN
- blendedClipAnimator.setLoops(1584);
+ blendedClipAnimator.setLoopCount(1584);
QCoreApplication::processEvents();
// THEN
diff --git a/tests/auto/animation/qclipanimator/tst_qclipanimator.cpp b/tests/auto/animation/qclipanimator/tst_qclipanimator.cpp
index 084e78809..1177be72a 100644
--- a/tests/auto/animation/qclipanimator/tst_qclipanimator.cpp
+++ b/tests/auto/animation/qclipanimator/tst_qclipanimator.cpp
@@ -59,7 +59,7 @@ private Q_SLOTS:
// THEN
QCOMPARE(animator.clip(), static_cast<Qt3DAnimation::QAbstractAnimationClip *>(nullptr));
QCOMPARE(animator.channelMapper(), static_cast<Qt3DAnimation::QChannelMapper *>(nullptr));
- QCOMPARE(animator.loops(), 1);
+ QCOMPARE(animator.loopCount(), 1);
}
void checkPropertyChanges()
@@ -111,21 +111,21 @@ private Q_SLOTS:
{
// WHEN
- QSignalSpy spy(&animator, SIGNAL(loopsChanged(int)));
+ QSignalSpy spy(&animator, SIGNAL(loopCountChanged(int)));
const int newValue = 5;
- animator.setLoops(newValue);
+ animator.setLoopCount(newValue);
// THEN
QVERIFY(spy.isValid());
- QCOMPARE(animator.loops(), newValue);
+ QCOMPARE(animator.loopCount(), newValue);
QCOMPARE(spy.count(), 1);
// WHEN
spy.clear();
- animator.setLoops(newValue);
+ animator.setLoopCount(newValue);
// THEN
- QCOMPARE(animator.loops(), newValue);
+ QCOMPARE(animator.loopCount(), newValue);
QCOMPARE(spy.count(), 0);
}
}
@@ -159,7 +159,7 @@ private Q_SLOTS:
QCOMPARE(animator.metaObject(), creationChangeData->metaObject());
QCOMPARE(animator.clip()->id(), data.clipId);
QCOMPARE(animator.channelMapper()->id(), data.mapperId);
- QCOMPARE(animator.loops(), data.loops);
+ QCOMPARE(animator.loopCount(), data.loops);
}
// WHEN
@@ -242,7 +242,7 @@ private Q_SLOTS:
{
// WHEN
- animator.setLoops(10);
+ animator.setLoopCount(10);
QCoreApplication::processEvents();
// THEN
@@ -250,14 +250,14 @@ private Q_SLOTS:
auto change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "loops");
QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
- QCOMPARE(change->value().toInt(), animator.loops());
+ QCOMPARE(change->value().toInt(), animator.loopCount());
arbiter.events.clear();
}
{
// WHEN
- animator.setLoops(10);
+ animator.setLoopCount(10);
QCoreApplication::processEvents();
// THEN