PDA

View Full Version : setFixedSize doesn't work as expected



jeremejevs
3rd June 2013, 01:33
I'm using the latest stable version of Qt 5 built statically with GCC 4.8 on Windows 8.

I've created a simple QMainWindow-based application with just one button. When I do setFixedSize(minimumSizeHint()) the window gets resized as I want it to and the maximize button gets disabled, but I can still see the double-sided arrows, when I hover my pointer over the edges, and I can resize the window vertically by 14 pixels. If I add 14 pixels (or more) to the minimum height (or insert a second button) - it becomes truly fixed, but I can still see the arrows, which isn't normal.

This is very weird, because absolutely the same code (and its variations) works perfectly well in PyQt4 (please, note, I use C++ now). I tried:
 

layout()->setSizeConstraint(QLayout::SetFixedSize) - same behavior
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint) - the window just disappears


I was suggested to use Qt 4 instead, but that isn't a real solution. Any way to fix this?

wysota
3rd June 2013, 02:25
Are you fixing the main window widget or its central widget?

jeremejevs
3rd June 2013, 09:50
The main window. I tried creating it without any widgets at all (just setFixedSize(256, 128) and show() in its constructor) - nothing changed.

UPD: Just built with Qt 4 - works as expected. Could that be a bug in Qt 5? Anyway, reported (https://bugreports.qt-project.org/browse/QTBUG-31519).

UPD 2: Turns out that if I put setWindowFlags(Qt::MSWindowsFixedSizeDialogHint) before show() - it works just as expected.