how to restrict sizegrip should resize vertically or horizontally only?

624 Views Asked by At

I am adding sizegrip(QSizegrip) to verticall bar on bottom-right side it is resizing both horizontally and vertically actually it should allow only vertically , how to do this? Any other solutions are welcome.

image for details

2

There are 2 best solutions below

0
On BEST ANSWER

On Object which one you want to restrict apply these flags based on requirement

    setMaximumWidth(Default_width);
    setMaximumHeight(Default_height);
1
On

You could override the event method (or https://doc.qt.io/Qt-5/qwidget.html#mouseMoveEvent), check for a MouseMove event and accordingly limit the maximum horizontal size of the dialog.