I have done the changes and now am sending the image via signal,but still I am unable to refresh the image.
Here is what I have done:
{
Q_OBJECT
private:
void run();
public:
signals:
void ImageRefreshSignal
(const QImage &image
);
};
class GrabThread : public QThread
{
Q_OBJECT
private:
void run();
public:
signals:
void ImageRefreshSignal(const QImage &image);
};
To copy to clipboard, switch view to plain text mode
Signal emmited like:
img.load("abc.bmp");
emit ImageRefreshSignal(img);
QImage img;
img.load("abc.bmp");
emit ImageRefreshSignal(img);
To copy to clipboard, switch view to plain text mode
slot method called like:
void Dialog_user
::ImageRefreshSlot(QImage img
) {
qDebug()<<"inside slot";
ui
->label
->setPixmap
(QPixmap::fromImage(img
));
}
void Dialog_user::ImageRefreshSlot(QImage img )
{
qDebug()<<"inside slot";
ui->label->setPixmap(QPixmap::fromImage(img));
}
To copy to clipboard, switch view to plain text mode
//dialog_user.h
{
Q_OBJECT
public:
explicit Dialog_user
(QWidget *parent
= 0);
~Dialog_user();
private slots:
void ImageRefreshSlot
(QImage img
);
class Dialog_user : public QDialog
{
Q_OBJECT
public:
explicit Dialog_user(QWidget *parent = 0);
~Dialog_user();
private slots:
void ImageRefreshSlot (QImage img);
To copy to clipboard, switch view to plain text mode
the connection is as follows:
QObject::connect( & gthread,
SIGNAL( ImageRefreshSignal
(QImage) ),
& d_user,
SLOT( ImageRefreshSlot
(QImage) ) );
QObject::connect( & gthread, SIGNAL( ImageRefreshSignal(QImage) ),& d_user, SLOT( ImageRefreshSlot(QImage) ) );
To copy to clipboard, switch view to plain text mode
I have checked the mechanism, and the message "inside slot" is being printed,but the image is not getting refreshed.
Bookmarks