From 44a72b805cffd64925e7bbcc44d7f4a8a675e82f Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Sat, 15 Feb 2014 22:54:41 -0200 Subject: Make it possible to hide some of the grid lines. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/profile/divecartesianaxis.cpp | 16 ++++++++++++++-- qt-ui/profile/divecartesianaxis.h | 2 ++ qt-ui/profile/profilewidget2.cpp | 10 ++++------ 3 files changed, 20 insertions(+), 8 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/profile/divecartesianaxis.cpp b/qt-ui/profile/divecartesianaxis.cpp index 705e06a1c..bb77a341d 100644 --- a/qt-ui/profile/divecartesianaxis.cpp +++ b/qt-ui/profile/divecartesianaxis.cpp @@ -101,6 +101,17 @@ void DiveCartesianAxis::setTextVisible(bool arg1) } } +void DiveCartesianAxis::setLinesVisible(bool arg1) +{ + if(lineVisibility == arg1){ + return; + } + lineVisibility = arg1; + Q_FOREACH(DiveLineItem *item, lines){ + item->setVisible(lineVisibility ); + } +} + template void emptyList( QList& list, double steps){ if (!list.isEmpty() && list.size() > steps) { while (list.size() > steps) { @@ -223,9 +234,10 @@ void DiveCartesianAxis::updateTicks() } } - Q_FOREACH(DiveTextItem *item, labels){ + Q_FOREACH(DiveTextItem *item, labels) item->setVisible(textVisibility); - } + Q_FOREACH(DiveLineItem *item, lines) + item->setVisible(lineVisibility); } void DiveCartesianAxis::animateChangeLine(const QLineF& newLine) diff --git a/qt-ui/profile/divecartesianaxis.h b/qt-ui/profile/divecartesianaxis.h index 7db47ae9d..1bfb4b913 100644 --- a/qt-ui/profile/divecartesianaxis.h +++ b/qt-ui/profile/divecartesianaxis.h @@ -37,6 +37,7 @@ public: void setTextColor(const QColor& color); void animateChangeLine(const QLineF& newLine); void setTextVisible(bool arg1); + void setLinesVisible(bool arg1); void setLineSize(qreal lineSize); int unitSystem; public slots: @@ -57,6 +58,7 @@ protected: double tick_size; QColor textColor; bool textVisibility; + bool lineVisibility; double labelScale; qreal line_size; }; diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index ecaa3b170..06f1f6707 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -176,14 +176,12 @@ void ProfileWidget2::setupItemOnScene() CREATE_PP_GAS( po2GasItem, PO2, PO2, PO2_ALERT, "po2threshold", "po2graph"); #undef CREATE_PP_GAS -#ifdef QT_NO_DEBUG // Some debug helpers. temperatureAxis->setTextVisible(false); + temperatureAxis->setLinesVisible(false); cylinderPressureAxis->setTextVisible(false); -#else - temperatureAxis->setTextVisible(true); - cylinderPressureAxis->setTextVisible(true); -#endif - + cylinderPressureAxis->setLinesVisible(false); + timeAxis->setLinesVisible(true); + profileYAxis->setLinesVisible(true); } void ProfileWidget2::setupItemSizes() -- cgit v1.2.3-70-g09d2