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:
parent
b8e3eed0dc
commit
d5753f1fba
14
applet.cpp
14
applet.cpp
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -278,10 +278,16 @@ 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);
|
||||||
|
if (linearLay)
|
||||||
|
{
|
||||||
|
linearLay->removeItem(applet);
|
||||||
|
}
|
||||||
applet->destroy();
|
applet->destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user