I have a QML application (also tested it with QWidgets, same problem) and make it borderless (but still support my own WM functions like aero snap, etc.). I followed this up by implementing the QAbstractNativeEventFilter and responding to the WM_NCCALSIZE signal with zero:
switch(msg->message) { case WM_NCCALCSIZE: *r = 0; return 1; ... }
I also set some window flags that are not in the Qt namespace with
SetWindowLong(hwnd, GWL_STYLE, WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPSIBLINGS | WS_BORDER | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_THICKFRAME);
This works fine until I moved or resized the window, which is why Qt redraws the width of the unpainted area of ββthe header width and borders:
Before moving / resizing 
After moving / resizing 
I also found a workaround for this by adding the FramelessWindowHint flag in Qt:
window->setFlags(Qt::FramelessWindowHint | Qt::WindowSystemMenuHint | Qt::Dialog);
But now these fields are repeated again when the state of the window changes (maximize, minimize, ...). By blocking the WM_SIZE event, for example, when SIZE_MAXIMIZED is a parameter, the margin does not appear, but then I also can not maximize the window from Qt. This means that this is a problem with the Qt side.
I also noticed by looking at the window style with winspector, after I maximized it, a new property atom appears:

Can you help me fix this?
user2282732
source share