mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
statistics: replace PieSeries by QSG nodes
Since there are no disk-segment QSG primitives (one could draw a triangle fan, but that doesn't seem optimal), this draws into a pixmap and blits that as a QSG node. Since this is the only series without axis, it needs a function that returns the size of the plot area. This didn't exist, so add it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
b07a7fe5f1
commit
b068b2b0e7
6 changed files with 92 additions and 50 deletions
|
@ -10,9 +10,9 @@
|
|||
#include <QString>
|
||||
|
||||
struct InformationBox;
|
||||
class QGraphicsEllipseItem;
|
||||
struct ChartPieItem;
|
||||
struct ChartTextItem;
|
||||
class QGraphicsScene;
|
||||
class QGraphicsSimpleTextItem;
|
||||
class QRectF;
|
||||
|
||||
class PieSeries : public StatsSeries {
|
||||
|
@ -34,20 +34,20 @@ private:
|
|||
// Get item under mouse pointer, or -1 if none
|
||||
int getItemUnderMouse(const QPointF &f) const;
|
||||
|
||||
std::unique_ptr<ChartPieItem> item;
|
||||
QString categoryName;
|
||||
std::vector<QString> makeInfo(int idx) const;
|
||||
|
||||
struct Item {
|
||||
std::unique_ptr<QGraphicsEllipseItem> item;
|
||||
std::unique_ptr<QGraphicsSimpleTextItem> innerLabel, outerLabel;
|
||||
std::unique_ptr<ChartTextItem> innerLabel, outerLabel;
|
||||
QString name;
|
||||
double angleTo; // In fraction of total
|
||||
double angleFrom, angleTo; // In fraction of total
|
||||
int count;
|
||||
QPointF innerLabelPos, outerLabelPos; // With respect to a (-1, -1)-(1, 1) rectangle.
|
||||
Item(QGraphicsScene *scene, const QString &name, int from, int count, int totalCount,
|
||||
Item(StatsView &view, const QString &name, int from, int count, int totalCount,
|
||||
int bin_nr, int numBins, bool labels);
|
||||
void updatePositions(const QRectF &rect, const QPointF ¢er, double radius);
|
||||
void highlight(int bin_nr, bool highlight, int numBins);
|
||||
void updatePositions(const QPointF ¢er, double radius);
|
||||
void highlight(ChartPieItem &item, int bin_nr, bool highlight, int numBins);
|
||||
};
|
||||
std::vector<Item> items;
|
||||
int totalCount;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue