diff options
author | Eike Ziller <eike.ziller@qt.io> | 2019-09-23 12:31:58 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2019-09-23 12:31:58 +0200 |
commit | 0491c1c06caaa20f40b7fd35b1f219b181e776d3 (patch) | |
tree | 0b10ac374bf8bdcc0736e6c06dc5c0b4e6cf4305 /src/libs | |
parent | 57749e91e8e36bc6fd9fe8e472910c3619da42c1 (diff) | |
parent | d8c78538a6af184d7ee672173d0a1b285dad4b89 (diff) | |
download | qt-creator-0491c1c06caaa20f40b7fd35b1f219b181e776d3.tar.gz |
Merge remote-tracking branch 'origin/4.10'
Change-Id: I4a22cdf4d7d5aab2083d5f9f7baaa38e510f83fd
Diffstat (limited to 'src/libs')
-rw-r--r-- | src/libs/utils/fadingindicator.cpp | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/libs/utils/fadingindicator.cpp b/src/libs/utils/fadingindicator.cpp index 1c822aeaba..31ebbb7916 100644 --- a/src/libs/utils/fadingindicator.cpp +++ b/src/libs/utils/fadingindicator.cpp @@ -69,8 +69,11 @@ public: m_label->setText(text); layout()->setSizeConstraint(QLayout::SetFixedSize); adjustSize(); - if (QWidget *parent = parentWidget()) - move(parent->rect().center() - rect().center()); + QWidget *parent = parentWidget(); + QPoint pos = parent ? (parent->rect().center() - rect().center()) : QPoint(); + if (pixmapIndicator && pixmapIndicator->geometry().intersects(QRect(pos, size()))) + pos.setY(pixmapIndicator->geometry().bottom() + 1); + move(pos); } void setPixmap(const QString &uri) @@ -79,8 +82,11 @@ public: m_pixmap.load(StyleHelper::dpiSpecificImageFile(uri)); layout()->setSizeConstraint(QLayout::SetNoConstraint); resize(m_pixmap.size() / m_pixmap.devicePixelRatio()); - if (QWidget *parent = parentWidget()) - move(parent->rect().center() - rect().center()); + QWidget *parent = parentWidget(); + QPoint pos = parent ? (parent->rect().center() - rect().center()) : QPoint(); + if (textIndicator && textIndicator->geometry().intersects(QRect(pos, size()))) + pos.setY(textIndicator->geometry().bottom() + 1); + move(pos); } void run(int ms) @@ -90,6 +96,9 @@ public: QTimer::singleShot(ms, this, &FadingIndicatorPrivate::runInternal); } + static QPointer<FadingIndicatorPrivate> textIndicator; + static QPointer<FadingIndicatorPrivate> pixmapIndicator; + protected: void paintEvent(QPaintEvent *) override { @@ -119,13 +128,17 @@ private: QPixmap m_pixmap; }; +QPointer<FadingIndicatorPrivate> FadingIndicatorPrivate::textIndicator; +QPointer<FadingIndicatorPrivate> FadingIndicatorPrivate::pixmapIndicator; + } // Internal namespace FadingIndicator { void showText(QWidget *parent, const QString &text, TextSize size) { - static QPointer<Internal::FadingIndicatorPrivate> indicator; + QPointer<Internal::FadingIndicatorPrivate> &indicator + = Internal::FadingIndicatorPrivate::textIndicator; if (indicator) delete indicator; indicator = new Internal::FadingIndicatorPrivate(parent, size); @@ -135,7 +148,8 @@ void showText(QWidget *parent, const QString &text, TextSize size) void showPixmap(QWidget *parent, const QString &pixmap) { - static QPointer<Internal::FadingIndicatorPrivate> indicator; + QPointer<Internal::FadingIndicatorPrivate> &indicator + = Internal::FadingIndicatorPrivate::pixmapIndicator; if (indicator) delete indicator; indicator = new Internal::FadingIndicatorPrivate(parent, LargeText); |