From kde-commits Tue Nov 11 05:26:53 2008 From: =?utf-8?q?Aaron=20J=2E=20Seigo?= Date: Tue, 11 Nov 2008 05:26:53 +0000 To: kde-commits Subject: KDE/kdelibs/plasma/private Message-Id: <1226381213.217931.12881.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=122638122011662 SVN commit 882654 by aseigo: ensure the toolbox fits in the panel; makes small panels work better M +19 -3 paneltoolbox.cpp --- trunk/KDE/kdelibs/plasma/private/paneltoolbox.cpp #882653:882654 @@ -118,14 +118,30 @@ QRectF PanelToolBox::boundingRect() const { + QRectF r; + if (corner() == ToolBox::Bottom) { - return QRectF(0, 0, size() * 2, -size()); + r = QRectF(0, 0, size() * 2, -size()); } else if (corner() == ToolBox::Left) { - return QRectF(0, 0, size(), size() * 2); + r = QRectF(0, 0, size(), size() * 2); //Only Left,Right and Bottom supported, default to Right } else { - return QRectF(0, 0, -size(), size() * 2); + r = QRectF(0, 0, -size(), size() * 2); } + + if (parentItem()) { + QSizeF s = parentItem()->boundingRect().size(); + + if (r.height() > s.height()) { + r.setHeight(s.height()); + } + + if (r.width() > s.width()) { + r.setWidth(s.width()); + } + } + + return r; } void PanelToolBox::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)