]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphiniconsview.cpp
don't start the editor for renaming the files when double clicking on items
[dolphin.git] / src / dolphiniconsview.cpp
index 8178d062a9884e250658cc29ae833c8acb2866cc..959f152f0dbec6522781a3c4b2a2f966e15389a8 100644 (file)
@@ -55,6 +55,7 @@ DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controlle
     setSpacing(KDialog::spacingHint());
     setMovement(QListView::Static);
     setDragEnabled(true);
+    setEditTriggers(QAbstractItemView::NoEditTriggers);
     viewport()->setAcceptDrops(true);
 
     setMouseTracking(true);
@@ -133,23 +134,16 @@ DolphinIconsView::~DolphinIconsView()
     m_categoryDrawer = 0;
 }
 
-QRect DolphinIconsView::visualRect(const QModelIndex& index) const
+void DolphinIconsView::dataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight)
 {
-    QRect itemRect = KCategorizedView::visualRect(index);
+    KCategorizedView::dataChanged(topLeft, bottomRight);
 
     KCategorizedSortFilterProxyModel* proxyModel = dynamic_cast<KCategorizedSortFilterProxyModel*>(model());
     if ((flow() == QListView::LeftToRight) && !proxyModel->isCategorizedModel()) {
-        // TODO: QListView might return a wrong x-position if the decoration size decreases. This is bypassed
-        // by the following workaround...
-        const IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings();
-        const int margin = settings->gridSpacing();
-        const int gridWidth = gridSize().width();
-        const int gridIndex = (itemRect.left() - margin + 1) / gridWidth;
-        const int centerInc = (m_itemSize.width() - itemRect.width()) / 2;
-        itemRect.moveLeft((gridIndex * gridWidth) + margin + centerInc);
+        // bypass a QListView issue that items are not layout correctly if the decoration size of
+        // an index changes
+        scheduleDelayedItemsLayout();
     }
-
-    return itemRect;
 }
 
 QStyleOptionViewItem DolphinIconsView::viewOptions() const