aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/profile
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-01-16 16:17:26 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-01-17 08:04:37 +1300
commit12dd46c1409dee7f09dcd970728681976459296e (patch)
treee56179fb64c4334badc612931e1dcccd39698c88 /qt-ui/profile
parent48a23b9b3ceb7cd6b9de0e2faad8845e6cdaf692 (diff)
downloadsubsurface-12dd46c1409dee7f09dcd970728681976459296e.tar.gz
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>
Diffstat (limited to 'qt-ui/profile')
-rw-r--r--qt-ui/profile/divetooltipitem.cpp12
-rw-r--r--qt-ui/profile/divetooltipitem.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/qt-ui/profile/divetooltipitem.cpp b/qt-ui/profile/divetooltipitem.cpp
index a8685673c..42aaf1d2c 100644
--- a/qt-ui/profile/divetooltipitem.cpp
+++ b/qt-ui/profile/divetooltipitem.cpp
@@ -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;
diff --git a/qt-ui/profile/divetooltipitem.h b/qt-ui/profile/divetooltipitem.h
index a383fecb3..6235ec8d9 100644
--- a/qt-ui/profile/divetooltipitem.h
+++ b/qt-ui/profile/divetooltipitem.h
@@ -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);