diff --git a/wallpapers/image/imagepackage/contents/ui/main.qml b/wallpapers/image/imagepackage/contents/ui/main.qml index aa8b3ec21..a23a86999 100644 --- a/wallpapers/image/imagepackage/contents/ui/main.qml +++ b/wallpapers/image/imagepackage/contents/ui/main.qml @@ -89,6 +89,7 @@ QQC2.StackView { } targetSize: root.sourceSize + onActualSizeChanged: Qt.callLater(loadImage); onColorSchemeChanged: loadImageImmediately(); } diff --git a/wallpapers/image/plugin/utils/mediaproxy.cpp b/wallpapers/image/plugin/utils/mediaproxy.cpp index 27c2ce65d..6f4cb8661 100644 --- a/wallpapers/image/plugin/utils/mediaproxy.cpp +++ b/wallpapers/image/plugin/utils/mediaproxy.cpp @@ -91,8 +91,13 @@ void MediaProxy::setTargetSize(const QSize &size) Q_EMIT targetSizeChanged(size); if (m_providerType == Provider::Type::Package) { + determineBackgroundType(); // In case file format changes after size changes updateModelImage(); } + if (m_providerType == Provider::Type::Image || m_backgroundType == BackgroundType::Type::AnimatedImage) { + // When KPackage contains animated wallpapers, image provider is not used. + Q_EMIT actualSizeChanged(); + } } Provider::Type MediaProxy::providerType() const diff --git a/wallpapers/image/plugin/utils/mediaproxy.h b/wallpapers/image/plugin/utils/mediaproxy.h index b76c33eca..e21c7dd1a 100644 --- a/wallpapers/image/plugin/utils/mediaproxy.h +++ b/wallpapers/image/plugin/utils/mediaproxy.h @@ -77,6 +77,13 @@ Q_SIGNALS: void targetSizeChanged(const QSize &size); + /** + * Emitted when the target size changes while the provider type is single image + * or the current wallpaper is animated. + * The frontend is required to force update the wallpaper. + */ + void actualSizeChanged(); + /** * Emitted when system color scheme changes. The frontend is required to * reload the wallpaper even if the image path is not changed.