diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-07-22 22:28:10 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-07-22 22:28:10 +1000 |
| commit | 89c7739fdbcea2e8918b30ca236d7e09beee1bc3 (patch) | |
| tree | f8dcca2fc422795d0032102f672e720d01031016 /widgets/CachingIconImage.qml | |
| parent | internal: fix typo (diff) | |
| download | caelestia-shell-89c7739fdbcea2e8918b30ca236d7e09beee1bc3.tar.gz caelestia-shell-89c7739fdbcea2e8918b30ca236d7e09beee1bc3.tar.bz2 caelestia-shell-89c7739fdbcea2e8918b30ca236d7e09beee1bc3.zip | |
filedialog: cache thumbnails
Much faster loading
Diffstat (limited to 'widgets/CachingIconImage.qml')
| -rw-r--r-- | widgets/CachingIconImage.qml | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/widgets/CachingIconImage.qml b/widgets/CachingIconImage.qml new file mode 100644 index 0000000..522a947 --- /dev/null +++ b/widgets/CachingIconImage.qml @@ -0,0 +1,31 @@ +import QtQuick + +Item { + property alias asynchronous: image.asynchronous + property alias status: image.status + property alias mipmap: image.mipmap + property alias backer: image + + property real implicitSize + readonly property real actualSize: Math.min(width, height) + + property url source + + onSourceChanged: { + if (source?.toString().startsWith("image://icon/")) + // Directly skip the path prop and treat like a normal Image component + image.source = source; + else if (source) + image.path = source; + } + + implicitWidth: implicitSize + implicitHeight: implicitSize + + CachingImage { + id: image + + anchors.fill: parent + fillMode: Image.PreserveAspectFit + } +} |