From 644859eec4921094d8becbd4bd7d733b57f9bf98 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Fri, 23 Apr 2010 18:23:53 +0000 Subject: [PATCH] a sensible default position for non-panel containments svn path=/trunk/KDE/kdelibs/; revision=1118043 --- containment.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/containment.cpp b/containment.cpp index 7e1979f3e..082e82dcb 100644 --- a/containment.cpp +++ b/containment.cpp @@ -340,12 +340,13 @@ void Containment::restore(KConfigGroup &group) if (geo.size() != geo.size().boundedTo(maximumSize())) { setMaximumSize(maximumSize().expandedTo(geo.size())); } + if (geo.size() != geo.size().expandedTo(minimumSize())) { setMinimumSize(minimumSize().boundedTo(geo.size())); } - setGeometry(geo); + resize(geo.size()); //are we an offscreen containment? if (containmentType() != PanelContainment && containmentType() != CustomPanelContainment && geo.right() < 0) { corona()->addOffscreenWidget(this); @@ -2344,13 +2345,19 @@ QPointF ContainmentPrivate::preferredPos(Corona *corona) const Q_ASSERT(corona); if (isPanelContainment()) { - kDebug() << "is a panel, so let's do it at" << preferredPanelPos(corona); + //kDebug() << "is a panel, so put it at" << preferredPanelPos(corona); return preferredPanelPos(corona); } - // FIXME - kDebug() << "not a panel"; - return QPointF(0, 0); + int width = q->size().width(); + QPointF pos(0, 0); + QTransform t; + while (corona->itemAt(pos, t)) { + pos.setX(pos.x() + width); + } + + //kDebug() << "not a panel, put it at" << pos; + return pos; } QPointF ContainmentPrivate::preferredPanelPos(Corona *corona) const