save the last size for formfactor, helps when the applet changes containment and back again

BUG:241857

svn path=/trunk/KDE/kdelibs/; revision=1138648
This commit is contained in:
Marco Martin 2010-06-16 12:26:23 +00:00
parent 404981d52b
commit c2d8eee98a
2 changed files with 13 additions and 0 deletions

View File

@ -1271,7 +1271,17 @@ void Applet::flushPendingConstraintsEvents()
at.rotateRadians(0); at.rotateRadians(0);
setTransform(at); setTransform(at);
} }
//was a size saved for a particular form factor?
if (d->sizeForFormFactor.contains(f)) {
resize(d->sizeForFormFactor.value(f));
} }
}
if ((c & Plasma::StartupCompletedConstraint) || (c & Plasma::SizeConstraint && !(c & Plasma::FormFactorConstraint))) {
d->sizeForFormFactor[formFactor()] = size();
}
if (c & Plasma::SizeConstraint || c & Plasma::FormFactorConstraint) { if (c & Plasma::SizeConstraint || c & Plasma::FormFactorConstraint) {
if (aspectRatioMode() == Plasma::Square || aspectRatioMode() == Plasma::ConstrainedSquare) { if (aspectRatioMode() == Plasma::Square || aspectRatioMode() == Plasma::ConstrainedSquare) {
// enforce square size in panels // enforce square size in panels

View File

@ -198,6 +198,9 @@ public:
// the applet can change size policy by itself, so save the old one for eventual restore // the applet can change size policy by itself, so save the old one for eventual restore
QSizePolicy preferredSizePolicy; QSizePolicy preferredSizePolicy;
//keep last sizes for formfactors, useful when the containment changes
QHash<FormFactor, QSizeF> sizeForFormFactor;
// timerEvent bookkeeping // timerEvent bookkeeping
QBasicTimer constraintsTimer; QBasicTimer constraintsTimer;
QBasicTimer busyWidgetTimer; QBasicTimer busyWidgetTimer;