Use Qt's High-DPI scaling on Windows (#4868)

This commit is contained in:
nerix
2024-05-12 13:59:14 +02:00
committed by GitHub
parent 8202cd0d99
commit febcf464fe
21 changed files with 459 additions and 320 deletions
+3 -16
View File
@@ -88,23 +88,10 @@ void Label::paintEvent(QPaintEvent *)
{
QPainter painter(this);
qreal deviceDpi =
#ifdef Q_OS_WIN
this->devicePixelRatioF();
#else
1.0;
#endif
QFontMetrics metrics = getIApp()->getFonts()->getFontMetrics(
this->getFontStyle(),
this->scale() * 96.f /
std::max<float>(
0.01F, static_cast<float>(this->logicalDpiX() * deviceDpi)));
painter.setFont(getIApp()->getFonts()->getFont(
this->getFontStyle(),
this->scale() * 96.f /
std::max<float>(
0.02F, static_cast<float>(this->logicalDpiX() * deviceDpi))));
this->getFontStyle(), this->scale());
painter.setFont(
getIApp()->getFonts()->getFont(this->getFontStyle(), this->scale()));
int offset = this->getOffset();