mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
statistics: replace chart title by QSG node
This one is trivial, since everything is there already: Replace the QGraphicsSimpleTextItem with a ChartTextItem. Only few functions have to be renamed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
2480d3b7e0
commit
01accbfa3e
2 changed files with 7 additions and 8 deletions
|
|
@ -211,7 +211,7 @@ void StatsView::plotAreaChanged(const QSizeF &s)
|
||||||
const double minSize = 30.0;
|
const double minSize = 30.0;
|
||||||
|
|
||||||
if (title)
|
if (title)
|
||||||
top += title->boundingRect().height() + titleBorder;
|
top += title->getRect().height() + titleBorder;
|
||||||
// Currently, we only have either none, or an x- and a y-axis
|
// Currently, we only have either none, or an x- and a y-axis
|
||||||
std::pair<double,double> horizontalSpace{ 0.0, 0.0 };
|
std::pair<double,double> horizontalSpace{ 0.0, 0.0 };
|
||||||
if (xAxis) {
|
if (xAxis) {
|
||||||
|
|
@ -310,17 +310,16 @@ void StatsView::setTitle(const QString &s)
|
||||||
title.reset();
|
title.reset();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
title = createItemPtr<QGraphicsSimpleTextItem>(&scene, s);
|
title = createChartItem<ChartTextItem>(ChartZValue::Legend, titleFont, s);
|
||||||
title->setFont(titleFont);
|
title->setColor(darkLabelColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatsView::updateTitlePos()
|
void StatsView::updateTitlePos()
|
||||||
{
|
{
|
||||||
if (!title)
|
if (!title)
|
||||||
return;
|
return;
|
||||||
QRectF rect = scene.sceneRect();
|
title->setPos(QPointF(round(sceneBorder + (boundingRect().width() - title->getRect().width()) / 2.0),
|
||||||
title->setPos(sceneBorder + (rect.width() - title->boundingRect().width()) / 2.0,
|
round(sceneBorder)));
|
||||||
sceneBorder);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class... Args>
|
template <typename T, class... Args>
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,10 @@ struct StatsBin;
|
||||||
struct StatsState;
|
struct StatsState;
|
||||||
struct StatsVariable;
|
struct StatsVariable;
|
||||||
|
|
||||||
class QGraphicsSimpleTextItem;
|
|
||||||
class StatsSeries;
|
class StatsSeries;
|
||||||
class CategoryAxis;
|
class CategoryAxis;
|
||||||
class ChartItem;
|
class ChartItem;
|
||||||
|
class ChartTextItem;
|
||||||
class CountAxis;
|
class CountAxis;
|
||||||
class HistogramAxis;
|
class HistogramAxis;
|
||||||
class HistogramMarker;
|
class HistogramMarker;
|
||||||
|
|
@ -130,7 +130,7 @@ private:
|
||||||
std::unique_ptr<Legend> legend;
|
std::unique_ptr<Legend> legend;
|
||||||
std::vector<std::unique_ptr<QuartileMarker>> quartileMarkers;
|
std::vector<std::unique_ptr<QuartileMarker>> quartileMarkers;
|
||||||
std::vector<std::unique_ptr<HistogramMarker>> histogramMarkers;
|
std::vector<std::unique_ptr<HistogramMarker>> histogramMarkers;
|
||||||
std::unique_ptr<QGraphicsSimpleTextItem> title;
|
std::unique_ptr<ChartTextItem> title;
|
||||||
std::unique_ptr<RegressionItem> regressionItem;
|
std::unique_ptr<RegressionItem> regressionItem;
|
||||||
StatsSeries *highlightedSeries;
|
StatsSeries *highlightedSeries;
|
||||||
StatsAxis *xAxis, *yAxis;
|
StatsAxis *xAxis, *yAxis;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue