diff --git a/src/declarativeimports/core/iconitem.cpp b/src/declarativeimports/core/iconitem.cpp index bc3722777..376c32ad4 100644 --- a/src/declarativeimports/core/iconitem.cpp +++ b/src/declarativeimports/core/iconitem.cpp @@ -141,6 +141,8 @@ void IconItem::setSource(const QVariant &source) return; } + disconnect(KIconLoader::global(), &KIconLoader::iconChanged, this, &IconItem::iconLoaderIconChanged); + const bool oldValid = isValid(); m_source = source; @@ -209,6 +211,10 @@ void IconItem::setSource(const QVariant &source) if (m_icon.isNull()) { m_icon = QIcon::fromTheme(sourceString); } + + //since QIcon is rendered by KIconLoader, watch for when its configuration changes now and reload as needed. + connect(KIconLoader::global(), &KIconLoader::iconChanged, this, &IconItem::iconLoaderIconChanged); + m_svgIconName.clear(); delete m_svgIcon; m_svgIcon = nullptr; @@ -543,6 +549,12 @@ void IconItem::animationFinished() update(); } +void IconItem::iconLoaderIconChanged(int group) +{ + Q_UNUSED(group); + schedulePixmapUpdate(); +} + void IconItem::schedulePixmapUpdate() { polish(); diff --git a/src/declarativeimports/core/iconitem.h b/src/declarativeimports/core/iconitem.h index 5378e2acb..5830ba324 100644 --- a/src/declarativeimports/core/iconitem.h +++ b/src/declarativeimports/core/iconitem.h @@ -192,6 +192,7 @@ private Q_SLOTS: void animationFinished(); void valueChanged(const QVariant &value); void onEnabledChanged(); + void iconLoaderIconChanged(int group); private: void loadPixmap();