Make the colors of the texts be prettier.

Just fixes some colors of the texts on the canvas.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2014-01-19 20:14:48 -02:00 committed by Dirk Hohndel
parent cd3867d46a
commit edad8712b9
3 changed files with 31 additions and 3 deletions

View file

@ -10,6 +10,13 @@
#include <QGraphicsView>
#include <QStyleOption>
static QPen gridPen(){
QPen pen;
pen.setColor(getColor(TIME_GRID));
pen.setWidth(2);
pen.setCosmetic(true);
return pen;
}
void DiveCartesianAxis::setMaximum(double maximum)
{
max = maximum;
@ -29,7 +36,7 @@ void DiveCartesianAxis::setTextColor(const QColor& color)
DiveCartesianAxis::DiveCartesianAxis() : orientation(LeftToRight), showTicks(true), showText(true)
{
setPen(gridPen());
}
DiveCartesianAxis::~DiveCartesianAxis()
@ -42,6 +49,11 @@ void DiveCartesianAxis::setOrientation(Orientation o)
orientation = o;
}
QColor DiveCartesianAxis::colorForValue(double value)
{
return QColor(Qt::black);
}
void DiveCartesianAxis::updateTicks()
{
QLineF m = line();
@ -108,6 +120,7 @@ void DiveCartesianAxis::updateTicks()
label = new DiveTextItem(this);
label->setText(textForValue(currValue));
label->setBrush(QBrush(textColor));
label->setBrush(colorForValue(currValue));
}
labels.push_back(label);
if (orientation == RightToLeft || orientation == LeftToRight) {
@ -223,6 +236,18 @@ QString DepthAxis::textForValue(double value)
return get_depth_string(value, false, false);
}
QColor DepthAxis::colorForValue(double value)
{
Q_UNUSED(value);
return QColor(Qt::red);
}
QColor TimeAxis::colorForValue(double value)
{
Q_UNUSED(value);
return QColor(Qt::blue);
}
QString TimeAxis::textForValue(double value)
{
return QString::number(value / 60);
@ -303,6 +328,7 @@ void DiveCartesianPlane::setup()
line->setLine(0, 0, horizontalSize, 0);
line->setPos(left,leftAxis->posAtValue(i));
line->setZValue(-1);
line->setPen(gridPen());
horizontalLines.push_back(line);
scene()->addItem(line);
}
@ -312,6 +338,7 @@ void DiveCartesianPlane::setup()
line->setLine(0, 0, 0, verticalSize);
line->setPos(bottomAxis->posAtValue(i), top);
line->setZValue(-1);
line->setPen(gridPen());
verticalLines.push_back(line);
scene()->addItem(line);
}

View file

@ -36,7 +36,7 @@ signals:
void sizeChanged();
protected:
virtual QString textForValue(double value);
virtual QColor colorForValue(double value);
Orientation orientation;
QList<DiveTextItem*> labels;
double min;
@ -51,11 +51,13 @@ protected:
class DepthAxis : public DiveCartesianAxis {
protected:
QString textForValue(double value);
QColor colorForValue(double value);
};
class TimeAxis : public DiveCartesianAxis {
protected:
QString textForValue(double value);
QColor colorForValue(double value);
};
class TemperatureAxis : public DiveCartesianAxis{

View file

@ -362,7 +362,6 @@ QColor ProfileGraphicsView::getColor(const color_indice_t i)
void ProfileGraphicsView::plot(struct dive *d, bool forceRedraw)
{
return;
struct divecomputer *dc = NULL;
if (d)