diff --git a/model/foldermodel.cpp b/model/foldermodel.cpp index 217c653..d6501b4 100644 --- a/model/foldermodel.cpp +++ b/model/foldermodel.cpp @@ -53,6 +53,7 @@ #include #include #include +#include // Qt Quick #include @@ -1199,6 +1200,11 @@ void FolderModel::keyboardSearch(const QString &text) } } +void FolderModel::clearPixmapCache() +{ + QPixmapCache::clear(); +} + void FolderModel::restoreFromTrash() { if (!m_selectionModel->hasSelection()) diff --git a/model/foldermodel.h b/model/foldermodel.h index 9750c3e..1fae7d5 100644 --- a/model/foldermodel.h +++ b/model/foldermodel.h @@ -209,6 +209,8 @@ public: Q_INVOKABLE void updateSelectedItemsSize(); Q_INVOKABLE void keyboardSearch(const QString &text); + Q_INVOKABLE void clearPixmapCache(); + void restoreFromTrash(); bool isDesktop() const; diff --git a/qml/Desktop/Wallpaper.qml b/qml/Desktop/Wallpaper.qml index 07f011b..ad9b21e 100644 --- a/qml/Desktop/Wallpaper.qml +++ b/qml/Desktop/Wallpaper.qml @@ -41,6 +41,9 @@ Item { clip: true cache: false + // Clear cache + onSourceChanged: dirModel.clearPixmapCache() + ColorOverlay { id: dimsWallpaper anchors.fill: parent diff --git a/window.cpp b/window.cpp index 13747ec..2d8f6ea 100644 --- a/window.cpp +++ b/window.cpp @@ -21,6 +21,7 @@ #include #include #include +#include Window::Window(QObject *parent) : QQmlApplicationEngine(parent) @@ -40,6 +41,7 @@ void Window::load(const QUrl &url) bool Window::eventFilter(QObject *obj, QEvent *e) { if (e->type() == QEvent::Close) { + QPixmapCache::clear(); clearComponentCache(); deleteLater(); e->accept();