Search code examples
buttonqt4groupbox

What is the easiest way to keep track of a group of checkable buttons in QT?


I have six checkable push buttons in QT, and I want it so that only one of the buttons are checked at one time (like radio buttons). I could probably do it with lots of signals and slots, but is there a easier way to do this?

I'm looking for something similar to how the QGroupBox and QRadioButtons work together.

Thanks


Solution

  • I think you're looking for http://doc.trolltech.com/4.7/qbuttongroup.html .

    Make sure all of your buttons are checkable, make the group exclusive, use addButton() for each button and run with it.