diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-09-03 18:58:32 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-09-03 18:58:32 +1000 |
| commit | d034f31624560d7acb54a0fb913e2cc1632e18a1 (patch) | |
| tree | 748bb300b1bd176d30636cea1cb95a6fd0f07383 | |
| parent | internal: refactor Paths util (diff) | |
| download | caelestia-shell-d034f31624560d7acb54a0fb913e2cc1632e18a1.tar.gz caelestia-shell-d034f31624560d7acb54a0fb913e2cc1632e18a1.tar.bz2 caelestia-shell-d034f31624560d7acb54a0fb913e2cc1632e18a1.zip | |
filedialog: fix anims
Assign to non reactive bindings so no update during remove anim when modelData is destroyed
| -rw-r--r-- | components/filedialog/CurrentItem.qml | 9 | ||||
| -rw-r--r-- | 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 { |