Want the toggle features and exclusive to user setting to one button, how to achieve this.



  • I have 3 pushbutton.
    created by 'go to slots' and 'clicked()'.
    In the GUI, i set checkable and in the code, i check for ischecked()

    I add in below code and my toggle button features disappear. Help ! I want the toggle features and exclusive to user setting one button, how to achieve this.
    QButtonGroup* group =new QButtonGroup(this);
    group->addButton(ui->pushbutton1);
    group->addButton(ui->pushbutton2);
    group->addButton(ui->pushbutton3);
    group->exclusive(true);


  • Moderators

    Hi,

    @
    group->exclusive(true);
    @

    to make it exclusive use "setExclusive":http://qt-project.org/doc/qt-5/qbuttongroup.html#exclusive-prop and set it to true.



  • Hi

    I have already group->exclusive(true);
    It affects the push button working properly. The clickable features disappear.
    Is it because i use "go to slot" clicked instead "go to slot" toggled(bool)"?

    I include my Group in my constructor.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.