Add easy way to add progress indicator overlay to a widget

Adds a way to 'attach' a progress indicator to a parent, so it
automatically keeps itself centered on the parent.
Also adds shortcut methods to BaseTreeView.

Change-Id: I962a9300d89ef5d1e03298d670e0cee781d3a4e5
Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
Eike Ziller
2015-01-16 11:59:54 +01:00
parent 7fec1199f3
commit bafdf36f80
4 changed files with 85 additions and 8 deletions

View File

@@ -45,24 +45,31 @@ class QTCREATOR_UTILS_EXPORT ProgressIndicator : public QWidget
{
Q_OBJECT
public:
enum Size {
enum IndicatorSize {
Small,
Large
};
explicit ProgressIndicator(Size size, QWidget *parent = 0);
explicit ProgressIndicator(IndicatorSize size, QWidget *parent = 0);
void setIndicatorSize(IndicatorSize size);
IndicatorSize indicatorSize() const;
QSize sizeHint() const;
void attachToWidget(QWidget *parent);
protected:
void paintEvent(QPaintEvent *);
void showEvent(QShowEvent *);
void hideEvent(QHideEvent *);
bool eventFilter(QObject *obj, QEvent *ev);
private:
void step();
void resizeToParent();
ProgressIndicator::Size m_size;
ProgressIndicator::IndicatorSize m_size;
int m_rotationStep;
int m_rotation;
QTimer m_timer;