##// END OF EJS Templates
Pass Variable as shared_ptr
Alexandre Leroux -
r187:60a84e67b911
parent child
Show More
@@ -4,6 +4,8
4 4 #include <QLoggingCategory>
5 5 #include <QVector>
6 6
7 #include <memory>
8
7 9 Q_DECLARE_LOGGING_CATEGORY(LOG_GraphPlottablesFactory)
8 10
9 11 class QCPAbstractPlottable;
@@ -23,7 +25,7 struct GraphPlottablesFactory {
23 25 * components.
24 26 * @return the list of the components created
25 27 */
26 static QVector<QCPAbstractPlottable *> create(const Variable *variable,
28 static QVector<QCPAbstractPlottable *> create(std::shared_ptr<Variable> variable,
27 29 QCustomPlot &plot) noexcept;
28 30 };
29 31
@@ -66,7 +66,7 QCPAbstractPlottable *createScalarSeriesComponent(ScalarSeries &scalarSeries, QC
66 66
67 67 } // namespace
68 68
69 QVector<QCPAbstractPlottable *> GraphPlottablesFactory::create(const Variable *variable,
69 QVector<QCPAbstractPlottable *> GraphPlottablesFactory::create(std::shared_ptr<Variable> variable,
70 70 QCustomPlot &plot) noexcept
71 71 {
72 72 auto result = QVector<QCPAbstractPlottable *>{};
@@ -45,7 +45,7 VisualizationGraphWidget::~VisualizationGraphWidget()
45 45 void VisualizationGraphWidget::addVariable(std::shared_ptr<Variable> variable)
46 46 {
47 47 // Uses delegate to create the qcpplot components according to the variable
48 auto createdPlottables = GraphPlottablesFactory::create(variable.get(), *ui->widget);
48 auto createdPlottables = GraphPlottablesFactory::create(variable, *ui->widget);
49 49
50 50 for (auto createdPlottable : qAsConst(createdPlottables)) {
51 51 impl->m_VariableToPlotMap.insert({variable, createdPlottable});
General Comments 0
You need to be logged in to leave comments. Login now