filedialog: fix anims
Assign to non reactive bindings so no update during remove anim when modelData is destroyed
This commit is contained in:
parent
1de24676bb
commit
d034f31624
2 changed files with 19 additions and 15 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -141,21 +141,17 @@ Item {
|
|||
anchors.topMargin: Appearance.padding.normal
|
||||
|
||||
implicitSize: Sizes.itemWidth - Appearance.padding.normal * 2
|
||||
source: {
|
||||
|
||||
Component.onCompleted: {
|
||||
const file = item.modelData;
|
||||
if (!file)
|
||||
return Quickshell.iconPath("application-x-zerosize");
|
||||
|
||||
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 {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue