mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
Make tooltips works
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
parent
2089c124a5
commit
ce8d30b938
2 changed files with 12 additions and 0 deletions
|
@ -11,6 +11,7 @@
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QPropertyAnimation>
|
#include <QPropertyAnimation>
|
||||||
#include <QGraphicsSceneHoverEvent>
|
#include <QGraphicsSceneHoverEvent>
|
||||||
|
#include <QMouseEvent>
|
||||||
|
|
||||||
#include "../color.h"
|
#include "../color.h"
|
||||||
#include "../display.h"
|
#include "../display.h"
|
||||||
|
@ -136,6 +137,16 @@ ProfileGraphicsView::ProfileGraphicsView(QWidget* parent) : QGraphicsView(parent
|
||||||
fill_profile_color();
|
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)
|
bool ProfileGraphicsView::eventFilter(QObject* obj, QEvent* event)
|
||||||
{
|
{
|
||||||
// This will "Eat" the default tooltip behavior.
|
// This will "Eat" the default tooltip behavior.
|
||||||
|
|
|
@ -87,6 +87,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *event);
|
void resizeEvent(QResizeEvent *event);
|
||||||
|
void mouseMoveEvent(QMouseEvent* event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void plot_depth_profile(struct graphics_context *gc, struct plot_info *pi);
|
void plot_depth_profile(struct graphics_context *gc, struct plot_info *pi);
|
||||||
|
|
Loading…
Add table
Reference in a new issue