summaryrefslogtreecommitdiffstats
path: root/qt-ui/profilegraphics.cpp
diff options
context:
space:
mode:
authorGravatar Helio Chissini de Castro <helio@kde.org>2013-06-07 22:49:57 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-06-07 21:25:16 -0700
commitef873b40821e3bc327b67ec980d1317112d2aa87 (patch)
tree302333d3ad9b39fa9f9615b1de40ca30ad22f8c4 /qt-ui/profilegraphics.cpp
parent3677f4e5ead410d4023668420ca4f062c4223888 (diff)
downloadsubsurface-ef873b40821e3bc327b67ec980d1317112d2aa87.tar.gz
Hide/Show tooltip on mouse over view widget
Proper hide/show tooltip under ProfileGraphicsView. Events are not properly handled and no custom tolltip status was stored. Text are properly hidden now when tooltip is collapsed. Reported-by: Tomaz Canabrava Signed-off-by: Helio Chissini de Castro <helio@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profilegraphics.cpp')
-rw-r--r--qt-ui/profilegraphics.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp
index cfd155132..164de13ff 100644
--- a/qt-ui/profilegraphics.cpp
+++ b/qt-ui/profilegraphics.cpp
@@ -179,6 +179,12 @@ void ProfileGraphicsView::mouseMoveEvent(QMouseEvent* event)
bool ProfileGraphicsView::eventFilter(QObject* obj, QEvent* event)
{
+ if (event->type() == QEvent::Leave) {
+ if (toolTip && toolTip->isExpanded())
+ toolTip->collapse();
+ return true;
+ }
+
// This will "Eat" the default tooltip behavior.
if (event->type() == QEvent::GraphicsSceneHelp) {
event->ignore();
@@ -1324,6 +1330,9 @@ void ToolTipItem::collapse()
animation->setStartValue(boundingRect());
animation->setEndValue(QRect(0, 0, ICON_SMALL, ICON_SMALL));
animation->start(QAbstractAnimation::DeleteWhenStopped);
+ clear();
+
+ status = COLLAPSED;
}
void ToolTipItem::expand()
@@ -1358,6 +1367,7 @@ void ToolTipItem::expand()
animation->setEndValue(nextRectangle);
animation->start(QAbstractAnimation::DeleteWhenStopped);
+ status = EXPANDED;
}
ToolTipItem::ToolTipItem(QGraphicsItem* parent): QGraphicsPathItem(parent), background(0)
@@ -1368,6 +1378,8 @@ ToolTipItem::ToolTipItem(QGraphicsItem* parent): QGraphicsPathItem(parent), back
setFlag(ItemIgnoresTransformations);
setFlag(ItemIsMovable);
+ status = COLLAPSED;
+
updateTitlePosition();
setZValue(99);
}
@@ -1401,6 +1413,11 @@ void ToolTipItem::updateTitlePosition()
}
}
+bool ToolTipItem::isExpanded() {
+ return status == EXPANDED;
+}
+
+
EventItem::EventItem(QGraphicsItem* parent): QGraphicsPolygonItem(parent)
{
setFlag(ItemIgnoresTransformations);