View Full Version : Change in QDockWidget resize behavior from Qt 4.3 to 4.4.1

11th September 2008, 07:05
I have an application that has a "tool options" box defined in the code as a QDockWidget that floats (non-dockable), with a QStackedWidget in it that contains a series of QWidgets, each with a QGridLayout in them. The QGridLayouts contain spinboxes, labels, buttons, and checkboxes.

In a version of the program compiled with Qt 4.3, the floating DockWidget is only resizable to a size that is as small as the largest child Widget in the QStackedWidget. When I compile now with Qt 4.4.1 I have noticed that the QDockWidget can now be resized to any size, and thus causes the child widgets to get squeezed in both axes. Here is a video explaining the behavior in more detail. The first part shows the good behavior with Qt 4.3, and the second part shows the incorrect behavior with Qt 4.4.1:


Does anyone have an idea as to what changed between these two versions that would cause this issue? Thanks for the help,

11th September 2008, 07:26
I noticed that the only difference between the documentation for QDockWidget in 4.3 vs. 4.4 is this paragraph in the SetWidget function:

If the dock widget is visible when widget is added, you must show() it explicitly.

Note that you must add the layout of the widget before you call this function; if not, the widget will not be visible.

I'm not sure what that means...

12th September 2008, 22:55
It means that you have to first set up the layout and then add the widget to the dock widget.

12th September 2008, 23:01
I guess the thing I really don't understand is that if i run my executable with Qt 4.3 or even 4.4 dll files, the QDockWidget floating window works properly, and with Qt 4.4.1 dll's , it doesn't work properly , like in that video.

13th September 2008, 00:01
The changelog for 4.4.1 says:
- QDockWidget
* [179989] Maximum size is now taken into account by the dock widget.
but for me this doesn't explain the behavior, but at least we know that QDockWidget code was changed and this might mean that they have fixed too much.

If you create a widget with stacked widget in Qt Designer 4.4.1 it behaves as you expect, so most likely this is something with QDockWidget. I suggest you talk to the Trolls.

Edit: It appears that somebody already did talk to them: http://trolltech.com/developer/task-tracker/index_html?method=entry&id=222030

13th September 2008, 00:13
wow, thank you so much! that saved me a lot of headaches. I'll just wait until 4.4.2 comes out and use the old dll's for now.

Thank you!