View Full Version : Layout management thoughts required

5th July 2011, 09:24
Hi all

I have the enviable task of porting a VB6 application to Qt. An improvement no doubt, but more than a little fun ;)

The primary UI of the app looks roughly like this:
I have labelled the components with how I expect you would lay out a QMainWindow to get the dockable widgets. The left hand tool widget would be a fixed dock widget (too complex for a QToolBar).

The bit I would like thoughts on is this... when the user selects other tools in the tool box the central widget and all docked widgets are replaced with other widget structures (the space occupied by the green and orange boxes is replaced) . This screams QStackedWidget to me. However, if I base the central widget on a QStackedWidget I have to manually manage hiding/unhiding the dock widgets as I switch back and forth

Is there a neater way to handle this?

5th July 2011, 10:55
Are you forced to use DockWidgets for green Widgets?

You could use a StackedWidget and, for each page, you can use QSplitters in order to allow users to organize the workspace.

6th July 2011, 00:58
Forced? No. In fact the existing UI is exactly the layout you see with the smaller green box represent a stack of about 10 panels of information, and the larger green box is a map. The green boxes are separated by a splitter, and there's another splitter between the green and orange boxes. I imagine a straight Qt translation of this layout would still be an improvement over the current inflexible layout.

Some of the existing users (esp. with dual screens) have expressed the desire to be able to float the map and/or see several of the smaller panels at the same time. One way to do that is to use dock widgets, which is why I am looking. This also (potentially) allows exploiting the extra space on the right-hand-side of the orange box that wide-screen monitors give, while still being workable in a 4:3 monitor space.

I guess a method for the user to create more vertical splits in the top half and allocate panels to them would also go some way toward meeting this desire.