Qt4,QToolbox:在禁用工具箱的情况下保持(某些)子小部件启用/可访问
数据采集应用程序,在该 UI 中,我将互斥采集模式的控件放置在 QToolbox 的不同子页面中,其中当前选定的 QToolbox 项选择采集模式参数。
我目前正在构建一个 所需的功能是锁定 UI - 更改参数后,必须应用/确认更改,能够锁定 UI 元素以防止意外更改是一个功能,只需禁用小部件即可实现。 由于采集模式是一个参数,这也意味着锁定 QToolbox。但是,工具箱中的某些控件需要保持解锁状态,因为它们的效果是立即的。
所以问题是:在 Qt4 中,当子部件的容器被禁用时,如何保持子部件的启用和可访问性。或者我如何模拟这种设置的行为和外观?
请不要建议对 UI 进行更改。我让研究小组中的所有人测试了不同的 UI 概念,当前的概念是最直观、最容易使用的。
I'm currently building a data aquisition application, in which UI I placed the controls for mutually exclusive aquisition modes in the different subpages of a QToolbox, where the currently selected QToolbox item selects the aquisition mode parameter.
One desired feature is to lock the UI – after changing the parameters, the changes have to be applied/confirmed, being able to lock the UI elements against accidental changes is a feature, implemented by simply disabling the widgets. And since the aquisition mode is one parameter this also means locking down the QToolbox. However some controls within the toolbox need to stay unlocked since their effect is immediate.
So here's the question: In Qt4, how can I keep child widgets enabled and accessible while their container has been disables. Or how can I emulate the behaviour and look of such a setup?
Please don't suggest changes in the UI. I had all people in my research group testing different UI concepts and the current one is the one that ist most intuitive and straightforward to use.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果禁用该容器,则其所有子小部件都将被禁用。我认为你无法改变这种行为。因此,您必须单独禁用您不希望保持启用状态的所有子小部件。
If you disable the container, all its child widgets will be disabled. I don't think you can change this behaviour. So you have to disable separately all the child widgets that you don't want to remain enabled.
最后,我通过使用 QComboBox + QStackedWidget 的组合而不是 QToolBox 来“解决”了该问题,并禁用组合框以将其锁定。
In the end I "solved" the problem by using a combination of QComboBox + QStackedWidget instead of a QToolBox and disable the combobox to lock it down.
您可以使用UI函数
setItemEnabled
锁定QToolbox的页面,并通过UI函数indexOf
传递页面的索引和您的布尔值。这里有一些代码:
ui->toolbox->setItemEnabled(ui->toolbox->indexOf(ui->page),false);
You can lock the page of QToolbox using the UI function:
setItemEnabled
and pass the index of the page through the UI function:indexOf
and your boolean.Here's a little code:
ui->toolbox->setItemEnabled(ui->toolbox->indexOf(ui->page),false);