Skip to content

Commit

Permalink
Fix macOS framelessWindow with Qt 6.8 (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
nuttyartist committed Oct 24, 2024
1 parent 75c876e commit f6ca1e8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/framelesswindow.mm
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ - (void)zoomButtonAction:(id)sender
return;
}

setAttribute(Qt::WA_ContentsMarginsRespectsSafeArea, false);

AppObserver *observer = [[AppObserver alloc] init];
if (observer) {
observer.window = this;
Expand Down
5 changes: 5 additions & 0 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,11 @@ void MainWindow::setupMainWindow()
setAttribute(Qt::WA_TranslucentBackground);
#endif

#if defined(Q_OS_MAC)
// Since Qt 6.8 we need this to ask the QLayout to ignore the contents marginsto to make the window frameless on macOS
ui->centralWidget->setAttribute(Qt::WA_LayoutOnEntireRect, true);
#endif

// load stylesheet
QFile mainWindowStyleFile(QStringLiteral(":/styles/main-window.css"));
mainWindowStyleFile.open(QFile::ReadOnly);
Expand Down

0 comments on commit f6ca1e8

Please sign in to comment.