aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/diveplanner.cpp16
-rw-r--r--qt-ui/diveplanner.h3
2 files changed, 18 insertions, 1 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 3e107b10c..a7bd0af4c 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -363,6 +363,10 @@ bool DivePlannerGraphics::isPointOutOfBoundaries(const QPointF& point)
void DivePlannerGraphics::mousePressEvent(QMouseEvent* event)
{
+ if (event->modifiers()){
+ QGraphicsView::mousePressEvent(event);
+ }
+
QPointF mappedPos = mapToScene(event->pos());
Q_FOREACH(QGraphicsItem *item, scene()->items(mappedPos, Qt::IntersectsItemBoundingRect, Qt::AscendingOrder, transform())){
if (DiveHandler *h = qgraphicsitem_cast<DiveHandler*>(item)) {
@@ -371,7 +375,6 @@ void DivePlannerGraphics::mousePressEvent(QMouseEvent* event)
originalHandlerPos = activeDraggedHandler->pos();
}
}
- QGraphicsView::mousePressEvent(event);
}
void DivePlannerGraphics::mouseReleaseEvent(QMouseEvent* event)
@@ -406,10 +409,21 @@ DiveHandler::DiveHandler(): QGraphicsEllipseItem(), from(0), to(0)
{
setRect(-5,-5,10,10);
setFlag(QGraphicsItem::ItemIgnoresTransformations);
+ setFlag(QGraphicsItem::ItemIsSelectable);
setBrush(Qt::white);
setZValue(2);
}
+void DiveHandler::mousePressEvent(QGraphicsSceneMouseEvent* event)
+{
+ if (event->modifiers().testFlag(Qt::ControlModifier)){
+ setSelected(true);
+ }
+ // mousePressEvent 'grabs' the mouse and keyboard, annoying.
+ ungrabMouse();
+ ungrabKeyboard();
+}
+
void Ruler::setMaximum(double maximum)
{
max = maximum;
diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h
index 547e38727..9c8a2b7a6 100644
--- a/qt-ui/diveplanner.h
+++ b/qt-ui/diveplanner.h
@@ -28,6 +28,9 @@ public:
QGraphicsLineItem *to;
int sec;
int mm;
+protected:
+ void mousePressEvent(QGraphicsSceneMouseEvent* event);
+
};
class Ruler : public QGraphicsLineItem{