diff options
author | Eike Ziller <eike.ziller@qt.io> | 2019-09-12 15:21:10 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2019-09-18 13:28:56 +0000 |
commit | fe62dde83021434ce564046dea3b550ebd2d877f (patch) | |
tree | 0c43414184f60b77287710f41fde0d97abde6be4 | |
parent | c9e536b9eb764cf3db96fd8942140db3333858fc (diff) | |
download | qt-creator-fe62dde83021434ce564046dea3b550ebd2d877f.tar.gz |
Fix conflict between presentationMode and warp indicator
With presentationMode turned on, the search shortcut display can hide
the wrap indicator. When showing a text indicator and a pixmap
indicator, simply move the one shown later a bit down.
Fixes: QTCREATORBUG-15371
Change-Id: I015dc6ebab29f2f4d863e68359f2bcaee706c805
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
-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 954d076e53..4e9b5067be 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); |