The checkable option is not selected by default. The button is a trigger button by default. Press it and it will pop up immediately.
After the checkable option is selected, the button changes to the toggle button, which can be in two states: Press/play; at this time, the button can emit a toggled (bool) signal, combined with the slot function setvisible (bool), it can be used to display controls alternately;
The two "more" buttons in the figure below are in the pop-up status and the press status below.
Problem:
I have the follwing code whereMorebutton
IsQpushbutton
. When I toggle the button, nothing happens.
Shouldn't it show or hideSecondarygroupbox
AndTertiarygroupbox
?
Qobject :: Connect ( Morebutton , Signal ( Toggled ( Bool )), Secondarygroupbox , Slot ( Setvisible ( Bool ))); Qobject :: Connect ( Morebutton , Signal ( Toggled ( Bool )), Tertiarygroupbox , Slot ( Setvisible ( Bool )));
Answer:
Most likely, your Pushbutton is notCheckable ()
. Try
Morebutton->Setcheckable(True)
A non-checkable button never emitsToggled (bool)
Signal.