summaryrefslogtreecommitdiffstats
path: root/qt-ui/starwidget.h
diff options
context:
space:
mode:
authorGravatar Giuseppe Bilotta <giuseppe.bilotta@gmail.com>2014-10-15 15:30:46 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-10-18 15:15:44 -0700
commit0171368b6dd32d02441096b358893f1e72d6848f (patch)
tree47687acb4ccf3812913da75127b780fea5a027a7 /qt-ui/starwidget.h
parent29851d956f166f8f57a8878047df94b0b058c7eb (diff)
downloadsubsurface-0171368b6dd32d02441096b358893f1e72d6848f.tar.gz
Dynamic StarWidget metrics
The default IMG_SIZE and SPACING in the StarWidget are not appropriate for HiDPI displays. Replace them with StarMetrics which are auto-computed from the (default) font size (which Qt determines from the display DPI settings). Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/starwidget.h')
-rw-r--r--qt-ui/starwidget.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/qt-ui/starwidget.h b/qt-ui/starwidget.h
index 3103a43eb..90310f041 100644
--- a/qt-ui/starwidget.h
+++ b/qt-ui/starwidget.h
@@ -4,11 +4,14 @@
#include <QWidget>
enum StarConfig {
- SPACING = 2,
- IMG_SIZE = 16,
TOTALSTARS = 5
};
+struct StarMetrics {
+ int size;
+ int spacing;
+};
+
class StarWidget : public QWidget {
Q_OBJECT
public:
@@ -19,6 +22,7 @@ public:
static const QImage& starActive();
static const QImage& starInactive();
+ static const StarMetrics& metrics();
signals:
void valueChanged(int stars);
@@ -41,6 +45,7 @@ private:
static QImage activeStar;
static QImage inactiveStar;
+ static StarMetrics imgMetrics;
};
#endif // STARWIDGET_H