From 7517afa198f71da9b265b5d2edecf10e928abbcc Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Wed, 21 Apr 2010 12:16:06 +0000 Subject: [PATCH] when overriding the size policy, save the old one, should unbork a little contaiment switching svn path=/trunk/KDE/kdelibs/; revision=1117160 --- applet.cpp | 7 +++++++ private/applet_p.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/applet.cpp b/applet.cpp index 469c0e95a..8832b5c63 100644 --- a/applet.cpp +++ b/applet.cpp @@ -1263,10 +1263,16 @@ void Applet::flushPendingConstraintsEvents() if (c & Plasma::SizeConstraint || c & Plasma::FormFactorConstraint) { if (aspectRatioMode() == Plasma::Square || aspectRatioMode() == Plasma::ConstrainedSquare) { // enforce square size in panels + //save the old size policy. since ignored doesn't (yet) have a valid use case in containments, use it as special unset value + if (d->preferredSizePolicy == QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored)) { + d->preferredSizePolicy = sizePolicy(); + } if (formFactor() == Horizontal) { setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding)); } else if (formFactor() == Vertical) { setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); + } else if (d->preferredSizePolicy != QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored)) { + setSizePolicy(d->preferredSizePolicy); } } updateGeometry(); @@ -2567,6 +2573,7 @@ AppletPrivate::AppletPrivate(KService::Ptr service, int uniqueID, Applet *applet activationAction(0), shortcutEditor(0), itemStatus(UnknownStatus), + preferredSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored), modificationsTimer(0), hasConfigurationInterface(false), failed(false), diff --git a/private/applet_p.h b/private/applet_p.h index ea321402a..141ff0e66 100644 --- a/private/applet_p.h +++ b/private/applet_p.h @@ -164,6 +164,9 @@ public: QString remoteLocation; Ui::publishWidget publishUI; + // the applet can change size policy by itself, so save the old one for eventual restore + QSizePolicy preferredSizePolicy; + // timerEvent bookkeeping QBasicTimer constraintsTimer; QBasicTimer busyWidgetTimer;