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

Width of QFileDialog is altered by filters set in constructor

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15.13, 5.15.9, 6.5.0
    • None
    • Linux/X11, Windows

    Description

      When setting a filter in a QFileDialog's constructor, the width of the QFileDialog can be extremely large if one of the filters is long. I have tested this on an olde Qt (5.13.2) and the issue did not occur (the text was cut off, and use of ellipses was done in the dropdown). I'm not positive, but the issue may be related to https://bugreports.qt.io/browse/QTBUG-84615, however the workaround they proposed did not seem to address my issue.

       

      Example Code:

      #include <QApplication>
      #include <QFileDialog>
      #include <QString>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
      
          QString largeFilter = "Large filter (*.aaa *.bbb *.ccc *.ddd *.eee *.fff *.ggg *.hhh *.iii *.jjj *.kkk *.lll *.mmm *.nnn *.ooo *.ppp *.qqq *.rrr *.sss *.ttt *.uuu *.vvv *.www *.xxx *.yyy *.zzz *.111 *.222 *.333 *.444 *.555 *.666 *.777 *.888 *.999)";
      
          QFileDialog dialogA(nullptr, "Filter set in constructor", "", largeFilter);
          dialogA.setOptions(QFileDialog::DontUseNativeDialog);
          dialogA.show();
      
          QFileDialog dialogB(nullptr, "Filter set via setNameFilters");
          dialogB.setOptions(QFileDialog::DontUseNativeDialog);
          dialogB.setNameFilters({largeFilter});
          dialogB.exec();
          
          return a.exec();
      } 

      5.13.2 Results

      5.15.9 Results

      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
            mcdongle Mike Baran
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes