summaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/divetooltipitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/profile/divetooltipitem.cpp')
-rw-r--r--qt-ui/profile/divetooltipitem.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/qt-ui/profile/divetooltipitem.cpp b/qt-ui/profile/divetooltipitem.cpp
index 0e68685b9..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"
@@ -21,7 +22,7 @@ void ToolTipItem::addToolTip(const QString &toolTip, const QIcon &icon)
{
QGraphicsPixmapItem *iconItem = 0;
double yValue = title->boundingRect().height() + SPACING;
- Q_FOREACH(ToolTip t, toolTips) {
+ Q_FOREACH (ToolTip t, toolTips) {
yValue += t.second->boundingRect().height();
}
if (!icon.isNull()) {
@@ -39,7 +40,7 @@ void ToolTipItem::addToolTip(const QString &toolTip, const QIcon &icon)
void ToolTipItem::clear()
{
- Q_FOREACH(ToolTip t, toolTips) {
+ Q_FOREACH (ToolTip t, toolTips) {
delete t.first;
delete t.second;
}
@@ -96,7 +97,7 @@ void ToolTipItem::expand()
return;
double width = 0, height = title->boundingRect().height() + SPACING;
- Q_FOREACH(ToolTip t, toolTips) {
+ Q_FOREACH (ToolTip t, toolTips) {
if (t.second->boundingRect().width() > width)
width = t.second->boundingRect().width();
height += t.second->boundingRect().height();
@@ -180,6 +181,9 @@ void ToolTipItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
persistPos();
QGraphicsPathItem::mouseReleaseEvent(event);
+ Q_FOREACH (QGraphicsItem *item, oldSelection) {
+ item->setSelected(true);
+ }
}
void ToolTipItem::persistPos()
@@ -226,8 +230,15 @@ void ToolTipItem::refresh(const QPointF &pos)
free_buffer(&mb);
QList<QGraphicsItem *> items = scene()->items(pos, Qt::IntersectsItemShape, Qt::DescendingOrder, scene()->views().first()->transform());
- Q_FOREACH(QGraphicsItem * item, items) {
+ Q_FOREACH (QGraphicsItem *item, items) {
if (!item->toolTip().isEmpty())
addToolTip(item->toolTip());
}
}
+
+void ToolTipItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+ oldSelection = scene()->selectedItems();
+ scene()->clearSelection();
+ QGraphicsItem::mousePressEvent(event);
+}