QFileDialog is not scaled the same way as the QApplicaiton with high DPI monitor
Unsolved
General and Desktop
-
I am developing an application to work with 4k monitor. I manged to get nicely scaled application with Qt5.14.2 with following code:
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::Ceil);
However when I open a file dialog using QFileDialog::getOpenFileNames, the pop-up dialog looks a lot smaller. I even tried the following code to make sure it has the same font size as the whole application, but the resultant pop up still looks the same same:
QFileDialog openFileDialog; QFont font = QApplication::font(); font.setPointSize(8); openFileDialog.setFont(font);
Any idea why this is happening and how to fix it?
-
@johnyang said in QFileDialog is not scaled the same way as the QApplicaiton with high DPI monitor:
getOpenFileNames
This is a static method, changing font on a QFileDialog instance will not influence what getOpenFileNames shows.