qtresizewindowqt-designerminimum-size

How to resize width to minimum possible using GUI


I use QtDesigner. I resized window width as small as possible using QtDesigner. But when window executed there is possible to make its width smaller. So I want to add to constructor code which made width as minimum possible using GUI.


Solution

  • You can resize the window to minimumSizeHint() in the constructor:

    resize(minimumSizeHint());
    

    This will shrink the window to minimum size.

    If you want to only shrink in width, then you can do something like:

    resize(minimumSizeHint().width(), hight());