[Solved] How to block vertical size of a QWidget on Windows.
-
Hi everyone,
I made a QWidget and I'd like to block the vertical size.
I tried many things like:
@setMinimumSize(200, 40);
setMaximumSize(500, 40);
resize(200,40);@But nothing work correctly: I can always "resize" vertically the widget. I also tried to add a layout and fixed the size but I have the same result.
What did I do wrong?
For information, I use Qt 5.1.1.
Thank you.
-
Hi,
Is "setFixedHeight":http://qt-project.org/doc/qt-5/qwidget.html#setFixedHeight what you are looking for ?
-
Did you set the sizePolicy to fixed?
And also set the sizeHint value? -
I tried too but no success...
@
setMinimumSize(200, 40);
setMaximumSize(500, 40);
setFixedHeight(40);
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
@In the documentation, I read this about minimumSizeHint:
@If minimumSize() is set, the minimum size hint will be ignored.@So I didn't overwrite it yet.