Frameless window on Windows has a returning titlebar after restoring from minimized state.
-
Whenever I minimize my app with Window.showMinimized() and restore it, the window title gets displayed in a weird rectangle at 0,0
small reproduction project: https://www.mediafire.com/file/ozkurikrufvme8m/Example.zip/file -
Hi and welcome to devnet,
Which version of Qt ?
On which OS ?
If Linux:
Which distribution ?
Which desktop environment ? -
@fear2137 After correcting
content/CMakeLists.txt
in your example it configures, compiles, and runs without issue on Linux Qt 6.6.0 under KDE. The application main window stays frameless.
This is almost certainly going to be a Windows-ism. I have to get Qt 6.6 into a Windows environment to check.Edit: Took a while to get everything in place (example is far from minimal): Qt 6.6.0, Windows 11, MingW tool chain. I see this on first launch:
and this after Minimize button, then restore:
Note the graphical artifact, top left. Not the symptom you claim, but not right either. -
Do anyone can solve this problem?
-
Qt 6.7.0 has the same issue. I temporarily solved it with the following code.
// Main Window Window{ id: rootWindow property bool isMinimized: false onVisibilityChanged: { if(rootWindow.visibility === Window.Minimized){ rootWindow.isMinimized = true rootWindow.flags = Qt.Window } else if(rootWindow.isMinimized === true){ rootWindow.flags = Qt.Window | Qt.FramelessWindowHint | Qt.WindowSystemMenuHint | Qt.WindowMinMaxButtonsHint rootWindow.isMinimized = false } } }
-
I solved this behavior by disabling WM_NCCALCSIZE message handling:
class WinEventFilter(QAbstractNativeEventFilter): def nativeEventFilter(self, eventType, message): if eventType == QByteArray(b"windows_generic_MSG"): msg = MSG.from_address(message.__int__()) if msg.message == win32con.WM_NCCALCSIZE: return True, 0 return False, 0