Allow hitting enter on a file in the virtual file dialog to select

This commit is contained in:
baldurk
2017-11-29 18:18:19 +00:00
parent 8931ed4086
commit 4b562ea49d
3 changed files with 17 additions and 1 deletions
@@ -719,6 +719,16 @@ void VirtualFileDialog::on_fileList_clicked(const QModelIndex &index)
ui->filename->setText(m_FileProxy->data(index, RemoteFileModel::FileNameRole).toString());
}
void VirtualFileDialog::on_fileList_keyPress(QKeyEvent *e)
{
// only process when enter is pressed
if(e->key() != Qt::Key_Return && e->key() != Qt::Key_Enter)
return;
// pass on to the filename field as if we hit enter there
on_filename_keyPress(e);
}
void VirtualFileDialog::on_showHidden_toggled(bool checked)
{
m_DirProxy->showHidden = ui->showHidden->isChecked();
@@ -51,6 +51,7 @@ private slots:
void on_dirList_clicked(const QModelIndex &index);
void on_fileList_doubleClicked(const QModelIndex &index);
void on_fileList_clicked(const QModelIndex &index);
void on_fileList_keyPress(QKeyEvent *e);
void on_showHidden_toggled(bool checked);
void on_filename_keyPress(QKeyEvent *e);
void on_filter_currentIndexChanged(int index);
@@ -121,7 +121,7 @@
</widget>
</item>
<item>
<widget class="QTreeView" name="fileList">
<widget class="RDTreeView" name="fileList">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>2</horstretch>
@@ -244,6 +244,11 @@
<extends>QLineEdit</extends>
<header>Widgets/Extended/RDLineEdit.h</header>
</customwidget>
<customwidget>
<class>RDTreeView</class>
<extends>QTreeView</extends>
<header>Widgets/Extended/RDTreeView.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../../Resources/resources.qrc"/>