aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Hartmann <thomas.hartmann@qt.io>2019-05-08 17:15:58 +0200
committerThomas Hartmann <thomas.hartmann@qt.io>2019-05-09 13:03:35 +0000
commita28cda6f99a05ef2e44a476ac1d35c21c6f1f61b (patch)
tree6f3ef42cccadc774eaa733c23513b3f312c31b86
parent2c0a1eb6b6d723d687819ff4b9c2519c35d31f8b (diff)
Sanitize the code base
Change-Id: I58c006a12e90ac05e2286c28f08be0dca6d78532 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
-rw-r--r--src/imports/timeline/qquickkeyframe.cpp39
-rw-r--r--src/imports/timeline/qquickkeyframe_p.h2
-rw-r--r--src/imports/timeline/qquicktimeline.cpp46
-rw-r--r--src/imports/timeline/qquicktimelineanimation.cpp2
4 files changed, 38 insertions, 51 deletions
diff --git a/src/imports/timeline/qquickkeyframe.cpp b/src/imports/timeline/qquickkeyframe.cpp
index 47081cc..b76c67e 100644
--- a/src/imports/timeline/qquickkeyframe.cpp
+++ b/src/imports/timeline/qquickkeyframe.cpp
@@ -48,15 +48,11 @@ class QQuickKeyframeGroupPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QQuickKeyframeGroup)
public:
- QQuickKeyframeGroupPrivate()
- : target(nullptr),
- componentComplete(false)
- {
- }
+ QQuickKeyframeGroupPrivate() = default;
- QObject *target;
+ QObject *target = nullptr;
QString propertyName;
- bool componentComplete;
+ bool componentComplete = false;
int userType = -1;
protected:
@@ -83,7 +79,7 @@ void QQuickKeyframeGroupPrivate::setupKeyframes()
void QQuickKeyframeGroupPrivate::append_keyframe(QQmlListProperty<QQuickKeyframe> *list, QQuickKeyframe *a)
{
- QQuickKeyframeGroup *q = static_cast<QQuickKeyframeGroup *>(list->object);
+ auto q = static_cast<QQuickKeyframeGroup *>(list->object);
q->d_func()->keyframes.append(a);
q->d_func()->setupKeyframes();
q->reset();
@@ -91,19 +87,19 @@ void QQuickKeyframeGroupPrivate::append_keyframe(QQmlListProperty<QQuickKeyframe
int QQuickKeyframeGroupPrivate::keyframe_count(QQmlListProperty<QQuickKeyframe> *list)
{
- QQuickKeyframeGroup *q = static_cast<QQuickKeyframeGroup *>(list->object);
+ auto q = static_cast<QQuickKeyframeGroup *>(list->object);
return q->d_func()->keyframes.count();
}
QQuickKeyframe* QQuickKeyframeGroupPrivate::keyframe_at(QQmlListProperty<QQuickKeyframe> *list, int pos)
{
- QQuickKeyframeGroup *q = static_cast<QQuickKeyframeGroup *>(list->object);
+ auto q = static_cast<QQuickKeyframeGroup *>(list->object);
return q->d_func()->keyframes.at(pos);
}
void QQuickKeyframeGroupPrivate::clear_keyframes(QQmlListProperty<QQuickKeyframe> *list)
{
- QQuickKeyframeGroup *q = static_cast<QQuickKeyframeGroup *>(list->object);
+ auto q = static_cast<QQuickKeyframeGroup *>(list->object);
while (q->d_func()->keyframes.count()) {
QQuickKeyframe *firstKeyframe = q->d_func()->keyframes.at(0);
q->d_func()->keyframes.removeAll(firstKeyframe);
@@ -114,12 +110,9 @@ class QQuickKeyframePrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QQuickKeyframe)
public:
- QQuickKeyframePrivate()
- : frame(0)
- {
- }
+ QQuickKeyframePrivate() = default;
- qreal frame;
+ qreal frame = 0;
QEasingCurve easingCurve;
QVariant value;
};
@@ -186,7 +179,7 @@ void QQuickKeyframe::setFrame(qreal f)
void QQuickKeyframe::reset()
{
- QQuickKeyframeGroup *keyframes = qobject_cast<QQuickKeyframeGroup*>(parent());
+ auto keyframes = qobject_cast<QQuickKeyframeGroup*>(parent());
if (keyframes)
keyframes->reset();
}
@@ -239,10 +232,10 @@ QQmlListProperty<QQuickKeyframe> QQuickKeyframeGroup::keyframes()
{
Q_D(QQuickKeyframeGroup);
- return QQmlListProperty<QQuickKeyframe>(this, &d->keyframes, QQuickKeyframeGroupPrivate::append_keyframe,
- QQuickKeyframeGroupPrivate::keyframe_count,
- QQuickKeyframeGroupPrivate::keyframe_at,
- QQuickKeyframeGroupPrivate::clear_keyframes);
+ return { this, &d->keyframes, QQuickKeyframeGroupPrivate::append_keyframe,
+ QQuickKeyframeGroupPrivate::keyframe_count,
+ QQuickKeyframeGroupPrivate::keyframe_at,
+ QQuickKeyframeGroupPrivate::clear_keyframes };
}
QObject *QQuickKeyframeGroup::target() const
@@ -291,7 +284,7 @@ QVariant QQuickKeyframeGroup::evaluate(qreal frame) const
return QVariant();
static QQuickKeyframe dummy;
- QQuickTimeline *timeline = qobject_cast<QQuickTimeline*>(parent());
+ auto timeline = qobject_cast<QQuickTimeline*>(parent());
if (timeline)
dummy.setFrame(timeline->startFrame() - 0.0001);
dummy.setValue(d->originalValue);
@@ -393,7 +386,7 @@ QVariant QQuickKeyframe::value() const
return d->value;
}
-void QQuickKeyframe::setValue(QVariant v)
+void QQuickKeyframe::setValue(const QVariant &v)
{
Q_D(QQuickKeyframe);
if (d->value == v)
diff --git a/src/imports/timeline/qquickkeyframe_p.h b/src/imports/timeline/qquickkeyframe_p.h
index 40e46af..63dc2f9 100644
--- a/src/imports/timeline/qquickkeyframe_p.h
+++ b/src/imports/timeline/qquickkeyframe_p.h
@@ -72,7 +72,7 @@ public:
void setEasing(const QEasingCurve &);
QVariant value() const;
- void setValue(QVariant);
+ void setValue(const QVariant &v);
virtual QVariant evaluate(QQuickKeyframe *pre, qreal frame, int userType) const;
diff --git a/src/imports/timeline/qquicktimeline.cpp b/src/imports/timeline/qquicktimeline.cpp
index 0097a65..5e3f409 100644
--- a/src/imports/timeline/qquicktimeline.cpp
+++ b/src/imports/timeline/qquicktimeline.cpp
@@ -39,18 +39,13 @@ class QQuickTimelinePrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QQuickTimeline)
public:
- QQuickTimelinePrivate()
- : startFrame(0),
- endFrame(0),
- currentFrame(0),
- enabled(false),
- componentComplete(true)
+ QQuickTimelinePrivate() : enabled(false), componentComplete(false)
{
}
- qreal startFrame;
- qreal endFrame;
- qreal currentFrame;
+ qreal startFrame = 0;
+ qreal endFrame = 0;
+ qreal currentFrame = 0;
bool enabled:1;
bool componentComplete:1;
@@ -69,7 +64,6 @@ protected:
static QQuickTimelineAnimation* animation_at(QQmlListProperty<QQuickTimelineAnimation> *list, int pos);
static void clear_animations(QQmlListProperty<QQuickTimelineAnimation> *list);
-
QList<QQuickKeyframeGroup *> keyframes;
QList<QQuickTimelineAnimation *> animations;
};
@@ -90,25 +84,25 @@ void QQuickTimelinePrivate::disable()
void QQuickTimelinePrivate::append_keyframe(QQmlListProperty<QQuickKeyframeGroup> *list, QQuickKeyframeGroup *a)
{
- QQuickTimeline *q = static_cast<QQuickTimeline *>(list->object);
+ auto q = static_cast<QQuickTimeline *>(list->object);
q->d_func()->keyframes.append(a);
}
int QQuickTimelinePrivate::keyframe_count(QQmlListProperty<QQuickKeyframeGroup> *list)
{
- QQuickTimeline *q = static_cast<QQuickTimeline *>(list->object);
+ auto q = static_cast<QQuickTimeline *>(list->object);
return q->d_func()->keyframes.count();
}
QQuickKeyframeGroup* QQuickTimelinePrivate::keyframe_at(QQmlListProperty<QQuickKeyframeGroup> *list, int pos)
{
- QQuickTimeline *q = static_cast<QQuickTimeline *>(list->object);
+ auto q = static_cast<QQuickTimeline *>(list->object);
return q->d_func()->keyframes.at(pos);
}
void QQuickTimelinePrivate::clear_keyframes(QQmlListProperty<QQuickKeyframeGroup> *list)
{
- QQuickTimeline *q = static_cast<QQuickTimeline *>(list->object);
+ auto q = static_cast<QQuickTimeline *>(list->object);
while (q->d_func()->keyframes.count()) {
QQuickKeyframeGroup *firstKeyframe = q->d_func()->keyframes.at(0);
q->d_func()->keyframes.removeAll(firstKeyframe);
@@ -117,26 +111,26 @@ void QQuickTimelinePrivate::clear_keyframes(QQmlListProperty<QQuickKeyframeGroup
void QQuickTimelinePrivate::append_animation(QQmlListProperty<QQuickTimelineAnimation> *list, QQuickTimelineAnimation *a)
{
- QQuickTimeline *q = static_cast<QQuickTimeline *>(list->object);
+ auto q = static_cast<QQuickTimeline *>(list->object);
a->setTargetObject(q);
q->d_func()->animations.append(a);
}
int QQuickTimelinePrivate::animation_count(QQmlListProperty<QQuickTimelineAnimation> *list)
{
- QQuickTimeline *q = static_cast<QQuickTimeline *>(list->object);
+ auto q = static_cast<QQuickTimeline *>(list->object);
return q->d_func()->animations.count();
}
QQuickTimelineAnimation* QQuickTimelinePrivate::animation_at(QQmlListProperty<QQuickTimelineAnimation> *list, int pos)
{
- QQuickTimeline *q = static_cast<QQuickTimeline *>(list->object);
+ auto q = static_cast<QQuickTimeline *>(list->object);
return q->d_func()->animations.at(pos);
}
void QQuickTimelinePrivate::clear_animations(QQmlListProperty<QQuickTimelineAnimation> *list)
{
- QQuickTimeline *q = static_cast<QQuickTimeline *>(list->object);
+ auto q = static_cast<QQuickTimeline *>(list->object);
while (q->d_func()->animations.count()) {
QQuickTimelineAnimation *firstAnimation = q->d_func()->animations.at(0);
q->d_func()->animations.removeAll(firstAnimation);
@@ -220,20 +214,20 @@ QQmlListProperty<QQuickKeyframeGroup> QQuickTimeline::keyframes()
{
Q_D(QQuickTimeline);
- return QQmlListProperty<QQuickKeyframeGroup>(this, &d->keyframes, QQuickTimelinePrivate::append_keyframe,
- QQuickTimelinePrivate::keyframe_count,
- QQuickTimelinePrivate::keyframe_at,
- QQuickTimelinePrivate::clear_keyframes);
+ return { this, &d->keyframes, QQuickTimelinePrivate::append_keyframe,
+ QQuickTimelinePrivate::keyframe_count,
+ QQuickTimelinePrivate::keyframe_at,
+ QQuickTimelinePrivate::clear_keyframes };
}
QQmlListProperty<QQuickTimelineAnimation> QQuickTimeline::animations()
{
Q_D(QQuickTimeline);
- return QQmlListProperty<QQuickTimelineAnimation>(this, &d->animations, QQuickTimelinePrivate::append_animation,
- QQuickTimelinePrivate::animation_count,
- QQuickTimelinePrivate::animation_at,
- QQuickTimelinePrivate::clear_animations);
+ return { this, &d->animations, QQuickTimelinePrivate::append_animation,
+ QQuickTimelinePrivate::animation_count,
+ QQuickTimelinePrivate::animation_at,
+ QQuickTimelinePrivate::clear_animations };
}
bool QQuickTimeline::enabled() const
diff --git a/src/imports/timeline/qquicktimelineanimation.cpp b/src/imports/timeline/qquicktimelineanimation.cpp
index 1e1053c..06da183 100644
--- a/src/imports/timeline/qquicktimelineanimation.cpp
+++ b/src/imports/timeline/qquicktimelineanimation.cpp
@@ -87,7 +87,7 @@ bool QQuickTimelineAnimation::pingPong() const
void QQuickTimelineAnimation::handleStarted()
{
- QQuickTimeline* timeline = qobject_cast<QQuickTimeline*>(parent());
+ auto timeline = qobject_cast<QQuickTimeline*>(parent());
if (!timeline)
return;