isContainment() only true for proper containments
This commit is contained in:
parent
7e3b2ae8af
commit
767336e87e
@ -562,7 +562,7 @@ Types::FormFactor Applet::formFactor() const
|
|||||||
Containment *Applet::containment() const
|
Containment *Applet::containment() const
|
||||||
{
|
{
|
||||||
Containment *c = qobject_cast<Containment*>(const_cast<Applet*>(this));
|
Containment *c = qobject_cast<Containment*>(const_cast<Applet*>(this));
|
||||||
if (c) {
|
if (c && qobject_cast<Corona *>(parent())) {
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -577,20 +577,6 @@ Containment *Applet::containment() const
|
|||||||
parent = parent->parent();
|
parent = parent->parent();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!c) {
|
|
||||||
//if the applet is an offscreen widget its parentItem will be 0, while its parent
|
|
||||||
//will be its parentWidget, so here we check the QObject hierarchy.
|
|
||||||
QObject *objParent = this->parent();
|
|
||||||
while (objParent) {
|
|
||||||
Containment *possibleC = qobject_cast<Containment*>(objParent);
|
|
||||||
if (possibleC) {
|
|
||||||
c = possibleC;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
objParent = objParent->parent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -757,7 +743,7 @@ void Applet::timerEvent(QTimerEvent *event)
|
|||||||
|
|
||||||
bool Applet::isContainment() const
|
bool Applet::isContainment() const
|
||||||
{
|
{
|
||||||
return qobject_cast<const Containment*>(this);
|
return qobject_cast<const Containment*>(this) && qobject_cast<Corona *>(parent());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // Plasma namespace
|
} // Plasma namespace
|
||||||
|
Loading…
Reference in New Issue
Block a user