PDA

View Full Version : Size of QTabWidget in DockWidget



Max97
26th March 2017, 11:53
Hello

i have a layout with 2 dockwidgets among each other, the first on has a list widget in it and the second one a tab widget.
When i edit the size in the qtdesigner and make the first one´s size very small and start the program it ignores my changes and the first one takes most of the space in my layout.

View in the editor:
12405

View in the program:
12404


It seems that it only happens if the second dock widget contains a tabwidget otherwise the sizes are equal.

d_stranz
26th March 2017, 16:49
The default size policies of the two widgets appear to be set such that the tab widget will assume its minimum size if it has no content, while the list widget will expand to take up whatever room it is given. The layout negotiates with each of the widgets to determine how much space they need and divides it up accordingly. Once you start to add content (pages with widget contents) to the tab widget, you'll likely see it being given more room to accommodate the largest page.

If you substitute a list widget for the tab widget, then both of them are arguing for as much space as possible, so the layout settles the argument by giving each one half.

What you see in Qt Designer is not always what you see at runtime, because this layout negotiation does not take place there.