Move the QGL resize hacks from extender to extenderapplet. The only applet atm for which this hack is necesarry is actually extenderapplet, in the future we will have better layouts, and it won't be necesarry at all, and for now it avoids breaking panel layouts when removing the last extenderitem from an extenderapplet.

svn path=/branches/KDE/4.2/kdelibs/; revision=908498
This commit is contained in:
Rob Scheepmaker 2009-01-09 20:41:24 +00:00
parent 49dc6e5bcd
commit daee98b062
3 changed files with 20 additions and 11 deletions

View File

@ -475,17 +475,6 @@ void ExtenderPrivate::adjustSizeHints()
q->setMinimumSize(layout->preferredSize());
}
if (applet->layout()) {
applet->layout()->updateGeometry();
qreal left, top, right, bottom;
applet->getContentsMargins(&left, &top, &right, &bottom);
QSizeF margins(left + right, top + bottom);
applet->setMinimumSize(applet->layout()->minimumSize() + margins);
applet->adjustSize();
}
q->adjustSize();
emit q->geometryChanged();

View File

@ -52,6 +52,8 @@ void ExtenderApplet::init()
connect(extender(), SIGNAL(itemDetached(Plasma::ExtenderItem*)),
this, SLOT(itemDetached(Plasma::ExtenderItem*)));
connect(extender(), SIGNAL(geometryChanged()),
this, SLOT(extenderGeometryChanged()));
}
void ExtenderApplet::itemDetached(Plasma::ExtenderItem *)
@ -61,6 +63,23 @@ void ExtenderApplet::itemDetached(Plasma::ExtenderItem *)
}
}
void ExtenderApplet::extenderGeometryChanged()
{
if (formFactor() != Plasma::Horizontal &&
formFactor() != Plasma::Vertical) {
qreal left, top, right, bottom;
getContentsMargins(&left, &top, &right, &bottom);
QSizeF margins(left + right, top + bottom);
setMinimumSize(extender()->minimumSize() + margins);
setMaximumSize(extender()->maximumSize() + margins);
setPreferredSize(extender()->preferredSize() + margins);
adjustSize();
}
}
} // namespace Plasma
#include "extenderapplet_p.moc"

View File

@ -41,6 +41,7 @@ class ExtenderApplet : public Plasma::PopupApplet
public Q_SLOTS:
void itemDetached(Plasma::ExtenderItem *);
void extenderGeometryChanged();
};
} // namespace Plasma