#include "mainwindow.h" #include #include namespace { QWidget *createWidget() { QWidget *wdg = new QWidget; wdg->setWindowTitle(qVersion()); if (QApplication::testAttribute(Qt::AA_EnableHighDpiScaling)) { wdg->setWindowTitle(wdg->windowTitle() + QString(" HighDPI")); } else { wdg->setWindowTitle(wdg->windowTitle() + QString(" Regular")); } QVBoxLayout *vbox = new QVBoxLayout(wdg); vbox->addWidget(new QLabel("This is a QLabel that has some text here to show the font problem")); vbox->addWidget(new QCheckBox("This is a QCheckBox another text")); vbox->addWidget(new QRadioButton("This is QRadioButton with yet another text")); vbox->addWidget(new QTextEdit("This is a QTextEdit with some more text")); QPushButton *ok = new QPushButton("Ok btn. Font does not seem ok though."); vbox->addWidget(ok); ok->connect(ok, &QPushButton::clicked, wdg, []() { qApp->quit(); } ); wdg->show(); wdg->resize(wdg->minimumSizeHint()); return wdg; } } int main(int argc, char *argv[]) { QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication app(argc, argv); createWidget(); createWidget(); return app.exec(); }