From 012f30c979c1e789e01ca24d373c3bdbab0e5afa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Fri, 14 Jun 2024 16:01:08 +0800 Subject: [PATCH] update --- example/src/main.cpp | 3 - src/FluFrameless.cpp | 78 +++++-------------- .../imports/FluentUI/Controls/FluCheckBox.qml | 8 -- .../imports/FluentUI/Controls/FluCheckBox.qml | 7 -- 4 files changed, 21 insertions(+), 75 deletions(-) diff --git a/example/src/main.cpp b/example/src/main.cpp index bd80267c..21cc3f78 100644 --- a/example/src/main.cpp +++ b/example/src/main.cpp @@ -59,9 +59,6 @@ int main(int argc, char *argv[]) QGuiApplication::setQuitOnLastWindowClosed(false); SettingsHelper::getInstance()->init(argv); Log::setup(argv,uri); -#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) - QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL); -#endif #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); diff --git a/src/FluFrameless.cpp b/src/FluFrameless.cpp index 90ccf947..c1649ede 100644 --- a/src/FluFrameless.cpp +++ b/src/FluFrameless.cpp @@ -105,22 +105,14 @@ void FluFrameless::componentComplete() { HWND hwnd = reinterpret_cast(window()->winId()); DWORD style = ::GetWindowLongPtr(hwnd, GWL_STYLE); if (_fixSize) { -#if (QT_VERSION == QT_VERSION_CHECK(6, 5, 3) || QT_VERSION == QT_VERSION_CHECK(6, 6, 0)) ::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_THICKFRAME);; -#else - ::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_THICKFRAME | WS_CAPTION); -#endif for (int i = 0; i <= QGuiApplication::screens().count() - 1; ++i) { connect(QGuiApplication::screens().at(i), &QScreen::logicalDotsPerInchChanged, this, [=] { SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_FRAMECHANGED); }); } } else { -#if (QT_VERSION == QT_VERSION_CHECK(6, 5, 3) || QT_VERSION == QT_VERSION_CHECK(6, 6, 0)) ::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_MAXIMIZEBOX | WS_THICKFRAME); -#else - ::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_MAXIMIZEBOX | WS_THICKFRAME | WS_CAPTION); -#endif } SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); connect(window(), &QQuickWindow::screenChanged, this, [hwnd] { @@ -183,28 +175,10 @@ void FluFrameless::componentComplete() { *result = static_cast(hitTestResult); return true; } -#if (QT_VERSION == QT_VERSION_CHECK(6, 5, 3) || QT_VERSION == QT_VERSION_CHECK(6, 6, 0)) clientRect->top = originalTop; clientRect->bottom = originalBottom; clientRect->left = originalLeft; clientRect->right = originalRight; -#else - bool isMaximum = ::IsZoomed(hwnd); - if (isMaximum) { - auto geometry = window()->screen()->geometry(); - auto offsetX = qAbs(geometry.left() - originalLeft); - auto offsetY = qAbs(geometry.top() - originalTop); - clientRect->top = originalTop + offsetY; - clientRect->bottom = originalBottom - offsetY; - clientRect->left = originalLeft + offsetX; - clientRect->right = originalRight - offsetX; - } else { - clientRect->top = originalTop; - clientRect->bottom = originalBottom; - clientRect->left = originalLeft; - clientRect->right = originalRight; - } -#endif _setMaximizeHovered(false); *result = WVR_REDRAW; return true; @@ -262,21 +236,12 @@ void FluFrameless::componentComplete() { *result = HTCLIENT; return true; } else if (uMsg == WM_NCPAINT) { -#if (QT_VERSION == QT_VERSION_CHECK(6, 5, 3) || QT_VERSION == QT_VERSION_CHECK(6, 6, 0)) *result = FALSE; return true; -#else - if (isCompositionEnabled()) { - return false; - } - *result = FALSE; - return true; -#endif } else if (uMsg == WM_NCACTIVATE) { *result = TRUE; return true; } else if (uMsg == WM_GETMINMAXINFO) { -#if (QT_VERSION == QT_VERSION_CHECK(6, 5, 3) || QT_VERSION == QT_VERSION_CHECK(6, 6, 0)) auto *minmaxInfo = reinterpret_cast(lParam); auto pixelRatio = window()->devicePixelRatio(); auto geometry = window()->screen()->availableGeometry(); @@ -286,7 +251,6 @@ void FluFrameless::componentComplete() { minmaxInfo->ptMaxPosition.y = rect.top; minmaxInfo->ptMaxSize.x = qRound(geometry.width() * pixelRatio); minmaxInfo->ptMaxSize.y = qRound(geometry.height() * pixelRatio); -#endif return false; } else if (_isWindows11OrGreater && (uMsg == WM_NCLBUTTONDBLCLK || uMsg == WM_NCLBUTTONDOWN)) { if (_hitMaximizeButton()) { @@ -411,27 +375,27 @@ void FluFrameless::_setMaximizeHovered(bool val) { void FluFrameless::_updateCursor(int edges) { switch (edges) { - case 0: - window()->setCursor(Qt::ArrowCursor); - break; - case Qt::LeftEdge: - case Qt::RightEdge: - window()->setCursor(Qt::SizeHorCursor); - break; - case Qt::TopEdge: - case Qt::BottomEdge: - window()->setCursor(Qt::SizeVerCursor); - break; - case Qt::LeftEdge | Qt::TopEdge: - case Qt::RightEdge | Qt::BottomEdge: - window()->setCursor(Qt::SizeFDiagCursor); - break; - case Qt::RightEdge | Qt::TopEdge: - case Qt::LeftEdge | Qt::BottomEdge: - window()->setCursor(Qt::SizeBDiagCursor); - break; - default: - break; + case 0: + window()->setCursor(Qt::ArrowCursor); + break; + case Qt::LeftEdge: + case Qt::RightEdge: + window()->setCursor(Qt::SizeHorCursor); + break; + case Qt::TopEdge: + case Qt::BottomEdge: + window()->setCursor(Qt::SizeVerCursor); + break; + case Qt::LeftEdge | Qt::TopEdge: + case Qt::RightEdge | Qt::BottomEdge: + window()->setCursor(Qt::SizeFDiagCursor); + break; + case Qt::RightEdge | Qt::TopEdge: + case Qt::LeftEdge | Qt::BottomEdge: + window()->setCursor(Qt::SizeBDiagCursor); + break; + default: + break; } } diff --git a/src/Qt5/imports/FluentUI/Controls/FluCheckBox.qml b/src/Qt5/imports/FluentUI/Controls/FluCheckBox.qml index 9d3b05ca..37c2107e 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluCheckBox.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluCheckBox.qml @@ -94,13 +94,6 @@ Button { } return normalColor } - Behavior on color { - enabled: control.animationEnabled - ColorAnimation{ - duration: 83 - } - } - FluIcon { anchors.centerIn: parent iconSource: FluentIcons.CheckboxIndeterminate @@ -114,7 +107,6 @@ Button { } } } - FluIcon { anchors.centerIn: parent iconSource: FluentIcons.AcceptMedium diff --git a/src/Qt6/imports/FluentUI/Controls/FluCheckBox.qml b/src/Qt6/imports/FluentUI/Controls/FluCheckBox.qml index d9f9d454..2b4292f5 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluCheckBox.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluCheckBox.qml @@ -95,13 +95,6 @@ Button { } return normalColor } - Behavior on color { - enabled: control.animationEnabled - ColorAnimation{ - duration: 83 - } - } - FluIcon { anchors.centerIn: parent iconSource: FluentIcons.CheckboxIndeterminate