mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
b5aac29cea
To enable rudimentary theming, collect all colors in a new theme class. The class has to be passed down to the various items. In general the items save a reference to the them in the constructor. Alternatively, they might also just query the StatsView everytime they need to access a color. For now, it's hard the say what is preferred: a reference per item or a function call per invokation? Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
31 lines
774 B
C++
31 lines
774 B
C++
// SPDX-License-Identifier: GPL-2.0
|
|
#include "quartilemarker.h"
|
|
#include "statsaxis.h"
|
|
#include "statscolors.h"
|
|
#include "statsview.h"
|
|
#include "zvalues.h"
|
|
|
|
static const double quartileMarkerSize = 15.0;
|
|
|
|
QuartileMarker::QuartileMarker(StatsView &view, double pos, double value, StatsAxis *xAxis, StatsAxis *yAxis) :
|
|
ChartLineItem(view, ChartZValue::ChartFeatures, view.getCurrentTheme().quartileMarkerColor, 2.0),
|
|
xAxis(xAxis), yAxis(yAxis),
|
|
pos(pos),
|
|
value(value)
|
|
{
|
|
updatePosition();
|
|
}
|
|
|
|
QuartileMarker::~QuartileMarker()
|
|
{
|
|
}
|
|
|
|
void QuartileMarker::updatePosition()
|
|
{
|
|
if (!xAxis || !yAxis)
|
|
return;
|
|
double x = xAxis->toScreen(pos);
|
|
double y = yAxis->toScreen(value);
|
|
setLine(QPointF(x - quartileMarkerSize / 2.0, y),
|
|
QPointF(x + quartileMarkerSize / 2.0, y));
|
|
}
|