HiDPI is now enabled by default in Qt6.

This commit is contained in:
Roman Telezhynskyi 2023-02-09 16:36:10 +02:00
parent 5335fecc98
commit f952368fa1
2 changed files with 5 additions and 1 deletions

View File

@ -290,7 +290,9 @@ void InitHighDpiScaling(int argc, char *argv[])
if (IsOptionSet(argc, argv, qPrintable(QLatin1String("--") + LONG_OPTION_NO_HDPI_SCALING))) if (IsOptionSet(argc, argv, qPrintable(QLatin1String("--") + LONG_OPTION_NO_HDPI_SCALING)))
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) #if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling); QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
#endif
#else #else
qputenv("QT_DEVICE_PIXEL_RATIO", QByteArray("1")); qputenv("QT_DEVICE_PIXEL_RATIO", QByteArray("1"));
#endif #endif
@ -298,7 +300,9 @@ void InitHighDpiScaling(int argc, char *argv[])
else else
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) #if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // DPI support QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // DPI support
#endif
#else #else
qputenv("QT_AUTO_SCREEN_SCALE_FACTOR", QByteArray("1")); qputenv("QT_AUTO_SCREEN_SCALE_FACTOR", QByteArray("1"));
#endif #endif

View File

@ -123,7 +123,7 @@ VAbstractApplication::VAbstractApplication(int &argc, char **argv)
QLoggingCategory::setFilterRules(rules); QLoggingCategory::setFilterRules(rules);
} }
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) #if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
// Enable support for HiDPI bitmap resources // Enable support for HiDPI bitmap resources
// The attribute is available since Qt 5.1, but by default disabled. // The attribute is available since Qt 5.1, but by default disabled.
// Because on Windows and Mac OS X we always use last version // Because on Windows and Mac OS X we always use last version