forked from qt-creator/qt-creator
Fix that there could be many "fading indicators" painted over each other
Simply hide the current indicator, if there is any. Task-number: QTCREATORBUG-14805 Change-Id: Ic25ba1b671e6ba2490803ba73b8a5757ccbff24b Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -37,6 +37,7 @@
|
|||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
|
#include <QPointer>
|
||||||
#include <QPropertyAnimation>
|
#include <QPropertyAnimation>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
@@ -130,14 +131,20 @@ namespace FadingIndicator {
|
|||||||
|
|
||||||
void showText(QWidget *parent, const QString &text, TextSize size)
|
void showText(QWidget *parent, const QString &text, TextSize size)
|
||||||
{
|
{
|
||||||
auto indicator = new Internal::FadingIndicatorPrivate(parent, size);
|
static QPointer<Internal::FadingIndicatorPrivate> indicator;
|
||||||
|
if (indicator)
|
||||||
|
delete indicator;
|
||||||
|
indicator = new Internal::FadingIndicatorPrivate(parent, size);
|
||||||
indicator->setText(text);
|
indicator->setText(text);
|
||||||
indicator->run(2500); // deletes itself
|
indicator->run(2500); // deletes itself
|
||||||
}
|
}
|
||||||
|
|
||||||
void showPixmap(QWidget *parent, const QString &pixmap)
|
void showPixmap(QWidget *parent, const QString &pixmap)
|
||||||
{
|
{
|
||||||
auto indicator = new Internal::FadingIndicatorPrivate(parent, LargeText);
|
static QPointer<Internal::FadingIndicatorPrivate> indicator;
|
||||||
|
if (indicator)
|
||||||
|
delete indicator;
|
||||||
|
indicator = new Internal::FadingIndicatorPrivate(parent, LargeText);
|
||||||
indicator->setPixmap(pixmap);
|
indicator->setPixmap(pixmap);
|
||||||
indicator->run(300); // deletes itself
|
indicator->run(300); // deletes itself
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user