From b6355b1d65edfa51c9f80ac4c8c088bf9f19b788 Mon Sep 17 00:00:00 2001 From: Fanda Vacek Date: Mon, 18 Feb 2019 20:07:20 +0100 Subject: variable font size --- qtmips_gui/fontsize.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 qtmips_gui/fontsize.cpp (limited to 'qtmips_gui/fontsize.cpp') 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 +#include +#include +#include + +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; +} -- cgit v1.2.3