[ColorScope] Work with plain QObjects again
Otherwise colorScope doesn't attach to things like Plasma.Svg. Also remove superfluous cast as parentItem() returns a QQuickItem *. Differential Revision: https://phabricator.kde.org/D25887
This commit is contained in:
parent
e44cab6ab5
commit
8f7b2c9ae0
@ -109,12 +109,19 @@ void ColorScope::setParentScope(ColorScope* parentScope)
|
|||||||
|
|
||||||
ColorScope *ColorScope::findParentScope()
|
ColorScope *ColorScope::findParentScope()
|
||||||
{
|
{
|
||||||
QQuickItem *candidate = qobject_cast<QQuickItem *>(parentItem());
|
QObject *candidate = parentItem();
|
||||||
if (!candidate) {
|
if (!candidate) {
|
||||||
candidate = qobject_cast<QQuickItem *>(parent());
|
candidate = parent();
|
||||||
}
|
}
|
||||||
|
|
||||||
while (candidate) {
|
while (candidate) {
|
||||||
candidate = candidate->parentItem();
|
auto *quickCandidate = qobject_cast<QQuickItem *>(candidate);
|
||||||
|
if (quickCandidate && quickCandidate->parentItem()) {
|
||||||
|
candidate = quickCandidate->parentItem();
|
||||||
|
} else {
|
||||||
|
candidate = candidate->parent();
|
||||||
|
}
|
||||||
|
|
||||||
ColorScope *s = qobject_cast<ColorScope *>(candidate);
|
ColorScope *s = qobject_cast<ColorScope *>(candidate);
|
||||||
if (!s) {
|
if (!s) {
|
||||||
// Make sure AppletInterface always has a ColorScope
|
// Make sure AppletInterface always has a ColorScope
|
||||||
|
Loading…
Reference in New Issue
Block a user