I'm writing an app using PyQt4 4.11.4 (Qt 4.8.7) and Python 2.7.12. When running it using RemoteApp (built-in Windows Remote Desktop service) I couldn't get windows to open in maximized state: it appears maximized for a few (single?) frames, and jumps to restored state immediately. Code to reproduce bug:
from PyQt4.QtGui import QApplication, QDialog
from PyQt4.QtCore import Qt
import sys
app = QApplication(sys.argv)
w = QDialog()
w.setWindowFlags(Qt.Window)
w.showMaximized()
w.show()
sys.exit(app.exec_())
Bug couldn't be reproduced with Python 2.6.4 and Qt 4.5.3 (app is built with PyInstaller and I can't find a way to get PyQt version).
The only mention of similiar bug (not sure if same) I found is here.
Is there any fix for this bug? I don't consider using older Qt version as solution.
UP1: The snippet above rewritten in C++ produces the same behavior, so it's a Qt bug.
UP2:
Windows in Qt 4.8 have WS_POPUP
and WS_combine_POPUPWINDOW
styles, while in Qt 4.5 they don't. Bug possibly introduced while fixing this one.
UP3:
Yes, the problem is in WS_POPUP
style. After manually removing it window stays maximized:
...
HWND hWnd = w.winId();
long style = GetWindowLong(hWnd, GWL_STYLE);
SetWindowLong(hWnd, GWL_STYLE, style & ~WS_POPUP);
...
Searching different way to remove it...