Qt QML app in new thread
-
Hi,
I write a simple application in Qt logic and QML application.
SystemConstrolleris a class registered in QML. Among other things, I use SLOT and SIGNAL mechanism like below:SystemController::SystemController(QObject *parent) : QObject{parent} { C56SdkApp *c56SdkApp = new C56SdkApp(); QObject::connect(this, SIGNAL(text2PrintChanged(QString)), c56SdkApp, SLOT(printText(QString))); }But when I try pass my object to new thread look like the mechanism SIGNAL and SLOT Stops working ,because I do not "communication" between my classes I should do something more to pass obiect to new thread?
SystemController::SystemController(QObject *parent) : QObject{parent} { QThread *threadPrinter = new QThread(); C56SdkApp *c56SdkApp = new C56SdkApp(); c56SdkApp->moveToThread(threadPrinter); QObject::connect(this, SIGNAL(text2PrintChanged(QString)), c56SdkApp, SLOT(printText(QString))); } -
Didn't you forget to start the thread ?
-
Hi,
What exactly is C56SdkApp ?
-
@SGaist said in Qt QML app in new thread:
What exactly is C56SdkApp ?
It is a class to communicate with printer.
-
Didn't you forget to start the thread ?
-
I really forgot, my mistake. Thanks!