[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:       2008-05-24 21:35:29
Message-ID: 1211664929.974207.15873.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 812218 by mart:

update borders size on theme change and resize the panel to mantain the
same applets size
BUG: 159797


 M  +29 -3     panel.cpp  


--- trunk/KDE/kdebase/workspace/plasma/containments/panel/panel.cpp #812217:812218
@@ -92,7 +92,7 @@
 
         m_configureAction = new QAction(i18n("Panel Settings"), this);
         m_configureAction->setIcon(KIcon("configure"));
-        connect(m_configureAction, SIGNAL(triggered()), this, SIGNAL(toolBoxToggled()));
+        connect(m_configureAction, SIGNAL(triggered()), this, SIGNAL(toolboxToggled()));
 
         m_removeAction = action("remove");
     }
@@ -327,8 +327,34 @@
 void Panel::themeUpdated()
 {
     //if the theme is changed all the calculations needs to be done again
-    //TODO resize based on the change in theme bordersize
-    constraintsEvent(Plasma::LocationConstraint);
+    //and resize based on the change in the theme bordersize
+
+    qreal oldLeftWidth;
+    qreal newLeftWidth;
+    qreal oldTopHeight;
+    qreal newTopHeight;
+    qreal oldRightWidth;
+    qreal newRightWidth;
+    qreal oldBottomHeight;
+    qreal newBottomHeight;
+
+    layout()->getContentsMargins(&oldLeftWidth, &oldTopHeight, &oldRightWidth, &oldBottomHeight);
+    m_background->getMargins(newLeftWidth, newTopHeight, newRightWidth, newBottomHeight);
+
+    QSize newSize(size().width()-(oldLeftWidth - newLeftWidth)-(oldRightWidth - newRightWidth),
+           size().height()-(oldTopHeight - newTopHeight)-(oldBottomHeight - newBottomHeight));
+
+    resize(newSize);
+
+    if (formFactor() == Plasma::Vertical) {
+        setMaximumWidth(newSize.width());
+        setMinimumWidth(newSize.width());
+    } else {
+        setMaximumHeight(newSize.height());
+        setMinimumHeight(newSize.height());
+    }
+
+    updateBorders(geometry().toRect());
 }
 
 void Panel::paintInterface(QPainter *painter,
[prev in list] [next in list] [prev in thread] [next in thread] 

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