mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
Update DPI scaling to not update default fonts
This commit is contained in:
parent
a5b737314d
commit
ab542c3599
1 changed files with 7 additions and 3 deletions
|
@ -35,8 +35,10 @@ void scaleWidgetFontSizes(QWidget* widget, float scale) {
|
|||
}
|
||||
QFont font = widget->font();
|
||||
qDebug() << "Pref: " << widget->objectName() << ": " << font.pointSizeF();
|
||||
font.setPointSizeF(font.pointSizeF() * scale);
|
||||
widget->setFont(font);
|
||||
if (font != QFont()) {
|
||||
font.setPointSizeF(font.pointSizeF() * scale);
|
||||
widget->setFont(font);
|
||||
}
|
||||
}
|
||||
|
||||
PreferencesDialog::PreferencesDialog(QWidget* parent) :
|
||||
|
@ -61,9 +63,11 @@ PreferencesDialog::PreferencesDialog(QWidget* parent) :
|
|||
setFixedHeight(parentWidget()->size().height() - PREFERENCES_HEIGHT_PADDING);
|
||||
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
|
||||
// All font sizes are based on 72 DPI.
|
||||
float dpiScale = 72.0f / glCanvas->logicalDpiX();
|
||||
|
||||
scaleWidgetFontSizes(ui.scrollArea, dpiScale);
|
||||
scaleWidgetFontSizes(this, dpiScale);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue