PDA

View Full Version : Qt Designer best practices for large forms?



bajarangi
4th December 2010, 00:38
I'm working on a gui that will eventually be pretty large. I've got a main window with tabbed interface, menus and toolbars. Using the "single inheritence" model if that matters.

Lately I've felt that I want to split up the ui form into multiple files, maybe one per tab.
I think this is possible, I just set the parent to each "page" widget to be the tab "page".

If this truly is possible, is it advisable?

Will I need to run "setupui" for each form in my c++ code, or just setup the main ui and then create each page widget? I have created some minor widgets in different forms and can place them into the appropriate parent form page, so I think it's possible on a larger level.

TIA,
baj

Lykurg
4th December 2010, 08:37
I would go that way if the pages becomes complex. One main ui with the tab widget and then multiple "QWidgtes" with the content of each tab. For them also use the single inheritence. Then you have two options:
You can put the pages by hand in the tab widget (in the cpp file of your main ui) or
add empty QWidgets in the designer to your tab widget and promote them to your own created page-classes.

You always can decide if you want a tab contend to be "outsourced" or not. So it is not necessarily a definite decision. (I normaly outsource all tabs if the dialog is otherwise too complicated.)

bajarangi
4th December 2010, 19:21
Thanks Lykurg - this is a topic that is not covered by any of the basic tutorials and examples.

marcvanriet
4th December 2010, 22:08
Hi,

Someone asked a similar question some time ago. You may check out this thread : QStackedWidget-and-QTabWidget-Structure-Advice (http://www.qtcentre.org/threads/36032-QStackedWidget-and-QTabWidget-Structure-Advice)

Regards,
Marc

bajarangi
5th December 2010, 00:39
Very good reference. Promotion seems very useful - I have not checked it out yet.