From a12a106791f4ac5cc8624ee5e5f3b7466882c384 Mon Sep 17 00:00:00 2001 From: Jokul Date: Mon, 20 Jul 2026 23:10:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20SettingsWindow=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E5=A4=B1=E8=B4=A5=E4=BF=AE=E5=A4=8D=20+=20?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E7=AA=97=E5=8F=A3=E4=BA=A4=E4=BA=92=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复 import "components" 错误:SettingsWindow.qml 位于 components/ 目录, 该 import 会找 components/components/(不存在)导致 QML 加载失败、插件消失; 同目录组件 QML 自动解析,删除该 import - 接口名左对齐、类型描述右对齐:RadioButton 只显示接口名,描述用独立 Text 右对齐,替代原 modelData + " - " + 描述 的连写形式 - 窗口高度 450 -> 390,字体颜色到卸载按钮的 fillHeight 改固定 4px 间距, 消除原大段空白 - 标题栏拖动改用 startSystemMove() 系统级窗口拖动(参考 TrafficChartWindow), 替代手动鼠标事件模拟,解决拖动抖动/不跟手问题 --- package/components/SettingsWindow.qml | 35 ++++++++++++++++++--------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/package/components/SettingsWindow.qml b/package/components/SettingsWindow.qml index e0350da..380aaf3 100644 --- a/package/components/SettingsWindow.qml +++ b/package/components/SettingsWindow.qml @@ -10,7 +10,6 @@ import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 import QtQuick.Window 2.15 -import "components" Window { id: root @@ -31,12 +30,12 @@ Window { // 卸载按钮文字:复制命令后临时显示提示,定时器到期后还原 property string uninstallButtonText: qsTr("卸载插件") - width: 340 - height: 450 - minimumWidth: 340 - maximumWidth: 340 - minimumHeight: 450 - maximumHeight: 450 + width: 350 + height: 390 + minimumWidth: 350 + maximumWidth: 350 + minimumHeight: 390 + maximumHeight: 390 visible: false flags: Qt.FramelessWindowHint | Qt.Window // NonModal:不阻塞桌面其他区域,用户可同时操作任务栏 @@ -86,11 +85,13 @@ Window { Layout.preferredHeight: 44 color: "transparent" - // 拖动区域 + // 拖动层:声明在关闭按钮之前(位于其下方),避免遮挡按钮点击与 hover + // 用 startSystemMove() 系统级窗口拖动,由窗口管理器接管移动, + // 这是 frameless Window 的正确做法,pressed 即触发,丝滑无抖动 MouseArea { anchors.fill: parent - drag.target: root - cursorShape: Qt.ArrowCursor + cursorShape: Qt.OpenHandCursor + onPressed: root.startSystemMove() } // 标题文字 @@ -184,12 +185,22 @@ Window { RadioButton { anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter - text: modelData + " — " + interfaceDescription(modelData) + text: modelData checked: modelData === activeInterface onToggled: { if (applet) applet.setActiveInterface(modelData) } } + + // 接口类型描述:右对齐显示,与接口名分居两侧 + Text { + anchors.right: parent.right + anchors.rightMargin: 12 + anchors.verticalCenter: parent.verticalCenter + text: interfaceDescription(modelData) + font.pixelSize: 12 + color: "#999999" + } } } @@ -220,7 +231,7 @@ Window { onColorSelected: if (applet) applet.textColor = color } - Item { Layout.fillHeight: true } + Item { Layout.preferredHeight: 4 } // 卸载插件按钮:文字可动态切换(复制命令后显示提示) // 提示状态期间按钮不可点击,文字变绿色