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;
|
textColor = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Ruler::eraseAll()
|
||||||
|
{
|
||||||
|
qDeleteAll(ticks);
|
||||||
|
ticks.clear();
|
||||||
|
qDeleteAll(labels);
|
||||||
|
labels.clear();
|
||||||
|
}
|
||||||
|
|
||||||
Ruler::Ruler() : orientation(Qt::Horizontal)
|
Ruler::Ruler() : orientation(Qt::Horizontal)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ruler::~Ruler()
|
||||||
|
{
|
||||||
|
eraseAll();
|
||||||
|
}
|
||||||
|
|
||||||
void Ruler::setOrientation(Qt::Orientation o)
|
void Ruler::setOrientation(Qt::Orientation o)
|
||||||
{
|
{
|
||||||
orientation = o;
|
orientation = o;
|
||||||
|
@ -784,10 +797,7 @@ void Ruler::setOrientation(Qt::Orientation o)
|
||||||
|
|
||||||
void Ruler::updateTicks()
|
void Ruler::updateTicks()
|
||||||
{
|
{
|
||||||
qDeleteAll(ticks);
|
eraseAll();
|
||||||
ticks.clear();
|
|
||||||
qDeleteAll(labels);
|
|
||||||
labels.clear();
|
|
||||||
|
|
||||||
QLineF m = line();
|
QLineF m = line();
|
||||||
QGraphicsLineItem *item = NULL;
|
QGraphicsLineItem *item = NULL;
|
||||||
|
|
|
@ -125,6 +125,7 @@ public slots:
|
||||||
class Ruler : public QGraphicsLineItem{
|
class Ruler : public QGraphicsLineItem{
|
||||||
public:
|
public:
|
||||||
Ruler();
|
Ruler();
|
||||||
|
~Ruler();
|
||||||
void setMinimum(double minimum);
|
void setMinimum(double minimum);
|
||||||
void setMaximum(double maximum);
|
void setMaximum(double maximum);
|
||||||
void setTickInterval(double interval);
|
void setTickInterval(double interval);
|
||||||
|
@ -141,6 +142,8 @@ public:
|
||||||
int unitSystem;
|
int unitSystem;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void eraseAll();
|
||||||
|
|
||||||
Qt::Orientation orientation;
|
Qt::Orientation orientation;
|
||||||
QList<QGraphicsLineItem*> ticks;
|
QList<QGraphicsLineItem*> ticks;
|
||||||
QList<QGraphicsSimpleTextItem*> labels;
|
QList<QGraphicsSimpleTextItem*> labels;
|
||||||
|
|
Loading…
Add table
Reference in a new issue