aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols/basic/impl/qquickbasicprogressbar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quickcontrols/basic/impl/qquickbasicprogressbar.cpp')
-rw-r--r--src/quickcontrols/basic/impl/qquickbasicprogressbar.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/quickcontrols/basic/impl/qquickbasicprogressbar.cpp b/src/quickcontrols/basic/impl/qquickbasicprogressbar.cpp
index 69d34f4e0f..1da27fa0aa 100644
--- a/src/quickcontrols/basic/impl/qquickbasicprogressbar.cpp
+++ b/src/quickcontrols/basic/impl/qquickbasicprogressbar.cpp
@@ -143,7 +143,6 @@ void QQuickBasicProgressBarNode::sync(QQuickItem *item)
QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode*>(transformNode->firstChild());
if (!rectNode) {
rectNode = d->sceneGraphContext()->createInternalRectangleNode();
- rectNode->setColor(bar->color());
transformNode->appendChildNode(rectNode);
}
@@ -151,6 +150,9 @@ void QQuickBasicProgressBarNode::sync(QQuickItem *item)
m.translate(blockStartX(i), 0);
transformNode->setMatrix(m);
+ // Set the color here too in case it was set after component completion,
+ // as updateCurrentTime doesn't sync it.
+ rectNode->setColor(bar->color());
rectNode->setRect(QRectF(QPointF(0, 0), QSizeF(BlockWidth, item->implicitHeight())));
rectNode->update();
@@ -165,10 +167,12 @@ void QQuickBasicProgressBarNode::sync(QQuickItem *item)
QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode *>(firstChild());
if (!rectNode) {
rectNode = d->sceneGraphContext()->createInternalRectangleNode();
- rectNode->setColor(bar->color());
appendChildNode(rectNode);
}
+ // Always set the color, not just when creating the rectangle node, so that we respect
+ // changes that are made after component completion.
+ rectNode->setColor(bar->color());
rectNode->setRect(QRectF(QPointF(0, 0), QSizeF(bar->progress() * item->width(), item->implicitHeight())));
rectNode->update();
}