Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.12.0, 5.15.1
-
None
Description
QFileDialog makes two calls on UNIX systems to check if the file exists using the ~ expansion - for filesystems that are really slow, this can cause quite a bit of UI lag. We could change the check so that it only does the expansion if a ~ is the leading character in the pathÂ
--- src/widgets/dialogs/qfiledialog.cpp +++ src/widgets/dialogs/qfiledialog.cpp @@ -1171,7 +1171,7 @@ QStringList QFileDialogPrivate::typedFiles() const if (!editText.contains(QLatin1Char('"'))) { #ifdef Q_OS_UNIX const QString prefix = q->directory().absolutePath() + QDir::separator(); - if (QFile::exists(prefix + editText)) + if (!editText.startsWith(QLatin1Char('~')) || QFile::exists(prefix + editText)) files << editText; else files << qt_tildeExpansion(editText); @@ -1189,7 +1189,7 @@ QStringList QFileDialogPrivate::typedFiles() const #ifdef Q_OS_UNIX const QString token = tokens.at(i); const QString prefix = q->directory().absolutePath() + QDir::separator(); - if (QFile::exists(prefix + token)) + if (!token.startsWith(QLatin1Char('~')) || QFile::exists(prefix + token)) files << token; else files << qt_tildeExpansion(token);
Dunno if this should be duped to https://bugreports.qt.io/browse/QTBUG-41373