[PATCH 1/5] [HiDPI] Resolution-independent DiveEventItem icon sizes
Giuseppe Bilotta
giuseppe.bilotta at gmail.com
Sun Oct 19 07:15:18 PDT 2014
Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta at gmail.com>
---
qt-ui/profile/diveeventitem.cpp | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/qt-ui/profile/diveeventitem.cpp b/qt-ui/profile/diveeventitem.cpp
index c1ea485..bd22c0d 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) {
--
2.1.0.255.gcd10c46
More information about the subsurface
mailing list