hackaround to prevent selecting an item after a cd
[case] / src / filelist.cpp
index ad822de..6b1749f 100644 (file)
@@ -80,6 +80,9 @@ void FileList::activateItem(QModelIndex index) {
 
     if(file.isDir()) {
         changePath(file.absoluteFilePath());
+        // hack: we reset it to MultiSelection again in the mousePressEvent
+        // without this, the item under the cursor gets selected right after changing the directory
+        setSelectionMode(QAbstractItemView::NoSelection);
     } else if(file.isExecutable()) {
         QProcess::startDetached(file.absoluteFilePath());
     } else {
@@ -98,4 +101,6 @@ void FileList::activateItem(QModelIndex index) {
 void FileList::mousePressEvent(QMouseEvent *event) {
     emit mousePressed();
     QListView::mousePressEvent(event);
+    // need to reset the selection mode in case it was set to NoSelection in activateItem(...)
+    setSelectionMode(QAbstractItemView::MultiSelection);
 }