Present window's devicePixelRatio in the UI

It's a more valid value when Qt's rater downscaling is in effect

Also round it
This commit is contained in:
Ilya Fedin 2023-02-11 18:44:59 +04:00 committed by John Preston
parent 9d3715a36a
commit 879df6e6a3

View file

@ -474,8 +474,9 @@ void SetupInterfaceScale(
if constexpr (Platform::IsMac()) { if constexpr (Platform::IsMac()) {
return QString::number(scale) + '%'; return QString::number(scale) + '%';
} else { } else {
const auto ratio = window->widget()->devicePixelRatioF(); const auto handle = window->widget()->windowHandle();
return QString::number(int(scale * ratio)) + '%'; const auto ratio = handle->devicePixelRatio();
return QString::number(base::SafeRound(scale * ratio)) + '%';
} }
}; };
label->setText(labelText(cEvalScale(scale))); label->setText(labelText(cEvalScale(scale)));