mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
2008857660
commit
b42e19e36b
4 changed files with 200 additions and 70 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue