Important: Please read the Qt Code of Conduct -

Toggle button

  • Hello,

    I have used QT2.3 with visual C++6 for many year ago, with a lot of applications for my workshop.
    Now, with the new PC and Win 7, I must change IDE and Qt.
    So I have QtCreator and QT5.4.
    But when I want re-compile my olds programs from Qt2.3, Many things goes wrong.

    Many are solved, but for one week, I am stopped by the Toggle Button.
    The problem is:
    I need a GroupButton with 4 pushbutton.
    When I click over one, it must stay "on", and all other must go "off".
    With Qt2.3, QPushButton->setToggleButton(), associated with GroupButton->setExclusive() work fine.
    setToggleButton disapear from Qt5.4.
    How can I solve my problem without many pages of code ?
    I have try setCheckable(), without result.. May be I don't know how use it.
    Sorry for my bad english

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    setToggleButton was move to the Qt 3 support layer during the transition to Qt 4. It as been replaced by setCheckable . Note that the Qt 3 support layer has been removed for Qt 5.

    Since you are migrating from Qt 2 you should also get the Qt 4 documentation handy, you'll find there some information that will help you go further for these cases.

Log in to reply