From d034f31624560d7acb54a0fb913e2cc1632e18a1 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Wed, 3 Sep 2025 18:58:32 +1000 Subject: filedialog: fix anims Assign to non reactive bindings so no update during remove anim when modelData is destroyed --- components/filedialog/CurrentItem.qml | 9 ++++++++- components/filedialog/FolderContents.qml | 25 +++++++++++-------------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/components/filedialog/CurrentItem.qml b/components/filedialog/CurrentItem.qml index b051212..bb87133 100644 --- a/components/filedialog/CurrentItem.qml +++ b/components/filedialog/CurrentItem.qml @@ -79,7 +79,14 @@ Item { anchors.rightMargin: Appearance.padding.larger - Appearance.padding.small anchors.bottomMargin: Appearance.padding.normal - Appearance.padding.small - text: qsTr(`"%1" selected`).arg(root.currentItem?.modelData.name) + Connections { + target: root + + function onCurrentItemChanged(): void { + if (root.currentItem) + content.text = qsTr(`"%1" selected`).arg(root.currentItem.modelData.name); + } + } } } diff --git a/components/filedialog/FolderContents.qml b/components/filedialog/FolderContents.qml index 3efa697..0c6f891 100644 --- a/components/filedialog/FolderContents.qml +++ b/components/filedialog/FolderContents.qml @@ -141,21 +141,17 @@ Item { anchors.topMargin: Appearance.padding.normal implicitSize: Sizes.itemWidth - Appearance.padding.normal * 2 - source: { - const file = item.modelData; - if (!file) - return Quickshell.iconPath("application-x-zerosize"); + Component.onCompleted: { + const file = item.modelData; if (file.isImage) - return Qt.resolvedUrl(file.path); - - if (!file.isDir) - return Quickshell.iconPath(file.mimeType.replace("/", "-"), "application-x-zerosize"); - - if (root.dialog.cwd.length === 1 && ["Desktop", "Documents", "Downloads", "Music", "Pictures", "Public", "Templates", "Videos"].includes(file.name)) - return Quickshell.iconPath(`folder-${file.name.toLowerCase()}`); - - return Quickshell.iconPath("inode-directory"); + source = Qt.resolvedUrl(file.path); + else if (!file.isDir) + source = Quickshell.iconPath(file.mimeType.replace("/", "-"), "application-x-zerosize"); + else if (root.dialog.cwd.length === 1 && ["Desktop", "Documents", "Downloads", "Music", "Pictures", "Public", "Templates", "Videos"].includes(file.name)) + source = Quickshell.iconPath(`folder-${file.name.toLowerCase()}`); + else + source = Quickshell.iconPath("inode-directory"); } } @@ -169,9 +165,10 @@ Item { anchors.margins: Appearance.padding.normal horizontalAlignment: Text.AlignHCenter - text: item.modelData?.name ?? "" elide: item.GridView.isCurrentItem ? Text.ElideNone : Text.ElideRight wrapMode: item.GridView.isCurrentItem ? Text.WrapAtWordBoundaryOrAnywhere : Text.NoWrap + + Component.onCompleted: text = item.modelData.name } Behavior on implicitHeight { -- cgit v1.2.3-freya