mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
cd3867d46a
commit
edad8712b9
3 changed files with 31 additions and 3 deletions
|
@ -10,6 +10,13 @@
|
||||||
#include <QGraphicsView>
|
#include <QGraphicsView>
|
||||||
#include <QStyleOption>
|
#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)
|
void DiveCartesianAxis::setMaximum(double maximum)
|
||||||
{
|
{
|
||||||
max = maximum;
|
max = maximum;
|
||||||
|
@ -29,7 +36,7 @@ void DiveCartesianAxis::setTextColor(const QColor& color)
|
||||||
|
|
||||||
DiveCartesianAxis::DiveCartesianAxis() : orientation(LeftToRight), showTicks(true), showText(true)
|
DiveCartesianAxis::DiveCartesianAxis() : orientation(LeftToRight), showTicks(true), showText(true)
|
||||||
{
|
{
|
||||||
|
setPen(gridPen());
|
||||||
}
|
}
|
||||||
|
|
||||||
DiveCartesianAxis::~DiveCartesianAxis()
|
DiveCartesianAxis::~DiveCartesianAxis()
|
||||||
|
@ -42,6 +49,11 @@ void DiveCartesianAxis::setOrientation(Orientation o)
|
||||||
orientation = o;
|
orientation = o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QColor DiveCartesianAxis::colorForValue(double value)
|
||||||
|
{
|
||||||
|
return QColor(Qt::black);
|
||||||
|
}
|
||||||
|
|
||||||
void DiveCartesianAxis::updateTicks()
|
void DiveCartesianAxis::updateTicks()
|
||||||
{
|
{
|
||||||
QLineF m = line();
|
QLineF m = line();
|
||||||
|
@ -108,6 +120,7 @@ void DiveCartesianAxis::updateTicks()
|
||||||
label = new DiveTextItem(this);
|
label = new DiveTextItem(this);
|
||||||
label->setText(textForValue(currValue));
|
label->setText(textForValue(currValue));
|
||||||
label->setBrush(QBrush(textColor));
|
label->setBrush(QBrush(textColor));
|
||||||
|
label->setBrush(colorForValue(currValue));
|
||||||
}
|
}
|
||||||
labels.push_back(label);
|
labels.push_back(label);
|
||||||
if (orientation == RightToLeft || orientation == LeftToRight) {
|
if (orientation == RightToLeft || orientation == LeftToRight) {
|
||||||
|
@ -223,6 +236,18 @@ QString DepthAxis::textForValue(double value)
|
||||||
return get_depth_string(value, false, false);
|
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)
|
QString TimeAxis::textForValue(double value)
|
||||||
{
|
{
|
||||||
return QString::number(value / 60);
|
return QString::number(value / 60);
|
||||||
|
@ -303,6 +328,7 @@ void DiveCartesianPlane::setup()
|
||||||
line->setLine(0, 0, horizontalSize, 0);
|
line->setLine(0, 0, horizontalSize, 0);
|
||||||
line->setPos(left,leftAxis->posAtValue(i));
|
line->setPos(left,leftAxis->posAtValue(i));
|
||||||
line->setZValue(-1);
|
line->setZValue(-1);
|
||||||
|
line->setPen(gridPen());
|
||||||
horizontalLines.push_back(line);
|
horizontalLines.push_back(line);
|
||||||
scene()->addItem(line);
|
scene()->addItem(line);
|
||||||
}
|
}
|
||||||
|
@ -312,6 +338,7 @@ void DiveCartesianPlane::setup()
|
||||||
line->setLine(0, 0, 0, verticalSize);
|
line->setLine(0, 0, 0, verticalSize);
|
||||||
line->setPos(bottomAxis->posAtValue(i), top);
|
line->setPos(bottomAxis->posAtValue(i), top);
|
||||||
line->setZValue(-1);
|
line->setZValue(-1);
|
||||||
|
line->setPen(gridPen());
|
||||||
verticalLines.push_back(line);
|
verticalLines.push_back(line);
|
||||||
scene()->addItem(line);
|
scene()->addItem(line);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ signals:
|
||||||
void sizeChanged();
|
void sizeChanged();
|
||||||
protected:
|
protected:
|
||||||
virtual QString textForValue(double value);
|
virtual QString textForValue(double value);
|
||||||
|
virtual QColor colorForValue(double value);
|
||||||
Orientation orientation;
|
Orientation orientation;
|
||||||
QList<DiveTextItem*> labels;
|
QList<DiveTextItem*> labels;
|
||||||
double min;
|
double min;
|
||||||
|
@ -51,11 +51,13 @@ protected:
|
||||||
class DepthAxis : public DiveCartesianAxis {
|
class DepthAxis : public DiveCartesianAxis {
|
||||||
protected:
|
protected:
|
||||||
QString textForValue(double value);
|
QString textForValue(double value);
|
||||||
|
QColor colorForValue(double value);
|
||||||
};
|
};
|
||||||
|
|
||||||
class TimeAxis : public DiveCartesianAxis {
|
class TimeAxis : public DiveCartesianAxis {
|
||||||
protected:
|
protected:
|
||||||
QString textForValue(double value);
|
QString textForValue(double value);
|
||||||
|
QColor colorForValue(double value);
|
||||||
};
|
};
|
||||||
|
|
||||||
class TemperatureAxis : public DiveCartesianAxis{
|
class TemperatureAxis : public DiveCartesianAxis{
|
||||||
|
|
|
@ -362,7 +362,6 @@ QColor ProfileGraphicsView::getColor(const color_indice_t i)
|
||||||
|
|
||||||
void ProfileGraphicsView::plot(struct dive *d, bool forceRedraw)
|
void ProfileGraphicsView::plot(struct dive *d, bool forceRedraw)
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
struct divecomputer *dc = NULL;
|
struct divecomputer *dc = NULL;
|
||||||
|
|
||||||
if (d)
|
if (d)
|
||||||
|
|
Loading…
Add table
Reference in a new issue