aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-05-08 16:21:49 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-08 14:18:27 -0700
commitce8d30b938b80c334eb0869650c3c463084ae018 (patch)
treed31e411419eb2c4259d516891364364ce2d6c30d
parent2089c124a582ac95c4e9adb9362446572ff791f7 (diff)
downloadsubsurface-ce8d30b938b80c334eb0869650c3c463084ae018.tar.gz
Make tooltips works
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
-rw-r--r--qt-ui/profilegraphics.cpp11
-rw-r--r--qt-ui/profilegraphics.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp
index 550a5ec57..508251232 100644
--- a/qt-ui/profilegraphics.cpp
+++ b/qt-ui/profilegraphics.cpp
@@ -11,6 +11,7 @@
#include <QIcon>
#include <QPropertyAnimation>
#include <QGraphicsSceneHoverEvent>
+#include <QMouseEvent>
#include "../color.h"
#include "../display.h"
@@ -136,6 +137,16 @@ ProfileGraphicsView::ProfileGraphicsView(QWidget* parent) : QGraphicsView(parent
fill_profile_color();
}
+void ProfileGraphicsView::mouseMoveEvent(QMouseEvent* event)
+{
+ toolTip->clear();
+ QList<QGraphicsItem*> items = scene()->items( mapToScene(event->pos() ), Qt::IntersectsItemShape, Qt::DescendingOrder, transform());
+ Q_FOREACH(QGraphicsItem *item, items){
+ if (!item->toolTip().isEmpty())
+ toolTip->addToolTip(item->toolTip());
+ }
+}
+
bool ProfileGraphicsView::eventFilter(QObject* obj, QEvent* event)
{
// This will "Eat" the default tooltip behavior.
diff --git a/qt-ui/profilegraphics.h b/qt-ui/profilegraphics.h
index ca1eb8983..d607e2615 100644
--- a/qt-ui/profilegraphics.h
+++ b/qt-ui/profilegraphics.h
@@ -87,6 +87,7 @@ public:
protected:
void resizeEvent(QResizeEvent *event);
+ void mouseMoveEvent(QMouseEvent* event);
private:
void plot_depth_profile(struct graphics_context *gc, struct plot_info *pi);