aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-06-23 13:21:01 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-06-23 13:21:01 -0700
commita0e5244ffe9cf8623ae771861d7b0c07a9844141 (patch)
tree57491bbc9727eda5de60c3ef5abf26d8d3af9969 /qt-ui
parent106775b1961711a5e74c80d1dde7aab5a9e2e336 (diff)
downloadsubsurface-a0e5244ffe9cf8623ae771861d7b0c07a9844141.tar.gz
Fix updateTicks
This is the correct way to add the ticks (and gets rid of two warnings). Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/diveplanner.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index e2886d966..d5a9aaa1f 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -300,19 +300,20 @@ void Ruler::setOrientation(Qt::Orientation o)
void Ruler::updateTicks()
{
qDeleteAll(ticks);
+ ticks.clear();
QLineF m = line();
if (orientation == Qt::Horizontal) {
double steps = (max - min) / interval;
double stepSize = (m.x2() - m.x1()) / steps;
for (qreal pos = m.x1(); pos < m.x2(); pos += stepSize) {
- QGraphicsLineItem *l = new QGraphicsLineItem(pos, m.y1(), pos, m.y1() + 1, this);
+ ticks.push_back(new QGraphicsLineItem(pos, m.y1(), pos, m.y1() + 1, this));
}
} else {
double steps = (max - min) / interval;
double stepSize = (m.y2() - m.y1()) / steps;
for (qreal pos = m.y1(); pos < m.y2(); pos += stepSize) {
- QGraphicsLineItem *l = new QGraphicsLineItem(m.x1(), pos, m.x1() - 1, pos, this);
+ ticks.push_back(new QGraphicsLineItem(m.x1(), pos, m.x1() - 1, pos, this));
}
}
}