在 QT 中跟踪一组可检查按钮的最简单方法是什么?

发布于 2024-10-05 21:04:13 字数 148 浏览 1 评论 0原文

我在 QT 中有六个可检查的按钮,我希望一次只检查其中一个按钮(如单选按钮)。我可能可以用大量信号和槽来做到这一点,但是有没有更简单的方法来做到这一点?

我正在寻找类似于 QGroupBox 和 QRadioButtons 如何协同工作的东西。

谢谢

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

殊姿 2024-10-12 21:04:13

我认为您正在寻找 http://doc.trolltech.com/4.7/qbuttongroup.html< /a> .

确保所有按钮都是可检查的,使该组独占,对每个按钮使用 addButton() 并使用它运行。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文