fix(qml):补充应用组点击空白区域完成重命名的功能

This commit is contained in:
qiqi49 2024-02-27 15:10:32 +08:00
parent 67d9b21beb
commit 47463f9e67
3 changed files with 20 additions and 3 deletions

View File

@ -28,6 +28,7 @@ Item {
property bool textCenterIn: false property bool textCenterIn: false
property bool editStatus: false property bool editStatus: false
property string textEdited: title property string textEdited: title
property string text: editLoader.item.text
property real textSize property real textSize
signal textEditingFinished(string text) signal textEditingFinished(string text)
@ -61,6 +62,7 @@ Item {
border.width: 2 border.width: 2
borderAlpha: textEdit.activeFocus ? 1 : 0 borderAlpha: textEdit.activeFocus ? 1 : 0
borderColor: Platform.Theme.Highlight borderColor: Platform.Theme.Highlight
property string text: textEdit.text
TextInput { TextInput {
id: textEdit id: textEdit
@ -112,7 +114,7 @@ Item {
anchors.centerIn: parent anchors.centerIn: parent
width: 16; height: width width: 16; height: width
source: "image://theme/edit-clear-symbolic" source: "image://theme/edit-clear-symbolic"
mode: isFullScreen ? UkuiItems.Icon.Highlight : UkuiItems.Icon.AutoHighlight mode: UkuiItems.Icon.AutoHighlight
} }
onClicked: { onClicked: {

View File

@ -125,7 +125,15 @@ Loader {
properties: "contentMargins, labelMagrins, labelSpacing, labelMagrins" properties: "contentMargins, labelMagrins, labelSpacing, labelMagrins"
} }
} }
ScriptAction { script: content.folderSwipeView.hideFolder() } ScriptAction {
script: {
//
if (folderNameText.text !== folderNameText.textEdited) {
folderModel.renameFolder(folderNameText.text);
}
content.folderSwipeView.hideFolder()
}
}
} }
}, },
Transition { Transition {

View File

@ -124,7 +124,14 @@ Loader {
properties: "contentMargins, labelMagrins, labelSpacing, labelMagrins" properties: "contentMargins, labelMagrins, labelSpacing, labelMagrins"
} }
} }
ScriptAction { script: content.folderSwipeView.hideFolder() } ScriptAction {
script: {
//
if (folderNameText.text !== folderNameText.textEdited) {
folderModel.renameFolder(folderNameText.text);
}
content.folderSwipeView.hideFolder()
}}
} }
}, },
Transition { Transition {