From 885ec697a466e79f59ccb1701d44451b19c205cd Mon Sep 17 00:00:00 2001 From: Wang Zichong Date: Thu, 23 Nov 2023 14:48:47 +0800 Subject: [PATCH] chore: clean up IconItemDelegate click implementation Log: --- qml/IconItemDelegate.qml | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/qml/IconItemDelegate.qml b/qml/IconItemDelegate.qml index 5fd5da7a..66eec377 100644 --- a/qml/IconItemDelegate.qml +++ b/qml/IconItemDelegate.qml @@ -98,7 +98,6 @@ Control { } } - Label { id: iconItemLabel text: display.startsWith("internal/category/") ? getCategoryName(display.substring(18)) : display @@ -108,20 +107,9 @@ Control { wrapMode: Text.WordWrap elide: Text.ElideRight maximumLineCount: 2 - } - } - } - - TapHandler { - acceptedButtons: Qt.RightButton - onTapped: { - root.menuTriggered() + } } - } - MouseArea { - anchors.fill: parent - acceptedButtons: Qt.LeftButton onClicked: { if (root.icons) { root.folderClicked() @@ -129,8 +117,12 @@ Control { root.itemClicked() } } - onPressAndHold: { + } + TapHandler { + acceptedButtons: Qt.RightButton + onTapped: { + root.menuTriggered() } } @@ -150,7 +142,11 @@ Control { } Keys.onSpacePressed: { - root.itemClicked() + if (root.icons !== undefined) { + root.folderClicked() + } else { + root.itemClicked() + } } Keys.onReturnPressed: {