Minimum Height in QDockWidget widget
-
Hy everybody (and sorry for my bad english...),
I got a mystical behaviour with a QDockWidget (DW) added to my QMainWindow (MW):
I got the DW docked , and when I try to hide it by getting the slider down to the bottom, it is blocked to minimum width.
To fix it, it try to set the minimal width of the DW widget to '0'. it changes nothing. But when I set it to '1', it works fine.Is this a normal behaviour ?
Thanks for your answers :)
-
Logically (at least to my logic) this is a normal behaviour, because setting the width to 0 should be impossible because a widget with 0 width is basically a widget that exists in background (similar to hidden) and might cause problems for a user (it will remain active), therefore using up resources that are not needed. I say this assuming that your DW is derived from a standard QWidget. One thing you can try is hide DW. If this doesn't resize your MW, then try setting the MinimumWidth for your MW->dockedWidget() to 1.
-
Thanks for you reply,
I can hide the DW with the cross, but I want to do it by resizing it...
Ideally, I wanted to set the width of the child of the DW by 0 so only the header of the DW would appear...I tried to set the minimal width of the DW to '1' but it doesn't work, and apparently it should not according to the doc:
bq. A QDockWidget acts as a wrapper for its child widget, set with setWidget(). Custom size hints, minimum and maximum sizes and size policies should be implemented in the child widget. QDockWidget will respect them, adjusting its own constraints to include the frame and title. Size constraints should not be set on the QDockWidget itself, because they change depending on whether it is docked; a docked QDockWidget has no frame and a smaller title bar.