PDA

View Full Version : SLOT or functions



mickey
8th February 2006, 19:16
Hi,
I'd code a SLOT in Mainform.ui (from Designer) and I the Connect in myWidget() class constructor.
I call emit mySignal() and starts the SLOT in mainform.
But I can make instead of "emit mySignal()" mainForm->function() (without signal). The result it's the same! and then, what do I use?
Wich in the different?
Thanks

jacek
8th February 2006, 19:45
Signals & slots mechanism:
many-to-many connections,
you can connect and disconnect objects in the runtime,
connected objects doesn't have to know anything about each other.

Direct method invocation:
many-to-one connection,
you must have a pointer or the object itself to invoke a method,
there is no way to disconnect those object without using conditional statements around the call,
a bit faster (although speed-up usually won't be noticeable).
What to use depends on the design.