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
+5 -3
View File
@@ -270,20 +270,22 @@ void AttachedWindow::updateWindowRect(void *_attachedPtr)
}
float scale = 1.f;
float ourScale = 1.F;
if (auto dpi = getWindowDpi(attached))
{
scale = *dpi / 96.f;
ourScale = scale / this->devicePixelRatio();
for (auto w : this->ui_.split->findChildren<BaseWidget *>())
{
w->setOverrideScale(scale);
w->setOverrideScale(ourScale);
}
this->ui_.split->setOverrideScale(scale);
this->ui_.split->setOverrideScale(ourScale);
}
if (this->height_ != -1)
{
this->ui_.split->setFixedWidth(int(this->width_ * scale));
this->ui_.split->setFixedWidth(int(this->width_ * ourScale));
// offset
int o = this->fullscreen_ ? 0 : 8;