Try adding exec(); at the end of the run function. Its going to start an event loop for the thread and you will be able to connect some signals to solots in the thread, using Qt::QueuedConnection.
Try adding exec(); at the end of the run function. Its going to start an event loop for the thread and you will be able to connect some signals to solots in the thread, using Qt::QueuedConnection.
Just be aware that having slots in a QThread subclass is problematic. Please read the Multithreading material by Bradley T. Hughes, starting from page 33 to understand why.
J-P Nurmi
Hello
tx for replies!
just read it and hope understood as well
anyway it should not be so problematic in my application
just short question
as i'm sending data fom thread to main i use a &thread pointer in connect()...
is there a way to use app.thread() pointer to make a signal-slot connection using connect() in created thread or there is another way to establish this-way connection?
as my main tread is a GUI where i just wish to pick one parameter and send it to Qthread subclass maybe there would be better way to make
Qt Code:
label->moveToThread(thread)To copy to clipboard, switch view to plain text mode
Greetz, Myx
just gave a guess but didnt try it this way...
i made something like this
and while creating a threadQt Code:
{ Q_OBJECT public: { GUI=mainGUI; } protected: void run() { connect(GUI,SIGNAL(),this,SLOT()); exec(); } private: QObject *GUI; (...) };To copy to clipboard, switch view to plain text mode
Qt Code:
SerialThread *thread=new SerialThread(this);To copy to clipboard, switch view to plain text mode
Bookmarks