Solved what is way to make invisible label with gif ?
-
I have added gif on static label. i want to hide gif with label after 5 second .
How to do it ?
QMovie *WaitingGIF = new QMovie(":/Images/giphy.gif"); ui->label->setMovie(WaitingGIF); WaitingGIF->start();
-
@Qt-embedded-developer said in what is way to make invisible label with gif ?:
How to do it ?
Using QTimer with 5 second timeout and calling hide() on the widget in the slot connected to the QTimer signal...
-
@Qt-embedded-developer said in what is way to make invisible label with gif ?:
How to do it ?
Using QTimer with 5 second timeout and calling hide() on the widget in the slot connected to the QTimer signal...
-
@jsulm hi i have add below code but i am getting below error
error: no matching function for call to 'G3_Scan::connect(QTimer*&, void (QTimer::*)(QTimer::QPrivateSignal), G3_Scan::on_pushButton_BleScan_released()::<lambda()>)'
} );
^Why i am getting this error ?
WaitingGIF->start(); QTimer *timer = new QTimer(this); timer->setSingleShot(true); timer->start(1000); connect(timer, &QTimer::timeout, [=]() { ui->label->hide(); timer->deleteLater(); } );
-
@Qt-embedded-developer said in what is way to make invisible label with gif ?:
G3_Scan::connect(QTimer*&, void (QTimer::*)(QTimer::QPrivateSignal), G3_Scan::on_pushButton_BleScan_released()::<lambda()>)'
It should actually work.
What exact compiler and Qt versions do you use? -
thanks jsulm. this resolved my issue.
QTimer *time = new QTimer(this); QObject::connect(time, SIGNAL(timeout()), this, SLOT(HideGif())); time->setSingleShot(true); time->start(1000);
-
@Qt-embedded-developer said in what is way to make invisible label with gif ?:
QObject::connect(time, SIGNAL(timeout()), this, SLOT(HideGif()));
Would be better to use new Qt5 connect syntax
-
@jsulm qt version 5.12
-
@jsulm can you please provide reference link for new QT5 connect syntax or give example ?
-
@Qt-embedded-developer https://doc.qt.io/qt-5/signalsandslots.html - you also find examples there, like:
Counter a, b; QObject::connect(&a, &Counter::valueChanged, &b, &Counter::setValue);
The advantage of this syntax is that if you do something wrong you will get a compiler error instead of a runtime warning.