FIX frame in QMainWindow (#58)

Co-authored-by: Julien Maille <julien.maille@data-pixel.com>
This commit is contained in:
Julien 2021-06-09 02:59:51 +02:00 committed by GitHub
parent 987a8397dc
commit 938756a757
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -85,6 +85,7 @@ void MainWindow::showEvent(QShowEvent *event)
FramelessWindowsManager::setHitTestVisibleInChrome(win, titleBarWidget->closeButton, true); FramelessWindowsManager::setHitTestVisibleInChrome(win, titleBarWidget->closeButton, true);
FramelessWindowsManager::setHitTestVisibleInChrome(win, appMainWindow->menubar, true); FramelessWindowsManager::setHitTestVisibleInChrome(win, appMainWindow->menubar, true);
inited = true; inited = true;
setContentsMargins(1, 1, 1, 1);
} }
} }
} }
@ -95,9 +96,9 @@ void MainWindow::changeEvent(QEvent *event)
bool shouldUpdate = false; bool shouldUpdate = false;
if (event->type() == QEvent::WindowStateChange) { if (event->type() == QEvent::WindowStateChange) {
if (isMaximized() || isFullScreen()) { if (isMaximized() || isFullScreen()) {
layout()->setContentsMargins(0, 0, 0, 0); setContentsMargins(0, 0, 0, 0);
} else if (!isMinimized()) { } else if (!isMinimized()) {
layout()->setContentsMargins(1, 1, 1, 1); setContentsMargins(1, 1, 1, 1);
} }
shouldUpdate = true; shouldUpdate = true;
Q_EMIT windowStateChanged(); Q_EMIT windowStateChanged();