45 QSGRectangleNode *geometryNode =
static_cast<QSGRectangleNode *>(firstChild());
46 Q_ASSERT(geometryNode->type() == QSGNode::GeometryNodeType);
47 const QRectF geometry = geometryNode->rect();
49 QSGTransformNode *firstNode =
static_cast<QSGTransformNode *>(geometryNode->firstChild());
51 Q_ASSERT(firstNode->type() == QSGNode::TransformNodeType);
53 const qreal progress = qMin<qreal>(1.0,
static_cast<qreal>(time) / SlideDuration);
54 moveNode(
static_cast<QSGTransformNode *>(firstNode), geometry, progress);
57 QSGTransformNode *secondNode =
static_cast<QSGTransformNode *>(geometryNode->lastChild());
59 Q_ASSERT(secondNode->type() == QSGNode::TransformNodeType);
61 const qreal progress = qMax<qreal>(0.0,
static_cast<qreal>(time - PauseDuration) / SlideDuration);
62 moveNode(
static_cast<QSGTransformNode *>(secondNode), geometry, progress);
68 QQuickMaterialProgressBar *bar =
static_cast<QQuickMaterialProgressBar *>(item);
69 if (m_indeterminate != bar->isIndeterminate()) {
70 m_indeterminate = bar->isIndeterminate();
77 QQuickItemPrivate *d = QQuickItemPrivate::get(item);
79 QRectF bounds = item->boundingRect();
80 bounds.setHeight(item->implicitHeight());
81 bounds.moveTop((item->height() - bounds.height()) / 2.0);
83 QSGRectangleNode *geometryNode =
static_cast<QSGRectangleNode *>(firstChild());
85 geometryNode = item->window()->createRectangleNode();
86 geometryNode->setColor(Qt::transparent);
87 appendChildNode(geometryNode);
89 geometryNode->setRect(bounds);
91 const int count = m_indeterminate ? 2 : 1;
92 const qreal w = m_indeterminate ? 0 : bar->progress() * item->width();
93 const QRectF rect(0, bounds.y(), w, bounds.height());
95 QSGNode *transformNode = geometryNode->firstChild();
96 for (
int i = 0; i < count; ++i) {
98 transformNode =
new QSGTransformNode;
99 geometryNode->appendChildNode(transformNode);
101 QSGInternalRectangleNode *rectNode = d->sceneGraphContext()->createInternalRectangleNode();
102 rectNode->setAntialiasing(
true);
103 transformNode->appendChildNode(rectNode);
105 Q_ASSERT(transformNode->type() == QSGNode::TransformNodeType);
106 static_cast<QSGTransformNode *>(transformNode)->setMatrix(QMatrix4x4());
108 QSGInternalRectangleNode *rectNode =
static_cast<QSGInternalRectangleNode *>(transformNode->firstChild());
109 Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType);
111 rectNode->setRect(rect);
112 rectNode->setColor(bar->color());
115 transformNode = transformNode->nextSibling();
118 while (transformNode) {
119 QSGNode *nextSibling = transformNode->nextSibling();
120 delete transformNode;
121 transformNode = nextSibling;
191void QQuickMaterialProgressBar::itemChange(QQuickItem::ItemChange change,
const QQuickItem::ItemChangeData &data)
193 QQuickItem::itemChange(change, data);
194 if (change == ItemVisibleHasChanged)