]> cloud.milkyroute.net Git - dolphin.git/commitdiff
remember old setting of the uniformItemSizes property and restore it again (thanks...
authorPeter Penz <peter.penz19@gmail.com>
Tue, 24 Jun 2008 23:38:52 +0000 (23:38 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Tue, 24 Jun 2008 23:38:52 +0000 (23:38 +0000)
CCMAIL: ereslibre@kde.org

svn path=/trunk/KDE/kdebase/apps/; revision=824128

src/iconmanager.cpp

index 471e69842f96aca2b6e3dd75edb401be2e13ec2e..ccf15e80c26c3fb85009db848f59229911dc58c8 100644 (file)
  * QListView does not invoke QItemDelegate::sizeHint() when the
  * uniformItemSize property has been set to true, so this property is
  * set before exchanging a block of icons. It is important to reset
  * QListView does not invoke QItemDelegate::sizeHint() when the
  * uniformItemSize property has been set to true, so this property is
  * set before exchanging a block of icons. It is important to reset
- * it to false again before the event loop is entered, otherwise QListView
+ * it again before the event loop is entered, otherwise QListView
  * would not get the correct size hints after dispatching the layoutChanged()
  * signal.
  */
 class LayoutBlocker {
 public:
  * would not get the correct size hints after dispatching the layoutChanged()
  * signal.
  */
 class LayoutBlocker {
 public:
-    LayoutBlocker(QAbstractItemView* view) : m_view(0)
+    LayoutBlocker(QAbstractItemView* view) :
+        m_uniformSizes(false),
+        m_view(0)
     {
         if (view->inherits("QListView")) {
             m_view = qobject_cast<QListView*>(view);
     {
         if (view->inherits("QListView")) {
             m_view = qobject_cast<QListView*>(view);
+            m_uniformSizes = m_view->uniformItemSizes();
             m_view->setUniformItemSizes(true);
         }
     }
             m_view->setUniformItemSizes(true);
         }
     }
@@ -70,11 +73,12 @@ public:
     ~LayoutBlocker()
     {
         if (m_view != 0) {
     ~LayoutBlocker()
     {
         if (m_view != 0) {
-            m_view->setUniformItemSizes(false);
+            m_view->setUniformItemSizes(m_uniformSizes);
         }
     }
 
 private:
         }
     }
 
 private:
+    bool m_uniformSizes;
     QListView* m_view;
 };
 
     QListView* m_view;
 };