[Interest] Send signal from non-GUI thread

Kio kio at little-bat.de
Wed Oct 3 12:43:01 CEST 2012


Hello,

i'm trying to display a QMessageBox from a non-GUI thread. For this i use signal&slots:

in a QMainWindow based object i defined the slot.
In the sending object i defined the signal and in the c'tor i connect them.
Then, from a background thread, i emit the signal.
Connecting and emitting the signal is executed without error but the slot is never executed.

Connect signal in c'tor:

> connect(this,SIGNAL(showNewWarning(cstr)),parent,SLOT(showNewWarning(cstr)),Qt::QueuedConnection);

Emit signal:

>  emit showNewWarning("Programme did not fit in ram.");

I really think this should work.


This is Qt 4.8 on Mac OSX.
I have no custom event loop in the QApplication object.
The background thread was not created by my application. It is an audio callback:
This may be the reason for the failure, but then i need a workaround. :-/

 static OSStatus audioDeviceIOProc
(
	AudioDeviceID			/*inDevice*/,
	const AudioTimeStamp*	/*inNow*/,
	const AudioBufferList*	inInputData,
	const AudioTimeStamp*	/*inInputTime*/,
	AudioBufferList*		outOutputData,
	const AudioTimeStamp*	inOutputTime,
	void* 					/*inClientData*/
)
{ ... }

Greetings from Germany,

	... Kio !

-- 
http://k1.dyndns.org/Vintage/Sinclair/






More information about the Interest mailing list