mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
29851d956f
commit
0171368b6d
3 changed files with 35 additions and 11 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue