Make it possible to hide some of the grid lines.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2014-02-15 22:54:41 -02:00 committed by Dirk Hohndel
parent 4699363a9e
commit 44a72b805c
3 changed files with 20 additions and 8 deletions

View file

@ -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<typename T> void emptyList( QList<T*>& list, double steps){ template<typename T> void emptyList( QList<T*>& list, double steps){
if (!list.isEmpty() && list.size() > steps) { if (!list.isEmpty() && list.size() > steps) {
while (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); item->setVisible(textVisibility);
} Q_FOREACH(DiveLineItem *item, lines)
item->setVisible(lineVisibility);
} }
void DiveCartesianAxis::animateChangeLine(const QLineF& newLine) void DiveCartesianAxis::animateChangeLine(const QLineF& newLine)

View file

@ -37,6 +37,7 @@ public:
void setTextColor(const QColor& color); void setTextColor(const QColor& color);
void animateChangeLine(const QLineF& newLine); void animateChangeLine(const QLineF& newLine);
void setTextVisible(bool arg1); void setTextVisible(bool arg1);
void setLinesVisible(bool arg1);
void setLineSize(qreal lineSize); void setLineSize(qreal lineSize);
int unitSystem; int unitSystem;
public slots: public slots:
@ -57,6 +58,7 @@ protected:
double tick_size; double tick_size;
QColor textColor; QColor textColor;
bool textVisibility; bool textVisibility;
bool lineVisibility;
double labelScale; double labelScale;
qreal line_size; qreal line_size;
}; };

View file

@ -176,14 +176,12 @@ void ProfileWidget2::setupItemOnScene()
CREATE_PP_GAS( po2GasItem, PO2, PO2, PO2_ALERT, "po2threshold", "po2graph"); CREATE_PP_GAS( po2GasItem, PO2, PO2, PO2_ALERT, "po2threshold", "po2graph");
#undef CREATE_PP_GAS #undef CREATE_PP_GAS
#ifdef QT_NO_DEBUG // Some debug helpers.
temperatureAxis->setTextVisible(false); temperatureAxis->setTextVisible(false);
temperatureAxis->setLinesVisible(false);
cylinderPressureAxis->setTextVisible(false); cylinderPressureAxis->setTextVisible(false);
#else cylinderPressureAxis->setLinesVisible(false);
temperatureAxis->setTextVisible(true); timeAxis->setLinesVisible(true);
cylinderPressureAxis->setTextVisible(true); profileYAxis->setLinesVisible(true);
#endif
} }
void ProfileWidget2::setupItemSizes() void ProfileWidget2::setupItemSizes()