Implement the paint method to draw the rounded rectangle.

The rectangle is now correct, but the collors are still
wrong. I'm tracking that down - most probably I've set
the wrong pen or brush  ( or both ) somewhere.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-01-16 16:17:26 -02:00 committed by Dirk Hohndel
parent 48a23b9b3c
commit 12dd46c140
2 changed files with 13 additions and 0 deletions

View file

@ -12,6 +12,7 @@
#include <QGraphicsScene>
#include <QSettings>
#include <QGraphicsView>
#include <QStyleOptionGraphicsItem>
#include <QDebug>
#define PORT_IN_PROGRESS 1
@ -184,6 +185,17 @@ void ToolTipItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
}
}
void ToolTipItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
Q_UNUSED(widget);
painter->save();
painter->setClipRect(option->rect);
painter->setPen(pen());
painter->setBrush(brush());
painter->drawRoundedRect(rect(), 10, 10, Qt::AbsoluteSize);
painter->restore();
}
void ToolTipItem::persistPos()
{
QSettings s;

View file

@ -43,6 +43,7 @@ public:
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
void setTimeAxis(DiveCartesianAxis *axis);
void setPlotInfo(const plot_info &plot);
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
public
slots:
void setRect(const QRectF &rect);