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
This commit is contained in:
Alexis Ménard 2008-04-14 20:37:54 +00:00
parent b8e3eed0dc
commit d5753f1fba
3 changed files with 22 additions and 6 deletions

View File

@ -725,12 +725,14 @@ void Applet::setDrawStandardBackground(bool drawBackground)
if (drawBackground) { if (drawBackground) {
if (!d->background) { if (!d->background) {
d->background = new Plasma::SvgPanel("widgets/background"); d->background = new Plasma::SvgPanel("widgets/background");
d->background->setBorderFlags(Plasma::SvgPanel::DrawAllBorders);
int left, top, right, bottom; int left, top, right, bottom;
d->getBorderSize(left, top, right, bottom); d->getBorderSize(left, top, right, bottom);
setContentsMargins(0, 0, right, bottom); QSizeF fitSize(left + right, top + bottom);
d->background->resize(QSize(geometry().width() + right + left, geometry().height() + top + bottom)); if (minimumSize().expandedTo(fitSize) != minimumSize()) {
d->background->setPos(QPointF(-left, -top)); setMinimumSize(minimumSize().expandedTo(fitSize));
//kDebug() << geometry() << left << top << right << bottom; }
d->background->resize(boundingRect().size());
} }
} else if (d->background) { } else if (d->background) {
delete d->background; delete d->background;
@ -1511,6 +1513,10 @@ void Applet::setGeometry(const QRectF& geometry)
} }
if (geometry.topLeft() != beforeGeom.topLeft()) if (geometry.topLeft() != beforeGeom.topLeft())
{ {
if (d->background) {
kDebug() << QGraphicsWidget::geometry();
}
emit geometryChanged(); emit geometryChanged();
} }
} }

View File

@ -278,11 +278,17 @@ void AppletBrowserWidget::destroyApplets(const QString &name)
foreach (Containment *containment, c->containments()) { foreach (Containment *containment, c->containments()) {
QList<Applet*> applets = containment->applets(); QList<Applet*> applets = containment->applets();
QGraphicsLayout *lay = containment->layout();
QGraphicsLinearLayout * linearLay = dynamic_cast<QGraphicsLinearLayout *>(lay);
foreach (Applet *applet,applets) { foreach (Applet *applet,applets) {
d->appletNames.remove(applet); d->appletNames.remove(applet);
if (applet->name() == name) { if (applet->name() == name) {
applet->disconnect(this); applet->disconnect(this);
applet->destroy(); if (linearLay)
{
linearLay->removeItem(applet);
}
applet->destroy();
} }
} }
} }

View File

@ -776,12 +776,16 @@ void Containment::appletAnimationComplete(QGraphicsItem *item, Plasma::Phase::An
{ {
if (anim == Phase::Disappear) { if (anim == Phase::Disappear) {
QGraphicsItem *parent = item->parentItem(); QGraphicsItem *parent = item->parentItem();
QGraphicsLayout *lay = layout();
QGraphicsLinearLayout * linearLay = dynamic_cast<QGraphicsLinearLayout *>(lay);
while (parent) { while (parent) {
if (parent == this) { if (parent == this) {
Applet *applet = qgraphicsitem_cast<Applet*>(item); Applet *applet = qgraphicsitem_cast<Applet*>(item);
if (applet) { if (applet) {
if (linearLay) {
linearLay->removeItem(applet);
}
applet->destroy(); applet->destroy();
} }