From 7e859da939447031ea667bc3b293175dc842d297 Mon Sep 17 00:00:00 2001 From: Taiane Ramos Date: Thu, 14 Nov 2013 23:54:35 -0200 Subject: Make tooltips work in the profile toolbar This patch enables tooltips on the profile toolbar. Tooltips were being treated as text to be shown at notification area. Now it is verified if the cursor was positioned over the toolbar when it activated the event. If so, tooltip is shown normally. Fixes #238 Signed-off-by: exhora Signed-off-by: Dirk Hohndel --- qt-ui/profilegraphics.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'qt-ui/profilegraphics.cpp') diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp index d2fa701f7..9e3db2d85 100644 --- a/qt-ui/profilegraphics.cpp +++ b/qt-ui/profilegraphics.cpp @@ -137,10 +137,12 @@ bool ProfileGraphicsView::eventFilter(QObject* obj, QEvent* event) return true; } - // This will "Eat" the default tooltip behavior. + // This will "Eat" the default tooltip behavior if it is not on the toolBar. if (event->type() == QEvent::GraphicsSceneHelp) { - event->ignore(); - return true; + if(!toolBarProxy->geometry().contains(mapFromGlobal(QCursor::pos()))){ + event->ignore(); + return true; + } } return QGraphicsView::eventFilter(obj, event); } @@ -383,6 +385,8 @@ void ProfileGraphicsView::addControlItems(struct dive *d) QAction *scaleAction = new QAction(QIcon(":scale"), tr("Scale"), this); QAction *rulerAction = new QAction(QIcon(":ruler"), tr("Ruler"), this); QToolBar *toolBar = new QToolBar("", 0); + rulerAction->setToolTip(tr("Show a ruler to nit pecking your dive")); + scaleAction->setToolTip(tr("Scale your dive to screen size")); toolBar->addAction(rulerAction); toolBar->addAction(scaleAction); toolBar->setOrientation(Qt::Vertical); -- cgit v1.2.3-70-g09d2