QThread struct reponse example ?
Unsolved
General and Desktop
-
Hi ,
I have worker Thread and defined a strcut:
struct response{ QImage _qimage; QString _t1; qint16 _int1; }; response cevap; void _frameChangedStruct (const response &cevap);
and in main:
connect(worker, SIGNAL(_frameChangedStruct(response)), this , SLOT(displayFrame(response))); void MainWindow::displayFrame(QImage qimg){ ui->FrameWindow->setPixmap(QPixmap::fromImage(cevap_._qimage)); }
It is not updating the widget. What is the correct way to pass a struct to the main thread ?
thx
[Fixed code tags ~kshegunov]
-
response
is quite different fromQImage
, so you should start by matching your function prototypes. To that end you should use the Qt5 connect syntax, which is going to throw you a compile-time error for that code, as it justifiably should. I don't understand the rationale between that global variable -response cevap;
though, you should explain what prompted you to use it like this.