Qt4, QToolbox: Keeping (some) child widgets enabled/accessible with toolbox being disabled
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 c开发者_StackOverflow中文版urrently 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.
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.
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.
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);
精彩评论