[PATCH] thread-safe queued KDialogs

Aurélien Gâteau aurelien.gateau at free.fr
Tue Nov 25 08:27:59 GMT 2008

Sebastian Trüg wrote:
>  > How about using QMetaObject::invokeMethod instead of a timer with 0
>  > time out? Just seems cleaner to me.
> I did not know about that. Thanks. This indeed seems cleaner. New patch 
> attached.

-  QTimer::singleShot( 0, _this, SLOT( slotShowQueuedDialog() ) );
+  // We use a queued connection to be able to use queued dialogs
+  // from threads other than the GUI thread (example: KMessageBox)
+  QMetaObject::invokeMethod( _this, SLOT(slotShowQueuedDialog()), 
Qt::QueuedConnection );

Does this work? If I am not mistaken, the second parameter should not be 
SLOT(slotShowQueuedDialog()), but "slotShowQueuedDialog", with quotes, 
without SLOT and without parenthesis.


More information about the kde-core-devel mailing list