diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2021-01-15 22:48:32 +0100 |
---|---|---|
committer | bstoeger <32835590+bstoeger@users.noreply.github.com> | 2021-01-20 08:47:18 +0100 |
commit | b42e19e36b4d80716059011581851c8600338cbb (patch) | |
tree | e752618c95a6ab4dcb980209800d3c3bbf292a0e /stats/barseries.h | |
parent | 20088576604a3159cc9891bcfea888c15b096a96 (diff) | |
download | subsurface-b42e19e36b4d80716059011581851c8600338cbb.tar.gz |
statistics: convert bar series to QSGNodes
To this end, two new ChartItems were added: A "bar" (a rectangle
with a border) and a "text" (multiple lines of text).
It turns out that the text on the bars now looks atrocious.
The reason appears to be that the antialiasing of the font-rendering
does not blend into the alpha channel, but into a supposed
background color? This will have to be investigated.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'stats/barseries.h')
-rw-r--r-- | stats/barseries.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/stats/barseries.h b/stats/barseries.h index 33a36395e..5655bc977 100644 --- a/stats/barseries.h +++ b/stats/barseries.h @@ -10,9 +10,11 @@ #include <memory> #include <vector> -#include <QGraphicsRectItem> +#include <QRectF> class QGraphicsScene; +class ChartBarItem; +class ChartTextItem; struct InformationBox; struct StatsVariable; @@ -80,17 +82,16 @@ private: // A label that is composed of multiple lines struct BarLabel { - std::vector<std::unique_ptr<QGraphicsSimpleTextItem>> items; - double totalWidth, totalHeight; // Size of the item + std::unique_ptr<ChartTextItem> item; bool isOutside; // Is shown outside of bar - BarLabel(QGraphicsScene *scene, const std::vector<QString> &labels, int bin_nr, int binCount); + BarLabel(StatsView &view, const std::vector<QString> &labels, int bin_nr, int binCount); void setVisible(bool visible); void updatePosition(bool horizontal, bool center, const QRectF &rect, int bin_nr, int binCount); void highlight(bool highlight, int bin_nr, int binCount); }; struct SubItem { - std::unique_ptr<QGraphicsRectItem> item; + std::unique_ptr<ChartBarItem> item; std::unique_ptr<BarLabel> label; double value_from; double value_to; @@ -107,7 +108,7 @@ private: const QString binName; StatsOperationResults res; int total; - Item(QGraphicsScene *scene, BarSeries *series, double lowerBound, double upperBound, + Item(BarSeries *series, double lowerBound, double upperBound, std::vector<SubItem> subitems, const QString &binName, const StatsOperationResults &res, int total, bool horizontal, bool stacked, int binCount); @@ -118,7 +119,6 @@ private: std::unique_ptr<InformationBox> information; std::vector<Item> items; - std::vector<BarLabel> barLabels; bool horizontal; bool stacked; QString categoryName; |