I am trying to refresh a image in a QLabel.It is getting refreshed when i used this code on a button click:
void Dialog_user::on_btn_Stop_clicked()
{
flag=0;
sleep(2);
ui
->label
->setPixmap
(QPixmap("abc.bmp"));
}
void Dialog_user::on_btn_Stop_clicked()
{
flag=0;
sleep(2);
ui->label->setPixmap(QPixmap("abc.bmp"));
}
To copy to clipboard, switch view to plain text mode
When i am doing the same thing via a signal-slot mechanism,it is not getting refreshed.The code is :
void Dialog_user::ImageRefreshSlot()
{
qDebug()<<"inside slot";
sleep(2);
qDebug()<<"after sleep";
ui
->label
->setPixmap
(QPixmap("abc.bmp"));
}
void Dialog_user::ImageRefreshSlot()
{
qDebug()<<"inside slot";
sleep(2);
qDebug()<<"after sleep";
ui->label->setPixmap(QPixmap("abc.bmp"));
}
To copy to clipboard, switch view to plain text mode
I have verified that signal and slot is connected via a debug message. The message "inside slot" and "after sleep" is successfully printed,but the label is not refreshed again.
But again if i am clicking the button,the image is getting refreshed.
P.S.:
I have a image processing application,where the image changes every 2 secs.
Bookmarks