Qpushbutton is used to send the checkable attribute of toggled (bool)

Source: Internet
Author: User

 

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 whereMorebuttonIsQpushbutton. When I toggle the button, nothing happens.

Shouldn't it show or hideSecondarygroupboxAndTertiarygroupbox?

 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.