summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Giuseppe Bilotta <giuseppe.bilotta@gmail.com>2014-10-15 15:30:51 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-10-18 15:16:11 -0700
commit72b256de629c7e4ef5c52d7a9ce62ebd68a77991 (patch)
tree4d42f30596eba1c393300a6499dc5cf0e2c759e0
parent5a2db2db4b31b37da5661db893d60619587e5a68 (diff)
downloadsubsurface-72b256de629c7e4ef5c52d7a9ce62ebd68a77991.tar.gz
actually use defaultIconSize()
Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/profile/divetooltipitem.cpp11
-rw-r--r--qt-ui/starwidget.cpp10
-rw-r--r--qt-ui/tableview.cpp8
3 files changed, 8 insertions, 21 deletions
diff --git a/qt-ui/profile/divetooltipitem.cpp b/qt-ui/profile/divetooltipitem.cpp
index 71d987a90..fe69b56dd 100644
--- a/qt-ui/profile/divetooltipitem.cpp
+++ b/qt-ui/profile/divetooltipitem.cpp
@@ -4,6 +4,7 @@
#include "dive.h"
#include "profile.h"
#include "membuffer.h"
+#include "metrics.h"
#include <QPropertyAnimation>
#include <QGraphicsSceneMouseEvent>
#include <QPen>
@@ -138,15 +139,9 @@ ToolTipItem::ToolTipItem(QGraphicsItem *parent) : QGraphicsPathItem(parent),
timeAxis(0),
lastTime(-1)
{
- // compute icon size, by rounding the font height to the nearest multiple of
- // 16 (small), and setting medium, big and spacing proportionally
+ // set icon sizes and spacing from the default icon size
if (iconMetrics.small == -1) {
- int height = QFontMetrics(title->font()).height();
- iconMetrics.small = (height + 8)/16;
- iconMetrics.small *= 16;
- // enforce a minimum small
- if (iconMetrics.small < 16)
- iconMetrics.small = 16;
+ iconMetrics.small = defaultIconSize();
iconMetrics.medium = iconMetrics.small + iconMetrics.small/2;
iconMetrics.big = iconMetrics.small*2;
iconMetrics.spacing = iconMetrics.small/4;
diff --git a/qt-ui/starwidget.cpp b/qt-ui/starwidget.cpp
index e12692c52..fe4342b7b 100644
--- a/qt-ui/starwidget.cpp
+++ b/qt-ui/starwidget.cpp
@@ -1,4 +1,5 @@
#include "starwidget.h"
+#include "metrics.h"
#include <QSvgRenderer>
#include <QPainter>
#include <QPaintEvent>
@@ -83,14 +84,9 @@ StarWidget::StarWidget(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f),
current(0),
readOnly(false)
{
- // compute image size, by rounding the font height to the nearest multiple of 16
+ // set image size and spacing from the default icon size
if (imgMetrics.size == -1) {
- int height = QFontMetrics(parent->font()).height();
- imgMetrics.size = (height + 8)/16;
- imgMetrics.size *= 16;
- // enforce a minimum size
- if (imgMetrics.size < 16)
- imgMetrics.size = 16;
+ imgMetrics.size = defaultIconSize();
imgMetrics.spacing = imgMetrics.size/8;
}
diff --git a/qt-ui/tableview.cpp b/qt-ui/tableview.cpp
index a654e3cf3..689a2c1cf 100644
--- a/qt-ui/tableview.cpp
+++ b/qt-ui/tableview.cpp
@@ -16,12 +16,8 @@ TableView::TableView(QWidget *parent) : QWidget(parent)
QFontMetrics fm(defaultModelFont());
int text_ht = fm.height();
int text_em = fm.width('m');
- // icon size is the closest multiple of 16 to the font height
- metrics.icon_size = (text_ht + 8)/16;
- metrics.icon_size *= 16;
- // enforce a minimum size
- if (metrics.icon_size < 16)
- metrics.icon_size = 16;
+ // set icon and button size from the default icon size
+ metrics.icon_size = defaultIconSize(text_ht);
metrics.btn_size = metrics.icon_size + metrics.icon_size/2;
metrics.btn_gap = metrics.icon_size/8;