Waypoint2DIcon.cc 746 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
#include "Waypoint2DIcon.h"
#include <QPainter>

#include <QDebug>

Waypoint2DIcon::Waypoint2DIcon(QGraphicsItem* parent) :
        QGC2DIcon(parent)
{
}

/**
 * @return the bounding rectangle of the icon
 */
QRectF Waypoint2DIcon::boundingRect() const
{
    qreal penWidth = 1;
    return QRectF(-10 - penWidth / 2, -10 - penWidth / 2,
                  20 + penWidth, 20 + penWidth);
}

/**
 * @param painter QPainter to draw with
 * @param option Visual style
 * @param widget Parent widget
 */
void Waypoint2DIcon::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
{
    qDebug() << __FILE__ << __LINE__ << "DRAWING";
    painter->setPen(QPen(Qt::red));
    painter->drawRoundedRect(-10, -10, 20, 20, 5, 5);
}