From 5a2db2db4b31b37da5661db893d60619587e5a68 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Wed, 15 Oct 2014 15:30:50 +0200 Subject: Define auxiliary functions for metrics Collect font, font metrics and icon size functions in a separate module. Signed-off-by: Giuseppe Bilotta Signed-off-by: Dirk Hohndel --- qt-ui/metrics.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 qt-ui/metrics.cpp (limited to 'qt-ui/metrics.cpp') diff --git a/qt-ui/metrics.cpp b/qt-ui/metrics.cpp new file mode 100644 index 000000000..49e27849f --- /dev/null +++ b/qt-ui/metrics.cpp @@ -0,0 +1,32 @@ +/* + * metrics.cpp + * + * methods to find/compute essential UI metrics + * (font properties, icon sizes, etc) + * + */ + +#include "metrics.h" + +QFont defaultModelFont() +{ + QFont font; +// font.setPointSizeF(font.pointSizeF() * 0.8); + return font; +} + +QFontMetrics defaultModelFontMetrics() +{ + return QFontMetrics(defaultModelFont()); +} + +// return the default icon size, computed as the multiple of 16 closest to +// the given height +int defaultIconSize(int height) +{ + int ret = (height + 8)/16; + ret *= 16; + if (ret < 16) + ret = 16; + return ret; +} -- cgit v1.2.3-70-g09d2