mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-01-18 03:42:09 +01:00
Fixed rendering issues
This commit is contained in:
parent
a5f11cb77b
commit
420e96a2f4
@ -35,7 +35,9 @@ AxisItem::AxisItem(Type type, QGraphicsItem *parent) : QGraphicsItem(parent)
|
|||||||
_type = type;
|
_type = type;
|
||||||
_size = 0;
|
_size = 0;
|
||||||
|
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
||||||
|
#endif // Q_OS_MAC
|
||||||
}
|
}
|
||||||
|
|
||||||
void AxisItem::setRange(const RangeF &range)
|
void AxisItem::setRange(const RangeF &range)
|
||||||
@ -93,9 +95,8 @@ void AxisItem::updateBoundingRect()
|
|||||||
mtw = qMax(ts.width(), mtw);
|
mtw = qMax(ts.width(), mtw);
|
||||||
}
|
}
|
||||||
|
|
||||||
_boundingRect = QRectF(-(ls.height() + mtw + 2*PADDING
|
_boundingRect = QRectF(-(ls.height() + mtw + 2*PADDING + TICK/2),
|
||||||
- fm.descent() + TICK/2), -(_size + es.height()/2
|
-(_size + es.height()/2 + fm.descent()), ls.height() + mtw + 2*PADDING
|
||||||
+ fm.descent()), ls.height() -fm.descent() + mtw + 2*PADDING
|
|
||||||
+ TICK, _size + es.height()/2 + fm.descent() + ss.height()/2);
|
+ TICK, _size + es.height()/2 + fm.descent() + ss.height()/2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,9 @@ ScaleItem::ScaleItem(QGraphicsItem *parent) : QGraphicsItem(parent)
|
|||||||
_zoom = ZOOM_MIN;
|
_zoom = ZOOM_MIN;
|
||||||
_lat = 0;
|
_lat = 0;
|
||||||
|
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
||||||
|
#endif // Q_OS_MAC
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScaleItem::updateBoundingRect()
|
void ScaleItem::updateBoundingRect()
|
||||||
@ -33,9 +35,9 @@ void ScaleItem::updateBoundingRect()
|
|||||||
es = fm.tightBoundingRect(QString::number(_length * SEGMENTS));
|
es = fm.tightBoundingRect(QString::number(_length * SEGMENTS));
|
||||||
us = fm.tightBoundingRect(units());
|
us = fm.tightBoundingRect(units());
|
||||||
|
|
||||||
_boundingRect = QRectF(-ss.width()/2, 0,
|
_boundingRect = QRectF(-ss.width()/2, 0, _width * SEGMENTS + ss.width()/2
|
||||||
_width * SEGMENTS + ss.width()/2 + qMax(us.width() + PADDING, es.width()/2),
|
+ qMax(us.width() + PADDING, es.width()/2) + 1, SCALE_HEIGHT + PADDING
|
||||||
SCALE_HEIGHT + PADDING + ss.height() + 2*fm.descent());
|
+ ss.height() + 2*fm.descent());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScaleItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
void ScaleItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
@ -69,10 +71,12 @@ void ScaleItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
|||||||
for (int i = 0; i < SEGMENTS; i += 2)
|
for (int i = 0; i < SEGMENTS; i += 2)
|
||||||
painter->fillRect(QRectF(i * _width, br.height() + PADDING, _width,
|
painter->fillRect(QRectF(i * _width, br.height() + PADDING, _width,
|
||||||
SCALE_HEIGHT), Qt::black);
|
SCALE_HEIGHT), Qt::black);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
painter->setPen(Qt::red);
|
painter->setPen(Qt::red);
|
||||||
painter->drawRect(boundingRect());
|
painter->drawRect(boundingRect());
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (aa)
|
if (aa)
|
||||||
painter->setRenderHint(QPainter::Antialiasing, true);
|
painter->setRenderHint(QPainter::Antialiasing, true);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user