Dear visitor, welcome to QtForum.org.
If this is your first visit here, please read the Help. It explains in detail how this page works.
To use all features of this page, you should consider registering.
Please use the registration form, to register here or read more information about the registration process.
If you are already registered, please login here.
How to disable all widgets on MainWindow except one
With
mainWindow->enable(false);
i can disable all widgets on it. But i want one of the widgets NOT to be disabled. Any ideas?
Of course i can disable them one by one, but it is lot of (inefficient) code.
Of course i can disable them one by one, but it is lot of (inefficient) code.
QObject has
QObject::children (). With a simple loop you can disable all children and after that enable the one you don't want to disable.
Thanks Skizmo!
A notice: By doing
mainWindow->setEnabled(true);
it enables all widgets except those that were explicitly disabled, e.g. widget1->setDisabled(true);
In other words, it works the other way...
Problem still. There is hierarchy between widgets so if i disable a parent then all children are disabled and they can't be enabled after that!
Problem solved. I had to disable it in pieces.