Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.15.13, 5.15.9, 6.5.0
-
None
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