diff --git a/src/declarativeimports/core/colorscope.h b/src/declarativeimports/core/colorscope.h --- a/src/declarativeimports/core/colorscope.h +++ b/src/declarativeimports/core/colorscope.h @@ -119,8 +119,6 @@ ColorScope *findParentScope(); void itemChange(ItemChange change, const ItemChangeData &value) override; - bool eventFilter(QObject * watched, QEvent * event) override; - Q_SIGNALS: void colorGroupChanged(); void colorsChanged(); diff --git a/src/declarativeimports/core/colorscope.cpp b/src/declarativeimports/core/colorscope.cpp --- a/src/declarativeimports/core/colorscope.cpp +++ b/src/declarativeimports/core/colorscope.cpp @@ -25,6 +25,8 @@ #include #include +#include + QHash ColorScope::s_attachedScopes = QHash(); QWeakPointer ColorScope::s_theme; @@ -47,11 +49,12 @@ connect(this, &ColorScope::colorGroupChanged, this, &ColorScope::colorsChanged); - QQuickItem *parentItem = qobject_cast(parentObject); - if (parentItem) { - connect(parentItem, &QQuickItem::parentChanged, this, &ColorScope::checkColorGroupChanged); - } else if (m_parent) { - m_parent->installEventFilter(this); + if (parentObject && qobject_cast(parentObject)) { + connect(static_cast(parentObject), &QQuickItem::parentChanged, + this, &ColorScope::checkColorGroupChanged); + } else if (parent) { + connect(parent, &QQuickItem::parentChanged, + this, &ColorScope::checkColorGroupChanged); } } @@ -76,15 +79,6 @@ return s; } -bool ColorScope::eventFilter(QObject* watched, QEvent* event) -{ - Q_ASSERT(watched == m_parent && !qobject_cast(watched)); - if (event->type() == QEvent::ParentChange) { - checkColorGroupChanged(); - } - return QQuickItem::eventFilter(watched, event); -} - void ColorScope::setParentScope(ColorScope* parentScope) { if (parentScope == m_parentScope) @@ -105,29 +99,24 @@ ColorScope *ColorScope::findParentScope() { - QObject *p = nullptr; - if (m_parent) { - QQuickItem *gp = qobject_cast(m_parent); - if (gp) { - p = gp->parentItem(); - } else { - p = m_parent->parent(); - } - } - - if (!p || !m_parent) { - setParentScope(nullptr); - return nullptr; + QQuickItem *candidate = qobject_cast(parentItem()); + if (!candidate) { + candidate = qobject_cast(parent()); } + while (candidate) { + candidate = candidate->parentItem(); + ColorScope *s = qobject_cast(candidate); + if (!s) { + // Make sure AppletInterface always has a ColorScope + s = static_cast(qmlAttachedPropertiesObject(candidate, qobject_cast(candidate))); + } - ColorScope *c = qobject_cast(p); - if (!c) { - c = qmlAttachedProperties(p); + if (s) { + setParentScope(s); + return s; + } } - - setParentScope(c); - - return m_parentScope; + return nullptr; } void ColorScope::setColorGroup(Plasma::Theme::ColorGroup group) diff --git a/src/desktoptheme/breeze/widgets/configuration-icons.svg b/src/desktoptheme/breeze/widgets/configuration-icons.svg --- a/src/desktoptheme/breeze/widgets/configuration-icons.svg +++ b/src/desktoptheme/breeze/widgets/configuration-icons.svg @@ -14,8 +14,8 @@ viewBox="0 0 32.808331 13.758333" id="svg2" version="1.1" - inkscape:version="0.48.5 r10040" - sodipodi:docname="configuration-icons.svgz"> + inkscape:version="0.92.2 5c3e80d, 2017-08-06" + sodipodi:docname="configuration-icons.svg">