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:
Eike Ziller
2015-11-06 14:30:16 +01:00
parent 7130ea7d83
commit 1302b8bbe7

View File

@@ -37,6 +37,7 @@
#include <QLabel>
#include <QPainter>
#include <QPixmap>
#include <QPointer>
#include <QPropertyAnimation>
#include <QTimer>
@@ -130,14 +131,20 @@ namespace FadingIndicator {
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->run(2500); // deletes itself
}
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->run(300); // deletes itself
}