1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 03:35:53 +01:00

Proper use of prepareGeometryChange()

This commit is contained in:
Martin Tůma 2016-04-01 21:20:23 +02:00
parent 803c4aecce
commit 34fcbfb60f
6 changed files with 18 additions and 11 deletions

View File

@ -38,23 +38,23 @@ AxisItem::AxisItem(Type type, QGraphicsItem *parent) : QGraphicsItem(parent)
void AxisItem::setRange(const RangeF &range)
{
prepareGeometryChange();
_range = range;
updateBoundingRect();
prepareGeometryChange();
}
void AxisItem::setSize(qreal size)
{
prepareGeometryChange();
_size = size;
updateBoundingRect();
prepareGeometryChange();
}
void AxisItem::setLabel(const QString& label)
{
prepareGeometryChange();
_label = label;
updateBoundingRect();
prepareGeometryChange();
}
void AxisItem::updateBoundingRect()

View File

@ -65,18 +65,19 @@ void InfoItem::insert(const QString &key, const QString &value)
KV kv(key, value);
int i;
prepareGeometryChange();
if ((i = _list.indexOf(kv)) < 0)
_list.append(kv);
else
_list[i] = kv;
updateBoundingRect();
prepareGeometryChange();
}
void InfoItem::clear()
{
prepareGeometryChange();
_list.clear();
updateBoundingRect();
prepareGeometryChange();
}

View File

@ -114,24 +114,24 @@ void ScaleItem::computeScale()
void ScaleItem::setLatitude(qreal lat)
{
prepareGeometryChange();
_lat = lat;
computeScale();
updateBoundingRect();
prepareGeometryChange();
}
void ScaleItem::setZoom(int z)
{
prepareGeometryChange();
_zoom = z;
computeScale();
updateBoundingRect();
prepareGeometryChange();
}
void ScaleItem::setUnits(enum Units units)
{
prepareGeometryChange();
_units = units;
computeScale();
updateBoundingRect();
prepareGeometryChange();
}

View File

@ -47,9 +47,9 @@ void SliderInfoItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
void SliderInfoItem::setText(const QString &text)
{
prepareGeometryChange();
_text = text;
updateBoundingRect();
prepareGeometryChange();
}
void SliderInfoItem::setSide(Side side)
@ -57,7 +57,7 @@ void SliderInfoItem::setSide(Side side)
if (side == _side)
return;
prepareGeometryChange();
_side = side;
updateBoundingRect();
prepareGeometryChange();
}

View File

@ -52,3 +52,9 @@ void SliderItem::clear()
_area = QRectF();
setPos(QPointF());
}
void SliderItem::setArea(const QRectF &area)
{
prepareGeometryChange();
_area = area;
}

View File

@ -15,7 +15,7 @@ public:
QWidget *widget);
const QRectF &area() const {return _area;}
void setArea(const QRectF &area) {_area = area;}
void setArea(const QRectF &area);
void clear();