From 812d87008613ce17b63266088632205e0a8406a2 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Mon, 19 May 2008 19:34:13 +0000 Subject: [PATCH] enforce square aspect ratio when aspectRatioMode() is square of applets in the panel svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=809947 --- applet.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/applet.cpp b/applet.cpp index ca02faac2..e489c1e58 100644 --- a/applet.cpp +++ b/applet.cpp @@ -710,6 +710,17 @@ void Applet::flushPendingConstraintsEvents() } } + //enforce square size in panels + if (aspectRatioMode() == Plasma::Square && (c & Plasma::SizeConstraint || c & Plasma::FormFactorConstraint)) { + if (formFactor() == Horizontal) { + setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding)); + resize(QSizeF(size().height(), size().height())); + } else if (formFactor() == Vertical) { + setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); + resize(QSizeF(size().width(), size().width())); + } + } + Containment* containment = qobject_cast(this); if (isContainment() && containment) { containment->d->containmentConstraintsEvent(c); @@ -1374,7 +1385,6 @@ Applet::Private::Private(KService::Ptr service, int uniqueID, Applet *applet) hasConfigurationInterface(false), failed(false), isContainment(false), - square(false), transient(false) { if (appletId == 0) {