Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 QT 中有六个可检查的按钮,我希望它一次只检查一个按钮(如单选按钮)。我可能可以用很多信号和插槽来做到这一点,但有没有更简单的方法来做到这一点?
我正在寻找类似于 QGroupBox 和 QRadioButtons 如何一起工作的东西。
谢谢
我认为您正在寻找http://doc.trolltech.com/4.7/qbuttongroup.html。
确保所有按钮都是可检查的,使组独占,对每个按钮使用 addButton() 并使用它运行。