在 Qt 4.4.3 菜单中执行单选按钮的方法
在 Linux 上希望有一组互斥的菜单项,并且通过单选按钮而不是复选框来指定当前选定的菜单项。
有没有办法在 Qt v4.4.3 中轻松做到这一点?
On Linux would like to have a set of menu items which are mutually exclusive and have the currently selected one be designated by a radio button instead of a checkbox.
Is there a way to do this in Qt v4.4.3 easily?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信您会想要使用 QtActionGroup 对那些应该互斥的菜单项进行分组。它还使它们在渲染时看起来像单选按钮。是这样的:
上面的3个菜单项应该一起摸索;更多详细信息请参见:QActionGroup 类参考
I believe you would want to use QtActionGroup to group those menu items which should be mutually exclusive. It also makes them look like a radio button when rendered. Smth like this:
3 menu items above should be groped together; more details here : QActionGroup Class Reference