PDA

View Full Version : Some problems when managing QDockWidgets



dave
2nd May 2010, 05:15
I have a couple of QDockWidgets arranged in a single QMainWindow. The problems I'm seeing are thus:

1. When I add a QDockWidget to the right with no central widget set it automatically resize itself and takes all the available space. I want it to take only some percentage of the window and no more. Unfortunately QDockWidget ignore size hints set on its contained widget (which includes a few buttons arranged in a QVBoxLayout).

2. When I add another QDockWidget, the available space is distributed evenly between them. One of them, though, is horizontal in nature and doesn't need all that space. I'm trying to tell QMainWindow to expand only the other QDockWidget, but I don't know exactly how.

Thanks

Lykurg
2nd May 2010, 08:50
1: set a empty widget as a central widget till you set the real one. just a place holder. also you can set the with of your dock widget using setMaximumWith.
2: play around with size hints and sizes for the dock widgets (which are normal QWidgets after all...)