From 76924a335f40a0c3cc13805b4cb9429c336d33ca Mon Sep 17 00:00:00 2001 From: SineStriker <trueful@163.com> Date: 周五, 29 12月 2023 11:34:22 +0800 Subject: [PATCH] Optimize system button area APIs --- examples/mainwindow/mainwindow.cpp | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/examples/mainwindow/mainwindow.cpp b/examples/mainwindow/mainwindow.cpp index 154aa62..313c771 100644 --- a/examples/mainwindow/mainwindow.cpp +++ b/examples/mainwindow/mainwindow.cpp @@ -289,6 +289,13 @@ #endif windowAgent->setHitTestVisible(menuBar, true); +#ifdef Q_OS_MAC + windowAgent->setSystemButtonAreaCallback([](const QSize &size) { + static constexpr const int width = 75; + return QRect(QPoint(size.width() - width, 0), QSize(width, size.height())); // + }); +#endif + setMenuWidget(windowBar); // 3. Adds simulated mouse events to the title bar buttons -- Gitblit v1.9.1