
Originally Posted by
codeslicer
Any chance I could create some for(int i=0; i<childWidgets().length(); i++) loop? Note that childWidgets() may not be an actual property, but for the sake of this question...
Do you mean something like:
QPushButton* button
= findChild<QPushButton
*>
("myButtonWithCertainObjectName");
if (button) // just to assure it was found
button->doSomething();
// or
QList<QPushButton*> allButtons = findChildren<QPushButton*>();
button->doSomething();
QPushButton* button = findChild<QPushButton*>("myButtonWithCertainObjectName");
if (button) // just to assure it was found
button->doSomething();
// or
QList<QPushButton*> allButtons = findChildren<QPushButton*>();
foreach (QPushButton* button, allButtons)
button->doSomething();
To copy to clipboard, switch view to plain text mode
Also, where would I put the connect()'s? In each of the plainUi and fancyUi functions, or in the constructor?
The whole GUI, including all widgets, gets re-created when you call respective setupUi(). So you must re-establish all signal-slot connections every time the "mode" is changed.
Bookmarks