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 (!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();
}
}

View File

@ -278,10 +278,16 @@ void AppletBrowserWidget::destroyApplets(const QString &name)
foreach (Containment *containment, c->containments()) {
QList<Applet*> applets = containment->applets();
QGraphicsLayout *lay = containment->layout();
QGraphicsLinearLayout * linearLay = dynamic_cast<QGraphicsLinearLayout *>(lay);
foreach (Applet *applet,applets) {
d->appletNames.remove(applet);
if (applet->name() == name) {
applet->disconnect(this);
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) {
QGraphicsItem *parent = item->parentItem();
QGraphicsLayout *lay = layout();
QGraphicsLinearLayout * linearLay = dynamic_cast<QGraphicsLinearLayout *>(lay);
while (parent) {
if (parent == this) {
Applet *applet = qgraphicsitem_cast<Applet*>(item);
if (applet) {
if (linearLay) {
linearLay->removeItem(applet);
}
applet->destroy();
}