summaryrefslogtreecommitdiffstats
path: root/qt-ui/diveplanner.cpp
diff options
context:
space:
mode:
authorGravatar Thiago Macieira <thiago@macieira.org>2013-11-30 09:18:03 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-30 09:25:16 -0800
commitbd7ded88940995ebbb46fc6983ba9cfd179e55e0 (patch)
treee32552e9de7ab7f1d2d8fe6cb33b17fb9462deb6 /qt-ui/diveplanner.cpp
parentba88a3358d2e8ed6b5486fff4c11bbef785ee959 (diff)
downloadsubsurface-bd7ded88940995ebbb46fc6983ba9cfd179e55e0.tar.gz
Delete the graphics items for the ticks and labels in the ruler
Ruler::updateTicks() was creating them, but nothing deleted them. Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r--qt-ui/diveplanner.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 5efac70a9..b18f56bd6 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -770,10 +770,23 @@ void Ruler::setTextColor(const QColor& color)
textColor = color;
}
+void Ruler::eraseAll()
+{
+ qDeleteAll(ticks);
+ ticks.clear();
+ qDeleteAll(labels);
+ labels.clear();
+}
+
Ruler::Ruler() : orientation(Qt::Horizontal)
{
}
+Ruler::~Ruler()
+{
+ eraseAll();
+}
+
void Ruler::setOrientation(Qt::Orientation o)
{
orientation = o;
@@ -784,10 +797,7 @@ void Ruler::setOrientation(Qt::Orientation o)
void Ruler::updateTicks()
{
- qDeleteAll(ticks);
- ticks.clear();
- qDeleteAll(labels);
- labels.clear();
+ eraseAll();
QLineF m = line();
QGraphicsLineItem *item = NULL;