1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 05:34:47 +01:00
GPXSee/src/markeritem.cpp

37 lines
721 B
C++
Raw Normal View History

2015-10-05 01:43:48 +02:00
#include <QPainter>
#include "markeritem.h"
2015-11-25 23:58:46 +01:00
2015-10-05 01:43:48 +02:00
#define SIZE 8
2015-10-17 01:33:02 +02:00
MarkerItem::MarkerItem(QGraphicsItem *parent) : QGraphicsItem(parent)
2015-10-05 01:43:48 +02:00
{
}
QRectF MarkerItem::boundingRect() const
{
return QRectF(-SIZE/2, -SIZE/2, SIZE, SIZE);
}
void MarkerItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget)
{
Q_UNUSED(option);
Q_UNUSED(widget);
2016-02-28 10:58:25 +01:00
bool aa;
if ((aa = painter->testRenderHint(QPainter::Antialiasing)))
painter->setRenderHint(QPainter::Antialiasing, false);
2015-10-05 01:43:48 +02:00
painter->setPen(Qt::red);
painter->drawLine(-SIZE/2, 0, SIZE/2, 0);
painter->drawLine(0, -SIZE/2, 0, SIZE/2);
2016-02-28 10:58:25 +01:00
if (aa)
painter->setRenderHint(QPainter::Antialiasing, true);
2015-10-05 01:43:48 +02:00
// painter->drawRect(boundingRect());
}