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

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/desktop/containments/panel
From:       Marco Martin <notmart () gmail ! com>
Date:       2010-06-10 20:34:43
Message-ID: 20100610203443.331A6AC8D2 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1136814 by mart:

delay the update of the panel size, to give time fr applets to adjust their hints
BUG:194447


 M  +10 -3     panel.cpp  
 M  +2 -0      panel.h  


--- trunk/KDE/kdebase/workspace/plasma/desktop/containments/panel/panel.cpp #1136813:1136814
@@ -297,16 +297,22 @@
     //FIXME: there must be some beter way to do this rather than this rather error prone arbitrary wait
     m_lastSpaceTimer->start(2000);
 
-    connect(applet, SIGNAL(sizeHintChanged(Qt::SizeHint)), this, SLOT(updateSize()));
+    connect(applet, SIGNAL(sizeHintChanged(Qt::SizeHint)), this, SLOT(delayedUpdateSize()));
 }
 
+void Panel::delayedUpdateSize()
+{
+    m_lastResizedApplet = qobject_cast<Plasma::Applet *>(sender());
+    QTimer::singleShot(800, this, SLOT(updateSize()));
+}
+
 void Panel::appletRemoved(Plasma::Applet* applet)
 {
     if (!m_layout) {
         return;
     }
 
-    connect(applet, SIGNAL(sizeHintChanged(Qt::SizeHint)), this, SLOT(updateSize()));
+    connect(applet, SIGNAL(sizeHintChanged(Qt::SizeHint)), this, SLOT(delayedUpdateSize()));
 
     m_layout->removeItem(applet);
 
@@ -324,6 +330,7 @@
 void Panel::updateSize()
 {
     Plasma::Applet *applet = qobject_cast<Plasma::Applet *>(sender());
+    applet = m_lastResizedApplet.data();
 
     if (m_canResize && applet) {
         if (formFactor() == Plasma::Horizontal) {
@@ -681,7 +688,7 @@
             unoderedApplets.append(applet);
         }
 
-        connect(applet, SIGNAL(sizeHintChanged(Qt::SizeHint)), this, SLOT(updateSize()));
+        connect(applet, SIGNAL(sizeHintChanged(Qt::SizeHint)), this, SLOT(delayedUpdateSize()));
     }
 
     foreach (Applet *applet, oderedApplets) {
--- trunk/KDE/kdebase/workspace/plasma/desktop/containments/panel/panel.h #1136813:1136814
@@ -65,6 +65,7 @@
     void backgroundChanged();
     void layoutApplet(Plasma::Applet* applet, const QPointF &pos);
     void appletRemoved(Plasma::Applet* applet);
+    void delayedUpdateSize();
     void updateSize();
     void adjustLastSpace();
     void enableUpdateSize();
@@ -93,6 +94,7 @@
     Spacer *m_lastSpace;
     QTimer *m_lastSpaceTimer;
     QGraphicsLinearLayout *m_layout;
+    QWeakPointer<Plasma::Applet>m_lastResizedApplet;
 
     friend class Spacer;
 };
[prev in list] [next in list] [prev in thread] [next in thread] 

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