From 938756a757205115a7fbde3190b32db8968c065c Mon Sep 17 00:00:00 2001 From: Julien <182520+JulienMaille@users.noreply.github.com> Date: Wed, 9 Jun 2021 02:59:51 +0200 Subject: [PATCH] FIX frame in QMainWindow (#58) Co-authored-by: Julien Maille --- examples/mainwindow/mainwindow.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/mainwindow/mainwindow.cpp b/examples/mainwindow/mainwindow.cpp index 3e63cad..92b7ac3 100644 --- a/examples/mainwindow/mainwindow.cpp +++ b/examples/mainwindow/mainwindow.cpp @@ -85,6 +85,7 @@ void MainWindow::showEvent(QShowEvent *event) FramelessWindowsManager::setHitTestVisibleInChrome(win, titleBarWidget->closeButton, true); FramelessWindowsManager::setHitTestVisibleInChrome(win, appMainWindow->menubar, true); inited = true; + setContentsMargins(1, 1, 1, 1); } } } @@ -95,9 +96,9 @@ void MainWindow::changeEvent(QEvent *event) bool shouldUpdate = false; if (event->type() == QEvent::WindowStateChange) { if (isMaximized() || isFullScreen()) { - layout()->setContentsMargins(0, 0, 0, 0); + setContentsMargins(0, 0, 0, 0); } else if (!isMinimized()) { - layout()->setContentsMargins(1, 1, 1, 1); + setContentsMargins(1, 1, 1, 1); } shouldUpdate = true; Q_EMIT windowStateChanged();