mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
ba88a3358d
commit
bd7ded8894
2 changed files with 17 additions and 4 deletions
|
@ -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;
|
||||
|
|
|
@ -125,6 +125,7 @@ public slots:
|
|||
class Ruler : public QGraphicsLineItem{
|
||||
public:
|
||||
Ruler();
|
||||
~Ruler();
|
||||
void setMinimum(double minimum);
|
||||
void setMaximum(double maximum);
|
||||
void setTickInterval(double interval);
|
||||
|
@ -141,6 +142,8 @@ public:
|
|||
int unitSystem;
|
||||
|
||||
private:
|
||||
void eraseAll();
|
||||
|
||||
Qt::Orientation orientation;
|
||||
QList<QGraphicsLineItem*> ticks;
|
||||
QList<QGraphicsSimpleTextItem*> labels;
|
||||
|
|
Loading…
Add table
Reference in a new issue