Move preferences dialog font scaling to UIUtil

This commit is contained in:
Ryan Huffman 2015-02-18 13:34:01 -08:00
parent ba66155d46
commit 9550339a2a

View file

@ -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);
}