Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-87062

QFileDialog optimization for slow filesystems

    XMLWordPrintable

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

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            cwgthornton Chris Thornton
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes