From 354acb0fe62917291ce5c26f4d6696c858f78d49 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Wed, 29 Jan 2014 10:53:40 -0200 Subject: Show gradient factor. The gradient factor is shown with this patch, but the correct position should still be adjusted. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/profile/diveprofileitem.cpp | 12 ++++++++++++ qt-ui/profile/diveprofileitem.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/qt-ui/profile/diveprofileitem.cpp b/qt-ui/profile/diveprofileitem.cpp index d72a83834..c3be684c7 100644 --- a/qt-ui/profile/diveprofileitem.cpp +++ b/qt-ui/profile/diveprofileitem.cpp @@ -370,6 +370,14 @@ void DiveGasPressureItem::paint(QPainter* painter, const QStyleOptionGraphicsIte } } +DiveCalculatedCeiling::DiveCalculatedCeiling() +{ + gradientFactor = new DiveTextItem(this); + gradientFactor->setY(0); + gradientFactor->setBrush(getColor(PRESSURE_TEXT)); + gradientFactor->setAlignment(Qt::AlignHCenter | Qt::AlignBottom); +} + void DiveCalculatedCeiling::modelDataChanged() { // We don't have enougth data to calculate things, quit. @@ -392,6 +400,10 @@ void DiveCalculatedCeiling::modelDataChanged() pat.setColorAt(1, getColor(CALC_CEILING_DEEP)); setPen(QPen(QBrush(Qt::NoBrush),0)); setBrush(pat); + + gradientFactor->setX(poly.boundingRect().width()/2); + gradientFactor->setText(QString("GF %1/%2").arg(prefs.gflow).arg(prefs.gfhigh)); + qDebug() << gradientFactor->pos() << mapToScene(gradientFactor->pos()); } void DiveCalculatedCeiling::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) diff --git a/qt-ui/profile/diveprofileitem.h b/qt-ui/profile/diveprofileitem.h index 41bb05329..980b99213 100644 --- a/qt-ui/profile/diveprofileitem.h +++ b/qt-ui/profile/diveprofileitem.h @@ -90,9 +90,12 @@ class DiveCalculatedCeiling : public AbstractProfilePolygonItem{ Q_OBJECT public: + DiveCalculatedCeiling(); virtual void modelDataChanged(); virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0); virtual void preferencesChanged(); +private: + DiveTextItem *gradientFactor; }; class DiveReportedCeiling : public AbstractProfilePolygonItem{ -- cgit v1.2.3-70-g09d2