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

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/applets/quicklaunch
From:       Sebastian Kügler <sebas () kde ! org>
Date:       2009-02-08 14:46:40
Message-ID: 1234104400.833362.27478.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 923292 by sebas:

sizeHint() can be called before init() is finished, so make sure we
actually have instantiated the layouts that are being called. Fixes a
crash on startup.

I'll get someone to review and possibly backport to 4.2.

 M  +15 -4     quicklaunchApplet.cpp  


--- trunk/KDE/kdebase/workspace/plasma/applets/quicklaunch/quicklaunchApplet.cpp \
#923291:923292 @@ -53,7 +53,9 @@
     m_addDialog(0),
     m_rightClickedIcon(0),
     m_addAction(0),
-    m_removeAction(0)
+    m_removeAction(0),
+    m_layout(0),
+    m_innerLayout(0)
 {
     setHasConfigurationInterface(true);
     setAcceptDrops(true);
@@ -136,10 +138,19 @@
 {
     if (which == Qt::PreferredSize) {
         QSizeF sizeHint = size();
+        if (!m_innerLayout) {
+            return sizeHint;
+        }
         if (m_icons.size() > m_visibleIcons) {
-            sizeHint.setWidth(sizeHint.height() / m_innerLayout->rowCount() * \
m_innerLayout->columnCount() + size().height()); +            qreal factor = \
m_innerLayout->rowCount() * m_innerLayout->columnCount() + size().height(); +         \
if (factor) { +                sizeHint.setWidth(sizeHint.height() / factor);
+            }
         } else {
-            sizeHint.setWidth(sizeHint.height() / m_innerLayout->rowCount() * \
m_innerLayout->columnCount()); +            qreal factor = m_innerLayout->rowCount() \
* m_innerLayout->columnCount(); +            if (factor) {
+                sizeHint.setWidth(sizeHint.height() / factor);
+            }
         }
         return sizeHint;
     }
@@ -251,7 +262,7 @@
             m_dialog->move(containment()->corona()->popupPosition(m_arrow, \
m_dialog->size()));  }
         KWindowSystem::setState(m_dialog->winId(), NET::SkipTaskbar);
-        //QPoint(popupPosition(m_dialog->sizeHint()).x() + (m_visibleIcons) * \
size().height() / m_rowCount,  +        \
//QPoint(popupPosition(m_dialog->sizeHint()).x() + (m_visibleIcons) * size().height() \
/ m_rowCount,  //               popupPosition(m_dialog->sizeHint()).y()));
         m_dialog->show();
     }


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

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