Unsolved how to pass a variable from a one thread to main GUI thread
-
I am using following code
QVariant myclass::Execute(QString command, QString xInfo)
{
QTimer::singleShot(0, this, SLOT(slotExecuteTcl()));
return QVariant(true);
}
void myClass::executeTcl()
{
QString res;
if ( Tcl_Eval(command, res) ) {}
// return QVariant(res);
}
I want to pass command from ::Execute to executeTcl , since we move from one thread to GUI main thread could you please suggest how to move the variable from one thread to GUI main thread
-
Hi
You can make a new signalsignals:
void MyValue( QString );and in execute, emit it
void myClass::executeTcl()
{ ...
emit MyValue("somestring"); // or via variable
}You have to have
some slot in main connected to MyValue signal.