1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 05:34:47 +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) void AxisItem::setRange(const RangeF &range)
{ {
prepareGeometryChange();
_range = range; _range = range;
updateBoundingRect(); updateBoundingRect();
prepareGeometryChange();
} }
void AxisItem::setSize(qreal size) void AxisItem::setSize(qreal size)
{ {
prepareGeometryChange();
_size = size; _size = size;
updateBoundingRect(); updateBoundingRect();
prepareGeometryChange();
} }
void AxisItem::setLabel(const QString& label) void AxisItem::setLabel(const QString& label)
{ {
prepareGeometryChange();
_label = label; _label = label;
updateBoundingRect(); updateBoundingRect();
prepareGeometryChange();
} }
void AxisItem::updateBoundingRect() void AxisItem::updateBoundingRect()

View File

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

View File

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

View File

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

View File

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

View File

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