diff options
Diffstat (limited to 'src/imports/controls/material/qquickmaterialprogressstrip.cpp')
-rw-r--r-- | src/imports/controls/material/qquickmaterialprogressstrip.cpp | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/imports/controls/material/qquickmaterialprogressstrip.cpp b/src/imports/controls/material/qquickmaterialprogressstrip.cpp index 1d888183..ce4d676e 100644 --- a/src/imports/controls/material/qquickmaterialprogressstrip.cpp +++ b/src/imports/controls/material/qquickmaterialprogressstrip.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 Labs 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 @@ -54,11 +54,11 @@ class QQuickMaterialProgressStripAnimatorJob : public QQuickAnimatorJob public: QQuickMaterialProgressStripAnimatorJob(); - void initialize(QQuickAnimatorController *controller) Q_DECL_OVERRIDE; - void updateCurrentTime(int time) Q_DECL_OVERRIDE; - void writeBack() Q_DECL_OVERRIDE; - void nodeWasDestroyed() Q_DECL_OVERRIDE; - void afterNodeSync() Q_DECL_OVERRIDE; + void initialize(QQuickAnimatorController *controller) override; + void updateCurrentTime(int time) override; + void writeBack() override; + void nodeWasDestroyed() override; + void afterNodeSync() override; void moveNode(QSGTransformNode *node, const QRectF &geometry, qreal progress); @@ -66,7 +66,7 @@ private: QSGNode *m_node; }; -QQuickMaterialProgressStripAnimatorJob::QQuickMaterialProgressStripAnimatorJob() : m_node(Q_NULLPTR) +QQuickMaterialProgressStripAnimatorJob::QQuickMaterialProgressStripAnimatorJob() : m_node(nullptr) { } @@ -111,7 +111,7 @@ void QQuickMaterialProgressStripAnimatorJob::writeBack() void QQuickMaterialProgressStripAnimatorJob::nodeWasDestroyed() { - m_node = Q_NULLPTR; + m_node = nullptr; } void QQuickMaterialProgressStripAnimatorJob::afterNodeSync() @@ -207,12 +207,17 @@ QSGNode *QQuickMaterialProgressStrip::updatePaintNode(QSGNode *oldNode, UpdatePa { QQuickItemPrivate *d = QQuickItemPrivate::get(this); + QRectF bounds = boundingRect(); + bounds.setHeight(implicitHeight()); + bounds.moveTop((height() - bounds.height()) / 2.0); + if (!oldNode) - oldNode = new QSGSimpleRectNode(boundingRect(), Qt::transparent); - static_cast<QSGSimpleRectNode *>(oldNode)->setRect(boundingRect()); + oldNode = new QSGSimpleRectNode(bounds, Qt::transparent); + static_cast<QSGSimpleRectNode *>(oldNode)->setRect(bounds); const int count = m_indeterminate ? 2 : 1; const qreal w = m_indeterminate ? 0 : m_progress * width(); + const QRectF rect(0, bounds.y(), w, bounds.height()); QSGNode *transformNode = oldNode->firstChild(); for (int i = 0; i < count; ++i) { @@ -230,7 +235,7 @@ QSGNode *QQuickMaterialProgressStrip::updatePaintNode(QSGNode *oldNode, UpdatePa QSGRectangleNode *rectNode = static_cast<QSGRectangleNode *>(transformNode->firstChild()); Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType); - rectNode->setRect(QRectF(0, 0, w, height())); + rectNode->setRect(rect); rectNode->setColor(m_color); rectNode->update(); |