In my mainwindow i have
qDebug()<< "ID->" << thread()->currentThreadId();
worker= new Worker(&ClassHasSomethingToDo);
worker->moveToThread(th);
th->start();
th = new QThread;
qDebug()<< "ID->" << thread()->currentThreadId();
worker= new Worker(&ClassHasSomethingToDo);
worker->moveToThread(th);
th->start();
To copy to clipboard, switch view to plain text mode
So, as I have above I can get two threads running in simultaneous.
Mainwindow has a button when is clicked, shows a dialog.
This dialog has to communicate with the class(ClassHasSomethingToDo) passed the Worker.
In dialog I have
QInitTokenDialog
(ClassHasSomethingToDo
*todo,
QWidget *parent
)this->todo=todo;
connect(todo,
SIGNAL(message
(QString)), ui
->textEdit,
SLOT(setText
(QString)));
QMetaObject::invokeMethod(todo,
"getMessage", Qt
::AutoConnection);
QInitTokenDialog(ClassHasSomethingToDo*todo, QWidget *parent)
this->todo=todo;
connect(todo, SIGNAL(message(QString)), ui->textEdit, SLOT(setText(QString)));
QMetaObject::invokeMethod(todo, "getMessage", Qt::AutoConnection);
To copy to clipboard, switch view to plain text mode
I cant catch the signal emitted by ClassHasSomethingToDo. Why guys?
Thanks for all answers, and sorry my English :P
Bookmarks