From 1c6d31a1691fdb893af8243be1c3835e8f5c8da3 Mon Sep 17 00:00:00 2001 From: Jokul Date: Sun, 9 Aug 2026 08:50:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20TextField=20rightItem=20=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E4=B8=8D=E5=AD=98=E5=9C=A8=E5=AF=BC=E8=87=B4=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E5=8A=A0=E8=BD=BD=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QtQuick.Controls TextField 无 rightItem 属性(DTK 专有), 清除按钮从 TextField 内部移到外部 RowLayout 中 --- package/components/TcpConnectionsWindow.qml | 39 +++++++++++---------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/package/components/TcpConnectionsWindow.qml b/package/components/TcpConnectionsWindow.qml index 21d12b2..123fc95 100644 --- a/package/components/TcpConnectionsWindow.qml +++ b/package/components/TcpConnectionsWindow.qml @@ -161,25 +161,26 @@ Window { selectByMouse: true text: root.searchText onTextChanged: root.searchText = text - // 清除按钮:有输入时显示 ×,点击清空搜索 - rightItem: Rectangle { - visible: root.searchText.length > 0 - width: 20; height: 20 - radius: 10 - color: clearSearchMouse.containsMouse ? theme.hoverBg : "transparent" - Text { - anchors.centerIn: parent - text: "×" - font.pixelSize: 14 - color: clearSearchMouse.containsMouse ? root.accentColor : theme.textTertiary - } - MouseArea { - id: clearSearchMouse - anchors.fill: parent - hoverEnabled: true - cursorShape: Qt.PointingHandCursor - onClicked: root.searchText = "" - } + } + + // 清除按钮:有输入时显示 ×,点击清空搜索 + Rectangle { + visible: root.searchText.length > 0 + width: 20; height: 20 + radius: 10 + color: clearSearchMouse.containsMouse ? theme.hoverBg : "transparent" + Text { + anchors.centerIn: parent + text: "×" + font.pixelSize: 14 + color: clearSearchMouse.containsMouse ? root.accentColor : theme.textTertiary + } + MouseArea { + id: clearSearchMouse + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + onClicked: root.searchText = "" } }