aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Giuseppe Bilotta <giuseppe.bilotta@gmail.com>2014-10-19 16:15:18 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-10-19 07:23:18 -0700
commit048f18db852c424ff2c5f81a0251074ef3bb4622 (patch)
treed94be4ed6dc4f4993947fafbe5b0d49bac8a1365 /qt-ui
parent5f44fdd9cf6fba073837cbc1d89c6ed3ea28dd76 (diff)
downloadsubsurface-048f18db852c424ff2c5f81a0251074ef3bb4622.tar.gz
Resolution-independent DiveEventItem icon sizes
Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/profile/diveeventitem.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/qt-ui/profile/diveeventitem.cpp b/qt-ui/profile/diveeventitem.cpp
index c1ea48544..bd22c0db9 100644
--- a/qt-ui/profile/diveeventitem.cpp
+++ b/qt-ui/profile/diveeventitem.cpp
@@ -8,6 +8,7 @@
#include "profile.h"
#include <QDebug>
#include "gettextfromc.h"
+#include "metrics.h"
extern struct ev_select *ev_namelist;
extern int evn_used;
@@ -58,8 +59,12 @@ void DiveEventItem::setEvent(struct event *ev)
void DiveEventItem::setupPixmap()
{
-#define EVENT_PIXMAP(PIX) QPixmap(QString(PIX)).scaled(20, 20, Qt::KeepAspectRatio, Qt::SmoothTransformation)
-#define EVENT_PIXMAP_BIGGER(PIX) QPixmap(QString(PIX)).scaled(40, 38, Qt::KeepAspectRatio, Qt::SmoothTransformation)
+ const IconMetrics& metrics = defaultIconMetrics();
+ int sz_bigger = metrics.sz_med + metrics.sz_small; // ex 40px
+ int sz_pix = sz_bigger/2; // ex 20px
+
+#define EVENT_PIXMAP(PIX) QPixmap(QString(PIX)).scaled(sz_pix, sz_pix, Qt::KeepAspectRatio, Qt::SmoothTransformation)
+#define EVENT_PIXMAP_BIGGER(PIX) QPixmap(QString(PIX)).scaled(sz_bigger, sz_bigger, Qt::KeepAspectRatio, Qt::SmoothTransformation)
if (!internalEvent->name) {
setPixmap(EVENT_PIXMAP(":warning"));
} else if (internalEvent->type == SAMPLE_EVENT_BOOKMARK) {