From c2e349f1c38b55fd12f8ae537e754fa6658ab631 Mon Sep 17 00:00:00 2001 From: Sine Striker <trueful@163.com> Date: 周一, 01 1月 2024 20:21:34 +0800 Subject: [PATCH] Tested 5.12.8 --- examples/mainwindow/mainwindow.cpp | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/examples/mainwindow/mainwindow.cpp b/examples/mainwindow/mainwindow.cpp index 154aa62..574fc06 100644 --- a/examples/mainwindow/mainwindow.cpp +++ b/examples/mainwindow/mainwindow.cpp @@ -1,3 +1,6 @@ +// Copyright (C) 2023-2024 Stdware Collections +// SPDX-License-Identifier: Apache-2.0 + #include "mainwindow.h" #include <QtCore/QDebug> @@ -5,6 +8,7 @@ #include <QtCore/QTime> #include <QtCore/QTimer> #include <QtGui/QPainter> +#include <QtGui/QWindow> #include <QtWidgets/QApplication> #include <QtWidgets/QStyle> #include <QtWidgets/QPushButton> @@ -289,6 +293,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