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>
This commit is contained in:
Thiago Macieira 2013-11-30 09:18:03 -08:00 committed by Dirk Hohndel
parent ba88a3358d
commit bd7ded8894
2 changed files with 17 additions and 4 deletions

View file

@ -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;