mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
ea4d4ac020
commit
963178d3d4
2 changed files with 14 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
#include "divetooltipitem.h"
|
#include "divetooltipitem.h"
|
||||||
#include "divecartesianaxis.h"
|
#include "divecartesianaxis.h"
|
||||||
|
#include "profilewidget2.h"
|
||||||
#include "profile.h"
|
#include "profile.h"
|
||||||
#include "dive.h"
|
#include "dive.h"
|
||||||
#include "membuffer.h"
|
#include "membuffer.h"
|
||||||
|
@ -180,6 +181,9 @@ void ToolTipItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
persistPos();
|
persistPos();
|
||||||
QGraphicsPathItem::mouseReleaseEvent(event);
|
QGraphicsPathItem::mouseReleaseEvent(event);
|
||||||
|
Q_FOREACH (QGraphicsItem *item, oldSelection) {
|
||||||
|
item->setSelected(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToolTipItem::persistPos()
|
void ToolTipItem::persistPos()
|
||||||
|
@ -231,3 +235,10 @@ void ToolTipItem::refresh(const QPointF &pos)
|
||||||
addToolTip(item->toolTip());
|
addToolTip(item->toolTip());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ToolTipItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||||
|
{
|
||||||
|
oldSelection = scene()->selectedItems();
|
||||||
|
scene()->clearSelection();
|
||||||
|
QGraphicsItem::mousePressEvent(event);
|
||||||
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ public:
|
||||||
bool isExpanded() const;
|
bool isExpanded() const;
|
||||||
void persistPos();
|
void persistPos();
|
||||||
void readPos();
|
void readPos();
|
||||||
|
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
||||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
|
||||||
void setTimeAxis(DiveCartesianAxis *axis);
|
void setTimeAxis(DiveCartesianAxis *axis);
|
||||||
void setPlotInfo(const plot_info &plot);
|
void setPlotInfo(const plot_info &plot);
|
||||||
|
@ -64,6 +65,8 @@ private:
|
||||||
DiveCartesianAxis *timeAxis;
|
DiveCartesianAxis *timeAxis;
|
||||||
plot_info pInfo;
|
plot_info pInfo;
|
||||||
int lastTime;
|
int lastTime;
|
||||||
|
|
||||||
|
QList<QGraphicsItem*> oldSelection;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIVETOOLTIPITEM_H
|
#endif // DIVETOOLTIPITEM_H
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue