summaryrefslogtreecommitdiffstats
path: root/qt-ui/diveplanner.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-06-20 13:28:04 -0300
committerGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-06-20 13:28:04 -0300
commit364254ed36d98ebe61385ddd7d2062c0f7214df3 (patch)
treeded0af2284fbe33a5c5fb3818a4d808c977bf1ee /qt-ui/diveplanner.cpp
parentab6aea73c17a10bfb934ba74fcda59cb916f278d (diff)
downloadsubsurface-364254ed36d98ebe61385ddd7d2062c0f7214df3.tar.gz
Better handling of the scene size for the dive Plan
Better handling of the scene size for the dive plan, The scene can be resized and a transform will be applied, the handles will not resize however - they are 10x10px and that's it. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r--qt-ui/diveplanner.cpp15
1 files changed, 14 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);
+}
+