summaryrefslogtreecommitdiffstats
path: root/stats/statsview.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-01-18 12:47:24 +0100
committerGravatar bstoeger <32835590+bstoeger@users.noreply.github.com>2021-01-20 08:47:18 +0100
commit01accbfa3e478062aec5afd14a05c93e0c189510 (patch)
treeac54d8b65d2b959cd682a87ec16cb58cab41199c /stats/statsview.cpp
parent2480d3b7e0280e34377c2cd1840c0a7770bf18ef (diff)
downloadsubsurface-01accbfa3e478062aec5afd14a05c93e0c189510.tar.gz
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>
Diffstat (limited to 'stats/statsview.cpp')
-rw-r--r--stats/statsview.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/stats/statsview.cpp b/stats/statsview.cpp
index 5acf3ecaf..efb530e45 100644
--- a/stats/statsview.cpp
+++ b/stats/statsview.cpp
@@ -211,7 +211,7 @@ void StatsView::plotAreaChanged(const QSizeF &s)
const double minSize = 30.0;
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
std::pair<double,double> horizontalSpace{ 0.0, 0.0 };
if (xAxis) {
@@ -310,17 +310,16 @@ void StatsView::setTitle(const QString &s)
title.reset();
return;
}
- title = createItemPtr<QGraphicsSimpleTextItem>(&scene, s);
- title->setFont(titleFont);
+ title = createChartItem<ChartTextItem>(ChartZValue::Legend, titleFont, s);
+ title->setColor(darkLabelColor);
}
void StatsView::updateTitlePos()
{
if (!title)
return;
- QRectF rect = scene.sceneRect();
- title->setPos(sceneBorder + (rect.width() - title->boundingRect().width()) / 2.0,
- sceneBorder);
+ title->setPos(QPointF(round(sceneBorder + (boundingRect().width() - title->getRect().width()) / 2.0),
+ round(sceneBorder)));
}
template <typename T, class... Args>