reposition the popup when the containment geometry changes

partially addresses 197522 (still have to manage cases where the view
just moves or the screen resizes without resizing the containment)
CCBUG:197522

svn path=/trunk/KDE/kdelibs/; revision=987082
This commit is contained in:
Marco Martin 2009-06-25 14:13:14 +00:00
parent fbb9239dda
commit ed562d82dd
3 changed files with 18 additions and 0 deletions

View File

@ -1999,6 +1999,19 @@ QVariant Applet::itemChange(GraphicsItemChange change, const QVariant &value)
old->copyTo(d->mainConfig);
old->deleteGroup();
delete old;
} else if (!d->isContainment) {
Plasma::PopupApplet *pa = qobject_cast<Plasma::PopupApplet *>(this);
if (!pa) {
break;
}
//reconnect of popupapplets with new containment geometryChanged
if (containment()) {
disconnect(containment(), SIGNAL(geometryChanged()), pa, SLOT(updateDialogPosition()));
}
Plasma::Containment *cont = dynamic_cast<Containment*>(value.value<QGraphicsItem *>());
if (cont) {
connect(cont, SIGNAL(geometryChanged()), pa, SLOT(updateDialogPosition()));
}
}
case ItemPositionChange:
return (immutability() == Mutable || isContainment() || formFactor() == Horizontal || formFactor() == Vertical) ? value : pos();

View File

@ -600,6 +600,10 @@ void PopupAppletPrivate::dialogStatusChanged(bool status)
void PopupAppletPrivate::updateDialogPosition()
{
if (!dialog) {
return;
}
QGraphicsView *view = q->view();
if (!view) {

View File

@ -148,6 +148,7 @@ private:
Q_PRIVATE_SLOT(d, void clearPopupLostFocus())
Q_PRIVATE_SLOT(d, void dialogSizeChanged())
Q_PRIVATE_SLOT(d, void dialogStatusChanged(bool))
Q_PRIVATE_SLOT(d, void updateDialogPosition())
friend class Applet;
friend class PopupAppletPrivate;