aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui/fontsize.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qtmips_gui/fontsize.cpp')
-rw-r--r--qtmips_gui/fontsize.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/qtmips_gui/fontsize.cpp b/qtmips_gui/fontsize.cpp
new file mode 100644
index 0000000..8923d08
--- /dev/null
+++ b/qtmips_gui/fontsize.cpp
@@ -0,0 +1,23 @@
+#include "fontsize.h"
+
+#include <QFont>
+#include <QDebug>
+#include <QApplication>
+#include <QFontMetrics>
+
+int FontSize::SIZE5 = 5;
+int FontSize::SIZE6 = 6;
+int FontSize::SIZE7 = 7;
+int FontSize::SIZE8 = 8;
+
+void FontSize::init()
+{
+ int h = QFontMetrics(QApplication::font()).height();
+ qDebug() << "Font size:" << h;
+ h /= 5;
+ int d = h / 10 + 1;
+ FontSize::SIZE5 = h - 2*d;
+ FontSize::SIZE6 = h - d;
+ FontSize::SIZE7 = h;
+ FontSize::SIZE8 = h + d;
+}