fix: SettingsWindow 组件加载失败修复 + 设置窗口交互优化
- 修复 import "components" 错误:SettingsWindow.qml 位于 components/ 目录, 该 import 会找 components/components/(不存在)导致 QML 加载失败、插件消失; 同目录组件 QML 自动解析,删除该 import - 接口名左对齐、类型描述右对齐:RadioButton 只显示接口名,描述用独立 Text 右对齐,替代原 modelData + " - " + 描述 的连写形式 - 窗口高度 450 -> 390,字体颜色到卸载按钮的 fillHeight 改固定 4px 间距, 消除原大段空白 - 标题栏拖动改用 startSystemMove() 系统级窗口拖动(参考 TrafficChartWindow), 替代手动鼠标事件模拟,解决拖动抖动/不跟手问题
This commit is contained in:
@@ -10,7 +10,6 @@ import QtQuick 2.15
|
|||||||
import QtQuick.Controls 2.15
|
import QtQuick.Controls 2.15
|
||||||
import QtQuick.Layouts 1.15
|
import QtQuick.Layouts 1.15
|
||||||
import QtQuick.Window 2.15
|
import QtQuick.Window 2.15
|
||||||
import "components"
|
|
||||||
|
|
||||||
Window {
|
Window {
|
||||||
id: root
|
id: root
|
||||||
@@ -31,12 +30,12 @@ Window {
|
|||||||
// 卸载按钮文字:复制命令后临时显示提示,定时器到期后还原
|
// 卸载按钮文字:复制命令后临时显示提示,定时器到期后还原
|
||||||
property string uninstallButtonText: qsTr("卸载插件")
|
property string uninstallButtonText: qsTr("卸载插件")
|
||||||
|
|
||||||
width: 340
|
width: 350
|
||||||
height: 450
|
height: 390
|
||||||
minimumWidth: 340
|
minimumWidth: 350
|
||||||
maximumWidth: 340
|
maximumWidth: 350
|
||||||
minimumHeight: 450
|
minimumHeight: 390
|
||||||
maximumHeight: 450
|
maximumHeight: 390
|
||||||
visible: false
|
visible: false
|
||||||
flags: Qt.FramelessWindowHint | Qt.Window
|
flags: Qt.FramelessWindowHint | Qt.Window
|
||||||
// NonModal:不阻塞桌面其他区域,用户可同时操作任务栏
|
// NonModal:不阻塞桌面其他区域,用户可同时操作任务栏
|
||||||
@@ -86,11 +85,13 @@ Window {
|
|||||||
Layout.preferredHeight: 44
|
Layout.preferredHeight: 44
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
// 拖动区域
|
// 拖动层:声明在关闭按钮之前(位于其下方),避免遮挡按钮点击与 hover
|
||||||
|
// 用 startSystemMove() 系统级窗口拖动,由窗口管理器接管移动,
|
||||||
|
// 这是 frameless Window 的正确做法,pressed 即触发,丝滑无抖动
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
drag.target: root
|
cursorShape: Qt.OpenHandCursor
|
||||||
cursorShape: Qt.ArrowCursor
|
onPressed: root.startSystemMove()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 标题文字
|
// 标题文字
|
||||||
@@ -184,12 +185,22 @@ Window {
|
|||||||
RadioButton {
|
RadioButton {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
text: modelData + " — " + interfaceDescription(modelData)
|
text: modelData
|
||||||
checked: modelData === activeInterface
|
checked: modelData === activeInterface
|
||||||
onToggled: {
|
onToggled: {
|
||||||
if (applet) applet.setActiveInterface(modelData)
|
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
|
onColorSelected: if (applet) applet.textColor = color
|
||||||
}
|
}
|
||||||
|
|
||||||
Item { Layout.fillHeight: true }
|
Item { Layout.preferredHeight: 4 }
|
||||||
|
|
||||||
// 卸载插件按钮:文字可动态切换(复制命令后显示提示)
|
// 卸载插件按钮:文字可动态切换(复制命令后显示提示)
|
||||||
// 提示状态期间按钮不可点击,文字变绿色
|
// 提示状态期间按钮不可点击,文字变绿色
|
||||||
|
|||||||
Reference in New Issue
Block a user