Improve file selection in file system widget

This commit is contained in:
2022-06-03 10:51:51 +02:00
parent eb417010c3
commit 032f5b0577
4 changed files with 38 additions and 26 deletions
+4 -3
View File
@@ -17,7 +17,7 @@ FilesystemWidget::FilesystemWidget(QAbstractItemModel *model, QWidget *parent) :
setLayout(layout);
connect(m_listView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(fileClicked(QModelIndex)));
connect(m_listView->selectionModel(), &QItemSelectionModel::currentChanged, this, &FilesystemWidget::fileClicked);
}
void FilesystemWidget::setDir(const QString &dir)
@@ -34,9 +34,10 @@ void FilesystemWidget::selectFile(int row)
m_listView->scrollTo(index);
}
void FilesystemWidget::fileClicked(const QModelIndex &index)
void FilesystemWidget::fileClicked(const QModelIndex &index, const QModelIndex &)
{
emit fileSelected(index.row());
if(index.isValid())
emit fileSelected(index.row());
}
Filetree::Filetree(QWidget *parent) : QTreeView(parent)