PDA

View Full Version : disconnect SIGNAL/SLOT directly after emitting data



donglebob
4th February 2009, 08:46
Hi,

I want to make sth. like a demux.
When data comes..i need to connect to the right destination thread, send the data and disconnect again.
otherwise when I wouldnt disconnect...next time the emitting of the data would cause that a wrong destination would receive data.

Is it ok to do this?

connect(.....);
emit senmydata(data);
disconnect(.....);

The receiver of the data is in another thread.

ktk
4th February 2009, 22:53
Hi,

I want to make sth. like a demux.
When data comes..i need to connect to the right destination thread, send the data and disconnect again.
otherwise when I wouldnt disconnect...next time the emitting of the data would cause that a wrong destination would receive data.

Is it ok to do this?

connect(.....);
emit senmydata(data);
disconnect(.....);

The receiver of the data is in another thread.

QMetaObject::invokeMethod(...) might be a path to take, too...