Factor an overlay widget out of progress indicator

The principle of having a widget on top of all other children of the
same parent, for the purpose of painting an overlay, is generic.

Change-Id: I6d3ee89cc51354988fedcc40340bb45a065db607
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Eike Ziller
2020-03-12 15:26:33 +01:00
parent c10ae65f24
commit 2307c61c95
7 changed files with 144 additions and 54 deletions

View File

@@ -25,6 +25,7 @@
#pragma once
#include "overlaywidget.h"
#include "utils_global.h"
#include <QTimer>
@@ -76,7 +77,7 @@ private:
UpdateCallback m_callback;
};
class QTCREATOR_UTILS_EXPORT ProgressIndicator : public QWidget
class QTCREATOR_UTILS_EXPORT ProgressIndicator : public OverlayWidget
{
Q_OBJECT
public:
@@ -86,17 +87,11 @@ public:
QSize sizeHint() const final;
void attachToWidget(QWidget *parent);
protected:
void paintEvent(QPaintEvent *) final;
void showEvent(QShowEvent *) final;
void hideEvent(QHideEvent *) final;
bool eventFilter(QObject *obj, QEvent *ev) final;
private:
void resizeToParent();
ProgressIndicatorPainter m_paint;
};