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

Now using antialiasing in track view

This commit is contained in:
Martin Tůma 2016-02-28 10:58:25 +01:00
parent 7a6e60b83d
commit 64e65679fe
3 changed files with 17 additions and 0 deletions

View File

@ -19,10 +19,18 @@ void MarkerItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
{
Q_UNUSED(option);
Q_UNUSED(widget);
bool aa;
if ((aa = painter->testRenderHint(QPainter::Antialiasing)))
painter->setRenderHint(QPainter::Antialiasing, false);
painter->setPen(Qt::red);
painter->drawLine(-SIZE/2, 0, SIZE/2, 0);
painter->drawLine(0, -SIZE/2, 0, SIZE/2);
if (aa)
painter->setRenderHint(QPainter::Antialiasing, true);
// painter->drawRect(boundingRect());
}

View File

@ -46,6 +46,11 @@ void ScaleItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
font.setFamily(FONT_FAMILY);
QFontMetrics fm(font);
QRect br;
bool aa;
if ((aa = painter->testRenderHint(QPainter::Antialiasing)))
painter->setRenderHint(QPainter::Antialiasing, false);
painter->setFont(font);
@ -63,6 +68,9 @@ void ScaleItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
painter->fillRect(QRectF(i * _width, br.height() + PADDING, _width,
SCALE_HEIGHT), Qt::black);
if (aa)
painter->setRenderHint(QPainter::Antialiasing, true);
/*
painter->setPen(Qt::red);
painter->drawRect(boundingRect());

View File

@ -27,6 +27,7 @@ TrackView::TrackView(QWidget *parent)
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setRenderHints(QPainter::Antialiasing);
_mapScale = new ScaleItem();
_mapScale->setZValue(2.0);