Using the timer and QMovie I have solved the Issue.
Below is the timer to update the Notification bar
updateScreenTimer = new QTimer(this);
connect(updateScreenTimer, SIGNAL(timeout()), this, SLOT(update_Time_Slot()));
updateScreenTimer->start(TIME_USED_UPDATE_NOTIFICATION);
After every TIME_USED_UPDATE_NOTIFICATION timeout, it will call the below slot and checks for the variable, if variable is set start the green blinking animated gif image movie. else start the red blinking animated gif image.
void Notification::update_Time_Slot()
{
if(ConectionStatus==1)
{
QMovie *movie = new QMovie(":/new/prefix1/greenBlinking1.gif");
if(movie->isValid())
{
ui->connectionLabel->setMovie(movie);
movie->start();
}
ui->connectionLabel->show();
}
else
{
QMovie *movie = new QMovie(":/new/prefix1/redBlinking1.gif");
if(movie->isValid())
{
ui->connectionLabel->setMovie(movie);
movie->start();
}
ui->connectionLabel->show();
}
}
Related posts -> What is the best way to display an animated icon in a QTableView?