Make red ceiling work

The existing code for toggling the DC reported ceiling in red or "surface
color" clearly had never been tested.

This seems to create a reasonably attractive implementation - not exactly
what we had in the past, but good enough.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-04-14 22:52:22 -07:00
parent a3aacfc6c2
commit e5967dd193
4 changed files with 12 additions and 3 deletions

View file

@ -581,8 +581,14 @@ void DiveReportedCeiling::modelDataChanged(const QModelIndex &topLeft, const QMo
}
setPolygon(p);
QLinearGradient pat(0, p.boundingRect().top(), 0, p.boundingRect().bottom());
pat.setColorAt(0, getColor(CEILING_SHALLOW));
pat.setColorAt(1, getColor(CEILING_DEEP));
// does the user want the ceiling in "surface color" or in red?
if (prefs.profile_red_ceiling) {
pat.setColorAt(0, getColor(CEILING_SHALLOW));
pat.setColorAt(1, getColor(CEILING_DEEP));
} else {
pat.setColorAt(0, getColor(BACKGROUND_TRANS));
pat.setColorAt(1, getColor(BACKGROUND_TRANS));
}
setPen(QPen(QBrush(Qt::NoBrush), 0));
setBrush(pat);
}
@ -605,7 +611,7 @@ void DiveReportedCeiling::preferencesChanged()
{
QSettings s;
s.beginGroup("TecDetails");
setVisible(s.value("redceiling").toBool());
setVisible(s.value("dcceiling").toBool());
}
void DiveReportedCeiling::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)