stephelton
14th January 2013, 09:09
I have a callback made from another (non-Q)Thread that I need to interact with the UI. I've tried having the callback start a QTimer and invoke a slot, but I get an error explaining that I can't use QTimer in a non-QThread. What other options do I have?
Added after 31 minutes:
This works:
timer->moveToThread( QApplication::instance()->thread() );
and also, when calling connect(), pass Qt::QueuedConnection, as in:
connect( timer, SIGNAL(timeout()), this, SLOT(update()), Qt::QueuedConnection );
Added after 31 minutes:
This works:
timer->moveToThread( QApplication::instance()->thread() );
and also, when calling connect(), pass Qt::QueuedConnection, as in:
connect( timer, SIGNAL(timeout()), this, SLOT(update()), Qt::QueuedConnection );