]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphindetailsview.cpp
Code moved to KDirSortFilterProxyModel
[dolphin.git] / src / dolphindetailsview.cpp
index d9052776774a8f759dcba247ebc13371161a7cce..46752fc95a39870bac6a84256d8cded1678ee1dc 100644 (file)
@@ -207,10 +207,13 @@ void DolphinDetailsView::mouseMoveEvent(QMouseEvent* event)
             // case QTreeView does no selection at all, which is not the wanted behavior
             // in Dolphin -> select all items within the elastic band rectangle
             clearSelection();
-            if (mousePos.x() < header()->sectionSize(DolphinModel::Name)) {
-                setSelection(QRect(m_elasticBandOrigin, m_elasticBandDestination),
-                             QItemSelectionModel::Select);
-            }
+
+            const int nameColumnWidth = header()->sectionSize(DolphinModel::Name);
+            QRect selRect = QRect(m_elasticBandOrigin, m_elasticBandDestination).normalized();
+            const QRect nameColumnsRect(0, 0, nameColumnWidth, viewport()->height());
+            selRect = nameColumnsRect.intersected(selRect);
+
+            setSelection(selRect, QItemSelectionModel::Select);
         }
 
         QTreeView::mouseMoveEvent(event);
@@ -317,7 +320,7 @@ void DolphinDetailsView::paintEvent(QPaintEvent* event)
     // TODO: remove this code when the issue #160611 is solved in Qt 4.4
     if (m_dragging) {
         const QBrush& brush = viewOptions().palette.brush(QPalette::Normal, QPalette::Highlight);
-        DragAndDropHelper::drawHoverIndication(viewport(), m_dropRect, brush);
+        DragAndDropHelper::drawHoverIndication(this, m_dropRect, brush);
     }
 }
 
@@ -399,11 +402,12 @@ void DolphinDetailsView::slotEntered(const QModelIndex& index)
 
 void DolphinDetailsView::updateElasticBand()
 {
-    Q_ASSERT(m_showElasticBand);
-    QRect dirtyRegion(elasticBandRect());
-    m_elasticBandDestination = viewport()->mapFromGlobal(QCursor::pos());
-    dirtyRegion = dirtyRegion.united(elasticBandRect());
-    setDirtyRegion(dirtyRegion);
+    if (m_showElasticBand) {
+        QRect dirtyRegion(elasticBandRect());
+        m_elasticBandDestination = viewport()->mapFromGlobal(QCursor::pos());
+        dirtyRegion = dirtyRegion.united(elasticBandRect());
+        setDirtyRegion(dirtyRegion);
+    }
 }
 
 QRect DolphinDetailsView::elasticBandRect() const