From f922978338df7a9d43f9dc5dd3f7e9531a7859a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Tue, 30 Apr 2024 19:27:57 +0800 Subject: [PATCH] update --- example/example_en_US.ts | 28 ++++++++++++++-------------- example/example_zh_CN.ts | 28 ++++++++++++++-------------- example/qml/page/T_TableView.qml | 2 -- example/qml/window/MainWindow.qml | 2 +- src/FluFrameless.cpp | 15 +++++++++++---- 5 files changed, 40 insertions(+), 35 deletions(-) diff --git a/example/example_en_US.ts b/example/example_en_US.ts index 81c845a7..0545ca0e 100644 --- a/example/example_en_US.ts +++ b/example/example_en_US.ts @@ -1964,7 +1964,7 @@ Some contents... - + Name @@ -1984,67 +1984,67 @@ Some contents... - + Age - + Clear All - + Delete Selection - + Add a row of Data - + Insert a Row - + Focus not acquired: Please click any item in the form as the target for insertion! - + Avatar - + Address - + Nickname - + Long String - + Options - + <Previous - + Next> diff --git a/example/example_zh_CN.ts b/example/example_zh_CN.ts index 09f6aac2..4c10312f 100644 --- a/example/example_zh_CN.ts +++ b/example/example_zh_CN.ts @@ -2110,7 +2110,7 @@ Some contents... - + Name 名称 @@ -2130,67 +2130,67 @@ Some contents... 全选 - + Age 年龄 - + Clear All 清除所有 - + Insert a Row 插入一行 - + Focus not acquired: Please click any item in the form as the target for insertion! 焦点未获取:请点击表格中的任意一项,作为插入的靶点! - + Avatar 头像 - + Address 地址 - + Nickname 昵称 - + Long String 长字符串 - + Options 操作 - + <Previous <上一页 - + Next> 下一页> - + Delete Selection 删除选中 - + Add a row of Data 添加一行数据 diff --git a/example/qml/page/T_TableView.qml b/example/qml/page/T_TableView.qml index a5a4f8f3..9f696693 100644 --- a/example/qml/page/T_TableView.qml +++ b/example/qml/page/T_TableView.qml @@ -273,7 +273,6 @@ FluContentPage{ } Component.onCompleted: { currentIndex=["100","300","500","1000"].findIndex((element) => element === display) - console.debug(textBox) textBox.forceActiveFocus() textBox.selectAll() } @@ -291,7 +290,6 @@ FluContentPage{ anchors.fill: parent focus: true Component.onCompleted: { - console.debug("333333") var data = ["傲来国界花果山水帘洞","傲来国界坎源山脏水洞","大唐国界黑风山黑风洞","大唐国界黄风岭黄风洞","大唐国界骷髅山白骨洞","宝象国界碗子山波月洞","宝象国界平顶山莲花洞","宝象国界压龙山压龙洞","乌鸡国界号山枯松涧火云洞","乌鸡国界衡阳峪黑水河河神府"] var result = data.map(function(item) { return {title: item}; diff --git a/example/qml/window/MainWindow.qml b/example/qml/window/MainWindow.qml index 4fff0309..a34f1ffe 100644 --- a/example/qml/window/MainWindow.qml +++ b/example/qml/window/MainWindow.qml @@ -15,7 +15,7 @@ FluWindow { title: "FluentUI" width: 1000 height: 680 - minimumWidth: 1000 + minimumWidth: 800 minimumHeight: 200 launchMode: FluWindowType.SingleTask fitsAppBarWindows: true diff --git a/src/FluFrameless.cpp b/src/FluFrameless.cpp index 8fec5f5e..799b8627 100644 --- a/src/FluFrameless.cpp +++ b/src/FluFrameless.cpp @@ -87,7 +87,7 @@ void FluFrameless::componentComplete() { int w = window()->width(); int h = window()->height(); _current = window()->winId(); - window()->setFlags((window()->flags()) | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint); + window()->setFlags((window()->flags()) | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint | Qt::FramelessWindowHint); if (!_fixSize) { window()->setFlag(Qt::WindowMaximizeButtonHint); } @@ -106,14 +106,14 @@ void FluFrameless::componentComplete() { HWND hwnd = reinterpret_cast(window()->winId()); DWORD style = ::GetWindowLongPtr(hwnd, GWL_STYLE); if (_fixSize) { - ::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_CAPTION); + ::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_THICKFRAME | WS_CAPTION); 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 { - ::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_MAXIMIZEBOX | WS_CAPTION); + ::SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_MAXIMIZEBOX | WS_THICKFRAME | WS_CAPTION); } SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); connect(window(), &QQuickWindow::screenChanged, this, [hwnd] { @@ -153,6 +153,7 @@ void FluFrameless::componentComplete() { const auto uMsg = msg->message; const auto wParam = msg->wParam; const auto lParam = msg->lParam; + static int offsetXY; if (uMsg == WM_WINDOWPOSCHANGING) { auto *wp = reinterpret_cast(lParam); if (wp != nullptr && (wp->flags & SWP_NOSIZE) == 0) { @@ -173,13 +174,19 @@ void FluFrameless::componentComplete() { *result = static_cast(hitTestResult); return true; } + if(clientRect->left - originalLeft != 0){ + offsetXY = clientRect->left - originalLeft; + } if (!isMaximum) { clientRect->top = originalTop; clientRect->bottom = originalBottom; clientRect->left = originalLeft; clientRect->right = originalRight; } else { - clientRect->top = 0; + clientRect->top = originalTop+offsetXY; + clientRect->bottom = originalBottom-offsetXY; + clientRect->left = originalLeft+offsetXY; + clientRect->right = originalRight-offsetXY; } _setMaximizeHovered(false); *result = WVR_REDRAW;