aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls/qquickprogressstrip.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/imports/controls/qquickprogressstrip.cpp')
-rw-r--r--src/imports/controls/qquickprogressstrip.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/imports/controls/qquickprogressstrip.cpp b/src/imports/controls/qquickprogressstrip.cpp
index e9480ff1..5b50a28d 100644
--- a/src/imports/controls/qquickprogressstrip.cpp
+++ b/src/imports/controls/qquickprogressstrip.cpp
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -47,11 +47,11 @@ public:
QQuickProgressAnimatorJob();
~QQuickProgressAnimatorJob();
- void initialize(QQuickAnimatorController *controller) Q_DECL_OVERRIDE;
- void afterNodeSync() Q_DECL_OVERRIDE;
- void updateCurrentTime(int time) Q_DECL_OVERRIDE;
- void writeBack() Q_DECL_OVERRIDE;
- void nodeWasDestroyed() Q_DECL_OVERRIDE;
+ void initialize(QQuickAnimatorController *controller) override;
+ void afterNodeSync() override;
+ void updateCurrentTime(int time) override;
+ void writeBack() override;
+ void nodeWasDestroyed() override;
private:
QSGNode *m_node;
@@ -63,8 +63,6 @@ QQuickProgressStrip::QQuickProgressStrip(QQuickItem *parent) :
m_indeterminate(false)
{
setFlag(QQuickItem::ItemHasContents);
- setImplicitWidth(116);
- setImplicitHeight(6);
}
QQuickProgressStrip::~QQuickProgressStrip()
@@ -142,6 +140,7 @@ QSGNode *QQuickProgressStrip::updatePaintNode(QSGNode *oldNode, QQuickItem::Upda
}
Q_ASSERT(rootTransformNode->type() == QSGNode::TransformNodeType);
+ const qreal y = (height() - implicitHeight()) / 2;
const QColor color(0x35, 0x36, 0x37);
if (m_indeterminate) {
if (rootTransformNode->childCount() != blocks) {
@@ -167,7 +166,7 @@ QSGNode *QQuickProgressStrip::updatePaintNode(QSGNode *oldNode, QQuickItem::Upda
m.translate(blockStartX(i), 0);
transformNode->setMatrix(m);
- rectNode->setRect(QRectF(QPointF(), QSizeF(blockWidth, height())));
+ rectNode->setRect(QRectF(QPointF(0, y), QSizeF(blockWidth, implicitHeight())));
rectNode->update();
transformNode = static_cast<QSGTransformNode *>(transformNode->nextSibling());
@@ -185,7 +184,7 @@ QSGNode *QQuickProgressStrip::updatePaintNode(QSGNode *oldNode, QQuickItem::Upda
rootTransformNode->appendChildNode(rectNode);
}
- rectNode->setRect(QRectF(QPointF(), QSizeF(m_progress * width(), height())));
+ rectNode->setRect(QRectF(QPointF(0, y), QSizeF(m_progress * width(), implicitHeight())));
rectNode->update();
}
@@ -210,7 +209,7 @@ QQuickAnimatorJob *QQuickProgressAnimator::createJob() const
}
QQuickProgressAnimatorJob::QQuickProgressAnimatorJob() :
- m_node(Q_NULLPTR)
+ m_node(nullptr)
{
}
@@ -308,7 +307,7 @@ void QQuickProgressAnimatorJob::writeBack()
void QQuickProgressAnimatorJob::nodeWasDestroyed()
{
- m_node = Q_NULLPTR;
+ m_node = nullptr;
}
QT_END_NAMESPACE