summaryrefslogtreecommitdiffstats
path: root/stats/statsview.h
diff options
context:
space:
mode:
Diffstat (limited to 'stats/statsview.h')
-rw-r--r--stats/statsview.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/stats/statsview.h b/stats/statsview.h
index 8270c237f..62fb246cd 100644
--- a/stats/statsview.h
+++ b/stats/statsview.h
@@ -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