QFontDialog: How to set it size?
-
Hi there,
I like to increase the size of a QFontDialog but my code doesn't work:
#include <QApplication> #include <QFileDialog> int main(int argc, char *argv[]) { QApplication a(argc, argv); a.setAttribute(Qt::AA_EnableHighDpiScaling); a.setDesktopSettingsAware(true); QFileDialog FileDialog(nullptr); FileDialog.resize(1600,800); // FileDialog.setGeometry(100, 100, 1600, 900); -> not working also QString filePath = QString("/home"); QString fileFilter = QString("Textfile (*.txt)"); QString selectedFilter; QString fullPath = FileDialog.getOpenFileName(nullptr, "File Save As", filePath, fileFilter, &selectedFilter); return a.exec(); }
My system:
Arch Linux
KDE Plasma 5.20.2 desktop
Qt 5.15.1How to increase the size of QFontDialog?
-
@mireiner said in QFontDialog: How to set it size?:
FileDialog.getOpenFileName(nullptr, "File Save As", filePath, fileFilter, &selectedFilter)
That's a static methd, calling that equals calling
QFileDialog::getOpenFileName(...)
.
So your setting onFileDialog
will not have any effect on it.
Just use non-static methods. -
Somehow you asked about QFontDialog, but you are using QFileDialog in the code...
For QFileDialog, https://doc.qt.io/qt-5/qfiledialog.html#details, start reading from "You can create your own QFileDialog without using the static functions."
For QFontDialog, the doc doesn't write that in detail, but it is just similar to QFileDialog. -