aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols/material/impl
diff options
context:
space:
mode:
Diffstat (limited to 'src/quickcontrols/material/impl')
-rw-r--r--src/quickcontrols/material/impl/qquickmaterialbusyindicator.cpp14
-rw-r--r--src/quickcontrols/material/impl/qquickmaterialbusyindicator_p.h1
2 files changed, 12 insertions, 3 deletions
diff --git a/src/quickcontrols/material/impl/qquickmaterialbusyindicator.cpp b/src/quickcontrols/material/impl/qquickmaterialbusyindicator.cpp
index 4d5b4e13e7..d99140b113 100644
--- a/src/quickcontrols/material/impl/qquickmaterialbusyindicator.cpp
+++ b/src/quickcontrols/material/impl/qquickmaterialbusyindicator.cpp
@@ -162,13 +162,16 @@ void QQuickMaterialBusyIndicator::setColor(const QColor &color)
bool QQuickMaterialBusyIndicator::isRunning() const
{
- return isVisible();
+ return m_running;
}
void QQuickMaterialBusyIndicator::setRunning(bool running)
{
- if (running)
+ m_running = running;
+
+ if (m_running)
setVisible(true);
+ // Don't set visible to false if not running, because we use an opacity animation (in QML) to hide ourselves.
}
int QQuickMaterialBusyIndicator::elapsed() const
@@ -181,7 +184,12 @@ void QQuickMaterialBusyIndicator::itemChange(QQuickItem::ItemChange change, cons
QQuickItem::itemChange(change, data);
switch (change) {
case ItemOpacityHasChanged:
- if (qFuzzyIsNull(data.realValue))
+ // If running is set to false and then true within a short period (QTBUG-85860), our
+ // OpacityAnimator cancels the 1 => 0 animation (which was for running being set to false),
+ // setting opacity to 0 and hence visible to false. This happens _after_ setRunning(true)
+ // was called, because the properties were set synchronously but the animation is
+ // asynchronous. To account for this situation, we only hide ourselves if we're not running.
+ if (qFuzzyIsNull(data.realValue) && !m_running)
setVisible(false);
break;
case ItemVisibleHasChanged:
diff --git a/src/quickcontrols/material/impl/qquickmaterialbusyindicator_p.h b/src/quickcontrols/material/impl/qquickmaterialbusyindicator_p.h
index b6bbd925c7..ab70432d61 100644
--- a/src/quickcontrols/material/impl/qquickmaterialbusyindicator_p.h
+++ b/src/quickcontrols/material/impl/qquickmaterialbusyindicator_p.h
@@ -45,6 +45,7 @@ protected:
QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override;
private:
+ bool m_running = false;
int m_elapsed = 0;
QColor m_color = Qt::black;
};