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)); } }