2

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 add another button or a status bar - nothing changes. If I add 14 pixels (or more) to the minimum height - 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

Any way to fix this?

UPD: I was wrong about adding another button (apparently, it isn't the same as adding a status bar) - it isn't possible to resize the window anymore (though, why would Qt let me set the height of the window less than it likes...), but the arrows are still there.

UPD 2: Found a very similar question, but the answer didn't help (for the reasons described in a comment to the question itself).

Community
  • 1
  • 1
Alec Mev
  • 4,663
  • 4
  • 30
  • 44
  • Wow, it didn't occur to me, that the order in which I call `setWindowFlags` and `show` could matter :) If I put it before `show` - works like a charm. If you post this as an answer - I'll accept it. [The bug](https://bugreports.qt-project.org/browse/QTBUG-31519) I submitted a bit earlier. – Alec Mev Jun 03 '13 at 08:49
  • I changed my comment to an answer. – thuga Jun 03 '13 at 09:35

2 Answers2

1

The sizegrip thing seems to work differently in Qt 5. Don't know if it's a bug or not. I tried setting the Qt::MSWindowsFixedSizeDialogHint flag for my main window and it seems to work fine for me. I'm on windows 7 though.

As it says in the documentation about the setWindowFlags function: Note: This function calls setParent() when changing the flags for a window, causing the widget to be hidden. You must call show() to make the widget visible again..

thuga
  • 12,601
  • 42
  • 52
0

If you want it to behave identically to what you had in PyQt4, you could just program in C++ using the same version of Qt that the PyQt project is using: Qt 4.8.4

http://qt-project.org/doc/qt-4.8/qwidget.html#setFixedSize

Hope that helps.

phyatt
  • 18,472
  • 5
  • 61
  • 80
  • Well, building Qt again is the very last option (and I can't just download it, because I need it to be static). And they are supposed to be the same anyway, check out the docs side-by-side: http://qt-project.org/doc/qt-5.0/qtwidgets/qwidget.html#setFixedSize – Alec Mev Jun 02 '13 at 19:36