consider also declarative items for parentSize

this fixes applets collapse in the new qml systray
This commit is contained in:
Marco Martin 2012-12-28 18:45:37 +01:00
parent cc24f1839a
commit 8db20e64c7

View File

@ -27,6 +27,7 @@
#include <QGraphicsLinearLayout>
#include <QTimer>
#include <QVBoxLayout>
#include <QDeclarativeItem>
#ifdef Q_WS_X11
#include <QX11Info>
@ -242,10 +243,13 @@ void PopupAppletPrivate::popupConstraintsEvent(Plasma::Constraints constraints)
//99% of the times q->parentWidget() is the containment, but using it we can also manage the applet-in-applet case (i.e. systray)
//there are also cases where the parentlayoutitem is bigger than the containment (e.g. newspaper)
QDeclarativeItem *di = qobject_cast<QDeclarativeItem *>(q->parentObject());
if (q->parentLayoutItem()) {
parentSize = q->parentLayoutItem()->geometry().size();
} else if (q->parentWidget()) {
parentSize = q->parentWidget()->size();
} else if (di) {
parentSize = QSizeF(di->width(), di->height());
}
//check if someone did the nasty trick of applets in applets, in this case we always want to be collapsed