look for the containment in the QObject hierarchy if it could not be find in the QGraphicsItem one. This is needed to
make the applet which are offscreen find their containment. svn path=/trunk/KDE/kdelibs/; revision=1207068
This commit is contained in:
parent
3ad1f7887a
commit
3534c4fc0e
14
applet.cpp
14
applet.cpp
@ -1513,6 +1513,20 @@ Containment *Applet::containment() const
|
||||
parent = parent->parentItem();
|
||||
}
|
||||
|
||||
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 && possibleC->Applet::d->isContainment) {
|
||||
c = possibleC;
|
||||
break;
|
||||
}
|
||||
objParent = objParent->parent();
|
||||
}
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
|
@ -883,6 +883,7 @@ void Containment::addApplet(Applet *applet, const QPointF &pos, bool delayInit)
|
||||
currentContainment->d->handles.remove(applet);
|
||||
}
|
||||
applet->setParentItem(this);
|
||||
applet->setParent(this);
|
||||
|
||||
// now move the old config to the new location
|
||||
//FIXME: this doesn't seem to get the actual main config group containing plugin=, etc
|
||||
@ -893,6 +894,7 @@ void Containment::addApplet(Applet *applet, const QPointF &pos, bool delayInit)
|
||||
disconnect(applet, SIGNAL(activate()), currentContainment, SIGNAL(activate()));
|
||||
} else {
|
||||
applet->setParentItem(this);
|
||||
applet->setParent(this);
|
||||
}
|
||||
|
||||
d->applets << applet;
|
||||
|
Loading…
Reference in New Issue
Block a user