Incorrect rendering of frameless window when used in conjunction with Windows Api
-
Hello!
I'm trying to draw a frameless window in older Windows versions (WinXp and Win7 with Qt5.2.1 MSVC 2010) with support for the system menu and system resizing, for this I use this approach:#include <QApplication> #include <QMainWindow> #include <Windows.h> class MainWindow : public QMainWindow { public: MainWindow(QWidget *parent = nullptr) : QMainWindow(parent) { // setWindowFlags(windowFlags() | Qt::FramelessWindowHint); setGeometry(600,300,600,400); HWND hwnd = (HWND)winId(); LONG style = ::GetWindowLong(hwnd, GWL_STYLE) | WS_OVERLAPPEDWINDOW; ::SetWindowLong(hwnd, GWL_STYLE, style & ~WS_CAPTION); SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); }; }; int main(int argc, char *argv[]) { QApplication app(argc, argv); MainWindow w; w.show(); return app.exec(); }But as a result, the window content displayed does not fill the entire client area:

If, for example, you minimize and then restore the window, the content size is displayed correctly.
If in my example I uncomment the line:setWindowFlags(windowFlags() | Qt::FramelessWindowHint);then the content, on the contrary, goes down more than necessary.
Thanks!