Mercurial > hg > svgui
comparison widgets/WidgetScale.h @ 1194:be5e43e2180c levelpanwidget
Record scale factor in log
author | Chris Cannam |
---|---|
date | Thu, 15 Dec 2016 16:29:18 +0000 |
parents | 3f5c82034f9b |
children | e7c9650e74a7 |
comparison
equal
deleted
inserted
replaced
1193:54e6be7ebe11 | 1194:be5e43e2180c |
---|---|
15 #ifndef SV_WIDGET_SCALE_H | 15 #ifndef SV_WIDGET_SCALE_H |
16 #define SV_WIDGET_SCALE_H | 16 #define SV_WIDGET_SCALE_H |
17 | 17 |
18 #include <QFont> | 18 #include <QFont> |
19 #include <QFontMetrics> | 19 #include <QFontMetrics> |
20 | |
21 #include "base/Debug.h" | |
20 | 22 |
21 class WidgetScale | 23 class WidgetScale |
22 { | 24 { |
23 public: | 25 public: |
24 /** | 26 /** |
36 #else | 38 #else |
37 baseEm = 15.0; | 39 baseEm = 15.0; |
38 #endif | 40 #endif |
39 double em = QFontMetrics(QFont()).height(); | 41 double em = QFontMetrics(QFont()).height(); |
40 ratio = em / baseEm; | 42 ratio = em / baseEm; |
43 SVDEBUG << "WidgetScale::scalePixelSize: baseEm = " << baseEm | |
44 << ", platform default font height = " << em | |
45 << ", resulting scale factor = " << ratio << endl; | |
41 } | 46 } |
42 | 47 |
43 int scaled = int(pixels * ratio + 0.5); | 48 int scaled = int(pixels * ratio + 0.5); |
44 if (pixels != 0 && scaled == 0) scaled = 1; | 49 if (pixels != 0 && scaled == 0) scaled = 1; |
45 return scaled; | 50 return scaled; |