diveprofileitem.cpp improvements

* Initialize/construct all variable members in constructor list.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Boris Barbulovski 2014-02-09 18:54:25 +01:00 committed by Dirk Hohndel
parent 38f0104d10
commit 6a6fe045b4
2 changed files with 8 additions and 5 deletions

View file

@ -100,6 +100,11 @@ void AbstractProfilePolygonItem::modelDataChanged(const QModelIndex& topLeft, co
texts.clear(); texts.clear();
} }
DiveProfileItem::DiveProfileItem() : show_reported_ceiling(0), reported_ceiling_in_red(0)
{
}
void DiveProfileItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) { void DiveProfileItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) {
Q_UNUSED(widget); Q_UNUSED(widget);
@ -383,9 +388,8 @@ void DiveGasPressureItem::paint(QPainter* painter, const QStyleOptionGraphicsIte
} }
} }
DiveCalculatedCeiling::DiveCalculatedCeiling() DiveCalculatedCeiling::DiveCalculatedCeiling() : is3mIncrement(false), gradientFactor(new DiveTextItem(this))
{ {
gradientFactor = new DiveTextItem(this);
gradientFactor->setY(0); gradientFactor->setY(0);
gradientFactor->setBrush(getColor(PRESSURE_TEXT)); gradientFactor->setBrush(getColor(PRESSURE_TEXT));
gradientFactor->setAlignment(Qt::AlignHCenter | Qt::AlignBottom); gradientFactor->setAlignment(Qt::AlignHCenter | Qt::AlignBottom);
@ -489,12 +493,10 @@ void DiveReportedCeiling::paint(QPainter* painter, const QStyleOptionGraphicsIte
QGraphicsPolygonItem::paint(painter, option, widget); QGraphicsPolygonItem::paint(painter, option, widget);
} }
MeanDepthLine::MeanDepthLine() MeanDepthLine::MeanDepthLine() : meanDepth(0), leftText(new DiveTextItem(this)), rightText(new DiveTextItem(this))
{ {
leftText = new DiveTextItem(this);
leftText->setAlignment(Qt::AlignRight | Qt::AlignBottom); leftText->setAlignment(Qt::AlignRight | Qt::AlignBottom);
leftText->setBrush(getColor(MEAN_DEPTH)); leftText->setBrush(getColor(MEAN_DEPTH));
rightText = new DiveTextItem(this);
rightText->setAlignment(Qt::AlignLeft | Qt::AlignBottom); rightText->setAlignment(Qt::AlignLeft | Qt::AlignBottom);
rightText->setBrush(getColor(MEAN_DEPTH)); rightText->setBrush(getColor(MEAN_DEPTH));
leftText->setPos(0, 0); leftText->setPos(0, 0);

View file

@ -66,6 +66,7 @@ class DiveProfileItem : public AbstractProfilePolygonItem{
Q_OBJECT Q_OBJECT
public: public:
DiveProfileItem();
virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0); virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
virtual void modelDataChanged(const QModelIndex& topLeft = QModelIndex(), const QModelIndex& bottomRight = QModelIndex()); virtual void modelDataChanged(const QModelIndex& topLeft = QModelIndex(), const QModelIndex& bottomRight = QModelIndex());
virtual void preferencesChanged(); virtual void preferencesChanged();