diff options
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r-- | qt-ui/diveplanner.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index 115aa5f7a..0ee87fea5 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -21,9 +21,16 @@ DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent) setBackgroundBrush(profile_color[BACKGROUND].at(0)); setMouseTracking(true); setScene(new QGraphicsScene()); - scene()->setSceneRect(0,0,200,200); + scene()->setSceneRect(0,0,1920,1080); + + QRectF r = scene()->sceneRect(); + + verticalLine = new QGraphicsLineItem( + fromPercent(0, Qt::Horizontal), + fromPercent(0, Qt::Vertical), + fromPercent(0, Qt::Horizontal), + fromPercent(100, Qt::Vertical)); - verticalLine = new QGraphicsLineItem(0,0,0, 200); verticalLine->setPen(QPen(Qt::DotLine)); scene()->addItem(verticalLine); @@ -88,6 +95,13 @@ DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent) setRenderHint(QPainter::Antialiasing); } +qreal DivePlannerGraphics::fromPercent(qreal percent, Qt::Orientation orientation) +{ + qreal total = orientation == Qt::Horizontal ? sceneRect().width() : sceneRect().height(); + qreal result = (total * percent) / 100; + return result; +} + void DivePlannerGraphics::cancelClicked() { qDebug() << "clicked"; @@ -133,10 +147,6 @@ void DivePlannerGraphics::mouseDoubleClickEvent(QMouseEvent* event) createDecoStops(); } -void DivePlannerGraphics::clearGeneratedDeco() -{ -} - void DivePlannerGraphics::createDecoStops() { qDeleteAll(lines); |