MistyD
MistyD

Reputation: 17223

Signal, slots and other classes

Currently I am porting a console C++ project to Qt. Regarding the porting I had some questions.Now my project is aligned as follows I have one Form class which is derived from QWidget and it uses other classes which are derived from QObject.

Now please let me know if I am correct: In my project other classes need to write to the GUI form for this purpose I am using signals and slots. The address of the GUI form is obtained from a static variable inside the GUI class.

Is this approach sensible specially for a multi threaded application?

Upvotes: 0

Views: 91

Answers (2)

raidsan
raidsan

Reputation: 797

connect: sender or receiver is static variable pointer which class derived from QObject, Of course is right. for multi threaded , only need consider use Qt::QueuedConnection param.

Upvotes: 0

Martin Beckett
Martin Beckett

Reputation: 96119

The gui form should implement a slot which recieves the data from a signal in the other thread. The data is sent as the parameter to the signal emit() call

Signals can be sent across threads safely - thats the point

Upvotes: 2

Related Questions