GUI: Windows: use pass through high DPI scaling factor rounding policy

Means fractional scaling factors such as Windows' 175% will no longer
use 200% (integer rounding) etc.

This is the default on Qt 6 anyway.

Implements #3043.
This commit is contained in:
Moritz Bunkus 2021-10-20 21:43:36 +02:00
parent 76d0b61287
commit ade0368f10
No known key found for this signature in database
GPG Key ID: 74AF00ADF2E32C85
3 changed files with 14 additions and 3 deletions

View File

@ -4,6 +4,11 @@
* mkvmerge: AC-3 parser: E-AC-3 with BSID values > 10 and ≤ 15 are recognized
now, too. Implements #3211.
* MKVToolNix GUI: only on Windows: when compiled with Qt ≥ 5.14 and < 6 (which
is the case for the officially provided binaries) fractional screen scaling
will be enabled. This means that the GUI will be scaled appropriately if
Windows is set to 125%, 150% or 175% instead of being too small or too
large. Implements #3043.
## Bug fixes

View File

@ -30,8 +30,14 @@ enableOrDisableHighDPIScaling() {
auto reg = Util::Settings::registry();
reg->beginGroup(s_grpSettings);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
if (!reg->value(s_valUiDisableHighDPIScaling).toBool())
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
if (reg->value(s_valUiDisableHighDPIScaling).toBool())
return;
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);
# if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
# endif
#endif
}

View File

@ -133,7 +133,7 @@ void
gatherEnvironmentVariables(QStringList &info) {
info << Q("") << Q("## Environment variables") << Q("");
auto keys = QStringList{} << Q("QT_AUTO_SCREEN_SCALE_FACTOR") << Q("QT_SCALE_FACTOR") << Q("QT_SCREEN_SCALE_FACTORS") << Q("QT_DEVICE_PIXEL_RATIO")
auto keys = QStringList{} << Q("QT_AUTO_SCREEN_SCALE_FACTOR") << Q("QT_SCALE_FACTOR") << Q("QT_SCREEN_SCALE_FACTORS") << Q("QT_DEVICE_PIXEL_RATIO") << Q("QT_SCALE_FACTOR_ROUNDING_POLICY")
<< Q("MTX_LOGGER") << Q("MTX_DEBUG") << Q("MKVTOOLNIX_DEBUG") << Q("MKVMERGE_DEBUG")
<< Q("LC_ALL") << Q("LC_MESSAGES") << Q("LC_CTYPE") << Q("LANG") << Q("LANGUAGE");
keys.sort();