diff options
-rw-r--r-- | qt-ui/profilegraphics.cpp | 11 | ||||
-rw-r--r-- | qt-ui/profilegraphics.h | 1 |
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); |