I have now removed the sleep and emitted a signal just after image has been formed.But still the image is not getting refreshed.
Here is what I am doing:
//GrabThread.cpp
void GrabThread::run()
{
ImageFormation();
check=0;
emit ImageRefreshSignal();
}
void GrabThread::run()
{
ImageFormation();
check=0;
emit ImageRefreshSignal();
}
To copy to clipboard, switch view to plain text mode
Image processing finishes in ImageFormation() and after that I emit a signal 'ImageRefreshSignal', which I am catching in a dialog as follows:
//dialog_user.cpp
Dialog_user
::Dialog_user(QWidget *parent
) : ui(new Ui::Dialog_user)
{
ui->setupUi(this);
ui
->label
->setPixmap
(QPixmap("abc.bmp"));
}
Dialog_user::~Dialog_user()
{
delete ui;
}
void Dialog_user::ImageRefreshSlot()
{
qDebug()<<"inside slot";
ui
->label
->setPixmap
(QPixmap("abc.bmp"));
}
Dialog_user::Dialog_user(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog_user)
{
ui->setupUi(this);
ui->label->setPixmap(QPixmap("abc.bmp"));
}
Dialog_user::~Dialog_user()
{
delete ui;
}
void Dialog_user::ImageRefreshSlot()
{
qDebug()<<"inside slot";
ui->label->setPixmap(QPixmap("abc.bmp"));
}
To copy to clipboard, switch view to plain text mode
I am successfully getting "inside slot" message,which indicates that ImageRefreshSlot() has been called,but still the image is not getting refreshed.
Have connected the signal-slot in main.cpp as follows:
int main(int argc, char *argv[])
{
MainWindow win;
win.show();
Dialog_user d_user;
GrabThread gthread;
QObject::connect( & gthread,
SIGNAL( ImageRefreshSignal
() ),
& d_user,
SLOT( ImageRefreshSlot
() ) );
gthread.start();
return a.exec();
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow win;
win.show();
Dialog_user d_user;
GrabThread gthread;
QObject::connect( & gthread, SIGNAL( ImageRefreshSignal() ),& d_user, SLOT( ImageRefreshSlot() ) );
gthread.start();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks