fix: TextField rightItem 属性不存在导致插件加载失败

QtQuick.Controls TextField 无 rightItem 属性(DTK 专有),
清除按钮从 TextField 内部移到外部 RowLayout 中
This commit is contained in:
2026-08-09 08:50:42 +08:00
parent f09ef2b424
commit 1c6d31a169
+20 -19
View File
@@ -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 = ""
}
}