]> cloud.milkyroute.net Git - dolphin.git/commitdiff
fixed selection behavior in the details view (when the selection enters the viewport...
authorPeter Penz <peter.penz19@gmail.com>
Sat, 15 Dec 2007 16:25:23 +0000 (16:25 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Sat, 15 Dec 2007 16:25:23 +0000 (16:25 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=748819

src/dolphindetailsview.cpp

index 68b288b0b96f2375e499e98315f61ce49c4904cc..d9052776774a8f759dcba247ebc13371161a7cce 100644 (file)
@@ -199,9 +199,24 @@ void DolphinDetailsView::mousePressEvent(QMouseEvent* event)
 
 void DolphinDetailsView::mouseMoveEvent(QMouseEvent* event)
 {
-    QTreeView::mouseMoveEvent(event);
     if (m_showElasticBand) {
+        const QPoint mousePos = event->pos();
+        const QModelIndex index = indexAt(mousePos);
+        if (!index.isValid()) {
+            // the destination of the selection rectangle is above the viewport. In this
+            // 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);
+            }
+        }
+
+        QTreeView::mouseMoveEvent(event);
         updateElasticBand();
+    } else {
+        QTreeView::mouseMoveEvent(event);
     }
 }