]> cloud.milkyroute.net Git - dolphin.git/commitdiff
fix selection regression that has been introduced by synchronizing the current index...
authorPeter Penz <peter.penz19@gmail.com>
Sun, 6 Apr 2008 21:01:05 +0000 (21:01 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Sun, 6 Apr 2008 21:01:05 +0000 (21:01 +0000)
BUG: 158649

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

src/dolphindetailsview.cpp

index 1a9b6f4da42ec2711df9c647ff069b3391403402..dc90482257f7ea994e66b1a4fc7c5c6ff8a24380 100644 (file)
@@ -355,7 +355,17 @@ void DolphinDetailsView::wheelEvent(QWheelEvent* event)
 void DolphinDetailsView::currentChanged(const QModelIndex& current, const QModelIndex& previous)
 {
     QTreeView::currentChanged(current, previous);
-    selectionModel()->select(current, QItemSelectionModel::ClearAndSelect);
+
+    // Stay consistent with QListView: When changing the current index by key presses,
+    // also change the selection.
+    const Qt::KeyboardModifiers modifier = QApplication::keyboardModifiers();
+    const bool adjustSelection =  !(modifier & Qt::ShiftModifier) &&
+                                  !(modifier & Qt::ControlModifier) &&
+                                  !m_showElasticBand;
+
+    if (adjustSelection) {
+        selectionModel()->select(current, QItemSelectionModel::ClearAndSelect);
+    }
 }
 
 void DolphinDetailsView::setSortIndicatorSection(DolphinView::Sorting sorting)