aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/utils/progressindicator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/utils/progressindicator.cpp')
-rw-r--r--src/libs/utils/progressindicator.cpp49
1 files changed, 4 insertions, 45 deletions
diff --git a/src/libs/utils/progressindicator.cpp b/src/libs/utils/progressindicator.cpp
index dc2d8bb626..7bc016f8ee 100644
--- a/src/libs/utils/progressindicator.cpp
+++ b/src/libs/utils/progressindicator.cpp
@@ -220,9 +220,11 @@ void ProgressIndicatorPainter::nextAnimationStep()
\sa setIndicatorSize
*/
ProgressIndicator::ProgressIndicator(ProgressIndicatorSize size, QWidget *parent)
- : QWidget(parent), m_paint(size)
+ : OverlayWidget(parent)
+ , m_paint(size)
{
- setAttribute(Qt::WA_TransparentForMouseEvents);
+ setPaintFunction(
+ [this](QWidget *w, QPainter &p, QPaintEvent *) { m_paint.paint(p, w->rect()); });
m_paint.setUpdateCallback([this]() { update(); });
updateGeometry();
}
@@ -249,29 +251,6 @@ QSize ProgressIndicator::sizeHint() const
}
/*!
- Makes the indicator a child of \a parent, automatically centering on it,
- and adapting to size changes.
-*/
-void ProgressIndicator::attachToWidget(QWidget *parent)
-{
- if (parentWidget())
- parentWidget()->removeEventFilter(this);
- setParent(parent);
- parent->installEventFilter(this);
- resizeToParent();
- raise();
-}
-
-/*!
- \internal
-*/
-void ProgressIndicator::paintEvent(QPaintEvent *)
-{
- QPainter p(this);
- m_paint.paint(p, rect());
-}
-
-/*!
\internal
*/
void ProgressIndicator::showEvent(QShowEvent *)
@@ -287,24 +266,4 @@ void ProgressIndicator::hideEvent(QHideEvent *)
m_paint.stopAnimation();
}
-/*!
- \internal
-*/
-bool ProgressIndicator::eventFilter(QObject *obj, QEvent *ev)
-{
- if (obj == parent() && ev->type() == QEvent::Resize) {
- resizeToParent();
- }
- return QWidget::eventFilter(obj, ev);
-}
-
-/*!
- \internal
-*/
-void ProgressIndicator::resizeToParent()
-{
- QTC_ASSERT(parentWidget(), return);
- setGeometry(QRect(QPoint(0, 0), parentWidget()->size()));
-}
-
} // namespace Utils