summaryrefslogtreecommitdiffstats
path: root/qt-ui/profilegraphics.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-05-08 07:22:23 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-08 14:18:27 -0700
commit2089c124a582ac95c4e9adb9362446572ff791f7 (patch)
tree403c43c437b0697cc7ea1ff2a85d51ec37ba2ed0 /qt-ui/profilegraphics.cpp
parent76e1436f684117766c5132c4ab69bf7ae50cd2ed (diff)
downloadsubsurface-2089c124a582ac95c4e9adb9362446572ff791f7.tar.gz
Work on the tooltips - WIP.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui/profilegraphics.cpp')
-rw-r--r--qt-ui/profilegraphics.cpp37
1 files changed, 14 insertions, 23 deletions
diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp
index e2fed39c5..550a5ec57 100644
--- a/qt-ui/profilegraphics.cpp
+++ b/qt-ui/profilegraphics.cpp
@@ -123,6 +123,7 @@ ProfileGraphicsView::ProfileGraphicsView(QWidget* parent) : QGraphicsView(parent
setScene(new QGraphicsScene());
setBackgroundBrush(QColor("#F3F3E6"));
scene()->setSceneRect(0,0,1000,1000);
+ scene()->installEventFilter(this);
setRenderHint(QPainter::Antialiasing);
setRenderHint(QPainter::HighQualityAntialiasing);
@@ -135,6 +136,16 @@ ProfileGraphicsView::ProfileGraphicsView(QWidget* parent) : QGraphicsView(parent
fill_profile_color();
}
+bool ProfileGraphicsView::eventFilter(QObject* obj, QEvent* event)
+{
+ // This will "Eat" the default tooltip behavior.
+ if (event->type() == QEvent::GraphicsSceneHelp){
+ event->ignore();
+ return true;
+ }
+ return QGraphicsView::eventFilter(obj, event);
+}
+
static void plot_set_scale(scale_mode_t scale)
{
switch (scale) {
@@ -355,8 +366,9 @@ void ProfileGraphicsView::plot_one_event(struct graphics_context *gc, struct plo
ev->flags == SAMPLE_FLAGS_END ? tr("Starts with space!", " end") : "";
}
- item->setToolTipController(toolTip);
- item->addToolTip(name);
+ //item->setToolTipController(toolTip);
+ //item->addToolTip(name);
+ item->setToolTip(name);
}
void ProfileGraphicsView::plot_depth_profile(struct graphics_context *gc, struct plot_info *pi)
@@ -809,24 +821,3 @@ EventItem::EventItem(QGraphicsItem* parent): QGraphicsPolygonItem(parent)
ball->setBrush(QBrush(Qt::black));
}
-
-void EventItem::hoverEnterEvent(QGraphicsSceneHoverEvent* event)
-{
- controller->addToolTip(text, icon);
-}
-
-void EventItem::hoverLeaveEvent(QGraphicsSceneHoverEvent* event)
-{
- controller->removeToolTip(text);
-}
-
-void EventItem::addToolTip(const QString& t, const QIcon& i)
-{
- text = t;
- icon = i;
-}
-
-void EventItem::setToolTipController(ToolTipItem* c)
-{
- controller = c;
-}