diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2014-05-23 21:06:30 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-05-24 07:30:36 -0700 |
commit | 963178d3d4513b9c3e9a67ae56ae7e9fa6248304 (patch) | |
tree | d00bb4772d93f90f149f0cc77d44867a0837ee74 /qt-ui/profile/divetooltipitem.cpp | |
parent | ea4d4ac020319dee0e1d74ff793ef50ab8c47508 (diff) | |
download | subsurface-963178d3d4513b9c3e9a67ae56ae7e9fa6248304.tar.gz |
Fixe movement of DiveHandlers when moving the NotificationArea
The QGraphicsView system moves every selected item when the user
clicks and drags one. This patch makes a cache of all selected
items and removes the selection on them. When the user stops dragging
the Notification, the selection is restored.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile/divetooltipitem.cpp')
-rw-r--r-- | qt-ui/profile/divetooltipitem.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/qt-ui/profile/divetooltipitem.cpp b/qt-ui/profile/divetooltipitem.cpp index 45f415419..032daf6ee 100644 --- a/qt-ui/profile/divetooltipitem.cpp +++ b/qt-ui/profile/divetooltipitem.cpp @@ -1,5 +1,6 @@ #include "divetooltipitem.h" #include "divecartesianaxis.h" +#include "profilewidget2.h" #include "profile.h" #include "dive.h" #include "membuffer.h" @@ -180,6 +181,9 @@ void ToolTipItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { persistPos(); QGraphicsPathItem::mouseReleaseEvent(event); + Q_FOREACH (QGraphicsItem *item, oldSelection) { + item->setSelected(true); + } } void ToolTipItem::persistPos() @@ -231,3 +235,10 @@ void ToolTipItem::refresh(const QPointF &pos) addToolTip(item->toolTip()); } } + +void ToolTipItem::mousePressEvent(QGraphicsSceneMouseEvent *event) +{ + oldSelection = scene()->selectedItems(); + scene()->clearSelection(); + QGraphicsItem::mousePressEvent(event); +} |