diff --git a/src/scriptengines/qml/plasmoid/containmentinterface.cpp b/src/scriptengines/qml/plasmoid/containmentinterface.cpp --- a/src/scriptengines/qml/plasmoid/containmentinterface.cpp +++ b/src/scriptengines/qml/plasmoid/containmentinterface.cpp @@ -851,10 +851,9 @@ return; } - if (!m_containment->wallpaper().isEmpty()) { - delete m_wallpaperInterface; - + if (!m_wallpaperInterface && !m_containment->wallpaper().isEmpty()) { m_wallpaperInterface = new WallpaperInterface(this); + m_wallpaperInterface->setZ(-1000); //Qml seems happier if the parent gets set in this way m_wallpaperInterface->setProperty("parent", QVariant::fromValue(this)); @@ -867,11 +866,9 @@ prop.write(expr.evaluate()); m_containment->setProperty("wallpaperGraphicsObject", QVariant::fromValue(m_wallpaperInterface)); - } else { - if (m_wallpaperInterface) { - m_wallpaperInterface->deleteLater(); - m_wallpaperInterface = nullptr; - } + } else if (m_wallpaperInterface && m_containment->wallpaper().isEmpty()) { + m_wallpaperInterface->deleteLater(); + m_wallpaperInterface = nullptr; } }