#include const char *setupInfo1 = "Setup Information (1) - 2 screens (One 4K + One 2560x1440) \n" "Scale is default (4K = 150% - the other is scaled at 100%) "; const char *setupInfo2 = "Setup Information (2) - 2 screens (One 4K + One 2560x1440) \n" "4K screen is scaled default (150%) - the other is also scaled to 150%."; const char *setupInfo3 = "Setup Information (3) - 1 4K screen - Scaled default (150%)"; // example1 int main(int argc, char *argv[]) { #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // Enable high dpi for Qt5 - it is always enabled for Qt6 QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough); #endif QApplication a(argc, argv); qDebug() << "Qt Version: " << qVersion(); qDebug() << setupInfo3; for (int u = 0; u < QGuiApplication::screens().size(); ++u) { auto s = QGuiApplication::screens().at(u); qDebug() << "Screen" << u << " geometry:" << s->geometry() << " dpr:" << s->devicePixelRatio(); } }