diff options
author | Fanda Vacek <vacek@elektroline.cz> | 2019-02-18 20:07:20 +0100 |
---|---|---|
committer | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-02-19 11:26:28 +0100 |
commit | b6355b1d65edfa51c9f80ac4c8c088bf9f19b788 (patch) | |
tree | be83041544feb5811498cb8424413a8a48dd5697 /qtmips_gui/fontsize.cpp | |
parent | 49c367d1d46cbe65de367ccb763f072399c6c05b (diff) | |
download | qtmips-b6355b1d65edfa51c9f80ac4c8c088bf9f19b788.tar.gz qtmips-b6355b1d65edfa51c9f80ac4c8c088bf9f19b788.tar.bz2 qtmips-b6355b1d65edfa51c9f80ac4c8c088bf9f19b788.zip |
variable font size
Diffstat (limited to 'qtmips_gui/fontsize.cpp')
-rw-r--r-- | qtmips_gui/fontsize.cpp | 23 |
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; +} |