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

List:       kde-commits
Subject:    KDE/kdelibs/kfile
From:       Rafael Fernández López <ereslibre () kde ! org>
Date:       2008-10-03 0:26:55
Message-ID: 1222993615.543806.24972.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 867177 by ereslibre:

Update grid size only when the text is on top


 M  +17 -6     kdiroperator.cpp  


--- trunk/KDE/kdelibs/kfile/kdiroperator.cpp #867176:867177
@@ -2363,23 +2363,34 @@
     if (leftChecked) {
         decorationPosition = QStyleOptionViewItem::Left;
         view->setFlow(QListView::TopToBottom);
-        view->setGridSize(QSize());
     } else {
         decorationPosition = QStyleOptionViewItem::Top;
         view->setFlow(QListView::LeftToRight);
-        updateListViewGrid();
     }
 
+    updateListViewGrid();
+
     itemView->update();
 }
 
 void KDirOperator::Private::updateListViewGrid()
 {
+    if (!itemView) {
+        return;
+    }
+
     QListView *view = static_cast<QListView*>(itemView);
-    const QFontMetrics metrics(itemView->viewport()->font());
-    int size = itemView->iconSize().height() + metrics.height() * 2;
-    // some heuristics for good looking. let's guess width = height * (3 / 2) is nice
-    view->setGridSize(QSize(size * (3.0 / 2.0), size));
+
+    const bool leftChecked = actionCollection->action("decorationAtLeft")->isChecked();
+
+    if (leftChecked) {
+        view->setGridSize(QSize());
+    } else {
+        const QFontMetrics metrics(itemView->viewport()->font());
+        int size = itemView->iconSize().height() + metrics.height() * 2;
+        // some heuristics for good looking. let's guess width = height * (3 / 2) is nice
+        view->setGridSize(QSize(size * (3.0 / 2.0), size));
+    }
 }
 
 void KDirOperator::setViewConfig(KConfigGroup& configGroup)
[prev in list] [next in list] [prev in thread] [next in thread] 

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