newbie's quesiton: signal/slot editing
-
could you clarify my understanding signal/slot using:
when I'm adding a handling code for the button click I see two ways in the designer:-
Right click on widget and select "Got to Slot..." handler stub will be added right?
by he way - if I need to remove this handler, is the removing from the class enough?
or I have to perform some additional steps in .ui file in designer or manually? -
Go to Edit signal/slot mode. Set the link between button and form .
in right panel (MainWIndow slots in my case) click Edit..
and add additional Slot for my processing and implement new slot in the code.
which way is right?
is there way to see all established "links" between signal and slots on current form? to edit this quickly?
-
-
if I need to remove this handler, is the removing from the class enough?
or I have to perform some additional steps in .ui file in designer or manually?This information is not stored in .ui file in any way. The designer just generates the
on_<object>_<slot>
member in your class and moc picks up this signature automatically. That being said if you want to remove that connection just remove the method from your .h/.cpp and compile it. No additional steps needed.is there way to see all established "links" between signal and slots on current form? to edit this quickly?
Yes. There's a "Signals & Slots Editor" pane in the designer. If you can't see it right click on the empty space in the designer and enable it there or do the same from Window->Views menu. There you can see/edit all the connections stored in the .ui file. Note that this list won't contain the connections made by the 1) method, as they are purely source/moc generated and not stored in the .ui file.
-
but which way is preferable ?
By whom?
Both are viable and there's even a third one - call connect directly from code. All have their good and bad sides but all are supported.
It's a question of fitting your needs. There's no good or bad way.