hackaround to prevent selecting an item after a cd
authorLukas Hrazky <lukkash@email.cz>
Sat, 17 Jul 2010 14:58:07 +0000 (16:58 +0200)
committerLukas Hrazky <lukkash@email.cz>
Sun, 18 Jul 2010 20:10:05 +0000 (22:10 +0200)
Signed-off-by: Lukas Hrazky <lukkash@email.cz>

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);
 }