mirror of
https://github.com/lubosz/overte.git
synced 2025-04-14 14:46:55 +02:00
Move preferences dialog font scaling to UIUtil
This commit is contained in:
parent
ba66155d46
commit
9550339a2a
1 changed files with 2 additions and 15 deletions
|
@ -24,23 +24,10 @@
|
|||
#include "PreferencesDialog.h"
|
||||
#include "Snapshot.h"
|
||||
#include "UserActivityLogger.h"
|
||||
#include "UIUtil.h"
|
||||
|
||||
const int PREFERENCES_HEIGHT_PADDING = 20;
|
||||
|
||||
void scaleWidgetFontSizes(QWidget* widget, float scale) {
|
||||
for (auto child : widget->findChildren<QWidget*>()) {
|
||||
if (child->parent() == widget) {
|
||||
scaleWidgetFontSizes(child, scale);
|
||||
}
|
||||
}
|
||||
QFont font = widget->font();
|
||||
qDebug() << "Pref: " << widget->objectName() << ": " << font.pointSizeF();
|
||||
if (font != QFont()) {
|
||||
font.setPointSizeF(font.pointSizeF() * scale);
|
||||
widget->setFont(font);
|
||||
}
|
||||
}
|
||||
|
||||
PreferencesDialog::PreferencesDialog(QWidget* parent) :
|
||||
QDialog(parent) {
|
||||
|
||||
|
@ -67,7 +54,7 @@ PreferencesDialog::PreferencesDialog(QWidget* parent) :
|
|||
// All font sizes are based on 72 DPI.
|
||||
float dpiScale = 72.0f / glCanvas->logicalDpiX();
|
||||
|
||||
scaleWidgetFontSizes(this, dpiScale);
|
||||
UIUtil::scaleWidgetFontSizes(this);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue