mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
statistics: turn infobox into a QSGNode
A small step in converting from QGraphicsScene to QQuickItem. This is the second item to be converted (after the legend) and for now items are drawn in order of creation, which means that the infobox is on top of the legend. This will have to be made deterministic in follow-up commits. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
d7878dad36
commit
785d5189f6
8 changed files with 53 additions and 58 deletions
|
|
@ -52,6 +52,9 @@ public:
|
|||
QSizeF size() const;
|
||||
void addQSGNode(QSGNode *node, int z); // Must only be called in render thread!
|
||||
void unregisterChartItem(const ChartItem *item);
|
||||
template <typename T, class... Args>
|
||||
std::unique_ptr<T> createChartItem(Args&&... args);
|
||||
|
||||
private slots:
|
||||
void replotIfVisible();
|
||||
private:
|
||||
|
|
@ -109,9 +112,6 @@ private:
|
|||
template <typename T, class... Args>
|
||||
T *createAxis(const QString &title, Args&&... args);
|
||||
|
||||
template <typename T, class... Args>
|
||||
std::unique_ptr<T> createChartItem(Args&&... args);
|
||||
|
||||
template<typename T>
|
||||
CategoryAxis *createCategoryAxis(const QString &title, const StatsBinner &binner,
|
||||
const std::vector<T> &bins, bool isHorizontal);
|
||||
|
|
@ -179,4 +179,14 @@ private:
|
|||
QSGImageNode *rootNode;
|
||||
};
|
||||
|
||||
// This implementation detail must be known to users of the class.
|
||||
// Perhaps move it into a statsview_impl.h file.
|
||||
template <typename T, class... Args>
|
||||
std::unique_ptr<T> StatsView::createChartItem(Args&&... args)
|
||||
{
|
||||
std::unique_ptr<T> res(new T(*this, std::forward<Args>(args)...));
|
||||
items.push_back(res.get());
|
||||
return res;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue