Closed yyc12345 closed 1 year ago
Another solution is... simply remove
Qt::WindowMinMaxButtonsHint
from window flags list, but then Winkey+Up / Winkey+Down will likely no longer works, and user will also no longer be able to minimize the window by clicking the taskbar icon.
I updated the master branch code with this as a workaround change before the real fix comes out.
that's all what i have done. hope you can check it out, especially code format and memory issue. the references of this implementation already has been written in code file.
Qt 6 assume that
Qt::WindowMinMaxButtonsHint
depend onQt::WindowSystemMenuHint
. And hard-code this in its source code. Source code reference: https://github.com/qt/qtbase/blob/6.4.2/src/plugins/platforms/windows/qwindowswindow.cpp#L833However, if
Qt::WindowSystemMenuHint
added, an extra window style calledWS_SYSMENU
will be added for this frameless window. Due to Windows implementation, ifWS_SYSMENU
existed, any resize operations of this window will fail, evenQWidget::nativeEvent()
was still running.I have tried
QWidget::setWindowFlag(Qt::WindowSystemMenuHint, false);
but it doesn't work. Obviously, we can removeQt::WindowMinMaxButtonsHint
to solve this issue. But we can not click icon on taskbar to minimize this window if removing it. This breaks the experience of this app, then I gave this up.So this is the final solution. I use native Win32 API to forced remove this annoying flag.