@@ -136,13 +136,14 void VariableController::createVariable(const QString &name, | |||
|
136 | 136 | // store the provider |
|
137 | 137 | impl->m_VariableToProviderMap[newVariable] = provider; |
|
138 | 138 | |
|
139 | auto addDateTimeAcquired | |
|
140 |
|
|
|
141 | ||
|
142 | impl->m_VariableCacheController->addDateTime(newVariable, dateTimeToPutInCache); | |
|
143 | newVariable->setDataSeries(dataSeriesAcquired); | |
|
144 | ||
|
145 |
|
|
|
139 | auto addDateTimeAcquired = [ this, varW = std::weak_ptr<Variable>{newVariable} ]( | |
|
140 | auto dataSeriesAcquired, auto dateTimeToPutInCache) | |
|
141 | { | |
|
142 | if (auto variable = varW.lock()) { | |
|
143 | impl->m_VariableCacheController->addDateTime(variable, dateTimeToPutInCache); | |
|
144 | variable->setDataSeries(dataSeriesAcquired); | |
|
145 | } | |
|
146 | }; | |
|
146 | 147 | |
|
147 | 148 | connect(provider.get(), &IDataProvider::dataProvided, addDateTimeAcquired); |
|
148 | 149 | this->onRequestDataLoading(newVariable, dateTime); |
@@ -121,9 +121,12 void GenerateVariableMenuOperation::visitLeave(VisualizationTabWidget *tabWidget | |||
|
121 | 121 | { |
|
122 | 122 | if (tabWidget) { |
|
123 | 123 | // 'Plot' menu |
|
124 | impl->visitNodeLeavePlot( | |
|
125 | *tabWidget, QObject::tr("Open in a new zone"), | |
|
126 | [ var = impl->m_Variable, tabWidget ]() { tabWidget->createZone(var); }); | |
|
124 | impl->visitNodeLeavePlot(*tabWidget, QObject::tr("Open in a new zone"), | |
|
125 | [ varW = std::weak_ptr<Variable>{impl->m_Variable}, tabWidget ]() { | |
|
126 | if (auto var = varW.lock()) { | |
|
127 | tabWidget->createZone(var); | |
|
128 | } | |
|
129 | }); | |
|
127 | 130 | |
|
128 | 131 | // 'Unplot' menu |
|
129 | 132 | impl->visitNodeLeaveUnplot(); |
@@ -152,7 +155,11 void GenerateVariableMenuOperation::visitLeave(VisualizationZoneWidget *zoneWidg | |||
|
152 | 155 | // 'Plot' menu |
|
153 | 156 | impl->visitNodeLeavePlot( |
|
154 | 157 | *zoneWidget, QObject::tr("Open in a new graph"), |
|
155 |
[ var = impl->m_Variable, zoneWidget ]() { |
|
|
158 | [ varW = std::weak_ptr<Variable>{impl->m_Variable}, zoneWidget ]() { | |
|
159 | if (auto var = varW.lock()) { | |
|
160 | zoneWidget->createGraph(var); | |
|
161 | } | |
|
162 | }); | |
|
156 | 163 | |
|
157 | 164 | // 'Unplot' menu |
|
158 | 165 | impl->visitNodeLeaveUnplot(); |
@@ -167,14 +174,20 void GenerateVariableMenuOperation::visit(VisualizationGraphWidget *graphWidget) | |||
|
167 | 174 | { |
|
168 | 175 | if (graphWidget) { |
|
169 | 176 | // 'Plot' menu |
|
170 | impl->visitLeafPlot( | |
|
171 | *graphWidget, QObject::tr("Open in %1").arg(graphWidget->name()), | |
|
172 | [ var = impl->m_Variable, graphWidget ]() { graphWidget->addVariableUsingGraph(var); }); | |
|
177 | impl->visitLeafPlot(*graphWidget, QObject::tr("Open in %1").arg(graphWidget->name()), | |
|
178 | [ varW = std::weak_ptr<Variable>{impl->m_Variable}, graphWidget ]() { | |
|
179 | if (auto var = varW.lock()) { | |
|
180 | graphWidget->addVariableUsingGraph(var); | |
|
181 | } | |
|
182 | }); | |
|
173 | 183 | |
|
174 | 184 | // 'Unplot' menu |
|
175 | impl->visitLeafUnplot( | |
|
176 | *graphWidget, QObject::tr("Remove from %1").arg(graphWidget->name()), | |
|
177 | [ var = impl->m_Variable, graphWidget ]() { graphWidget->removeVariable(var); }); | |
|
185 | impl->visitLeafUnplot(*graphWidget, QObject::tr("Remove from %1").arg(graphWidget->name()), | |
|
186 | [ varW = std::weak_ptr<Variable>{impl->m_Variable}, graphWidget ]() { | |
|
187 | if (auto var = varW.lock()) { | |
|
188 | graphWidget->removeVariable(var); | |
|
189 | } | |
|
190 | }); | |
|
178 | 191 | } |
|
179 | 192 | else { |
|
180 | 193 | qCCritical(LOG_GenerateVariableMenuOperation(), |
General Comments 0
You need to be logged in to leave comments.
Login now