Improve file selection in file system widget
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user