mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-30 02:16:33 +00:00
Allow hitting enter with a selected filename to enter a directory
This commit is contained in:
@@ -765,21 +765,21 @@ void VirtualFileDialog::on_filename_keyPress(QKeyEvent *e)
|
||||
re.setPatternSyntax(QRegExp::Wildcard);
|
||||
|
||||
int fileCount = m_FileProxy->rowCount(curDir);
|
||||
int matches = 0;
|
||||
int matches = 0, dirmatches = 0;
|
||||
QString match;
|
||||
QModelIndex idx;
|
||||
|
||||
for(int f = 0; f < fileCount; f++)
|
||||
{
|
||||
QModelIndex file = m_FileProxy->index(f, 0, curDir);
|
||||
bool isDir = m_FileProxy->data(file, RemoteFileModel::FileIsDirRole).toBool();
|
||||
|
||||
if(isDir)
|
||||
continue;
|
||||
|
||||
QString filename = m_FileProxy->data(file, RemoteFileModel::FileNameRole).toString();
|
||||
|
||||
if(re.exactMatch(filename))
|
||||
{
|
||||
idx = file;
|
||||
dirmatches += isDir ? 1 : 0;
|
||||
matches++;
|
||||
match = m_FileProxy->data(file, RemoteFileModel::FilePathRole).toString();
|
||||
}
|
||||
@@ -787,8 +787,16 @@ void VirtualFileDialog::on_filename_keyPress(QKeyEvent *e)
|
||||
|
||||
if(matches == 1)
|
||||
{
|
||||
m_ChosenPath = match;
|
||||
QDialog::accept();
|
||||
if(dirmatches == 1)
|
||||
{
|
||||
changeCurrentDir(m_FileProxy->mapToSource(idx));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ChosenPath = match;
|
||||
QDialog::accept();
|
||||
}
|
||||
}
|
||||
|
||||
if(matches == 0 && !text.trimmed().isEmpty())
|
||||
|
||||
Reference in New Issue
Block a user