From b54e368f16e8bd977fe57fcc738fc6804af076e4 Mon Sep 17 00:00:00 2001 From: Zhao Yuhang <2546789017@qq.com> Date: 周一, 01 1月 2024 22:20:17 +0800 Subject: [PATCH] Update README --- 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