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

Extremely wide QFileDialog windows, regression in 5.13, 5.14, or 5.15

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15.0
    • None

    Description

      After upgrading Qt from 5.12 to 5.15, one of my QFileDialog windows has become extremely wide, see attached image. The reason seems to be this line:

       

      https://code.qt.io/cgit/qt/qtbase.git/tree/src/widgets/dialogs/qfiledialog.cpp#n3083 

       

      I.e. this line:

      qFileDialogUi->fileTypeCombo->setSizeAdjustPolicy(QComboBox::AdjustToContentsOnFirstShow);

      should IMHO look like this:

      qFileDialogUi->fileTypeCombo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon);

       

      Workaround if using Qt 5.15:

       

        static inline void fixqfiledialog(QWidget *widget){
          if (widget != NULL){
            QComboBox *box = dynamic_cast<QComboBox*>(widget);
            if (box != NULL)
              box->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon);
            
            for(auto *c : widget->children())
              fixqfiledialog(dynamic_cast<QWidget*>(c));
          }
        }
      
      

       

       

       

      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
            kmatheussen Kjetil Matheussen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes