[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/plasma/private
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2008-11-11 5:26:53
Message-ID: 1226381213.217931.12881.nullmailer () svn ! kde ! org
[Download RAW message or body]

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)
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic