diff options
-rw-r--r-- | qt-ui/diveplanner.cpp | 15 | ||||
-rw-r--r-- | qt-ui/diveplanner.h | 3 |
2 files changed, 17 insertions, 1 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index 90d677177..a22efb200 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -16,7 +16,8 @@ DivePlanner::DivePlanner(QWidget* parent): QGraphicsView(parent) void DivePlanner::mouseDoubleClickEvent(QMouseEvent* event) { - QGraphicsEllipseItem *item = new QGraphicsEllipseItem(-10,-10,20,20); + QGraphicsEllipseItem *item = new QGraphicsEllipseItem(-5,-5,10,10); + item->setFlag(QGraphicsItem::ItemIgnoresTransformations); QPointF mappedPos = mapToScene(event->pos()); item->setPos( mappedPos ); @@ -52,3 +53,15 @@ void DivePlanner::create_deco_stop() lines << item; } +void DivePlanner::resizeEvent(QResizeEvent* event) +{ + QGraphicsView::resizeEvent(event); + fitInView(sceneRect(), Qt::KeepAspectRatio); +} + +void DivePlanner::showEvent(QShowEvent* event) +{ + QGraphicsView::showEvent(event); + fitInView(sceneRect(), Qt::KeepAspectRatio); +} + diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h index fc9575cfa..682c56ae4 100644 --- a/qt-ui/diveplanner.h +++ b/qt-ui/diveplanner.h @@ -10,6 +10,9 @@ public: static DivePlanner *instance(); protected: virtual void mouseDoubleClickEvent(QMouseEvent* event); + virtual void showEvent(QShowEvent* event); + virtual void resizeEvent(QResizeEvent* event); + void clear_generated_deco(); void create_deco_stop(); |