From 7990ac78e1938536650456bf987a4c986a4e6f1b Mon Sep 17 00:00:00 2001 From: Sine Striker <trueful@163.com> Date: 周三, 03 1月 2024 23:27:33 +0800 Subject: [PATCH] Update license --- examples/shared/widgetframe/windowbar_p.h | 3 src/core/contexts/cocoawindowcontext.mm | 3 examples/shared/widgetframe/windowbutton.h | 3 src/quick/qwkquickglobal.h | 3 src/quick/quickwindowagent_win.cpp | 3 src/quick/qwkquickglobal.cpp | 3 src/core/qwkglobal.h | 3 src/quick/quickitemdelegate.cpp | 3 src/core/style/styleagent.h | 3 examples/qml/main.cpp | 3 src/core/windowitemdelegate_p.h | 3 src/quick/quickitemdelegate_p.h | 3 src/core/qwindowkit_windows.cpp | 3 src/core/contexts/qtwindowcontext.cpp | 3 src/widgets/widgetwindowagent.h | 3 LICENSE | 2 src/core/qwkglobal_p.h | 3 examples/mainwindow/mainwindow.cpp | 3 src/core/style/styleagent.cpp | 3 src/core/style/styleagent_mac.mm | 3 src/widgets/widgetitemdelegate_p.h | 3 examples/shared/widgetframe/windowbar.h | 3 src/core/style/styleagent_p.h | 3 src/quick/quickwindowagent_p.h | 3 src/widgets/widgetwindowagent_p.h | 3 src/core/contexts/qtwindowcontext_p.h | 3 src/widgets/widgetwindowagent_mac.cpp | 3 src/core/contexts/win32windowcontext_p.h | 3 src/core/kernel/sharedeventfilter_p.h | 3 src/widgets/widgetwindowagent.cpp | 3 src/core/kernel/nativeeventfilter.cpp | 9 src/core/kernel/nativeeventfilter_p.h | 3 src/quick/quickwindowagent_mac.cpp | 3 src/core/kernel/sharedeventfilter.cpp | 3 src/quick/quickwindowagent.h | 3 src/widgets/widgetitemdelegate.cpp | 3 examples/mainwindow/main.cpp | 3 src/core/contexts/abstractwindowcontext_p.h | 3 src/core/contexts/cocoawindowcontext_p.h | 3 src/core/contexts/win32windowcontext.cpp | 3 src/core/windowitemdelegate.cpp | 3 src/core/style/styleagent_win.cpp | 7 src/core/qwindowkit_windows.h | 3 src/core/windowagentbase_p.h | 3 src/quick/quickwindowagent.cpp | 3 examples/shared/widgetframe/windowbar.cpp | 3 src/core/qwindowkit_linux.h | 3 src/core/contexts/abstractwindowcontext.cpp | 3 src/widgets/widgetwindowagent_win.cpp | 3 src/widgets/qwkwidgetsglobal.h | 3 src/core/windowagentbase.h | 3 examples/mainwindow/mainwindow.h | 3 src/core/shared/qwkwindowsextra_p.h | 5 src/core/shared/systemwindow_p.h | 182 ++++++++++++------------- examples/shared/widgetframe/windowbutton.cpp | 3 src/core/windowagentbase.cpp | 3 examples/shared/widgetframe/windowbutton_p.h | 3 src/core/style/styleagent_linux.cpp | 3 58 files changed, 205 insertions(+), 159 deletions(-) diff --git a/LICENSE b/LICENSE index 8a1f6e7..36395aa 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright (C) 2023-2024 Stdware Collections + Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/examples/mainwindow/main.cpp b/examples/mainwindow/main.cpp index b25a7a0..002360e 100644 --- a/examples/mainwindow/main.cpp +++ b/examples/mainwindow/main.cpp @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #include <QtWidgets/QApplication> diff --git a/examples/mainwindow/mainwindow.cpp b/examples/mainwindow/mainwindow.cpp index 574fc06..c27bddd 100644 --- a/examples/mainwindow/mainwindow.cpp +++ b/examples/mainwindow/mainwindow.cpp @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #include "mainwindow.h" diff --git a/examples/mainwindow/mainwindow.h b/examples/mainwindow/mainwindow.h index 01bc6d1..53514a1 100644 --- a/examples/mainwindow/mainwindow.h +++ b/examples/mainwindow/mainwindow.h @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #ifndef MAINWINDOW_H diff --git a/examples/qml/main.cpp b/examples/qml/main.cpp index 1a898bb..8332f5d 100644 --- a/examples/qml/main.cpp +++ b/examples/qml/main.cpp @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #include <QtGui/QGuiApplication> diff --git a/examples/shared/widgetframe/windowbar.cpp b/examples/shared/widgetframe/windowbar.cpp index a71c463..8753bc2 100644 --- a/examples/shared/widgetframe/windowbar.cpp +++ b/examples/shared/widgetframe/windowbar.cpp @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #include "windowbar.h" diff --git a/examples/shared/widgetframe/windowbar.h b/examples/shared/widgetframe/windowbar.h index 6005f36..2e802f2 100644 --- a/examples/shared/widgetframe/windowbar.h +++ b/examples/shared/widgetframe/windowbar.h @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #ifndef WINDOWBAR_H diff --git a/examples/shared/widgetframe/windowbar_p.h b/examples/shared/widgetframe/windowbar_p.h index 7506422..36ceb17 100644 --- a/examples/shared/widgetframe/windowbar_p.h +++ b/examples/shared/widgetframe/windowbar_p.h @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #ifndef WINDOWBARPRIVATE_H diff --git a/examples/shared/widgetframe/windowbutton.cpp b/examples/shared/widgetframe/windowbutton.cpp index 4f520a5..f0b2c70 100644 --- a/examples/shared/widgetframe/windowbutton.cpp +++ b/examples/shared/widgetframe/windowbutton.cpp @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #include "windowbutton.h" diff --git a/examples/shared/widgetframe/windowbutton.h b/examples/shared/widgetframe/windowbutton.h index a3061c9..402b50f 100644 --- a/examples/shared/widgetframe/windowbutton.h +++ b/examples/shared/widgetframe/windowbutton.h @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #ifndef WINDOWBUTTON_H diff --git a/examples/shared/widgetframe/windowbutton_p.h b/examples/shared/widgetframe/windowbutton_p.h index ac53d0a..34aaaaf 100644 --- a/examples/shared/widgetframe/windowbutton_p.h +++ b/examples/shared/widgetframe/windowbutton_p.h @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #ifndef WINDOWBUTTONPRIVATE_H diff --git a/src/core/contexts/abstractwindowcontext.cpp b/src/core/contexts/abstractwindowcontext.cpp index d0ca27c..ff35f76 100644 --- a/src/core/contexts/abstractwindowcontext.cpp +++ b/src/core/contexts/abstractwindowcontext.cpp @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #include "abstractwindowcontext_p.h" diff --git a/src/core/contexts/abstractwindowcontext_p.h b/src/core/contexts/abstractwindowcontext_p.h index 13490f3..c35d306 100644 --- a/src/core/contexts/abstractwindowcontext_p.h +++ b/src/core/contexts/abstractwindowcontext_p.h @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #ifndef ABSTRACTWINDOWCONTEXT_P_H diff --git a/src/core/contexts/cocoawindowcontext.mm b/src/core/contexts/cocoawindowcontext.mm index ca49d2f..3989831 100644 --- a/src/core/contexts/cocoawindowcontext.mm +++ b/src/core/contexts/cocoawindowcontext.mm @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #include "cocoawindowcontext_p.h" diff --git a/src/core/contexts/cocoawindowcontext_p.h b/src/core/contexts/cocoawindowcontext_p.h index 512fb20..f2e28cc 100644 --- a/src/core/contexts/cocoawindowcontext_p.h +++ b/src/core/contexts/cocoawindowcontext_p.h @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #ifndef COCOAWINDOWCONTEXT_P_H diff --git a/src/core/contexts/qtwindowcontext.cpp b/src/core/contexts/qtwindowcontext.cpp index 8b25c04..3a21965 100644 --- a/src/core/contexts/qtwindowcontext.cpp +++ b/src/core/contexts/qtwindowcontext.cpp @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #include "qtwindowcontext_p.h" diff --git a/src/core/contexts/qtwindowcontext_p.h b/src/core/contexts/qtwindowcontext_p.h index 829fe84..caee804 100644 --- a/src/core/contexts/qtwindowcontext_p.h +++ b/src/core/contexts/qtwindowcontext_p.h @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #ifndef QTWINDOWCONTEXT_P_H diff --git a/src/core/contexts/win32windowcontext.cpp b/src/core/contexts/win32windowcontext.cpp index f9be258..3f6623e 100644 --- a/src/core/contexts/win32windowcontext.cpp +++ b/src/core/contexts/win32windowcontext.cpp @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #include "win32windowcontext_p.h" diff --git a/src/core/contexts/win32windowcontext_p.h b/src/core/contexts/win32windowcontext_p.h index 09ce67f..39a2767 100644 --- a/src/core/contexts/win32windowcontext_p.h +++ b/src/core/contexts/win32windowcontext_p.h @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #ifndef WIN32WINDOWCONTEXT_P_H diff --git a/src/core/kernel/nativeeventfilter.cpp b/src/core/kernel/nativeeventfilter.cpp index ab6a032..27c29d9 100644 --- a/src/core/kernel/nativeeventfilter.cpp +++ b/src/core/kernel/nativeeventfilter.cpp @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #include "nativeeventfilter_p.h" @@ -25,7 +26,7 @@ } bool NativeEventDispatcher::nativeDispatch(const QByteArray &eventType, void *message, - QT_NATIVE_EVENT_RESULT_TYPE *result) { + QT_NATIVE_EVENT_RESULT_TYPE *result) { for (const auto &ef : std::as_const(m_nativeEventFilters)) { if (ef->nativeEventFilter(eventType, message, result)) return true; @@ -66,12 +67,10 @@ return nativeDispatch(eventType, message, result); } - static AppMasterNativeEventFilter *instance; + static inline AppMasterNativeEventFilter *instance = nullptr; friend class AppNativeEventFilter; }; - - AppMasterNativeEventFilter *AppMasterNativeEventFilter::instance = nullptr; AppNativeEventFilter::AppNativeEventFilter() { if (!AppMasterNativeEventFilter::instance) { diff --git a/src/core/kernel/nativeeventfilter_p.h b/src/core/kernel/nativeeventfilter_p.h index 174ae4e..cef78b7 100644 --- a/src/core/kernel/nativeeventfilter_p.h +++ b/src/core/kernel/nativeeventfilter_p.h @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #ifndef NATIVEEVENTFILTER_P_H diff --git a/src/core/kernel/sharedeventfilter.cpp b/src/core/kernel/sharedeventfilter.cpp index 5e66c65..f57a626 100644 --- a/src/core/kernel/sharedeventfilter.cpp +++ b/src/core/kernel/sharedeventfilter.cpp @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #include "sharedeventfilter_p.h" diff --git a/src/core/kernel/sharedeventfilter_p.h b/src/core/kernel/sharedeventfilter_p.h index 4445610..eeaf38f 100644 --- a/src/core/kernel/sharedeventfilter_p.h +++ b/src/core/kernel/sharedeventfilter_p.h @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #ifndef SHAREDEVENTFILTER_P_H diff --git a/src/core/qwindowkit_linux.h b/src/core/qwindowkit_linux.h index 57d3840..17e0106 100644 --- a/src/core/qwindowkit_linux.h +++ b/src/core/qwindowkit_linux.h @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #ifndef QWINDOWKIT_LINUX_H diff --git a/src/core/qwindowkit_windows.cpp b/src/core/qwindowkit_windows.cpp index 517ab73..51a6f33 100644 --- a/src/core/qwindowkit_windows.cpp +++ b/src/core/qwindowkit_windows.cpp @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #include "qwindowkit_windows.h" diff --git a/src/core/qwindowkit_windows.h b/src/core/qwindowkit_windows.h index 0a2f8a5..511268c 100644 --- a/src/core/qwindowkit_windows.h +++ b/src/core/qwindowkit_windows.h @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #ifndef QWINDOWKIT_WINDOWS_H diff --git a/src/core/qwkglobal.h b/src/core/qwkglobal.h index c659e0b..ded26b5 100644 --- a/src/core/qwkglobal.h +++ b/src/core/qwkglobal.h @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #ifndef QWKGLOBAL_H diff --git a/src/core/qwkglobal_p.h b/src/core/qwkglobal_p.h index 1691ef7..afaac67 100644 --- a/src/core/qwkglobal_p.h +++ b/src/core/qwkglobal_p.h @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #ifndef QWKGLOBAL_P_H diff --git a/src/core/shared/qwkwindowsextra_p.h b/src/core/shared/qwkwindowsextra_p.h index 6976b3c..1c66ea2 100644 --- a/src/core/shared/qwkwindowsextra_p.h +++ b/src/core/shared/qwkwindowsextra_p.h @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #ifndef QWKWINDOWSEXTRA_P_H @@ -158,7 +159,7 @@ struct DynamicApis { static const DynamicApis &instance() { - static const DynamicApis inst{}; + static const DynamicApis inst; return inst; } diff --git a/src/core/shared/systemwindow_p.h b/src/core/shared/systemwindow_p.h index 3b8cf87..d969aa9 100644 --- a/src/core/shared/systemwindow_p.h +++ b/src/core/shared/systemwindow_p.h @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #ifndef SYSTEMWINDOW_P_H @@ -18,107 +19,100 @@ #include <QWKCore/private/qwkglobal_p.h> -// Don't include this header in any header files. - namespace QWK { - // Anonymous namespace - namespace { + class WindowMoveManipulator : public QObject { + public: + explicit WindowMoveManipulator(QWindow *targetWindow) + : QObject(targetWindow), target(targetWindow), initialMousePosition(QCursor::pos()), + initialWindowPosition(targetWindow->position()) { + target->installEventFilter(this); + } - class WindowMoveManipulator : public QObject { - public: - explicit WindowMoveManipulator(QWindow *targetWindow) - : QObject(targetWindow), target(targetWindow), initialMousePosition(QCursor::pos()), - initialWindowPosition(targetWindow->position()) { - target->installEventFilter(this); - } - - protected: - bool eventFilter(QObject *obj, QEvent *event) override { - switch (event->type()) { - case QEvent::MouseMove: { - auto mouseEvent = static_cast<QMouseEvent *>(event); - QPoint delta = getMouseEventGlobalPos(mouseEvent) - initialMousePosition; - target->setPosition(initialWindowPosition + delta); - return true; - } - - case QEvent::MouseButtonRelease: { - if (target->y() < 0) { - target->setPosition(target->x(), 0); - } - target->removeEventFilter(this); - deleteLater(); - } - - default: - break; + protected: + bool eventFilter(QObject *obj, QEvent *event) override { + switch (event->type()) { + case QEvent::MouseMove: { + auto mouseEvent = static_cast<QMouseEvent *>(event); + QPoint delta = getMouseEventGlobalPos(mouseEvent) - initialMousePosition; + target->setPosition(initialWindowPosition + delta); + return true; } - return false; - } - private: - QWindow *target; - QPoint initialMousePosition; - QPoint initialWindowPosition; - }; - - class WindowResizeManipulator : public QObject { - public: - WindowResizeManipulator(QWindow *targetWindow, Qt::Edges edges) - : QObject(targetWindow), target(targetWindow), resizeEdges(edges), - initialMousePosition(QCursor::pos()), initialWindowRect(target->geometry()) { - target->installEventFilter(this); - } - - protected: - bool eventFilter(QObject *obj, QEvent *event) override { - switch (event->type()) { - case QEvent::MouseMove: { - auto mouseEvent = static_cast<QMouseEvent *>(event); - QPoint globalMousePos = getMouseEventGlobalPos(mouseEvent); - QRect windowRect = initialWindowRect; - - if (resizeEdges & Qt::LeftEdge) { - int delta = globalMousePos.x() - initialMousePosition.x(); - windowRect.setLeft(initialWindowRect.left() + delta); - } - if (resizeEdges & Qt::RightEdge) { - int delta = globalMousePos.x() - initialMousePosition.x(); - windowRect.setRight(initialWindowRect.right() + delta); - } - if (resizeEdges & Qt::TopEdge) { - int delta = globalMousePos.y() - initialMousePosition.y(); - windowRect.setTop(initialWindowRect.top() + delta); - } - if (resizeEdges & Qt::BottomEdge) { - int delta = globalMousePos.y() - initialMousePosition.y(); - windowRect.setBottom(initialWindowRect.bottom() + delta); - } - - target->setGeometry(windowRect); - return true; + case QEvent::MouseButtonRelease: { + if (target->y() < 0) { + target->setPosition(target->x(), 0); } - - case QEvent::MouseButtonRelease: { - target->removeEventFilter(this); - deleteLater(); - } - - default: - break; + target->removeEventFilter(this); + deleteLater(); } - return false; + + default: + break; } + return false; + } - private: - QWindow *target; - QPoint initialMousePosition; - QRect initialWindowRect; - Qt::Edges resizeEdges; - }; + private: + QWindow *target; + QPoint initialMousePosition; + QPoint initialWindowPosition; + }; - } + class WindowResizeManipulator : public QObject { + public: + WindowResizeManipulator(QWindow *targetWindow, Qt::Edges edges) + : QObject(targetWindow), target(targetWindow), resizeEdges(edges), + initialMousePosition(QCursor::pos()), initialWindowRect(target->geometry()) { + target->installEventFilter(this); + } + + protected: + bool eventFilter(QObject *obj, QEvent *event) override { + switch (event->type()) { + case QEvent::MouseMove: { + auto mouseEvent = static_cast<QMouseEvent *>(event); + QPoint globalMousePos = getMouseEventGlobalPos(mouseEvent); + QRect windowRect = initialWindowRect; + + if (resizeEdges & Qt::LeftEdge) { + int delta = globalMousePos.x() - initialMousePosition.x(); + windowRect.setLeft(initialWindowRect.left() + delta); + } + if (resizeEdges & Qt::RightEdge) { + int delta = globalMousePos.x() - initialMousePosition.x(); + windowRect.setRight(initialWindowRect.right() + delta); + } + if (resizeEdges & Qt::TopEdge) { + int delta = globalMousePos.y() - initialMousePosition.y(); + windowRect.setTop(initialWindowRect.top() + delta); + } + if (resizeEdges & Qt::BottomEdge) { + int delta = globalMousePos.y() - initialMousePosition.y(); + windowRect.setBottom(initialWindowRect.bottom() + delta); + } + + target->setGeometry(windowRect); + return true; + } + + case QEvent::MouseButtonRelease: { + target->removeEventFilter(this); + deleteLater(); + } + + default: + break; + } + return false; + } + + private: + QWindow *target; + QPoint initialMousePosition; + QRect initialWindowRect; + Qt::Edges resizeEdges; + }; // QWindow::startSystemMove() and QWindow::startSystemResize() is first supported at Qt 5.15 // QWindow::startSystemResize() returns false on macOS @@ -126,7 +120,7 @@ // When the new API fails, we emulate the window actions using the classical API. - static inline void startSystemMove(QWindow *window) { + inline void startSystemMove(QWindow *window) { #if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0)) std::ignore = new WindowMoveManipulator(window); #elif defined(Q_OS_LINUX) @@ -139,7 +133,7 @@ #endif } - static inline void startSystemResize(QWindow *window, Qt::Edges edges) { + inline void startSystemResize(QWindow *window, Qt::Edges edges) { #if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0)) std::ignore = new WindowResizeManipulator(window, edges); #elif defined(Q_OS_MAC) || defined(Q_OS_LINUX) diff --git a/src/core/style/styleagent.cpp b/src/core/style/styleagent.cpp index 16ff148..4b88447 100644 --- a/src/core/style/styleagent.cpp +++ b/src/core/style/styleagent.cpp @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #include "styleagent.h" diff --git a/src/core/style/styleagent.h b/src/core/style/styleagent.h index d583288..c573e8d 100644 --- a/src/core/style/styleagent.h +++ b/src/core/style/styleagent.h @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #ifndef STYLEAGENT_H diff --git a/src/core/style/styleagent_linux.cpp b/src/core/style/styleagent_linux.cpp index b091016..2825f09 100644 --- a/src/core/style/styleagent_linux.cpp +++ b/src/core/style/styleagent_linux.cpp @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #include "styleagent_p.h" diff --git a/src/core/style/styleagent_mac.mm b/src/core/style/styleagent_mac.mm index 176c4ad..e4764ad 100644 --- a/src/core/style/styleagent_mac.mm +++ b/src/core/style/styleagent_mac.mm @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #include "styleagent_p.h" diff --git a/src/core/style/styleagent_p.h b/src/core/style/styleagent_p.h index d7f584b..0ee6500 100644 --- a/src/core/style/styleagent_p.h +++ b/src/core/style/styleagent_p.h @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #ifndef STYLEAGENTPRIVATE_H diff --git a/src/core/style/styleagent_win.cpp b/src/core/style/styleagent_win.cpp index f6b92e8..8adf936 100644 --- a/src/core/style/styleagent_win.cpp +++ b/src/core/style/styleagent_win.cpp @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #include "styleagent_p.h" @@ -63,7 +64,7 @@ return false; } - static SystemSettingEventFilter *instance; + static inline SystemSettingEventFilter *instance = nullptr; static inline void install() { if (instance) { @@ -80,8 +81,6 @@ instance = nullptr; } }; - - SystemSettingEventFilter *SystemSettingEventFilter::instance = nullptr; void StyleAgentPrivate::setupSystemThemeHook() { systemTheme = getSystemTheme(); diff --git a/src/core/windowagentbase.cpp b/src/core/windowagentbase.cpp index 4c1f26a..69328d9 100644 --- a/src/core/windowagentbase.cpp +++ b/src/core/windowagentbase.cpp @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #include "windowagentbase.h" diff --git a/src/core/windowagentbase.h b/src/core/windowagentbase.h index fec450a..5b25528 100644 --- a/src/core/windowagentbase.h +++ b/src/core/windowagentbase.h @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #ifndef WINDOWAGENTBASE_H diff --git a/src/core/windowagentbase_p.h b/src/core/windowagentbase_p.h index 689e9ab..e7b67ec 100644 --- a/src/core/windowagentbase_p.h +++ b/src/core/windowagentbase_p.h @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #ifndef WINDOWAGENTBASEPRIVATE_H diff --git a/src/core/windowitemdelegate.cpp b/src/core/windowitemdelegate.cpp index 23e0d68..25f0bf3 100644 --- a/src/core/windowitemdelegate.cpp +++ b/src/core/windowitemdelegate.cpp @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #include "windowitemdelegate_p.h" diff --git a/src/core/windowitemdelegate_p.h b/src/core/windowitemdelegate_p.h index 344c0aa..b2c7520 100644 --- a/src/core/windowitemdelegate_p.h +++ b/src/core/windowitemdelegate_p.h @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #ifndef WINDOWITEMDELEGATE_P_H diff --git a/src/quick/quickitemdelegate.cpp b/src/quick/quickitemdelegate.cpp index 64fa0dc..c370931 100644 --- a/src/quick/quickitemdelegate.cpp +++ b/src/quick/quickitemdelegate.cpp @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #include "quickitemdelegate_p.h" diff --git a/src/quick/quickitemdelegate_p.h b/src/quick/quickitemdelegate_p.h index 6d79f5c..55f2586 100644 --- a/src/quick/quickitemdelegate_p.h +++ b/src/quick/quickitemdelegate_p.h @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #ifndef QUICKITEMDELEGATE_P_H diff --git a/src/quick/quickwindowagent.cpp b/src/quick/quickwindowagent.cpp index 058272c..32ed68f 100644 --- a/src/quick/quickwindowagent.cpp +++ b/src/quick/quickwindowagent.cpp @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #include "quickwindowagent.h" diff --git a/src/quick/quickwindowagent.h b/src/quick/quickwindowagent.h index 92c0c3e..c319615 100644 --- a/src/quick/quickwindowagent.h +++ b/src/quick/quickwindowagent.h @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #ifndef QUICKWINDOWAGENT_H diff --git a/src/quick/quickwindowagent_mac.cpp b/src/quick/quickwindowagent_mac.cpp index 58c5f8b..c7a822e 100644 --- a/src/quick/quickwindowagent_mac.cpp +++ b/src/quick/quickwindowagent_mac.cpp @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #include "quickwindowagent_p.h" diff --git a/src/quick/quickwindowagent_p.h b/src/quick/quickwindowagent_p.h index 738d234..ec0042d 100644 --- a/src/quick/quickwindowagent_p.h +++ b/src/quick/quickwindowagent_p.h @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #ifndef QUICKWINDOWAGENTPRIVATE_H diff --git a/src/quick/quickwindowagent_win.cpp b/src/quick/quickwindowagent_win.cpp index 6feb63d..338dbfa 100644 --- a/src/quick/quickwindowagent_win.cpp +++ b/src/quick/quickwindowagent_win.cpp @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #include "quickwindowagent_p.h" diff --git a/src/quick/qwkquickglobal.cpp b/src/quick/qwkquickglobal.cpp index b3b0d6e..1af2943 100644 --- a/src/quick/qwkquickglobal.cpp +++ b/src/quick/qwkquickglobal.cpp @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #include "qwkquickglobal.h" diff --git a/src/quick/qwkquickglobal.h b/src/quick/qwkquickglobal.h index 4fd4ffe..8020038 100644 --- a/src/quick/qwkquickglobal.h +++ b/src/quick/qwkquickglobal.h @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #ifndef QWKQUICKGLOBAL_H diff --git a/src/widgets/qwkwidgetsglobal.h b/src/widgets/qwkwidgetsglobal.h index ccf4e64..5bca751 100644 --- a/src/widgets/qwkwidgetsglobal.h +++ b/src/widgets/qwkwidgetsglobal.h @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #ifndef QWKWIDGETSGLOBAL_H diff --git a/src/widgets/widgetitemdelegate.cpp b/src/widgets/widgetitemdelegate.cpp index ddbd953..c81e6fb 100644 --- a/src/widgets/widgetitemdelegate.cpp +++ b/src/widgets/widgetitemdelegate.cpp @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #include "widgetitemdelegate_p.h" diff --git a/src/widgets/widgetitemdelegate_p.h b/src/widgets/widgetitemdelegate_p.h index ffb45bf..f63077c 100644 --- a/src/widgets/widgetitemdelegate_p.h +++ b/src/widgets/widgetitemdelegate_p.h @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #ifndef WIDGETITEMDELEGATE_P_H diff --git a/src/widgets/widgetwindowagent.cpp b/src/widgets/widgetwindowagent.cpp index 27ff365..6ba46dd 100644 --- a/src/widgets/widgetwindowagent.cpp +++ b/src/widgets/widgetwindowagent.cpp @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #include "widgetwindowagent.h" diff --git a/src/widgets/widgetwindowagent.h b/src/widgets/widgetwindowagent.h index 64f5adc..2d73ef1 100644 --- a/src/widgets/widgetwindowagent.h +++ b/src/widgets/widgetwindowagent.h @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #ifndef WIDGETWINDOWAGENT_H diff --git a/src/widgets/widgetwindowagent_mac.cpp b/src/widgets/widgetwindowagent_mac.cpp index aa9018d..17156e4 100644 --- a/src/widgets/widgetwindowagent_mac.cpp +++ b/src/widgets/widgetwindowagent_mac.cpp @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #include "widgetwindowagent_p.h" diff --git a/src/widgets/widgetwindowagent_p.h b/src/widgets/widgetwindowagent_p.h index 8e19958..1382dd5 100644 --- a/src/widgets/widgetwindowagent_p.h +++ b/src/widgets/widgetwindowagent_p.h @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #ifndef WIDGETWINDOWAGENTPRIVATE_H diff --git a/src/widgets/widgetwindowagent_win.cpp b/src/widgets/widgetwindowagent_win.cpp index e4fc4e0..f192f6b 100644 --- a/src/widgets/widgetwindowagent_win.cpp +++ b/src/widgets/widgetwindowagent_win.cpp @@ -1,4 +1,5 @@ -// Copyright (C) 2023-2024 Stdware Collections +// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware) +// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao) // SPDX-License-Identifier: Apache-2.0 #include "widgetwindowagent_p.h" -- Gitblit v1.9.1