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

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/containments/panel
From:       Marco Martin <notmart () gmail ! com>
Date:       2009-05-06 10:48:12
Message-ID: 1241606892.321508.8619.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 964215 by mart:

try to auto resize panel when the immutability changes (i.e. take into
account space for the cashew)


 M  +13 -1     panel.cpp  


--- trunk/KDE/kdebase/workspace/plasma/containments/panel/panel.cpp #964214:964215
@@ -483,7 +483,7 @@
         QSizeF s = box->boundingRect().size();
         if (formFactor() == Vertical) {
             //hardcoded extra margin for the toolbox right now
-            bottomHeight += s.height();;
+            bottomHeight += s.height();
             //Default to horizontal for now
         } else {
             if (QApplication::layoutDirection() == Qt::RightToLeft) {
@@ -512,8 +512,20 @@
         default:
             break;
         }
+        qreal oldLeft, oldTop, oldRight, oldBottom;
+        layout()->getContentsMargins(&oldLeft, &oldTop, &oldRight, &oldBottom);
+
         layout()->setContentsMargins(leftWidth, topHeight, rightWidth, bottomHeight);
+
+        if (formFactor() == Plasma::Vertical) {
+            setPreferredHeight(preferredHeight() - (oldBottom-bottomHeight));
+        } else if (QApplication::layoutDirection() == Qt::LeftToRight) {
+            setPreferredWidth(preferredWidth() - (oldRight-rightWidth));
+        } else {
+            setPreferredWidth(preferredWidth() - (oldLeft-leftWidth));
+        }
         layout()->invalidate();
+        resize(preferredSize());
     }
 
     update();
[prev in list] [next in list] [prev in thread] [next in thread] 

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