From d5753f1fba90e234fbff4b6e0f1acec57df40059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9nard?= Date: Mon, 14 Apr 2008 20:37:54 +0000 Subject: [PATCH] welcome back to the background that will be a little modified soon with window frame (that will include the applet handle No More Seperate Item ;) ) + delete in layouts in containments when removing applets svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=797066 --- applet.cpp | 14 ++++++++++---- appletbrowser.cpp | 8 +++++++- containment.cpp | 6 +++++- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/applet.cpp b/applet.cpp index 1473238e2..b4f1003c7 100644 --- a/applet.cpp +++ b/applet.cpp @@ -725,12 +725,14 @@ void Applet::setDrawStandardBackground(bool drawBackground) if (drawBackground) { if (!d->background) { d->background = new Plasma::SvgPanel("widgets/background"); + d->background->setBorderFlags(Plasma::SvgPanel::DrawAllBorders); int left, top, right, bottom; d->getBorderSize(left, top, right, bottom); - setContentsMargins(0, 0, right, bottom); - d->background->resize(QSize(geometry().width() + right + left, geometry().height() + top + bottom)); - d->background->setPos(QPointF(-left, -top)); - //kDebug() << geometry() << left << top << right << bottom; + QSizeF fitSize(left + right, top + bottom); + if (minimumSize().expandedTo(fitSize) != minimumSize()) { + setMinimumSize(minimumSize().expandedTo(fitSize)); + } + d->background->resize(boundingRect().size()); } } else if (d->background) { delete d->background; @@ -1511,6 +1513,10 @@ void Applet::setGeometry(const QRectF& geometry) } if (geometry.topLeft() != beforeGeom.topLeft()) { + if (d->background) { + + kDebug() << QGraphicsWidget::geometry(); + } emit geometryChanged(); } } diff --git a/appletbrowser.cpp b/appletbrowser.cpp index 9c921e094..b8be0b995 100644 --- a/appletbrowser.cpp +++ b/appletbrowser.cpp @@ -278,11 +278,17 @@ void AppletBrowserWidget::destroyApplets(const QString &name) foreach (Containment *containment, c->containments()) { QList applets = containment->applets(); + QGraphicsLayout *lay = containment->layout(); + QGraphicsLinearLayout * linearLay = dynamic_cast(lay); foreach (Applet *applet,applets) { d->appletNames.remove(applet); if (applet->name() == name) { applet->disconnect(this); - applet->destroy(); + if (linearLay) + { + linearLay->removeItem(applet); + } + applet->destroy(); } } } diff --git a/containment.cpp b/containment.cpp index 80ce5234b..445b6c1aa 100644 --- a/containment.cpp +++ b/containment.cpp @@ -776,12 +776,16 @@ void Containment::appletAnimationComplete(QGraphicsItem *item, Plasma::Phase::An { if (anim == Phase::Disappear) { QGraphicsItem *parent = item->parentItem(); - + QGraphicsLayout *lay = layout(); + QGraphicsLinearLayout * linearLay = dynamic_cast(lay); while (parent) { if (parent == this) { Applet *applet = qgraphicsitem_cast(item); if (applet) { + if (linearLay) { + linearLay->removeItem(applet); + } applet->destroy(); }