#include #include #include #include #include #include int main(int argc, char *argv[]) { // High-DPI scale factor rounding // !! test this on screen with a normally a device pixel ratio of 1.5 !! QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::Floor); // problem // QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::Ceil); // okay // QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough); // okay // application QApplication app(argc,argv); // combox contents too narrow // 4K screen under Windows 10 with (normally) a device pixel ratio 1.5, // but rounded down to 1.0. QComboBox *combobox = new QComboBox(); combobox->addItem(QStringLiteral("Z")); QHBoxLayout *layout = new QHBoxLayout(); layout->addStretch(); layout->addWidget(combobox); layout->addStretch(); QWidget widget; widget.setLayout(layout); widget.show(); return QApplication::exec(); }